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.

Installing SilverStripe /

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

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

i18n cant set german as a language


Reply


5 Posts   3046 Views

Avatar
plagil

Community Member, 5 Posts

17 March 2009 at 7:47pm

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 ?

Avatar
bokkers

Community Member, 6 Posts

14 May 2009 at 12:20am

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

Avatar
Kalileo

Community Member, 127 Posts

17 May 2009 at 4:23pm

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 [url=http://silverstripe.org/general-questions/show/253576?start=16#post258573]missing translations despite language file being present[/url].

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 [url=http://silverstripe.org/blog-module-forum/show/257317?start=0#post257396]forum discussion[/url] about it and here's the [url=http://open.silverstripe.com/ticket/3400] ticket with patch for fixing i18n in templates included by templates[/url].

HTH,
Kalileo

Avatar
Kalileo

Community Member, 127 Posts

17 May 2009 at 4:28pm

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

Avatar
m-phil

Community Member, 37 Posts

5 May 2010 at 7:09pm

Edited: 18/05/2010 8:13pm

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