自己的国际化支持



在我正在开发的项目中,没有使用国际化。

现在迁移到AEM 6.1,我们想要使用sight,但仍然使用我们自己的自定义系统。我想知道是否有可能为我们自己的系统创建类似的东西。

我尝试使用模板,但很难在不同的数据标记中使用它们,然后调用。(例如data-sly-attribute)我在这里犯了一个错误吗?

template.html
<template data-sly-template.foo="${ @ key }">bar</template>
<sly data-sly-call="${ foo }" data-sly-unwrap></sly>
<div data-sly-attribute="${ foo }"></div>
output.html
bar
<div></div>

我试图使一些工作与java接口运行时扩展,但它没有工作。

我们的系统基本上是一个带有标签和字符串的xml文件。我可以毫无问题地从那里获取数据。

的例子:

<en>
    <com.example.title jcr:primaryType="nt:unstructured" value="A title"/>
    <com.example.desc jcr:primaryType="nt:unstructured" value="Description"/>
</en>
<de>
    <com.example.title jcr:primaryType="nt:unstructured" value="Ein Tiel"/>
    <com.example.desc jcr:primaryType="nt:unstructured" value="Beschreibung"/>
</de>

如果你对这个问题有任何疑问,请提出来。

不能定义自己的可视标签。你最多能做的就是利用use指令并使用另一个模板作为你的自定义标记。你可以看看/libs/granite/sight/templates/clientlib.html下的工作示例,它基本上遵循以下结构:. html

<template data-sly-template.customi18n="${@ i18nkey}">do something here</template>

. html

<div data-sly-use.i18n="${'/path/to/templates/customi18n.html'}" data-sly-unwrap>
   <span data-sly-call="${i18n.customi18n @ i18nkey='My Translation Key'}" data-sly-unwrap></span>
</div>

最新更新