• Resolved Daedalon

    (@daedalon)


    As I’ve reported before, calendar-small.php outputs the Finnish months in the wrong form: “January” is “tammikuu”, and the short form is “tammi”, equivalent for “Jan”. No one uses “Tam”, ever, but that is what EM gives here.

    Some other languages in which short representation of the month doesn’t equal the three first letters of the full name: Arabic, Azerbaijani, Greek, Estonian, Farsi, Hebrew, Croatian, Hungarian, Armenian, Indonesian, Korean, Lithuanian, Polish, Tamil, Thai, Vietnamese and Chinese. In other words, something like half the population of the planet.

    What’s new is that calendar-small.php has been updated: instead of forcing three-letter short forms for all languages it now checks the settings:

    echo ucfirst(date_i18n(get_option('dbem_small_calendar_month_format'), $calendar['month_start']));

    The result is still the same as before, “Tam” instead of “Tammi” for Finnish ands similar misrepresentation for every other language listed above. EM has included the proper translations in http://plugins.trac.wordpress.org/browser/events-manager/tags/5.4.4/includes/js/i18n/jquery.ui.datepicker-fi.js for 3 years, so it’s a shame that the calendar widget doesn’t get the correct strings from anywhere. As it is, we’re stuck with maintaining a customization to the template replacing the above line with:

    $custom_month = date_i18n('M Y', $calendar['month_start']);
    if ( function_exists( 'qtrans_getLanguage' ) && qtrans_getLanguage() == 'fi' ) {
      $custom_month = preg_replace( '/kuu /', ' ', date_i18n('F Y', $calendar['month_start']) );
    }
    echo ucfirst( $custom_month );

    Until the proper translations are used, Events Manager will suffer from:

    1. All users of the languages listed above are seeing incorrect language in their EM site
    2. Except on sites that use this workaround, which leads to
    2.a) either having to check and synchronize changes to the template with every single EM update, or, when skipping a few versions to save time for actual development work,
    2.b) risk having issues due to non-synced updates to the template, and then filing bug reports that eat up the development time for siteadmins and EM developers.

    One way to fix this:

    1. Add shorthand months to the EM translations.
    2. Use those instead of date_i18n( ‘M’ ).

    #2 can be implemented without breaking customizability by parsing the setting string before passing it to date_i18n(), and replacing any M with the lookup for the proper translation string.

    A permanent fix should possibly be implemented at date_i18n() level, but that might take a long time before it’s implemented. In the meanwhile a few lines of code go a long way in properly supporting that half of the planet that is currently seeing incorrect month names when accessing an EM site.

    http://wordpress.org/plugins/events-manager/

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Marcus (aka @msykes)

    (@netweblogic)

    Will look into this in the future.

    For posterity when testing, what’s the shorthand for Tammi?

    I’ll assume with 3 char abbreviations it’s Tam but that’s wrong, so I’ll look into ways to get the correct abbrev in Finnish for testing.

    Thread Starter Daedalon

    (@daedalon)

    Thanks for looking into it.

    January = Tammikuu (the full name)
    Jan = Tammi (the shorthand)

    The shorthand is always the month’s name with just “kuu” removed (which is Finnish for month). That’s what we take advantage of with our workaround, but that won’t help with the other languages.

    Correct translation set available at: http://plugins.trac.wordpress.org/browser/events-manager/tags/5.4.4/includes/js/i18n/jquery.ui.datepicker-fi.js

    Plugin Author Marcus (aka @msykes)

    (@netweblogic)

    are the abbrvs consistently shortened to 5 letters? because if so, then the solution is simply to change the Initial lengths setting in your calendar format to 5.

    Plugin Author Marcus (aka @msykes)

    (@netweblogic)

    also, does

    date_i18n('D');

    work for you? that may be the bettter approach i think.

    the translations you’re pointing to are JS, we use PHP here and they’re two different formats. ideally WP should have the core translation files already and be able to determine dates using the function above.

    Thread Starter Daedalon

    (@daedalon)

    No, unfortunately the lengths vary between 3-6 characters, as can be seen in the jQuery Datepicker translation file. date_i18n('D'); is the three-letter name for a weekday, not month, right? http://codex.wordpress.org/Formatting_Date_and_Time Speaking of which, that, too, is wrong in many languages. To use Finnish as an example, days of week are always shortened to two letters.

    Yes, the translations are in JS, and I agree, ideally WP would include a date_i18n() option for displaying the appropriate local ones regardless of their length. However, such changes in WP core tend to take a long time, sometimes even years. In the meanwhile there’s a substantial EM userbase affected by the issue, so you might want to resolve it already.

    My suggested solution, again:

    1. Add the strings to EM translations (they can be directly copied from the JS files).
    2. Use those strings.

    Plugin Author Marcus (aka @msykes)

    (@netweblogic)

    Problem with your suggestion is that you’re assuming every language translator will translate those strings in our po/mo files. I’d rather leave that responsability to WP’s internal translation

    I’ll check this out again in a few months (i’ve noted it in our bug tracker) and if this still isn’t handled by WP will consider the options.

    Thread Starter Daedalon

    (@daedalon)

    Reported in core: #24899.

    Marking as resolved at EM’s side for now. We can get back to this in a few months if no progress at WP core.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Support national short forms for months in calendar’ is closed to new replies.