mirror of
https://github.com/hacksider/Deep-Live-Cam.git
synced 2025-03-28 18:51:57 +01:00
commit
21d3c8766a
46
locales/zh.json
Normal file
46
locales/zh.json
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
{
|
||||||
|
"Source x Target Mapper": "Source x Target Mapper",
|
||||||
|
"select an source image": "选择一个源图像",
|
||||||
|
"Preview": "预览",
|
||||||
|
"select an target image or video": "选择一个目标图像或视频",
|
||||||
|
"save image output file": "保存图像输出文件",
|
||||||
|
"save video output file": "保存视频输出文件",
|
||||||
|
"select an target image": "选择一个目标图像",
|
||||||
|
"source": "源",
|
||||||
|
"Select a target": "选择一个目标",
|
||||||
|
"Select a face": "选择一张脸",
|
||||||
|
"Keep audio": "保留音频",
|
||||||
|
"Face Enhancer": "面纹增强器",
|
||||||
|
"Many faces": "多脸",
|
||||||
|
"Show FPS": "显示帧率",
|
||||||
|
"Keep fps": "保持帧率",
|
||||||
|
"Keep frames": "保持帧数",
|
||||||
|
"Fix Blueish Cam": "修复偏蓝的摄像头",
|
||||||
|
"Mouth Mask": "口罩",
|
||||||
|
"Show Mouth Mask Box": "显示口罩盒",
|
||||||
|
"Start": "开始",
|
||||||
|
"Live": "直播",
|
||||||
|
"Destroy": "结束",
|
||||||
|
"Map faces": "识别人脸",
|
||||||
|
"Processing...": "处理中...",
|
||||||
|
"Processing succeed!": "处理成功!",
|
||||||
|
"Processing ignored!": "处理被忽略!",
|
||||||
|
"Failed to start camera": "启动相机失败",
|
||||||
|
"Please complete pop-up or close it.": "请先完成弹出窗口或者关闭它",
|
||||||
|
"Getting unique faces": "获取独特面部",
|
||||||
|
"Please select a source image first": "请先选择一个源图像",
|
||||||
|
"No faces found in target": "目标图像中没有人脸",
|
||||||
|
"Add": "添加",
|
||||||
|
"Clear": "清除",
|
||||||
|
"Submit": "确认",
|
||||||
|
"Select source image": "请选取源图像",
|
||||||
|
"Select target image": "请选取目标图像",
|
||||||
|
"Please provide mapping!": "请提供映射",
|
||||||
|
"Atleast 1 source with target is required!": "至少需要一个来源图像与目标图像相关!",
|
||||||
|
"At least 1 source with target is required!": "至少需要一个来源图像与目标图像相关!",
|
||||||
|
"Face could not be detected in last upload!": "最近上传的图像中没有检测到人脸!",
|
||||||
|
"Select Camera:": "选择摄像头",
|
||||||
|
"All mappings cleared!": "所有映射均已清除!",
|
||||||
|
"Mappings successfully submitted!": "成功提交映射!",
|
||||||
|
"Source x Target Mapper is already open.": "源 x 目标映射器已打开。"
|
||||||
|
}
|
@ -44,6 +44,7 @@ def parse_args() -> None:
|
|||||||
program.add_argument('--mouth-mask', help='mask the mouth region', dest='mouth_mask', action='store_true', default=False)
|
program.add_argument('--mouth-mask', help='mask the mouth region', dest='mouth_mask', action='store_true', default=False)
|
||||||
program.add_argument('--video-encoder', help='adjust output video encoder', dest='video_encoder', default='libx264', choices=['libx264', 'libx265', 'libvpx-vp9'])
|
program.add_argument('--video-encoder', help='adjust output video encoder', dest='video_encoder', default='libx264', choices=['libx264', 'libx265', 'libvpx-vp9'])
|
||||||
program.add_argument('--video-quality', help='adjust output video quality', dest='video_quality', type=int, default=18, choices=range(52), metavar='[0-51]')
|
program.add_argument('--video-quality', help='adjust output video quality', dest='video_quality', type=int, default=18, choices=range(52), metavar='[0-51]')
|
||||||
|
program.add_argument('-l', '--lang', help='Ui language', default="en")
|
||||||
program.add_argument('--live-mirror', help='The live camera display as you see it in the front-facing camera frame', dest='live_mirror', action='store_true', default=False)
|
program.add_argument('--live-mirror', help='The live camera display as you see it in the front-facing camera frame', dest='live_mirror', action='store_true', default=False)
|
||||||
program.add_argument('--live-resizable', help='The live camera frame is resizable', dest='live_resizable', action='store_true', default=False)
|
program.add_argument('--live-resizable', help='The live camera frame is resizable', dest='live_resizable', action='store_true', default=False)
|
||||||
program.add_argument('--max-memory', help='maximum amount of RAM in GB', dest='max_memory', type=int, default=suggest_max_memory())
|
program.add_argument('--max-memory', help='maximum amount of RAM in GB', dest='max_memory', type=int, default=suggest_max_memory())
|
||||||
@ -78,6 +79,7 @@ def parse_args() -> None:
|
|||||||
modules.globals.max_memory = args.max_memory
|
modules.globals.max_memory = args.max_memory
|
||||||
modules.globals.execution_providers = decode_execution_providers(args.execution_provider)
|
modules.globals.execution_providers = decode_execution_providers(args.execution_provider)
|
||||||
modules.globals.execution_threads = args.execution_threads
|
modules.globals.execution_threads = args.execution_threads
|
||||||
|
modules.globals.lang = args.lang
|
||||||
|
|
||||||
#for ENHANCER tumbler:
|
#for ENHANCER tumbler:
|
||||||
if 'face_enhancer' in args.frame_processor:
|
if 'face_enhancer' in args.frame_processor:
|
||||||
@ -253,5 +255,5 @@ def run() -> None:
|
|||||||
if modules.globals.headless:
|
if modules.globals.headless:
|
||||||
start()
|
start()
|
||||||
else:
|
else:
|
||||||
window = ui.init(start, destroy)
|
window = ui.init(start, destroy, modules.globals.lang)
|
||||||
window.mainloop()
|
window.mainloop()
|
||||||
|
26
modules/gettext.py
Normal file
26
modules/gettext.py
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
import json
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
class LanguageManager:
|
||||||
|
def __init__(self, default_language="en"):
|
||||||
|
self.current_language = default_language
|
||||||
|
self.translations = {}
|
||||||
|
self.load_language(default_language)
|
||||||
|
|
||||||
|
def load_language(self, language_code) -> bool:
|
||||||
|
"""load language file"""
|
||||||
|
if language_code == "en":
|
||||||
|
return True
|
||||||
|
try:
|
||||||
|
file_path = Path(__file__).parent.parent / f"locales/{language_code}.json"
|
||||||
|
with open(file_path, "r", encoding="utf-8") as file:
|
||||||
|
self.translations = json.load(file)
|
||||||
|
self.current_language = language_code
|
||||||
|
return True
|
||||||
|
except FileNotFoundError:
|
||||||
|
print(f"Language file not found: {language_code}")
|
||||||
|
return False
|
||||||
|
|
||||||
|
def _(self, key, default=None) -> str:
|
||||||
|
"""get translate text"""
|
||||||
|
return self.translations.get(key, default if default else key)
|
Loading…
x
Reference in New Issue
Block a user