Skip to content

Commit 5052e07

Browse files
Merge pull request #32 from xcoder-tool/chinese-translation
chore: chinese language added by @OrangePig007
2 parents 10a4c03 + 8c50d1e commit 5052e07

File tree

6 files changed

+112
-18
lines changed

6 files changed

+112
-18
lines changed

xcoder/console.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,7 @@ def question(message: str) -> bool:
3737

3838

3939
if __name__ == "__main__":
40-
console = Console()
41-
console.ask_integer("Please, type any integer")
40+
Console.ask_integer("Please, type any integer")
4241

4342
for i in range(1000):
44-
console.progress_bar("Test progress bar", i, 1000)
43+
Console.progress_bar("Test progress bar", i, 1000)

xcoder/languages/en-EU.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"crt_workspace": "Creating workspace directories...",
88
"verifying": "Verifying installation...",
99
"installed": "%s was successfully installed!",
10-
"update_done": "The update was downloaded successfully! Please move all files from directory%s to script directory",
10+
"update_done": "The update was downloaded successfully! Please move all files from directory %s to script directory",
1111
"not_installed": "%s wasn't installed!",
1212
"clear_qu": "Are you sure you want to clear the dirs?",
1313
"done": "Completed in %.2f seconds!",

xcoder/languages/ru-RU.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
"xcoder_header": "XCoder | Версия: %s | От: Vorono4ka",
44
"detected_os": "Обнаружена система %s.",
55
"installing": "Установка необходимых модулей...",
6-
"update_downloading": "Скачивание обновления...",
6+
"update_downloading": "Загрузка обновления...",
77
"crt_workspace": "Создаются рабочие папки...",
88
"verifying": "Проверка установки...",
99
"installed": "%s успешно установлен!",
10-
"update_done": "Обновление успешно скачалось! Пожалуйста, переместите все файлы из каталога%s в каталог скрипта",
10+
"update_done": "Обновление успешно загружено! Пожалуйста, переместите все файлы из каталога %s в каталог скрипта",
1111
"not_installed": "%s не установлен!",
1212
"clear_qu": "Вы действительно хотите очистить папки?",
1313
"done": "Выполнено за %.2f секунд!",

xcoder/languages/zh-CN.json

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
{
2+
"name": "简体中文",
3+
"xcoder_header": "XCoder | 版本: %s | Vorono4ka制作 | OrangePig汉化",
4+
"detected_os": "检测到 %s 操作系统。",
5+
"installing": "正在安装所需模块...",
6+
"update_downloading": "更新下载中...",
7+
"crt_workspace": "正在创建工作空间目录...",
8+
"verifying": "正在验证安装...",
9+
"installed": "%s 安装成功!",
10+
"update_done": "更新下载成功!请将所有文件从目录%s移动到脚本目录",
11+
"not_installed": "%s 未安装!",
12+
"clear_qu": "确定要清空目录吗?",
13+
"done": "已完成,用时 %.2f 秒!",
14+
"done_qu": "完成?",
15+
"choice": "你的选择(输入数字后回车):",
16+
"to_continue": "按回车键继续...",
17+
"experimental": "实验性功能",
18+
19+
"sc_label": "SC 文件(一般为 UI 或特效贴图)",
20+
"decode_sc": "SC 转 PNG",
21+
"encode_sc": "PNG 转 SC",
22+
"decode_by_parts": "SC 转 精灵图",
23+
"encode_by_parts": "精灵图 转 SC",
24+
"overwrite_by_parts": "精灵图 转 SC(覆盖)",
25+
"decode_sc_description": "将 SC 转换为一整张大的 PNG",
26+
"encode_sc_description": "将一整张大的 PNG 转换为 SC",
27+
"decode_by_parts_description": "将 SC 转换为 PNG 并按照成分切割",
28+
"encode_by_parts_description": "将一张张独立的精灵图组合好并转换为 SC",
29+
"overwrite_by_parts_description": "同上,但会 \"覆盖\" 文件夹",
30+
31+
"csv_label": "CSV 文件(一般为各种数据)",
32+
"decompress_csv": "解压 CSV",
33+
"compress_csv": "压缩 CSV",
34+
"decompress_csv_description": "解压电子表格文件",
35+
"compress_csv_description": "压缩电子表格文件",
36+
37+
"ktx_label": "KTX 文件(一般为模型贴图)",
38+
"ktx_from_png_label": "PNG 转 KTX",
39+
"png_from_ktx_label": "KTX 转 PNG",
40+
"ktx_from_png_description": "将 PNG 转换为 KTX",
41+
"png_from_ktx_description": "将 KTX 转换为 PNG",
42+
43+
"other_features_label": "其他选项",
44+
"check_update": "检查更新",
45+
"reinit": "重新初始化",
46+
"change_language": "切换语言",
47+
"clear_directories": "清空工作空间目录",
48+
"toggle_update_auto_checking": "切换自动检查更新",
49+
"exit": "退出",
50+
"version": "当前版本:%s",
51+
"reinit_description": "如果出现问题,请重新初始化",
52+
"change_lang_description": "当前语言:%s",
53+
"clean_dirs_description": "清空输入和输出目录",
54+
55+
"not_latest": "安装的不是最新版本",
56+
"collecting_inf": "文件:%s。正在收集信息...",
57+
"about_sc": "关于纹理。文件名:%s (%d),像素类型:%d,尺寸:%sx%s",
58+
"decompression_error": "解压时出错!尝试直接解码...",
59+
"skip_not_installed": "%s 未安装!请重新初始化",
60+
"detected_comp": "检测到 %s 压缩",
61+
"unknown_pixel_type": "未知像素类型:%s",
62+
"crt_pic": "正在创建图片...",
63+
"join_pic": "正在合并图片...",
64+
"png_save": "正在保存为 png...",
65+
"saved": "保存完成!",
66+
"xcod_not_found": "文件 '%s.xcod' 不存在!",
67+
"illegal_size": "非法图片尺寸!预期为 %sx%s,但得到的是 %sx%s",
68+
"resize_qu": "是否需要调整图片尺寸?",
69+
"resizing": "正在调整大小...",
70+
"split_pic": "正在切割图片...",
71+
"writing_pic": "正在写入像素...",
72+
"compressing_with": "使用 %s 压缩纹理...",
73+
"compression_error": "压缩失败",
74+
"compression_done": "压缩完成!",
75+
"dir_empty": "目录 '%s' 为空!",
76+
"not_found": "文件 '%s' 未找到!",
77+
"cut_sprites_process": "正在裁剪精灵图... (%d/%d)",
78+
"place_sprites_process": "正在放置精灵图... (%d/%d)",
79+
"not_implemented": "此功能将在未来更新中添加。\n你可以在此处关注 XCoder 更新:{repo_url}",
80+
"error": "错误!(%s.%s: %s)",
81+
"e1sc1": "覆盖 SC 精灵图",
82+
"cgl": "更新日志:\n%s",
83+
"upd_av": "\n有可用更新!\n版本:%s\n",
84+
"upd_qu": "你要更新吗?",
85+
"upd": "正在更新...",
86+
"upd_ck": "正在检查更新...",
87+
"bkp": "正在备份当前版本...",
88+
"stp": "正在安装...",
89+
"margin_qu": "考虑边缘空白吗?",
90+
"enabled": "已启用",
91+
"disabled": "已禁用",
92+
93+
"install_to_unlock": "安装 '%s' 以解锁更多功能!"
94+
}

xcoder/localization.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,6 @@ def load(self, language: str):
124124
def change(self):
125125
language_files = os.listdir(_LOCALES_DIRECTORY)
126126

127-
print("Select Language\nВыберите язык\nВиберіть Мову\n")
128-
129127
for file_index, language_file in enumerate(language_files):
130128
language_path = _LOCALES_DIRECTORY / language_file
131129
language_name = json.load(open(language_path, encoding="utf-8"))["name"]

xcoder/pvr_tex_tool.py

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -37,26 +37,29 @@ def can_use_pvr_tex_tool() -> bool:
3737
return _cli_path is not None
3838

3939

40+
# noinspection PyTypeChecker
4041
def get_image_from_ktx_data(data: bytes) -> Image.Image:
41-
tmp = tempfile.NamedTemporaryFile(delete=False, suffix=".ktx")
42-
try:
42+
with tempfile.NamedTemporaryFile(delete=False, suffix=".ktx") as tmp:
4343
tmp.write(data)
44-
finally:
45-
tmp.close()
4644

47-
image = get_image_from_ktx(Path(tmp.name))
48-
os.remove(tmp.name)
45+
try:
46+
image = get_image_from_ktx(Path(tmp.name))
47+
finally:
48+
os.remove(tmp.name)
4949

5050
return image
5151

5252

53+
# noinspection PyTypeChecker
5354
def get_image_from_ktx(filepath: Path) -> Image.Image:
5455
png_filepath = convert_ktx_to_png(filepath)
5556
image_open = Image.open(png_filepath)
56-
image = image_open.copy()
57-
image_open.close()
58-
os.remove(png_filepath)
59-
return image
57+
58+
try:
59+
return image_open.copy()
60+
finally:
61+
image_open.close()
62+
os.remove(png_filepath)
6063

6164

6265
def convert_ktx_to_png(filepath: Path, output_folder: Path | None = None) -> Path:

0 commit comments

Comments
 (0)