[wp-trac] [WordPress Trac] #22225: WordPress does not localize ordinal suffixes in dates
WordPress Trac
noreply at wordpress.org
Wed Jun 1 19:27:13 UTC 2016
#22225: WordPress does not localize ordinal suffixes in dates
--------------------------------------+-----------------------------
Reporter: mihaimihai | Owner:
Type: enhancement | Status: reviewing
Priority: normal | Milestone: Future Release
Component: I18N | Version: 3.4.2
Severity: normal | Resolution:
Keywords: has-patch has-unit-tests | Focuses:
--------------------------------------+-----------------------------
Changes (by ocean90):
* keywords: dev-feedback has-patch has-unit-tests needs-testing => has-
patch has-unit-tests
* owner: ocean90 =>
* milestone: 4.6 => Future Release
Comment:
I don't like the filter approach because it doesn't provide out of the box
support for any other locale. As you've already noticed Russian doesn't
have a specific identifier for ordinals and an empty translations is not
supported.
I'd like to see an approach which follows the `Plural-Forms` entry in a
.po file. It's `"Plural-Forms: nplurals=2; plural=n != 1;\n"` for German
or `"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2
&& n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n"` for Russian.
You'll see similar rules in the Unicode CLDR database:
http://www.unicode.org/cldr/charts/29/supplemental/language_plural_rules.html.
An example for English could be `"Ordinal-Forms: nplurals=4; plural=(n %
10 = 1 && n % 100 != 11) ? 'st' : (n % 10 = 3 && n % 100 != 13) ? 'nd' :
(n % 10 = 3 && n % 100 != 13) ? 'rd' : 'th';"`.
That's something which we can be stored into the translation file and
parsed by a `WP_Locale::get_ordinal_suffix()` method.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/22225#comment:13>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list