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've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Customising the CMS /

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

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


Go to End


12 Posts   3749 Views

Avatar
ShachMaT

Community Member, 6 Posts

18 February 2012 at 6:30am

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.

Avatar
martimiz

Forum Moderator, 1391 Posts

18 February 2012 at 9:11am

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('...')

Avatar
ShachMaT

Community Member, 6 Posts

20 February 2012 at 4:41am

Edited: 20/02/2012 8:36am

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.

Avatar
martimiz

Forum Moderator, 1391 Posts

21 February 2012 at 12:15am

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
Avatar
ShachMaT

Community Member, 6 Posts

21 February 2012 at 8:24am

Edited: 21/02/2012 8:25am

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

Avatar
mishell

Community Member, 19 Posts

25 February 2012 at 1:57am

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

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

M.

Avatar
martimiz

Forum Moderator, 1391 Posts

25 February 2012 at 3:56am

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

Avatar
ShachMaT

Community Member, 6 Posts

26 February 2012 at 3:29am

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');

Go to Top