Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Template Questions

i18n in main Template


8 Posts   2287 Views


19 August 2009 at 7:19am Community Member, 279 Posts

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.


19 August 2009 at 8:16am (Last edited: 19 August 2009 8:16am), Community Member, 37 Posts

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
Replacing de_DE with your locale of choice of course.
in the mysite/_config.php file


19 August 2009 at 9:15am Community Member, 279 Posts

Thanks for Your answer, Xeal. The translationfile de_DE.php contains the following line:

i18n::include_locale_file('modules: blog', 'en_US');

The is not part of a module. Where do i put those translation files?


20 August 2009 at 2:01am Community Member, 37 Posts

The way I make translations for is bu going into the sapphire/lang/<language> files and adding whatever I need.

$lang['en_US']['']['Link'] = 'Lien';
$lang['fr_FR']['']['Link'] = 'Link';

and then in the 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.


20 August 2009 at 2:04am Community Member, 279 Posts

Thanks for Your help Xeal. I will try this way.


20 August 2009 at 4:38pm Community Member, 279 Posts

I tried it and it works, thanks again Xeal. I really have to say, that I love Silverstripe for it´s features anf fexibility :)


11 September 2009 at 11:09pm Community Member, 127 Posts

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.


28 November 2009 at 12:21am Forum Moderator, 435 Posts