Jump to:

5450 Posts in 1672 Topics by 1197 members

Customising the CMS

SilverStripe Forums » Customising the CMS » [SOLVED] Interface language set to PL, CMS uses EN

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

Page: 1 2
Go to End
Author Topic: 1124 Views
  • ShachMaT
    Avatar
    Community Member
    6 Posts

    [SOLVED] Interface language set to PL, CMS uses EN Link to this post

    I have been working with SilverStripe for last 3 months, did many interesting and challenging things.

    Today i had to fix some issues with translation and some missing files.
    After trying to enable 2nd language for content my default was changed.
    Polish language was changed to English and i can't rollback.

    SS version: 2.4.6
    was interface was running in Polish (in my admin profile it is still polish) changed to English.
    Polish translation is present no files seem to be missing.

    On fresh install of SS: Polish language doesn't work from start (CMS uses en_GB/US).

    P.S. this might sound strange, ask as many questions as you wish, so i can explain in more detailed form.

  • martimiz
    Avatar
    Forum Moderator
    1037 Posts

    Re: [SOLVED] Interface language set to PL, CMS uses EN Link to this post

    Hi ShachMaT, welcome to the forums,

    You need to set the default locale before you enable Translatable:

    Translatable::set_default_locale('pl_PL');

    When Translatable is enabled, it will create a 'Locale' field in every page and other Translatable object. If you don't set the default locale like this, then 'en_US' is used. Once done, you can't easily go back!

    http://doc.silverstripe.org/sapphire/en/topics/translation#setting-the-default-locale

    This has nothing to do with the CMS user profile locale or i18n::set_locale('...')

  • ShachMaT
    Avatar
    Community Member
    6 Posts

    Re: [SOLVED] Interface language set to PL, CMS uses EN Link to this post

    i figured out the way to get Polish and English content on front of the page.

    But still i can't get CMS (Back-end) to work with polish and i don't mean the editing i mean the labes for tabs, buttons, controls etc.

  • martimiz
    Avatar
    Forum Moderator
    1037 Posts

    Re: [SOLVED] Interface language set to PL, CMS uses EN Link to this post

    When I set my admin profile to Polish (after installing in Dutch ), I get this (see attachment) in SilverStripe 2.4.7, so normally that should work for you as well... But you don't see any Polish, ever, not even after reloading the CMS? What version of the CMS are you using?

    Attached Files
  • ShachMaT
    Avatar
    Community Member
    6 Posts

    Re: [SOLVED] Interface language set to PL, CMS uses EN Link to this post

    Yes even if i refresh CMS, clear cache etc.

    I'm running SS v 2.4.6

    and i can't get the result like you shown in that screenshot, what's more it doesn't even read from en_US language file. It uses DEFAULTS from templates (ones used with _t() ).

    Thank you for your patience

  • mishell
    Avatar
    Community Member
    19 Posts

    Re: [SOLVED] Interface language set to PL, CMS uses EN Link to this post

    I don't have any problems using Polish on backend. Maybe try this:

    // Set the site locale
    i18n::set_locale('pl_PL');

    M.

  • martimiz
    Avatar
    Forum Moderator
    1037 Posts

    Re: [SOLVED] Interface language set to PL, CMS uses EN Link to this post

    I would think that the backend profile settings would normally overrule the i18n::setLocale() in _config.php. There must be a reason why, as you said, i18n doesn't seem to work at all.

    If _t() always returns the default, the only thing I can think of is that for some reason the pl_PL.php language file is not present in /cms/lang/ or it cannot be loaded. But I don't know why that should be...

  • ShachMaT
    Avatar
    Community Member
    6 Posts

    Re: [SOLVED] Interface language set to PL, CMS uses EN Link to this post

    I have migrated my local copy (one with not working PL) to web server (with working PL).

    CMS Language stopped working after migration. This got to be problem with my config.

    SS_Log::add_writer(new SS_LogFileWriter('*logfile*'), SS_Log::WARN, '<=');

    global $project;
    $project = 'project';

    MySQLDatabase::set_connection_charset('utf8');

    // on webserver this line is commented
    // Object::add_extension('SiteTree', 'Translatable');

    Translatable::set_default_locale('pl_PL');

    i18n::enable();

    global $allowed_locales;
    $allowed_locales = array(
    'pl_PL' => array('Polish', 'Polski'),
    'en_US' => array('English', 'English')
    );
    i18n::$common_locales = $allowed_locales;

    i18n::set_locale('pl_PL');

    SSViewer::set_theme('project');

    1124 Views
Page: 1 2
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.