HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Dates localization

13»

Comments

  • jungicajungica New
    edited February 2012

    forget it, check your

    applications\dashboard\locale\en-CA\definitions.php

    or your own, and find

    $Definition['Date.DefaultFormat'] = '%Y, %B %e';
    $Definition['Date.DefaultDayFormat'] = '%B %e';
    $Definition['Date.DefaultYearFormat'] = '%Y %B';
    $Definition['Date.DefaultTimeFormat'] = '%Y %b %e, %R';

  • @jungica replacement %B for %e did not help in my case...anybody else try it?

  • This is such a long thread to follow, can you summarize what you have currently have and what you want to do? If you feel like it.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • MacWebskMacWebsk New
    edited April 2012

    @peregrine:

    first I inserted new line ($Configuration['Garden']['Locale'] = 'sk-SK';) into conf/congig.php file, it replaced english names of months to slovak names, but I have to change the order of months and days in that names - not februar 13, I need "13 februar"

    jungica advised to find applications\dashboard\locale\en-CA\definitions.php and so on...there is %B %e and replacement of these to parameters did not solve date order...

  • peregrineperegrine MVP
    edited April 2012

    Thanks, I'll get back to you in about 6 hours - got some things to do.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • peregrineperegrine MVP
    edited April 2012

    @MacWebsk - let me know if you try this and if it works. You should also try
    Delete all the .ini files in your cache/ folder. To clear the cache after you make the change.
    You may be stuck with days like 01 marec with the %d option. The %e option will not work on some machines.

    /vanilla/cache/Smarty/

    Edit a file called locale.php in your /vanilla/conf/local.php

         <?php if (!defined('APPLICATION')) exit();
    
            //  1 March - no leading zero  - may not work on some computers.
            $Definition['Date.DefaultDayFormat'] = '%e %B'; 
            // or uncomment  the  one below  for 01 March.
            //$Definition['Date.DefaultDayFormat'] = '%d %B'; 
    

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • MacWebskMacWebsk New
    edited April 2012

    @peregrine: Thank you very much, it works and looks pretty good :) my issue solved :)

    Take a look: http://www.macweb.sk/forum

  • @MacWebsk

    As a followup, there appears to be numerous ways to do what you wanted to.
    
    This is probably the better way assuming you created a locale.
    You can change definitions in the  
    /vanilla/locales/the-locale-you-created/definitions.php
    
    search for it to see if the definition exists and modify it, if not add line
    
     $Definition['Date.DefaultDayFormat'] = '%e %B'; 
    
    
    below will get overwritten when you update your version, so make a copy.
    
    /config/locale.php
    as above 
    http://vanillaforums.org/discussion/comment/158378#Comment_158378
    
    and the numerous ways described here...
    http://vanillaforums.org/docs/localization
    
    e.g.
    Plugin: pluginfolder/locale/en-CA.php
    
    
    there is a search order - so if the definition occurs multiple times in the same file, which it shouldn't, but if it does the last one in the file will take effect.
    
    the config/locale.php  - appears to be the last one to act and will override any other instances.
    

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • I'm using the Italian transifex translation and have the same problem.
    I managed to change date format by adding the $Definition['Date.DefaultDayFormat'] = '%e %B'; row to the site_core.php file (not definitions.php).
    But I tried to add the lines for localizing month names and they didn't work, no matter what file I did put them in.
    Any suggestion?

  • AnonymooseAnonymoose ✭✭
    edited January 2013

    Apparently Vanilla gets the names of the names of the months from the unix locale settings, rather than from any localization files of the script itself. Which is unfortunate and impedes localization.

    See: http://vanillaforums.org/discussion/22190/change-date-format#latest

  • I'm using the Dutch local, it has this in definitions.php: 'Locale' => 'nl'. When I add either $Configuration['Garden']['Locale'] = 'nl_NL' or $Configuration['Garden']['Locale'] = 'nl' to my /conf/config.php I loose the Dutch translations. With $Configuration['Garden']['Locale'] = 'nl_NL' I do get the correct month names. How do I match these two settings ?

  • peregrineperegrine MVP
    edited October 2014

    edited out.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • peregrineperegrine MVP
    edited October 2014

    @piotrnl

    for some reason dealing with Transifexes Todd has changed country codes in locale files.
    Not sure how this affects the Month and interaction with your locale on server via php.

    you could download.

    http://vanillaforums.org/addon/vf_nl_nl-locale

    $LocaleInfo['vf_nl_NL'] = array (
      'Locale' => 'nl-NL',
    

    with this...

     $Configuration['Garden']['Locale'] = 'nl_NL'  
    

    this may be a red herring though.

    Interesting to see if it works for you.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • What worked for me: changed everything to nl_NL, renamed the folder /locales/Dutch to /locales/nl_NL and enabled locale nl_NL in Dashboard. Thanks again peregrine !

  • My way.
    Inserted into the file \ library \ core \ class.locale.php after line 93
    setlocale (LC_ALL, "ru_RU.UTF-8");

  • @Vasya said:
    My way.
    Inserted into the file \ library \ core \ class.locale.php after line 93
    setlocale (LC_ALL, "ru_RU.UTF-8");

    My advice: put it into /conf/locale.php. Your changes might be gone after the next Vanilla/locale update and that would be bad for you and your users.

  • @R_J said:
    My advice: put it into /conf/locale.php. Your changes might be gone after the next Vanilla/locale update and that would be bad for you and your users.

    what's been said numerous times, can't be said enough!

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • AnonymooseAnonymoose ✭✭
    edited December 2014

    The Vanilla locales should be able to specify the wording of the dates themselves rather than rely on the unix locale, otherwise it is not possible to build Vanilla locales for which unix locales don't exist, which are not installed, or which have mistakes that need to be corrected or otherwise custom working is needed.

  • I read through this thread... it appears to me that simply setting the locale in config.php should do the trick. But for some reason it's not working for me.

    I'm running v2.3, and I've set $Configuration['Garden']['Locale'] = 'pt_BR'; in conf/config.php

    I also made sure the server (linux) has the locale installed, as by default it's not.

    But all dates are still showing up in english.

    I cleared out the cache ini files, restarted server, etc.

Sign In or Register to comment.