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.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Problems with Default language


Reply


4 Posts   1086 Views

Avatar
Andre

Community Member, 126 Posts

25 August 2009 at 9:08pm

Edited: 25/08/2009 9:09pm

Hi there, I'm trying since days now, to get familiar with the single/multilanguage support in Silverstripe. The Backend was no Problem. Page Types I added with lang folder and de_DE.php and en_US.php files are translated correctly to the chosen backend language. But in the frontend it doesn't seem to work.

First I did nothing to my _config.php and so in every module english was chosen (testing with event_calender and image_galary).
After adding the following three lines (also tried all other combinations with only one or two lines) I recieved a language Dropdown in the Backend which was set to english.

i18n::enable();
i18n::set_locale('de_DE');
i18n::set_default_lang('de_DE');

changing the dropdown to german resulted in an empty Pagetree. I then changed all locale entries inside the database to de_DE and now I have the Full Sitetree under german and english is empty. Fine, that's working, but the modules do not seem to be translated. I added a de_DE.php to the image_galary but that didn't work. Making changes to the en_US.php which are not shown in the frontend tell me, that the translation file isn't taken by silverstripe and it uses the default Text (second argument of _t()).

Do I have to set another parameter to activate the translation in the frontend or are these three lines enough and there might be some other issues?

Avatar
Andre

Community Member, 126 Posts

26 August 2009 at 2:48am

Is there anyone with a Solution to my Problem, I can't imagine, that this is not an all Day Task which can be solved with just one or two further lines of code.

Avatar
Taffy

Community Member, 119 Posts

26 August 2009 at 9:31pm

Hi Andre, What version of SS are you using?

To the best of my knowledge "i18n::enable();" is not required since 2.3.2 but "Object::add_extension('SiteTree', 'Translatable');" is required to enable the translatable functionality.

http://doc.silverstripe.com/doku.php?id=multilingualcontent
http://doc.silverstripe.com/doku.php?id=i18n

Avatar
Andre

Community Member, 126 Posts

14 September 2009 at 6:23am

Will it be enough if I add Translation for Sitetree? What if I have a has_many relation on a Page Object which includes a bunch of Dataobjects? Will they be translatet, because of their Parentobject which is of class SiteTree?