Fix default_locale and get_best_locale

Fix error in default_locale key
default_locale is a key that preferences has, not usr_prefs.

Reverted the part of the process that requires path expansion in get_best_locale.
This commit is contained in:
Masato TOYOSHIMA
2025-01-27 15:43:07 +09:00
parent 5ff16ac51c
commit 307c619ff2
+2 -2
View File
@@ -250,7 +250,7 @@ class Hello(Gtk.Window):
:return: locale to use :return: locale to use
:rtype: str :rtype: str
""" """
path = f"{self.preferences["locale_path"]}/LC_MESSAGES/{self.app}*.mo" path = self.preferences["locale_path"] + "/{}/LC_MESSAGES/" + self.app + ".mo"
if os.path.isfile(path.format(self.usr_prefs["locale"])): if os.path.isfile(path.format(self.usr_prefs["locale"])):
# return usr_preference # return usr_preference
@@ -374,7 +374,7 @@ class Hello(Gtk.Window):
""" """
filename = f"{self.preferences["data_path"]}/pages/{self.usr_prefs["locale"]}/{name}" filename = f"{self.preferences["data_path"]}/pages/{self.usr_prefs["locale"]}/{name}"
if not os.path.isfile(filename): if not os.path.isfile(filename):
f"{self.preferences["data_path"]}/pages/{self.usr_prefs["default_locale"]}/{name}" f"{self.preferences["data_path"]}/pages/{self.preferences["default_locale"]}/{name}"
try: try:
with open(filename, "r") as fil: with open(filename, "r") as fil:
return fil.read() return fil.read()