All Low add-ons are now owned by EEHarbor. Read the blog post.

Support archive

Low Nice Date in other languages?

Joan Lindhout 19 Feb 2013 08:39 question, complete

Hi Low,

I'm using Low Nice Date on a multi-language website and I want to be able to output the dates in another language besides English. So far as I can see, that's not possible out of the box. Is that right?

Basically I'm looking for the 'lang' parameter as seen in the Low Events calendar tag.

Replies

  1. Low 19 Feb 2013 08:48

    Correct, it will only parse the date in the language of the current site, or of the preferred language of the logged in user.

  2. Joan Lindhout 22 Feb 2013 17:32

    I have a dutch language pack installed and the language of the current site is set to Dutch, but it still outputs dates in English.
    What can be wrong?

  3. Low 22 Feb 2013 23:37

    If you're logged in and the language in your profile is set to English, you'll see the dates in English. Try opening another browser where you're not logged in and see what shows then.

  4. Joan Lindhout 25 Feb 2013 18:37

    It shows in English, logged in or not.
    For the Low Events calendar tag, there's a lang parameter that I've set to lang="{language}" so it will output Dutch dates on the dutch version of the site.
    I was looking for the same parameter for Low Nice Date, so I can do exactly the same.

    But if I understand well, I don't even need that for Low Events, it should be possible by setting the language as global variable.

    In my index root file I have


    $assign_to_config['global_vars'] = array(
    "user_language" => "nl",
    "language" => "dutch",
    "locale" => "nl_NL",
    );


    Default language is Dutch. For the English version I have a separate index root in /en folder and set those global vars to the English equivalents.

    So what could be wrong?

  5. Low 26 Feb 2013 08:43

    Low Events has its own date formatting algorithm which allows for the lang="" parameter, using the native language files. It was quite a tricky thing to build. I'd need to copy that whole code over to Low Nice Date, but I'm not quite sure if that's worth the trouble for the free add-on.

    Setting a default language as a variable is just that: setting a variable. You need to define it as a config override, not as a variable. If you take a look a the control panel, under Admin -> General Configuration, you can see the Default Language dropdown. Change that to 'dutch' to show Dutch translations for date strings for non-logged-in users.

    Or add this to your config.php file:

    $config['deft_lang'] = 'dutch';

  6. Joan Lindhout 26 Feb 2013 15:00

    Ah, I didn't know I could set the default language that way.
    This helped me out, thanks!