mirror of
https://github.com/lutris/lutris
synced 2024-10-14 11:42:36 +00:00
i18n: fix the issue that translation cannot be applied on setting dialogs.
This commit is contained in:
parent
74b63ea12b
commit
4644e53ad0
20
bin/lutris
20
bin/lutris
|
@ -27,16 +27,26 @@ if os.path.isdir(os.path.join(LAUNCH_PATH, "../lutris")):
|
|||
else:
|
||||
sys.path.insert(0, os.path.normpath(os.path.join(LAUNCH_PATH, "../lib/lutris")))
|
||||
|
||||
try:
|
||||
gettext.textdomain('lutris')
|
||||
except:
|
||||
sys.stderr.write("Couldn't set gettext domain, translations won't work.")
|
||||
|
||||
try:
|
||||
locale.setlocale(locale.LC_ALL, "")
|
||||
except locale.Error:
|
||||
sys.stderr.write("Unsupported locale setting. Fix your locales\n")
|
||||
|
||||
try:
|
||||
# Application install prefix
|
||||
# Example:
|
||||
# /usr/bin/lutris/../.. -> /usr
|
||||
# $HOME/.local/bin/lutris/../.. -> $HOME/.local
|
||||
prefixPath = os.path.realpath(os.path.join(__file__, os.path.pardir, os.path.pardir))
|
||||
|
||||
localDir = "%s/share/locale" % prefixPath
|
||||
locale.bindtextdomain("lutris", localDir)
|
||||
locale.textdomain("lutris")
|
||||
gettext.bindtextdomain("lutris", localDir)
|
||||
gettext.textdomain("lutris")
|
||||
except:
|
||||
sys.stderr.write("Couldn't set gettext domain, translations won't work.")
|
||||
|
||||
from lutris.gui.application import Application # pylint: disable=no-name-in-module
|
||||
|
||||
app = Application() # pylint: disable=invalid-name
|
||||
|
|
|
@ -63,12 +63,6 @@ class Application(Gtk.Application):
|
|||
)
|
||||
init_lutris()
|
||||
|
||||
localDir = "%s/share/locale" % settings.PREFIX_PATH
|
||||
locale.bindtextdomain("lutris", localDir)
|
||||
locale.textdomain("lutris")
|
||||
gettext.bindtextdomain("lutris", localDir)
|
||||
gettext.textdomain("lutris")
|
||||
|
||||
GLib.set_application_name(_("Lutris"))
|
||||
self.running_games = Gio.ListStore.new(Game)
|
||||
self.window = None
|
||||
|
|
|
@ -29,12 +29,6 @@ BANNER_PATH = os.path.join(DATA_DIR, "banners")
|
|||
COVERART_PATH = os.path.join(DATA_DIR, "coverart")
|
||||
ICON_PATH = os.path.join(GLib.get_user_data_dir(), "icons", "hicolor", "128x128", "apps")
|
||||
|
||||
# Application install prefix
|
||||
# Example:
|
||||
# /usr/lib/python3.7/site-packages/lutris/settings.py/../../../../.. -> /usr
|
||||
# $HOME/.local/lib/python3.7/site-packages/lutris/settings.py/../../../../.. -> $HOME/.local
|
||||
PREFIX_PATH = os.path.realpath(os.path.join(__file__, *([os.path.pardir] * 5)))
|
||||
|
||||
sio = SettingsIO(CONFIG_FILE)
|
||||
PGA_DB = sio.read_setting("pga_path") or os.path.join(DATA_DIR, "pga.db")
|
||||
SITE_URL = sio.read_setting("website") or "https://lutris.net"
|
||||
|
|
Loading…
Reference in a new issue