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.

All other Modules /

Discuss all other Modules here.

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

(newbie) Event Calendar translation


Go to End


5 Posts   2650 Views

Avatar
magge

Community Member, 3 Posts

15 July 2010 at 11:12pm

Edited: 15/07/2010 11:22pm

Hello,

I've been trying to translate the front end text for the Event calendar, what I've done is:

*** For _config.php I've changed like so:

15,16c15,16
< Calendar::set_param('language','EN');
< Calendar::set_param('timezone', 'US-Eastern');
---
> Calendar::set_param('language','NO');
> Calendar::set_param('timezone', 'Europe/Oslo');
18,19c18
<
< CalendarDateTime::set_param('offset','-04:00');
---
> // CalendarDateTime::set_param('offset','02:00');
24c23
< i18n::include_locale_file('event_calendar', 'en_US');
---
> i18n::include_locale_file('event_calendar', 'nb_NO');

*** I've created lang/nb_NO.php - a replica of the existing de_DE.php translation, except I've changed all the array keys to nb_NO and translated all the content. Also changed the last line to:

$lang['nb_NO']['CalendarWidget']['LOCALEFILE'] = 'date_nbNO.js';

*** I've created javascript/locale/date_nbNO.js, again replica of the existing date_de.js except the content has been translated.

After doing this - nothing happens. All is still english. I've double checked:
- My users profile is norwegian (although it seems the locale is hard-coded in event_calendar/_config.php anyways?)
- The page I created is registered as a norwegian translation (again as above, maybe it does not matter?)
- Run dev/build?flush=1 a couple of times.

So clearly I'm missing something which probably is part of the SilverStripe basics - but please help me because I cannot seem to Google my way to that info.

Thanks for your time,
Magnus

Avatar
lerni

Community Member, 81 Posts

19 July 2010 at 1:08am

heho

i gues smth like this in your mysite/_config.php will do the trick

i18n::set_locale('de_DE');
setlocale(LC_ALL, 'de_DE');
setlocale (LC_TIME, "de_DE.UTF-8");

Avatar
magge

Community Member, 3 Posts

19 July 2010 at 6:14am

Ah, that seems to work. Thanks!

Now - did I just hardcode the locale for everyone, or is this just the default setting? :)

M

Avatar
UncleCheese

Forum Moderator, 4102 Posts

19 July 2010 at 7:15am

Yeah, you hardcoded the locale. By default it should be the locale of your php configuration, so maybe your hosting provider is US based? You're going to have to handle setting the locale dynamically within Silverstripe, e.g. evaluating the "locale" request parameter, or using a subdomain, etc..

Avatar
magge

Community Member, 3 Posts

20 July 2010 at 12:12am

Ok, thanks for the info.

My hosting is myself and it's not US based - but it might very well be that I've misconfigured something making PHP think it is in the US. :)

So if I understand you correctly - evaluation of what locale to use, other that the system default, is not part of Silverstripe and the logic for selecting the right locale (be it request parameter, subdomain or something else) is usually put in mysite/_config.php ?

Otherwise, UncleCheese, big kudos on both the Event Calendar and the image gallery. I've been trying them out (along with my first ever Silverstripe installation) and they seem to rock real hard!

-
Regards, Magnus