Jump to:

10993 Posts in 2727 Topics by 1818 members

All other Modules

SilverStripe Forums » All other Modules » Event Calendar and locale

Discuss all other Modules here.

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

Page: 1 2
Go to End
Author Topic: 5026 Views
  • UncleCheese
    Avatar
    4085 Posts

    Re: Event Calendar and locale Link to this post

    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.

  • FnC/odontodactylus
    Avatar
    Community Member
    7 Posts

    Re: Event Calendar and locale Link to this post

    If I can solve it myself I'll contribute.

  • loeppel
    Avatar
    Community Member
    7 Posts

    Re: Event Calendar and locale Link to this post

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

  • jak
    Avatar
    Community Member
    46 Posts

    Re: Event Calendar and locale Link to this post

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

  • furehead
    Avatar
    Community Member
    1 Post

    Re: Event Calendar and locale Link to this 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    

  • tchintchie
    Avatar
    Community Member
    63 Posts

    Re: Event Calendar and locale Link to this post

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