Jump to:

22972 Posts in 11596 Topics by 2824 members

General Questions

SilverStripe Forums » General Questions » Template issue on multilanguage site

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: 741 Views
  • Pipifix
    Avatar
    Community Member
    54 Posts

    Template issue on multilanguage site Link to this post

    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

  • Pipifix
    Avatar
    Community Member
    54 Posts

    Re: Template issue on multilanguage site Link to this post

    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

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