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 Page.ss


Reply


8 Posts   2361 Views

Avatar
baba-papa

Community Member, 279 Posts

19 August 2009 at 7:19am

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.

Avatar
Xeal

Community Member, 37 Posts

19 August 2009 at 8:16am

Edited: 19/08/2009 8:16am

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

Avatar
baba-papa

Community Member, 279 Posts

19 August 2009 at 9:15am

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

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


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

Avatar
Xeal

Community Member, 37 Posts

20 August 2009 at 2:01am

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.

Avatar
baba-papa

Community Member, 279 Posts

20 August 2009 at 2:04am

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

Avatar
baba-papa

Community Member, 279 Posts

20 August 2009 at 4:38pm

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

Avatar
Kalileo

Community Member, 127 Posts

11 September 2009 at 11:09pm

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.

Avatar
biapar

Forum Moderator, 435 Posts

28 November 2009 at 12:21am

Good..