The links in my main navigation have to be translated. They are static and lead to another site. I know how to work with i18n, but this is only described for modules, not for the templates of a theme.
I appreciate any help.
This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.
Please use forum.silverstripe.org for any new questions
(announcement).
The forum archive will stick around, but will be read only.
You can also use our Slack channel
or StackOverflow to ask for help.
Check out our community overview for more options to contribute.
The links in my main navigation have to be translated. They are static and lead to another site. I know how to work with i18n, but this is only described for modules, not for the templates of a theme.
I appreciate any help.
If you have the latest SS version 3.2.2 all you have to do is go to the translations tab and create your translations from there. (You have to manually translate the links). This will allow you to make as many different translations for your site as you want.
Unless I'm mistaken and what you want is to change the language of your site? in Which case all you have to do is put this line
i18n::set_locale('de_DE');
Replacing de_DE with your locale of choice of course.
in the mysite/_config.php file
Thanks for Your answer, Xeal. The translationfile de_DE.php contains the following line:
i18n::include_locale_file('modules: blog', 'en_US');
The way I make translations for Page.ss is bu going into the sapphire/lang/<language> files and adding whatever I need.
$lang['en_US']['Page.ss']['Link'] = 'Lien';
$lang['fr_FR']['Page.ss']['Link'] = 'Link';
and then in the Page.ss file you want to add a line that looks like this:
<% _t("Link","link") %>
That should do it for translations just add as many as you need.
Thanks for Your help Xeal. I will try this way.
I tried it and it works, thanks again Xeal. I really have to say, that I love Silverstripe for it´s features anf fexibility :)
Let me suggest to add your translations not to sapphire/lang/<language> but to cms/lang/<language> or even better to mysite/lang/<language> - that way it does not get overwritten when you upgrade.
Good..