visol / translationapi
获取翻译单元的API。
3.0.0
2022-06-17 14:45 UTC
Requires
- typo3/cms-core: ^11
This package is auto-updated.
Last update: 2024-09-17 19:31:22 UTC
README
此扩展允许您从TYPO3获取本地化标签。它将自动将标签作为JSON从任何locallang.xlf
文件中导出,前提是给定其扩展键。
如何在Fluid中使用
此扩展能够将标签作为JSON导出,以便嵌入到HTML片段中。
<div
xmlns="http://www.w3.org/1999/xhtml" lang="en"
xmlns:f="http://typo3.org/ns/TYPO3/Fluid/ViewHelpers"
xmlns:l10n="http://typo3.org/ns/Sinso/Translationapi/ViewHelpers"
>
<!-- standard notation -->
<l10n:exportXliff extensionKey="some-extension" prefix="some-prefix" />
<!-- inline notation -->
<section data-localized-days='{l10n:exportXliff(extensionKey:"some-extension", prefix:"some-prefix")}'>
...
</section>
</div>
选项
-
?omitPrefix=yes
(默认值为"no
")将从键中删除前缀。例如,使用"module"作为前缀,键"module.foo.bar"将返回为"foo.bar"
-
?expand=yes
(默认值为"no
")将"展开"键作为子数组{ "module.foo.bar.key1": "value1", "module.foo.bar.key2": "value2", }
变成
{ "module": { "foo": { "bar": { "key1": "value1", "key2": "value2" } } } }