Skip to content

Commit

Permalink
FIX: reading translation files
Browse files Browse the repository at this point in the history
  • Loading branch information
amilcarlucas committed Nov 1, 2024
1 parent 25d0d7f commit b1483e5
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion MethodicConfigurator/internationalization.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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:
Expand Down

0 comments on commit b1483e5

Please sign in to comment.