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

Event Calendar and locale


Go to End


14 Posts   7311 Views

Avatar
UncleCheese

Forum Moderator, 4102 Posts

1 October 2009 at 5:32am

Thanks for that. I'm really bad with i18n stuff, so if anyone has some code to contribute, I'll ratify it and check it in. Being in the US, as ashamed as I am to say it, I rarely have to deal with this stuff, so I've never really gotten the exposure to it. I'd love for my modules to be as accessible as possible, though, so please lend a hand if you can.

Avatar
Form & Code

Community Member, 7 Posts

1 October 2009 at 5:51am

If I can solve it myself I'll contribute. :)

Avatar
loeppel

Community Member, 7 Posts

24 March 2010 at 9:07am

@alexanm how you solved the problem? Seems to work on your site?
Btw. the widgets on the homepage are selfmade?

Avatar
jak

Community Member, 46 Posts

29 March 2010 at 5:44am

Edited: 29/03/2010 5:49am

The problem is, that i18n::set_locale(); does not call setlocale, so functions like strftime don't know that the locale has changed.
The simplest fix for this is to call setlocale after calling i18n::set_locale().
Example: mysite/_config.php
i18n::set_locale('de_DE');
setlocale(LC_TIME, 'de_DE.UTF8') //for a linux/unix server.
You can also use LC_ALL to set the other locale relevant things as well, see the php documentation for setlocale.

IMHO this behaviour should be changed in sapphire/core/i18n.php, so that set_locale includes this call to setlocale():

	static function set_locale($locale) {
		if ($locale){
 			self::$current_locale = $locale;
			setlocale(LC_ALL, $locale);
	}

Avatar
furehead

Community Member, 1 Post

10 September 2010 at 3:53am

I had a similar problem: Translation in the CMS Backend worked, but dates and times (only from event_calendar!) where shown in english instead of german.

Hack:
put the following line into CalendarUtil.php function i18n_date so that it looks like this:

	public static function i18n_date($char, $ts)
	{
                setlocale(LC_ALL, i18n::get_locale());			
		return strftime($char,$ts);
	}

Seems like php forgets the locale. Setting locale in _config did not work for me :-(

Avatar
tchintchie

Community Member, 63 Posts

2 June 2011 at 4:08am

Hello all!

I have managed to set the EventCalendar to German. All works fine except the one special character in the monthNav (March = März) it does show the "ä" in the headline of the description page but why not in the calendar widget monthNAV? Any idea how I can fix that?

kind regards

PS: included a screenshot

Attached Files
Go to Top