【问题标题】:Silverstripe template i18n translationSilverstripe 模板 i18n 翻译
【发布时间】:2018-09-24 12:24:07
【问题描述】:

我正在尝试在 Silverstripe 的模板中使用 i18n 功能。

在模板 ss 文件中,我有以下内容:

<h4 class="red-underline"><%t Namespace1.Replace "ToBeReplaced" %></h4>

我在 /lang/en_US.yml 中有以下内容:

en:
  Namespace1:
    Replace: 'ReplacedString'

我也将此添加到我的 _config.php

use SilverStripe\i18n\i18n;
i18n::set_locale('en_US');

这在我的 config.yml 中:

SilverStripe\i18n\i18n:
  common_locales:
    en_US:
      name: English (USA)
      native: English

但是字符串“ToBeReplaced”没有被替换。 我可以找到的有关此的文档是: https://docs.silverstripe.org/en/4/developer_guides/i18n/

我错过了什么吗?

【问题讨论】:

    标签: internationalization silverstripe silverstripe-4


    【解决方案1】:

    问题是 lang 文件夹添加到了错误的位置。

    它应该位于 /mysite/lang/

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-08-09
      • 2015-12-04
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多