如何在CQ5字典中创建嵌套结构?

时间:2013-03-25 17:51:50

标签: internationalization cq5 sling

我想知道是否有办法创建嵌套字典结构,让键以某种方式命名? (不创建数百个词典)

我试过了:

{
    "jcr:createdBy": "admin",
    "sling:basename": "en-content",
    "jcr:mixinTypes": ["mix:language"],
    "jcr:created": "Mon Mar 25 2013 07:00:18 GMT-0400",
    "jcr:language": "en",
    "jcr:primaryType": "sling:Folder",
    "test": {
        "jcr:createdBy": "admin",
        "jcr:created": "Mon Mar 25 2013 13:26:52 GMT-0400",
        "jcr:primaryType": "nt:folder",
        "item": {
            "jcr:createdBy": "admin",
            "jcr:mixinTypes": ["sling:Message"],
            "jcr:created": "Mon Mar 25 2013 07:00:18 GMT-0400",
            "sling:message": "Value",
            "jcr:primaryType": "nt:folder"
        }
    }
}

http://localhost:4503/libs/cq/i18n/translator.html仅显示test条目。

我直接从我的JavaScript应用程序获取CQ的字典,因此嵌套的JSON格式对开发人员和内容创建者很有用。

根据http://sling.apache.org/site/internationalization-support-i18n.html

  

mix:语言节点的(直接)子节点必须包含两个节点   命名键字符串和消息的特殊属性:

有没有其他方法可以从非直接的孩子那里得到它,或以某种方式解决它?

1 个答案:

答案 0 :(得分:0)

您提供的示例将起作用(尽管我更喜欢使用nt:unstructured作为nodetype进行测试。唯一的问题是您不能使用CQs Translator,因为它不知道名称间距。可以扩展它或向Adobe提出功能请求。

HTH, (c)中

相关问题