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.

All other Modules

Discuss all other Modules here.

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

Event Calendar and locale


Reply

14 Posts   5057 Views

Avatar
UncleCheese

1 October 2009 at 5:32am 4085 Posts

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
FnC/odontodactylus

1 October 2009 at 5:51am Community Member, 7 Posts

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

Avatar
loeppel

24 March 2010 at 9:07am Community Member, 7 Posts

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

Avatar
jak

29 March 2010 at 5:44am (Last edited: 29 March 2010 5:49am), Community Member, 46 Posts

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

10 September 2010 at 3:53am Community Member, 1 Post

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

2 June 2011 at 4:08am Community Member, 63 Posts

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