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.

We're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

General Questions /

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

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

Template issue on multilanguage site


Go to End


2 Posts   1566 Views

Avatar
Pipifix

Community Member, 56 Posts

18 June 2011 at 4:44am

Hi Everybody.

I want to set up a multilanguage website SS2.4.5. Everythhings wents fine so far. But all pages in the second language (de_DE=locale, 2nd en_GB language) dont have the active template attached. The Pages (e.g. HomePage, ProducsPage, MaterialsPage, ...) are renderd with the generic ContentController.ss (./sapphire/templates/). Whats wrong? Where i have to set to use the corresponding Page-Template?

my _config.php looks like that

// Set the site locale

i18n::set_locale('de_DE');
setlocale (LC_ALL, 'de_DE@euro', 'de_DE', 'de', 'ge');
setlocale(LC_TIME,"de_DE.UTF-8");
Translatable::set_default_locale('de_DE');
Translatable::set_allowed_locales(array('de_DE', 'en_GB'));
Object::add_extension('SiteConfig', 'Translatable'); // 2.4 or newer only
Object::add_extension('SiteTree', 'Translatable');
//i18n::include_locale_file('event_calendar', 'de_DE');

Has anybody tested UncleCheeses Lang-Editor module? I get a blank admin-site after creating a file 'de_DE' in ./mysite/lang/. Any hints on that?

Thanks. Pipifix

Avatar
Pipifix

Community Member, 56 Posts

20 June 2011 at 11:07pm

Hello.
Answering myself ;)

1. Template Issue
I dont know what changes. But the right template works now for the second template.

my _config.php looks now:

// Set the site locale
i18n::set_locale('de_DE');
Object::add_extension('SiteConfig', 'Translatable'); // 2.4 or newer only
Object::add_extension('SiteTree', 'Translatable');

//This is done in the Page_Controller's init() method to setup the locale entities depending on the active language
//setlocale (LC_ALL, 'de_DE@euro', 'de_DE', 'de', 'ge');

Translatable::set_default_locale('de_DE');
Translatable::set_allowed_locales(array('de_DE', 'en_US', 'ru_RU'));

2. Blank page by using Uncle Cheeses LangEditor

At first i've had to install PHPUnit on my local server. After that i collected the t-strings via /dev/tasks/i18nTextCollectorTask. The file will created in /themes/lang/. No matter what default locale is set, the file was named en_US.php. In my case i copied the content of this file in /mysite/lang/de_DE.php. (because of the german strings in the template). After duplicating this file in en_US.php it works. So i guess its absolutely necessary to have this file (en_US.php)

Greetings from Germany. Pipifix