0
votes

I'm trying to use i18n functionality in templates in Silverstripe.

In a template ss file, I have the following:

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

And I have the following in /lang/en_US.yml:

en:
  Namespace1:
    Replace: 'ReplacedString'

I have also added this to my _config.php:

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

And this in my config.yml:

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

But the string "ToBeReplaced" is not replaced. The documentation I can find about this, is: https://docs.silverstripe.org/en/4/developer_guides/i18n/

Am I missing something?

1

1 Answers

1
votes

The problem was that the lang folder was added to the wrong location.

It should be located in /mysite/lang/