22427 Posts in 6976 Topics by 2750 members
|Go to End|
29 April 2010 at 10:02am
I am working on a site with 2 languages and it has a language chooser page to choose from 2 different homepages. When a homepage is selected, everything works just fine except 18n strings (I use them in templates via <% _t() %> ). How do I force i18n to look for a correct translation?
Setting the ?locale=... or hreflang=... in URL does not help.
Currently I use a dirty hack in HomePage.php index() to check the URLSegment and set locale with i18n::set_locale().
Is there a nicer way to do that or is it just a plain bug that the i18n does not follow the page language setting?
29 April 2010 at 8:56pm
Not sure, but try adding this to your config.php:
9 May 2010 at 10:23pm
Thanks! This indeed works as expected! However one would expect that this works automatically. Perhaps a bug in sapphire?
10 May 2010 at 7:13pm
Not a bug. I18N and Translatable are independent of each other. I18n is for backend/ui translation where Translatable allows to have website content in different languages. A bit confusing, though.
10 May 2010 at 7:32pm
But what about <% _t() %> in templates? That defines page content as well. And this translation ignores page's locale by default. I still consider that code snippet above a hack
10 May 2010 at 7:34pm
|Go to Top|