翻译地区
现在支持特定区域的翻译,该地区定位了页面构建器中的区域名称。在该区域HTML中,我们现在可以添加一个翻译字段来指向正确的本地化schema_translations.json.
。
翻译区域示例
在此示例中,我们将在主页上翻译几个区域。以下代码示例包含本地化的翻译字段层数
PageBuilder内的窗格。
- 添加
翻译
字段到主页(/templates/pages/home.html)。
笔记
- 翻译必须遵循前缀“i18n.regionname”。
- 您只能将翻译字段添加到a
{{{ 地区 }}}
场地。
home.html.
<div班级=“主要填充“>{{#if products.featured}} {{>组件/产品/特色产品= products.featured列= theme_settings.homepage_featured_products_column_count}} {{/ if}} {{{region name =“home_below_featured_products”transling =“i18n.regionname.homebelowfeaturedproducts“}}} {{#if products.top_sellers}} {翻译=“i18n.regionname.homebelowtopproducts”}}} {{#if products.new}} {{>组件/产品/新产品= products.new columns = theme_settings.homepage_new_products_column_count}} {{{{{{{{{{区域名称=“home_below_new_products”翻译=“i18n.regionnname.homebelownewproducts”}}} {{{region name =“delave_content - global”translation =“i18n.regionname.homebelowcontentglobal”}}}div>
- 将区域翻译添加到
schema_translations.json.
文件。
笔记
- 区域翻译必须居住在Schema_Translations.json文件中。
- 语言代码必须包含默认值。
- 默认语言之外的语言代码将支持两个字符语言代码以及多个字符语言代码(由两个小写字母,短划线和至少两个字母数字字符格式化)。以下提供的示例:
- 两个字符语言代码“en”,“fr”,“英国”,“zh”。
- 多个字符语言代码“FR-FR”,“ZH-CN”,“EN-US”,“UK-UA”,“ES-419”,“ES-419”示例。
schematranslations.json.
{“i18n.regionname.homebelowmenu”:{“默认”:“家庭下面的菜单”那“en”:“家庭下面的菜单”那“fr-fr”:“Accueil Ci-Dessous菜单”那“Zh”:“主页下方菜单”那“Zh-Cn”:“主页下方菜单”}那“i18n.regionname.homebelowcarousel”:{“默认”:“旋转木马下的家”那“en”:“旋转木马下的家”那“fr-fr”:“Accueil Ci-Dessous Carrousel”那“Zh”:“旋转木马下方的主页”那“Zh-Cn”:“旋转木马下方的主页”}那“i18n.regionname.homebelowfeaturedproducts”:{“默认”:“Home以下特色产品”那“en”:“Home以下特色产品”那“fr-fr”:“Accueil Ci-Dessous Produites en Vedette”那“Zh”:“主页特价产品”那“Zh-Cn”:“主页特价产品”}那“i18n.regionname.homebelowtopproducts”:{“默认”:“首页上面的顶级产品”那“en”:“首页上面的顶级产品”那“fr-fr”:“Accueil Ci-Dessous顶级产品”那“Zh”:“主页热门产品下方”那“Zh-Cn”:“主页热门产品下方”}那“i18n.regionname.homebelownew产品”:{“默认”:“家庭下面的新产品”那“en”:“家庭下面的新产品”那“fr-fr”:“Accueil Ci-Dessous Nouveaux Produits”那“Zh”:“新产品首页”那“Zh-Cn”:“新产品首页”}那“i18n.regionname.headerbottomglobal”:{“默认”:“标题底部(全球)”那“en”:“标题底部(全球)”那“fr-fr”:“Bas de l'en-tête(全球)”那“Zh”:“标题底部(全局)”那“Zh-Cn”:“标题底部(全局)”}那“i18n.regionname.headerbottom”:{“默认”:“标题底部”那“en”:“标题底部”那“fr-fr”:“Bas de l'en-tête”那“Zh”:“标题标题”那“Zh-Cn”:“标题标题”}}
- 更改控制面板设置中的语言以查看翻译区域。去
我的个人资料>编辑配置文件>首选语言
。
翻译钥匙