Merge pull request #52969 from bruvzg/locale_detection

This commit is contained in:
Rémi Verschelde 2022-01-18 15:43:04 +01:00 committed by GitHub
commit ce2b5bdfa8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
28 changed files with 2430 additions and 1635 deletions

View file

@ -2493,7 +2493,10 @@
</constant>
<constant name="PROPERTY_HINT_ARRAY_TYPE" value="39" enum="PropertyHint">
</constant>
<constant name="PROPERTY_HINT_MAX" value="41" enum="PropertyHint">
<constant name="PROPERTY_HINT_LOCALE_ID" value="41" enum="PropertyHint">
Hints that a string property is a locale code. Editing it will show a locale dialog for picking language and country.
</constant>
<constant name="PROPERTY_HINT_MAX" value="42" enum="PropertyHint">
</constant>
<constant name="PROPERTY_USAGE_NONE" value="0" enum="PropertyUsageFlags">
</constant>

View file

@ -24,6 +24,46 @@
Clears the server from all translations.
</description>
</method>
<method name="compare_locales" qualifiers="const">
<return type="int" />
<argument index="0" name="locale_a" type="String" />
<argument index="1" name="locale_b" type="String" />
<description>
Compares two locales and return similarity score between [code]0[/code](no match) and [code]10[/code](full match).
</description>
</method>
<method name="get_all_countries" qualifiers="const">
<return type="PackedStringArray" />
<description>
Returns array of known country codes.
</description>
</method>
<method name="get_all_languages" qualifiers="const">
<return type="PackedStringArray" />
<description>
Returns array of known language codes.
</description>
</method>
<method name="get_all_scripts" qualifiers="const">
<return type="PackedStringArray" />
<description>
Returns array of known script codes.
</description>
</method>
<method name="get_country_name" qualifiers="const">
<return type="String" />
<argument index="0" name="country" type="String" />
<description>
Returns readable country name for the [code]country[/code] code.
</description>
</method>
<method name="get_language_name" qualifiers="const">
<return type="String" />
<argument index="0" name="language" type="String" />
<description>
Returns readable language name for the [code]language[/code] code.
</description>
</method>
<method name="get_loaded_locales" qualifiers="const">
<return type="Array" />
<description>
@ -44,6 +84,13 @@
Returns a locale's language and its variant (e.g. [code]"en_US"[/code] would return [code]"English (United States)"[/code]).
</description>
</method>
<method name="get_script_name" qualifiers="const">
<return type="String" />
<argument index="0" name="script" type="String" />
<description>
Returns readable script name for the [code]script[/code] code.
</description>
</method>
<method name="get_translation_object">
<return type="Translation" />
<argument index="0" name="locale" type="String" />
@ -80,6 +127,13 @@
If translations have been loaded beforehand for the new locale, they will be applied.
</description>
</method>
<method name="standardize_locale" qualifiers="const">
<return type="String" />
<argument index="0" name="locale" type="String" />
<description>
Retunrs [code]locale[/code] string standardized to match known locales (e.g. [code]en-US[/code] would be matched to [code]en_US[/code]).
</description>
</method>
<method name="translate" qualifiers="const">
<return type="StringName" />
<argument index="0" name="message" type="StringName" />