You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-11 13:10:58 +00:00
Implement OS::get_locale_language() helper method
This method extracts the 2 or 3-letter language code from `OS::get_locale()`,
making it easier for users to identify the "main" language code for users
that might have different OS locales due to different OS or region, but
should be matched to the same translation (e.g. "generic" Spanish).
Fixes #40703.
(cherry picked from commit def99c7baf)
This commit is contained in:
@@ -527,6 +527,10 @@ String _OS::get_locale() const {
|
||||
return OS::get_singleton()->get_locale();
|
||||
}
|
||||
|
||||
String _OS::get_locale_language() const {
|
||||
return OS::get_singleton()->get_locale_language();
|
||||
}
|
||||
|
||||
String _OS::get_latin_keyboard_variant() const {
|
||||
switch (OS::get_singleton()->get_latin_keyboard_variant()) {
|
||||
case OS::LATIN_KEYBOARD_QWERTY:
|
||||
@@ -1333,6 +1337,7 @@ void _OS::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("get_ticks_usec"), &_OS::get_ticks_usec);
|
||||
ClassDB::bind_method(D_METHOD("get_splash_tick_msec"), &_OS::get_splash_tick_msec);
|
||||
ClassDB::bind_method(D_METHOD("get_locale"), &_OS::get_locale);
|
||||
ClassDB::bind_method(D_METHOD("get_locale_language"), &_OS::get_locale_language);
|
||||
ClassDB::bind_method(D_METHOD("get_latin_keyboard_variant"), &_OS::get_latin_keyboard_variant);
|
||||
ClassDB::bind_method(D_METHOD("get_model_name"), &_OS::get_model_name);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user