From b1483e5942db9629c7997acfcbf37817130bfbe7 Mon Sep 17 00:00:00 2001 From: "Dr.-Ing. Amilcar do Carmo Lucas" Date: Fri, 1 Nov 2024 13:53:01 +0100 Subject: [PATCH] FIX: reading translation files --- MethodicConfigurator/internationalization.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/MethodicConfigurator/internationalization.py b/MethodicConfigurator/internationalization.py index fccf980..b164278 100644 --- a/MethodicConfigurator/internationalization.py +++ b/MethodicConfigurator/internationalization.py @@ -10,6 +10,8 @@ import argparse import gettext +from os import path as os_path + # Do not import nor use logging functions in this file. # Logging is not yet configured when these functions are called @@ -33,7 +35,9 @@ def load_translation() -> callable: # Load the correct language ASAP based on the command line argument try: - translation = gettext.translation('MethodicConfigurator', localedir='locale', + script_dir = os_path.dirname(os_path.abspath(__file__)) + locale_dir = os_path.join(script_dir, 'locale') + translation = gettext.translation('MethodicConfigurator', localedir=locale_dir, languages=[pre_args.language], fallback=False) return translation.gettext except FileNotFoundError: