Jump to:

23483 Posts in 18976 Topics by 2878 members

General Questions

SilverStripe Forums » General Questions » Problems with Default language

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

Page: 1
Go to End
Author Topic: 1027 Views
  • Andre
    Avatar
    Community Member
    126 Posts

    Problems with Default language Link to this post

    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?

  • Andre
    Avatar
    Community Member
    126 Posts

    Re: Problems with Default language Link to this post

    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.

  • Taffy
    Avatar
    Community Member
    119 Posts

    Re: Problems with Default language Link to this post

    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

  • Andre
    Avatar
    Community Member
    126 Posts

    Re: Problems with Default language Link to this post

    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?

    1027 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.