You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2026-01-07 19:53:17 +00:00
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:
@@ -102,5 +102,9 @@
|
||||
<member name="locale" type="String" setter="set_locale" getter="get_locale" default=""en"">
|
||||
The locale of the translation.
|
||||
</member>
|
||||
<member name="plural_rules_override" type="String" setter="set_plural_rules_override" getter="get_plural_rules_override" default="""">
|
||||
The plural rules string to enforce. See [url=https://www.gnu.org/software/gettext/manual/html_node/Plural-forms.html]GNU gettext[/url] for examples and more info.
|
||||
If empty or invalid, default plural rules from [method TranslationServer.get_plural_rules] are used. The English plural rules are used as a fallback.
|
||||
</member>
|
||||
</members>
|
||||
</class>
|
||||
|
||||
@@ -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