Skip to content

Commit ca212d9

Browse files
committed
feat(i18n): Complete main translation
1 parent 192cddf commit ca212d9

9 files changed

Lines changed: 388 additions & 402 deletions

File tree

assets/i18n/languages/en_US.json

Lines changed: 323 additions & 344 deletions
Large diffs are not rendered by default.

assets/i18n/scan.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def extract_i18n_strings(node):
2323

2424

2525
def process_file(file_path):
26-
with open(file_path, "r", encoding="utf8") as file:
26+
with open(file_path, "r", encoding="utf8", errors="ignore") as file:
2727
code = file.read()
2828
if "I18nAuto" in code:
2929
tree = ast.parse(code)
@@ -40,13 +40,16 @@ def process_file(file_path):
4040
code_keys = set()
4141

4242
for py_file in py_files:
43+
if py_file.parts and py_file.parts[0] == 'env':
44+
continue
4345
strings = process_file(py_file)
4446
code_keys.update(strings)
4547

4648
print()
4749
print("Total unique:", len(code_keys))
4850

49-
standard_file = "languages/en_US.json"
51+
standard_file = Path(__file__).parent / "languages" / "en_US.json"
52+
5053
with open(standard_file, "r", encoding="utf-8") as file:
5154
standard_data = json.load(file, object_pairs_hook=OrderedDict)
5255
standard_keys = set(standard_data.keys())

tabs/extra/sections/f0_extractor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def f0_extractor_tab():
5353
button = gr.Button(i18n("Extract F0 Curve"))
5454

5555
with gr.Row():
56-
txt_output = gr.File(label="F0 Curve", type="filepath")
56+
txt_output = gr.File(label=i18n("F0 Curve"), type="filepath")
5757
image_output = gr.Image(type="filepath", interactive=False)
5858

5959
button.click(

tabs/inference/inference.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -689,7 +689,7 @@ def inference_tab():
689689
visible=False,
690690
)
691691
chorus = gr.Checkbox(
692-
label=i18n("chorus"),
692+
label=i18n("Chorus"),
693693
info=i18n("Apply chorus to the audio."),
694694
value=False,
695695
interactive=True,
@@ -707,7 +707,7 @@ def inference_tab():
707707
chorus_depth = gr.Slider(
708708
minimum=0,
709709
maximum=1,
710-
label=i18n("chorus Depth"),
710+
label=i18n("Chorus Depth"),
711711
info=i18n("Set the chorus depth."),
712712
value=0.25,
713713
interactive=True,
@@ -716,7 +716,7 @@ def inference_tab():
716716
chorus_center_delay = gr.Slider(
717717
minimum=7,
718718
maximum=8,
719-
label=i18n("chorus Center Delay ms"),
719+
label=i18n("Chorus Center Delay ms"),
720720
info=i18n("Set the chorus center delay ms."),
721721
value=7,
722722
interactive=True,
@@ -725,7 +725,7 @@ def inference_tab():
725725
chorus_feedback = gr.Slider(
726726
minimum=0,
727727
maximum=1,
728-
label=i18n("chorus Feedback"),
728+
label=i18n("Chorus Feedback"),
729729
info=i18n("Set the chorus feedback."),
730730
value=0.0,
731731
interactive=True,
@@ -1322,7 +1322,7 @@ def enforce_terms_batch(terms_accepted, *args):
13221322
visible=False,
13231323
)
13241324
chorus_batch = gr.Checkbox(
1325-
label=i18n("chorus"),
1325+
label=i18n("Chorus"),
13261326
info=i18n("Apply chorus to the audio."),
13271327
value=False,
13281328
interactive=True,
@@ -1340,7 +1340,7 @@ def enforce_terms_batch(terms_accepted, *args):
13401340
chorus_depth_batch = gr.Slider(
13411341
minimum=0,
13421342
maximum=1,
1343-
label=i18n("chorus Depth"),
1343+
label=i18n("Chorus Depth"),
13441344
info=i18n("Set the chorus depth."),
13451345
value=0.25,
13461346
interactive=True,
@@ -1349,7 +1349,7 @@ def enforce_terms_batch(terms_accepted, *args):
13491349
chorus_center_delay_batch = gr.Slider(
13501350
minimum=7,
13511351
maximum=8,
1352-
label=i18n("chorus Center Delay ms"),
1352+
label=i18n("Chorus Center Delay ms"),
13531353
info=i18n("Set the chorus center delay ms."),
13541354
value=7,
13551355
interactive=True,
@@ -1358,7 +1358,7 @@ def enforce_terms_batch(terms_accepted, *args):
13581358
chorus_feedback_batch = gr.Slider(
13591359
minimum=0,
13601360
maximum=1,
1361-
label=i18n("chorus Feedback"),
1361+
label=i18n("Chorus Feedback"),
13621362
info=i18n("Set the chorus feedback."),
13631363
value=0.0,
13641364
interactive=True,

tabs/realtime/realtime.py

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -319,8 +319,8 @@ def realtime_tab():
319319

320320
with gr.Blocks() as ui:
321321
with gr.Row():
322-
start_button = gr.Button("Start", variant="primary")
323-
stop_button = gr.Button("Stop", interactive=False)
322+
start_button = gr.Button(i18n("Start"), variant="primary")
323+
stop_button = gr.Button(i18n("Stop"), interactive=False)
324324
latency_info = gr.Label(label=i18n("Status"), value="Realtime not started.")
325325
terms_checkbox = gr.Checkbox(
326326
label=i18n("I agree to the terms of use"),
@@ -334,13 +334,13 @@ def realtime_tab():
334334
with gr.Tabs():
335335
with gr.TabItem("Audio Settings"):
336336
with gr.Row():
337-
refresh_devices_button = gr.Button("Refresh Audio Devices")
337+
refresh_devices_button = gr.Button(i18n("Refresh Audio Devices"))
338338
with gr.Row():
339-
with gr.Accordion("Input Device", open=True):
339+
with gr.Accordion(i18n("Input Device"), open=True):
340340
with gr.Column():
341341
input_audio_device = gr.Dropdown(
342-
label="Input Device",
343-
info="Select the microphone or audio interface you will be speaking into.",
342+
label=i18n("Input Device"),
343+
info=i18n("Select the microphone or audio interface you will be speaking into."),
344344
choices=input_devices,
345345
value=get_safe_dropdown_value(
346346
saved_settings["input_device"], input_devices
@@ -351,24 +351,24 @@ def realtime_tab():
351351
minimum=0,
352352
maximum=200,
353353
value=100,
354-
label="Input Gain (%)",
355-
info="Adjusts the input volume before processing. Prevents clipping or boosts a quiet mic.",
354+
label=i18n("Input Gain (%)"),
355+
info=i18n("Adjusts the input volume before processing. Prevents clipping or boosts a quiet mic."),
356356
interactive=True,
357357
)
358358
input_asio_channels = gr.Slider(
359359
minimum=-1,
360360
maximum=16,
361361
value=-1,
362362
step=1,
363-
label="Input ASIO Channel",
364-
info="For ASIO drivers, selects a specific input channel. Leave at -1 for default.",
363+
label=i18n("Input ASIO Channel"),
364+
info=i18n("For ASIO drivers, selects a specific input channel. Leave at -1 for default."),
365365
interactive=True,
366366
)
367367
with gr.Accordion("Output Device", open=True):
368368
with gr.Column():
369369
output_audio_device = gr.Dropdown(
370-
label="Output Device",
371-
info="Select the device where the final converted voice will be sent (e.g., a virtual cable).",
370+
label=i18n("Output Device"),
371+
info=i18n("Select the device where the final converted voice will be sent (e.g., a virtual cable)."),
372372
choices=output_devices,
373373
value=get_safe_dropdown_value(
374374
saved_settings["output_device"], output_devices
@@ -379,27 +379,27 @@ def realtime_tab():
379379
minimum=0,
380380
maximum=200,
381381
value=100,
382-
label="Output Gain (%)",
383-
info="Adjusts the final volume of the converted voice after processing.",
382+
label=i18n("Output Gain (%)"),
383+
info=i18n("Adjusts the final volume of the converted voice after processing."),
384384
interactive=True,
385385
)
386386
output_asio_channels = gr.Slider(
387387
minimum=-1,
388388
maximum=16,
389389
value=-1,
390390
step=1,
391-
label="Output ASIO Channel",
392-
info="For ASIO drivers, selects a specific output channel. Leave at -1 for default.",
391+
label=i18n("Output ASIO Channel"),
392+
info=i18n("For ASIO drivers, selects a specific output channel. Leave at -1 for default."),
393393
interactive=True,
394394
)
395395
with gr.Accordion("Monitor Device (Optional)", open=False):
396396
with gr.Column():
397397
use_monitor_device = gr.Checkbox(
398-
label="Use Monitor Device", value=False, interactive=True
398+
label=i18n("Use Monitor Device"), value=False, interactive=True
399399
)
400400
monitor_output_device = gr.Dropdown(
401-
label="Monitor Device",
402-
info="Select the device for monitoring your voice (e.g., your headphones).",
401+
label=i18n("Monitor Device"),
402+
info=i18n("Select the device for monitoring your voice (e.g., your headphones)."),
403403
choices=output_devices,
404404
value=get_safe_dropdown_value(
405405
saved_settings["monitor_device"], output_devices
@@ -410,29 +410,29 @@ def realtime_tab():
410410
minimum=0,
411411
maximum=200,
412412
value=100,
413-
label="Monitor Gain (%)",
414-
info="Adjusts the volume of the monitor feed, independent of the main output.",
413+
label=i18n("Monitor Gain (%)"),
414+
info=i18n("Adjusts the volume of the monitor feed, independent of the main output."),
415415
interactive=True,
416416
)
417417
monitor_asio_channels = gr.Slider(
418418
minimum=-1,
419419
maximum=16,
420420
value=-1,
421421
step=1,
422-
label="Monitor ASIO Channel",
423-
info="For ASIO drivers, selects a specific monitor output channel. Leave at -1 for default.",
422+
label=i18n("Monitor ASIO Channel"),
423+
info=i18n("For ASIO drivers, selects a specific monitor output channel. Leave at -1 for default."),
424424
interactive=True,
425425
)
426426
with gr.Row():
427427
exclusive_mode = gr.Checkbox(
428-
label="Exclusive Mode (WASAPI)",
429-
info="For WASAPI (Windows), gives the app exclusive control for potentially lower latency.",
428+
label=i18n("Exclusive Mode (WASAPI)"),
429+
info=i18n("For WASAPI (Windows), gives the app exclusive control for potentially lower latency."),
430430
value=True,
431431
interactive=True,
432432
)
433433
vad_enabled = gr.Checkbox(
434-
label="Enable VAD",
435-
info="Enables Voice Activity Detection to only process audio when you are speaking, saving CPU.",
434+
label=i18n("Enable VAD"),
435+
info=i18n("Enables Voice Activity Detection to only process audio when you are speaking, saving CPU."),
436436
value=True,
437437
interactive=True,
438438
)
@@ -614,34 +614,34 @@ def realtime_tab():
614614
maximum=2730.7,
615615
value=512,
616616
step=1,
617-
label="Chunk Size (ms)",
618-
info="Audio buffer size in milliseconds. Lower values may reduce latency but increase CPU load.",
617+
label=i18n("Chunk Size (ms)"),
618+
info=i18n("Audio buffer size in milliseconds. Lower values may reduce latency but increase CPU load."),
619619
interactive=True,
620620
)
621621
cross_fade_overlap_size = gr.Slider(
622622
minimum=0.05,
623623
maximum=0.2,
624624
value=0.01,
625-
label="Crossfade Overlap Size (s)",
626-
info="Duration of the fade between audio chunks to prevent clicks. Higher values create smoother transitions but may increase latency.",
625+
label=i18n("Crossfade Overlap Size (s)"),
626+
info=i18n("Duration of the fade between audio chunks to prevent clicks. Higher values create smoother transitions but may increase latency."),
627627
interactive=True,
628628
)
629629
extra_convert_size = gr.Slider(
630630
minimum=0.1,
631631
maximum=5,
632632
value=0.5,
633633
step=0.1,
634-
label="Extra Conversion Size (s)",
635-
info="Amount of extra audio processed to provide context to the model. Improves conversion quality at the cost of higher CPU usage.",
634+
label=i18n("Extra Conversion Size (s)"),
635+
info=i18n("Amount of extra audio processed to provide context to the model. Improves conversion quality at the cost of higher CPU usage."),
636636
interactive=True,
637637
)
638638
silent_threshold = gr.Slider(
639639
minimum=-90,
640640
maximum=-60,
641641
value=-90,
642642
step=1,
643-
label="Silence Threshold (dB)",
644-
info="Volume level below which audio is treated as silence and not processed. Helps to save CPU resources and reduce background noise.",
643+
label=i18n("Silence Threshold (dB)"),
644+
info=i18n("Volume level below which audio is treated as silence and not processed. Helps to save CPU resources and reduce background noise."),
645645
interactive=True,
646646
)
647647

tabs/report/report.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ def report_tab():
5454
]
5555
components = [gr.Markdown(value=instruction) for instruction in instructions]
5656

57-
start_button = gr.Button("Record Screen")
57+
start_button = gr.Button(i18n("Record Screen"))
5858
video_component = gr.Video(interactive=False)
5959

6060
def toggle_button_label(returned_string):

tabs/settings/settings.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@
55
now_dir = os.getcwd()
66
sys.path.append(now_dir)
77

8+
from assets.i18n.i18n import I18nAuto
9+
10+
i18n = I18nAuto()
11+
812
from tabs.settings.sections.presence import presence_tab
913
from tabs.settings.sections.themes import theme_tab
1014
from tabs.settings.sections.version import version_tab
@@ -15,12 +19,12 @@
1519

1620

1721
def settings_tab():
18-
with gr.TabItem(label="General"):
22+
with gr.TabItem(label=i18n("General")):
1923
presence_tab()
2024
theme_tab()
2125
version_tab()
2226
lang_tab()
2327
restart_tab()
24-
with gr.TabItem(label="Training"):
28+
with gr.TabItem(label=i18n("Training")):
2529
model_author_tab()
2630
precision_tab()

tabs/train/train.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -556,24 +556,24 @@ def train_tab():
556556
interactive=True,
557557
)
558558
with gr.Row(visible=False) as embedder_custom:
559-
with gr.Accordion("Custom Embedder", open=True):
559+
with gr.Accordion(i18n("Custom Embedder"), open=True):
560560
with gr.Row():
561561
embedder_model_custom = gr.Dropdown(
562-
label="Select Custom Embedder",
562+
label=i18n("Select Custom Embedder"),
563563
choices=refresh_embedders_folders(),
564564
interactive=True,
565565
allow_custom_value=True,
566566
)
567-
refresh_embedders_button = gr.Button("Refresh embedders")
568-
folder_name_input = gr.Textbox(label="Folder Name", interactive=True)
567+
refresh_embedders_button = gr.Button(i18n("Refresh embedders"))
568+
folder_name_input = gr.Textbox(label=i18n("Folder Name"), interactive=True)
569569
with gr.Row():
570570
bin_file_upload = gr.File(
571-
label="Upload .bin", type="filepath", interactive=True
571+
label=i18n("Upload .bin"), type="filepath", interactive=True
572572
)
573573
config_file_upload = gr.File(
574-
label="Upload .json", type="filepath", interactive=True
574+
label=i18n("Upload .json"), type="filepath", interactive=True
575575
)
576-
move_files_button = gr.Button("Move files to custom embedder folder")
576+
move_files_button = gr.Button(i18n("Move files to custom embedder folder"))
577577

578578
extract_output_info = gr.Textbox(
579579
label=i18n("Output Information"),

tabs/tts/tts.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,14 +108,14 @@ def tts_tab():
108108
)
109109

110110
with gr.Tabs():
111-
with gr.Tab(label="Text to Speech"):
111+
with gr.Tab(label=i18n("Text to Speech")):
112112
tts_text = gr.Textbox(
113113
label=i18n("Text to Synthesize"),
114114
info=i18n("Enter the text to synthesize."),
115115
placeholder=i18n("Enter text to synthesize"),
116116
lines=3,
117117
)
118-
with gr.Tab(label="File to Speech"):
118+
with gr.Tab(label=i18n("File to Speech")):
119119
txt_file = gr.File(
120120
label=i18n("Upload a .txt file"),
121121
type="filepath",

0 commit comments

Comments
 (0)