You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
GPT-Brain/batch-programs/update_language.py

20 lines
638 B
Python

import os
import subprocess
import sys
# Add the parent directory to the Python path
parent_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
sys.path.append(parent_dir)
from modules import utilities as util
locals_path = f'.locals'
languages = util.read_json(f'{locals_path}/languages.json')
try:
# create LC_MESSAGES under .local directory if not exist
for language in languages.values():
subprocess.call(f'msgmerge -U {locals_path}/{language}/LC_MESSAGES/base.po {locals_path}/base.pot', shell=True)
except Exception as e:
print(e)
print('Error: Unable to merge .pot file with .po files')