Add default plural rules
This makes the PO loader correctly handle the situation where the optional `Plural-Forms` header field does not exist. The `Translation` class and its subclasses always have access to valid plural rules via `_get_plural_rules()`. Plural rules are prioritized: 1. `Translation.plural_rules_override` 2. `TranslationServer.get_plural_rules(locale)` 3. The English plural rules: `nplurals=2; plurals=(n != 1)` Co-Authored-By: Pāvels Nadtočajevs <7645683+bruvzg@users.noreply.github.com>
This commit is contained in:
@ -92,6 +92,13 @@
|
||||
Returns the translation domain with the specified name. An empty translation domain will be created and added if it does not exist.
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_plural_rules" qualifiers="const">
|
||||
<return type="String" />
|
||||
<param index="0" name="locale" type="String" />
|
||||
<description>
|
||||
Returns the default plural rules for the [param locale].
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_script_name" qualifiers="const">
|
||||
<return type="String" />
|
||||
<param index="0" name="script" type="String" />
|
||||
|
||||
Reference in New Issue
Block a user