Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Facebook Sign In with Google Sign In with OpenID Sign In with Twitter
Support for Vanilla Forums Cloud product

In this Discussion

Follow Us


Dates localization

2»

Comments

  • you don't have to use arrays, just set your config file (conf/config.php) insert new line anywhere like this:

    $Configuration['Garden']['Locale'] = 'hu-HU';

    (this means all names will be hungarian)

    TurbolegoMacWebsk
  • @Olivier_Chevet hi, step 4 of your instructions is the same with step 1?

    My long month names (Slovak) are visible just as one letter. I follow your 3 steps instructions carefuly.

    check my forum site pls: macweb.sk/forum/

    thanks

  • @jungica: ok, solved, thank you very much mate. :) koszonom

    Onia
  • @jungica: nice fix, but the order is still backwards...

    Right now, it says "februar 13" when i need "13 februar".

    Any way to change the order? :)

    Thanks in advance.

  • Turbolego said: Right now, it says "februar 13" when i need "13 februar".

    which language do you want to use?

  • Norwegian (nb_NO)

    jungica said:

    Turbolego said: Right now, it says "februar 13" when i need "13 februar".

    which language do you want to use?

  • jungicajungica New
    edited February 2012

    put into config: $Configuration['Garden']['Locale'] = 'nb_NO'; and search for the time display and change

    "%B %d"

    (februar 13)

    to

    "%d %B"

    (13 februar)

  • I added "$Configuration['Garden']['Locale'] = 'nb_NO';" to /conf/config.php, and it shows norwegian month names perfectly.

    But there are no "%B" or "%d" in the entire /conf/config.php document.

    Could you post your time display code?

    jungica said: put into config: $Configuration['Garden']['Locale'] = 'nb_NO'; and search for the time display and change

    "%B %d"

    (februar 13)

    to

    "%d %B"

    (13 februar)

  • jungicajungica New
    edited February 2012

    try library\core\class.format.php line 468? or library\core\functions.general.php line 927?

  • jungica said:

    try library\core\class.format.php line 468?

    Found this when i searched for %B:

           // If the timestamp is the same year, show the month and date
            $Format = T('Date.DefaultDayFormat', '%B %e');
         } else if (date('Y', $Timestamp) != date('Y', $Now)) {
            // If the timestamp is not the same year, just show the year
            $Format = T('Date.DefaultYearFormat', '%B %Y');
         } else {
            // Otherwise, use the date format
            $Format = T('Date.DefaultFormat', '%B %e, %Y');
         }
    

    Found this when i searched for %d:

    $Format = str_replace('%e', ltrim(strftime('%d', $Timestamp), '0'), $Format);

    or library\core\functions.general.php line 927?

    Found this when i searched for %B:

              case 'medium':
                  $Result = Gdn_Format::Date($Value, '%e %b %Y');
                  break;
               case 'long':
                  $Result = Gdn_Format::Date($Value, '%e %B %Y');
                  break;
    

    Found this when i searched for %d:

    $Result = Gdn_Format::Date($Value, '%d/%m/%Y');

    Did not find anything in either documents when i searched for %B %d.

    Please advice.

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

    Monetary Donations will be appreciated if you use my plugins. Thanks in Advance.
    As a waiter gets a tip for a good meal, tips for successful solutions appreciated as well. Peregrine

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

    Monetary Donations will be appreciated if you use my plugins. Thanks in Advance.
    As a waiter gets a tip for a good meal, tips for successful solutions appreciated as well. Peregrine

  • 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'; 
    

    Monetary Donations will be appreciated if you use my plugins. Thanks in Advance.
    As a waiter gets a tip for a good meal, tips for successful solutions appreciated as well. Peregrine

    MacWebsk
  • 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.
    

    Monetary Donations will be appreciated if you use my plugins. Thanks in Advance.
    As a waiter gets a tip for a good meal, tips for successful solutions appreciated as well. Peregrine

  • 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

2»
Sign In or Register to comment.