Jump to:

4952 Posts in 14480 Topics by 1491 members

Installing SilverStripe

SilverStripe Forums » Installing SilverStripe » i18n cant set german as a language

Getting SilverStripe up and running on your computer and on your web server.

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

Page: 1
Go to End
Author Topic: 2936 Views
  • plagil
    Avatar
    Community Member
    5 Posts

    i18n cant set german as a language Link to this post

    Hi I am fairly new to this so i might hve overlooked something but anyhow. I am trying to tell my site that it should use de_DE (german) as a language. As far as I understand I have to enable i18n in mysite/_config.php and also I have to tell silverstripe there which language to use. So i did exactly that. After I flushed teh cache i still got all the messages ie. in my gallery in english. So i checked wethere there was a language file availiable. That turned out positive. So how and where do I have to tell silverstripe to use german as a language ?

  • bokkers
    Avatar
    Community Member
    6 Posts

    Re: i18n cant set german as a language Link to this post

    Wondering about the exact same thing. How can I effectively switch my Silverstripe website to German?

  • Kalileo
    Avatar
    Community Member
    127 Posts

    Re: i18n cant set german as a language Link to this post

    Your problem descriptions are not 100% clear about what you actually see in German, and thus I have to assume you see some stuff in German, but other stuff not, despite a language file being present.

    This looks like the issue I ran into earlier, see her for a description and workaround for such missing translations despite language file being present.

    But before you go through all templates now and apply the workaround, there is a bug ticket and a patch already, which solves this more elegantly, because with much less work. However it will probably be not included in 2.3.2, so you might need to repatch once you upgrade. Here's the forum discussion about it and here's the ticket with patch for fixing i18n in templates included by templates.

    HTH,
    Kalileo

  • Kalileo
    Avatar
    Community Member
    127 Posts

    Re: i18n cant set german as a language Link to this post

    ... and just in case you would have forgotten that: set your locale in your mysite/_config.php with i18n::set_locale('...') after enabling i18n.

  • m-phil
    Avatar
    Community Member
    37 Posts

    Re: i18n cant set german as a language Link to this post

    For multiligual websites you need to add

    if($this->dataRecord->hasExtension('Translatable')) {
       i18n::set_locale($this->dataRecord->Locale);
    }


    in Page.php -> class Page_Controller -> public function init() to use _t() function in templates.

    For the gallery module:
    I've created a translation for the gallery module version 0.2.2 (http://doc.silverstripe.org/modules:gallery), so that all backend fields and also some outputs in the templates like "Next", "Previous" and so on use the language files in a lang directory (currently english and german)

    If needed, send me a message

    2936 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.