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

Dates localization

lukoielukoie New
edited June 2010 in Localization
How do i translate month names?
Tagged:
«13

Comments

  • oliverraduneroliverraduner Contributing to Vanilla since 2010 Switzerland ✭✭
    edited June 2010
    I would be very interested in this, too!

    Most likely I found the reason, why you cannot localize Months & Days (yet): http://github.com/vanillaforums/Garden/commit/ce6c2600a98ed2a8571424edc3c74fb42e1891ed#commitcomment-98474
  • do you think it is possible to make a small patched file for the time being?
    or manually edit necessary lines?
  • as i understand it gets it from the mysql, right?
  • SS ✭✭
    edited February 2011
    Windows:
    http://php.net/manual/en/function.setlocale.php
    On Windows, setlocale(LC_ALL, '') sets the locale names from the system's regional/language settings (accessible via Control Panel).

    // Test on Linux
    locale -a
    no_NO.UTF-8
    pl_PL.ISO8859-2
    pl_PL.UTF-8
    pt_BR.ISO8859-1
    pt_BR.UTF-8
    ....
    =>
    setlocale($LocaleName. '.'. $Encoding);

    // php script
    $x[] = setlocale(LC_ALL, 'sk_SK'); //
    $CurrentLocale = Gdn::Config('Garden.Locale', 'en-CA');
    setlocale(LC_ALL, str_replace('-', '_', $CurrentLocale));
    Fail.
  • oliverraduneroliverraduner Contributing to Vanilla since 2010 Switzerland ✭✭
    @lukoie wrote:
    do you think it is possible to make a small patched file for the time being?
    Yes it would be possible. But as this is a Core function of Vanilla, I think the developers should address it properly.
  • @S:
    huh?
  • I think the best solution would be to make gdn::Format->Date overridable as many other functions, such as Plural, since setting proper locale does not do the job for some languages (it would be better to format text in different way). For instance, in russian locale-formatted string looks like, say, "Июнь 24", while proper way is "24 июня".
  • SS ✭✭
    edited June 2010
    Gdn_Format::Date() uses strftime() which can display month in genitive case. Use token %B. However, I think that anyway need to make overridable Format::Date() function, +1 @TiGR

    http://vanillaforums.org/blog/translation-improvements-in-vanilla-2/comment-page-1/#comment-2238
  • @S token %B does not return month in genitive case on various server configurations (quite common problem, btw, AFAIK it works better only on FreeBSD servers, all linux servers return nominative form).

    Here is more information about various locale-related bugs in PHP: http://www.onphp5.com/article/22
  • SS ✭✭
    edited June 2010
    @TiGR. Therefore, I have FreeBSD :p
    It is the only thing to do - modify your theme
    Gdn_Format::Date($Comment->DateInserted) -> 
    Gdn_Format::To($Comment->DateInserted, 'CustomFormatMethod')
  • The problem is that Gdn_Format::Date() calls are located not only in theme.

    P.S: We can't add FreeBSD as a requirement for Vanilla, right? Then we need function override.
  • oliverraduneroliverraduner Contributing to Vanilla since 2010 Switzerland ✭✭
    At this point I want throw in the initial question to the discussion
    How do i translate month names?
  • phreakphreak Vanilla*APP (White Label) & Vanilla*Skins Shop MVP
    Hi all,

    I'm interested as well in the date change issue. Can someone hep translate "S"'s idea into something that easier to understand and implement for the time beeing?

    Thanx
    • VanillaAPP | iOS & Android App for Vanilla - White label app for Vanilla Forums OS
    • VanillaSkins | Plugins, Themes, Graphics and Custom Development for Vanilla
  • TimTim Operations Vanilla Staff
    We've made some changes in RC3 that make our calls to setlocale() more sensible. In theory, this should clear up a lot of these issues.

    Vanilla Forums COO [GitHub, Twitter, About.me]

  • TiGRTiGR
    edited July 2010
    @Tim, I don't see any changes that could solve the problem discussed (on current git). What do you mean exactly?
  • I would be eagerly interested in a simple answer to the initial question.
    Furthermore: is there a setting to change date and time format?
  • good question. how can I change this? time and date ...
    Does anyone have an idea? :)
  • Please help! Are there any solution?
  • Sorry to resurrect an old discussion, but... Is it possible to have the month names translated somehow?
  • ToddTodd Chief Product Officer Vanilla Staff
    I don't believe so at this time. We'll take a pull request though.
Sign In or Register to comment.