Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

how do i change language of dates?

edited November 2008 in Vanilla 1.0 Help
Hi, I have a Russian version of Vanilla. It is all in Russian, except some little phrases/words. The question is, how do i translate the following into russian:

1. dates; (eg. change Oct 5th to Окт 5)
2. in the extended search, the word "simple" to "простой"

i think that's all, but im not sure yet...

thanks in advance


  • The date words are not something you can change in Vanilla, it's something you'll have to set in either your PHP or web server settings, I think. One way you can change it in vanilla is to not use words, but instead use a format with only numbers, for instance 2006-10-22 or similar. To do that you'll have to open the file called definitions.php in languages/Russian (since you're using the Russian language). Search for OldPostDateFormatCode. It'll probably say 'M jS Y', change that to 'j M Y'. If you want some other formatting, check out the documentation for php's date() function.

    As for the simple thing, it seems like that has been left out of the Russian translation, in the same definitions.php file, add this: $Context->Dictionary['Simple'] = 'простой';
  • You could alternately add a call to str_replace after the date is created which replaces all the english months with russian ones. Eg. replace line return date($Context->GetDefinition('OldPostDateFormatCode'), $Time); in the TimeDiff function (file library/Framework/Framework.Functions.php) with return str_replace( array('Jan', 'Feb', etc...), array('russian equivelent of jan', 'of feb', etc...), date($Context->GetDefinition('OldPostDateFormatCode'), $Time) );
  • edited October 2006
    thanks guys.. i think i will stick to the first option... but still thanks, SirNot.. i will keep that in mind

    i have also updated the Russian (with extensions) add-on (my only add-on :)

    thanks again
  • Also, have a look at strftime() function which is able to output date according to the locale set-up with setlocale().
  • thx may_b my solution with strftime() and setlocale() for a German date format: go to library/Framework/Framework.Functions.php 1) add setlocale(LC_ALL, 'de_DE'); //change de_DE to your language at the top of the file 2)replace the line (near line 810) return date($Context->GetDefinition('OldPostDateFormatCode'), $Time); with return strftime("%d.%m.%y"); // see for your individual format
  • phreakphreak Vanilla*APP (White Label) & Vanilla*Skins Shop MVP
    Hi ruthverena, I tried your solution but it gives every posting just the date of today ? Did you use another solution or does anyne know one? Thanx a lot p*
    • VanillaAPP | iOS & Android App for Vanilla - White label app for Vanilla Forums OS
    • VanillaSkins | Plugins, Themes, Graphics and Custom Development for Vanilla
  • Try it like this:

    1) Add
    setlocale(LC_ALL, 'pt_PT.UTF-8@UTF-8'); //change pt_PT to your language
    at the top of file

    2) Change in that file
    $Context->Dictionary['OldPostDateFormatCode'] = 'M jS Y';
    $Context->Dictionary['OldPostDateFormatCode'] = '%e %B %G'; // see the formatting here

    2) Replace the line (near line 810)
    return date($Context->GetDefinition('OldPostDateFormatCode'), $Time);
    return strftime($Context->GetDefinition('OldPostDateFormatCode'), $Time);

    That's it.
This discussion has been closed.