Skip to content

Commit 2eba47b

Browse files
committed
Make sure the language file exists
1 parent 0f5c1a5 commit 2eba47b

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

pyqt_openai/__init__.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,14 @@ def move_updater():
249249
MAIN_INDEX = 'main.py'
250250
IMAGE_DEFAULT_SAVE_DIRECTORY = 'image_result'
251251
INI_FILE_NAME = os.path.join(get_config_directory(), 'config.yaml')
252-
LANGUAGE_FILE = os.path.join(get_config_directory(), 'translations.json')
252+
LANGUAGE_FILE_BASE_NAME = 'translations.json'
253+
LANGUAGE_FILE = os.path.join(get_config_directory(), LANGUAGE_FILE_BASE_NAME)
254+
LANGUAGE_FILE_SRC = os.path.join(os.path.join(EXEC_PATH, 'lang'), LANGUAGE_FILE_BASE_NAME)
255+
256+
# Make sure the language file exists
257+
if not os.path.exists(LANGUAGE_FILE):
258+
shutil.copy(LANGUAGE_FILE_SRC, LANGUAGE_FILE)
259+
253260

254261
DB_FILE_NAME = 'conv'
255262
FILE_NAME_LENGTH = 32

pyqt_openai/lang/translations.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import json
2-
import os.path
32

43
from PySide6.QtCore import QLocale
54

0 commit comments

Comments
 (0)