mirror of
https://github.com/Orama-Interactive/Pixelorama.git
synced 2025-01-18 09:09:47 +00:00
Try to fix issue when certain languages are set to the OS system locale and some GUI elements are not being translated during startup
Only confirmed with Brazilian Portuguese at the moment
This commit is contained in:
parent
e5fd34aa91
commit
30dfb6aa58
|
@ -9,7 +9,7 @@
|
|||
## Keychain
|
||||
|
||||
- Upstream: https://github.com/Orama-Interactive/Keychain
|
||||
- Version: [34bd83ab13f32c932479db8be4bb8c8b7e594fa2](https://github.com/Orama-Interactive/Keychain/commit/34bd83ab13f32c932479db8be4bb8c8b7e594fa2)
|
||||
- Version: [0e675303915543eb04e9c91116974e73337640fc](https://github.com/Orama-Interactive/Keychain/commit/0e675303915543eb04e9c91116974e73337640fc)
|
||||
- License: [MIT](https://github.com/Orama-Interactive/Keychain/blob/main/LICENSE)
|
||||
|
||||
## gdgifexporter
|
||||
|
|
|
@ -48,6 +48,11 @@ class InputGroup:
|
|||
folded = _folded
|
||||
|
||||
|
||||
func _init() -> void:
|
||||
for locale in TranslationServer.get_loaded_locales():
|
||||
load_translation(locale)
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
if !config_file:
|
||||
config_file = ConfigFile.new()
|
||||
|
|
|
@ -654,6 +654,11 @@ func _init() -> void:
|
|||
# Load settings from the config file
|
||||
config_cache.load(CONFIG_PATH)
|
||||
loaded_locales.sort() # Make sure locales are always sorted
|
||||
var saved_locale := OS.get_locale()
|
||||
# Load language
|
||||
if config_cache.has_section_key("preferences", "locale"):
|
||||
saved_locale = config_cache.get_value("preferences", "locale")
|
||||
set_locale(saved_locale, false) # If no language is saved, OS' locale is used
|
||||
if OS.has_feature("template"):
|
||||
root_directory = OS.get_executable_path().get_base_dir()
|
||||
if OS.get_name() == "macOS":
|
||||
|
@ -682,11 +687,6 @@ func _init() -> void:
|
|||
|
||||
func _ready() -> void:
|
||||
_initialize_keychain()
|
||||
var saved_locale := OS.get_locale()
|
||||
# Load language
|
||||
if config_cache.has_section_key("preferences", "locale"):
|
||||
saved_locale = config_cache.get_value("preferences", "locale")
|
||||
set_locale(saved_locale) # If no language is saved, OS' locale is used
|
||||
default_width = config_cache.get_value("preferences", "default_width", default_width)
|
||||
default_height = config_cache.get_value("preferences", "default_height", default_height)
|
||||
default_fill_color = config_cache.get_value(
|
||||
|
@ -999,7 +999,7 @@ func path_join_array(basepaths: PackedStringArray, subpath: String) -> PackedStr
|
|||
return res
|
||||
|
||||
|
||||
func set_locale(locale: String) -> void:
|
||||
func set_locale(locale: String, load_keychain := true) -> void:
|
||||
locale = find_nearest_locale(locale)
|
||||
if not locale in TranslationServer.get_loaded_locales():
|
||||
var translation := load("res://Translations/%s.po" % locale)
|
||||
|
@ -1008,7 +1008,8 @@ func set_locale(locale: String) -> void:
|
|||
else:
|
||||
printerr("Translation %s for locale %s failed to load." % [translation, locale])
|
||||
return
|
||||
Keychain.load_translation(locale)
|
||||
if load_keychain:
|
||||
Keychain.load_translation(locale)
|
||||
TranslationServer.set_locale(locale)
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue