mc-cms-namelessmc/dev/scripts/create_lang.py
2024-09-17 11:24:56 +02:00

22 lines
706 B
Python
Executable file

#!/usr/bin/env python3
import sys
from pathlib import Path
# 2 letter language code: https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes
# 2 letter country code: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2
if __name__ == '__main__':
if len(sys.argv) != 2:
print(f"Usage: {sys.argv[0]} <language code>_<country code>")
sys.exit(1)
name = sys.argv[1]
modules = [e.name for e in Path('modules').iterdir()]
paths = [Path('modules', module, 'language', name + '.json') for module in modules]
for path in paths:
with path.open('bw+') as f:
f.write(b'{}\n')
print("Done. Don't forget to add the language to core/classes/Core/Language.php")