You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何在TYPO3 tt_products旧式模板中使用自定义翻译标记?

在tt_products旧式模板中调用配置好的翻译内容

针对你在TS setup中配置了markerFile = de.locallang_marker.xlf的情况,有两种常用方式在tt_products的旧式模板中调用对应翻译内容:

方法一:直接在模板中使用LLL标记语法

tt_products的旧式模板支持直接通过###LLL:{trans-unit-id}###的格式调用markerFile里的翻译单元。

针对你提供的翻译单元(id为p_category),直接在模板需要显示翻译文本的位置添加:

###LLL:p_category###

渲染后会自动替换为对应的目标语言文本(即德语的Kategorie)。

方法二:通过TypoScript绑定到自定义模板标记

如果需要更灵活的控制,或者要和现有模板标记的命名风格统一,可以在TS setup中将翻译内容赋值给自定义标记:

plugin.tt_products.marker.CATEGORY_TRANSLATED = LLL:fileadmin/path/to/de.locallang_marker.xlf:p_category

(注意替换为你实际的markerFile路径)

然后在模板中使用这个自定义标记:

###CATEGORY_TRANSLATED###

多语言站点补充说明

如果站点支持多语言,需要为不同语言配置对应的markerFile,比如通过TS条件判断:

[globalVar = GP:L = 1]
  plugin.tt_products.markerFile = fileadmin/path/to/en.locallang_marker.xlf
[globalVar = GP:L = 2]
  plugin.tt_products.markerFile = fileadmin/path/to/de.locallang_marker.xlf
[global]

这样切换语言时,模板中的翻译标记会自动加载对应语言的文本。

内容的提问来源于stack exchange,提问作者averlon

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.01 05:10:26