Skip to content

Commit

Permalink
fix: fixup previous commit
Browse files Browse the repository at this point in the history
  • Loading branch information
OmarIthawi committed Aug 5, 2024
1 parent 5ede65d commit 29ca75b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions i18n_scripts/translation.py
Original file line number Diff line number Diff line change
Expand Up @@ -414,12 +414,12 @@ def replace_underscores(modules_dir=None):
languages_dirs = get_languages_dirs(modules_dir)

for lang_dir in languages_dirs:
lang_old_path = os.path.dirname(get_translation_file_path(modules_dir, 'I18N', lang_dir))
try:
pattern = r'_(\w\w.lproj$)'
if re.search(pattern, lang_dir):
replacement = r'-\1'
new_name = re.sub(pattern, replacement, lang_dir)
lang_old_path = os.path.dirname(get_translation_file_path(modules_dir, 'I18N', lang_dir))
lang_new_path = os.path.dirname(get_translation_file_path(modules_dir, 'I18N', new_name))

os.rename(lang_old_path, lang_new_path)
Expand All @@ -432,7 +432,7 @@ def replace_underscores(modules_dir=None):
print(f"Error: Permission denied while renaming {lang_old_path}: {e}", file=sys.stderr)
raise
except Exception as e:
print(f"Error: An unexpected error occurred while renaming {lang_old_path} to {lang_new_path}: {e}",
print(f"Error: An unexpected error occurred while renaming {lang_old_path}: {e}",
file=sys.stderr)
raise

Expand Down

0 comments on commit 29ca75b

Please sign in to comment.