-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
38 lines (33 loc) · 1.26 KB
/
Copy pathmain.py
File metadata and controls
38 lines (33 loc) · 1.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import sys
from pkg_builder import PKGBuilder
from config_generator import ConfigGenerator
from safety_validator import SafetyValidator
from languages import LanguageManager
def main():
pc_lang_id = LanguageManager.detect_pc_language()
lang = LanguageManager.get_strings(pc_lang_id)
if len(sys.argv) < 2:
print(lang["cli_usage"])
sys.exit(1)
# CORRECTION EXACTE : Extraction de la chaîne de caractères à l'index 1
cmd = sys.argv[1].lower()
target_dir = "build_pkg"
if cmd == "build":
print(PKGBuilder(target_dir).build(lang))
elif cmd == "config":
print(ConfigGenerator.generate())
elif cmd == "export-pkg":
success, msg = SafetyValidator.validate_structure(target_dir, lang)
print(msg)
if not success:
sys.exit(1)
elif cmd == "test-lang":
print("🌍 Translation Matrix :")
for lang_id, name in [(0, "English"), (1, "Français"), (2, "Español")]:
strings = LanguageManager.get_strings(lang_id)
print(f" -> PS3 ({name:8}) : '{strings['title']}' | '{strings['enable_hen']}' [{strings['btn_on']}]")
else:
print(f"{lang['err_unknown']} {cmd}")
print(lang["cli_usage"])
if __name__ == "__main__":
main()