sling-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (SLING-6826) i18n: Supported nested keys in JSON i18n files
Date Wed, 03 May 2017 19:58:04 GMT

    [ https://issues.apache.org/jira/browse/SLING-6826?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15995529#comment-15995529
] 

ASF GitHub Bot commented on SLING-6826:
---------------------------------------

GitHub user stefanseifert opened a pull request:

    https://github.com/apache/sling/pull/222

    SLING-6826 i18n: Supported nested keys in JSON i18n files

    

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/stefanseifert/sling feature/SLING-6826-i18n-json-hierarchy

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/sling/pull/222.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #222
    
----
commit 83447b43a445cb1ead08f318d8613397548eee6b
Author: sseifert <sseifert@pro-vision.de>
Date:   2017-05-03T19:51:08Z

    SLING-6826 i18n: Supported nested keys in JSON i18n files

----


> i18n: Supported nested keys in JSON i18n files
> ----------------------------------------------
>
>                 Key: SLING-6826
>                 URL: https://issues.apache.org/jira/browse/SLING-6826
>             Project: Sling
>          Issue Type: New Feature
>          Components: i18n
>    Affects Versions: i18n 2.5.8
>            Reporter: Stefan Seifert
>
> i18n supports resource files stored as JSON binary files in the repository:
> https://sling.apache.org/documentation/bundles/internationalization-support-i18n.html#json-file-based
> currently nested key structures are not really supported - from the docs page: 
> {quote}
> The parser will take any "key":"value" pair in the JSON file, including those in nested
objects or arrays. Normally, a dictionary will be just a single json object = hash map though.
> {quote}
> that means that these two JSON example will produc the same result:
> A)
> {code:javascript}
> {
>   "key1": "value1",
>   "key2": "value2",
>   "key3": "value3"
> }
> {code}
> B)
> {code:javascript}
> {
>   "level1": {
>     "key1": "value1",
>     "level2: {
>       "key2": "value2",
>       "level3": {
>         "key3": "value3"
>       }
>     }
>   }
> }
> {code}
> in both cases the keys are just
> {noformat}
> key1
> key2
> key3
> {noformat}
> the goal of this ticket is to interpret the nested JSON object structure as parts of
the i18n keys, so that example B would produce these keys:
> {noformat}
> level1.key1
> level1.level2.key2
> level1.level2.level3.key3
> {noformat}
> as statet in the documentation in most cases people will only use the JSON as key/value
map file with no hierarchies at all. in this case the result is the same. but if someone used
hierarchies this ticket will create a backward compatibility issue. i will start a discussion
on the sling-dev list about this.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Mime
View raw message