mc-cms-namelessmc/dev/scripts/create_lang.py

23 lines
706 B
Python
Raw Permalink Normal View History

2024-09-17 11:24:56 +02:00
#!/usr/bin/env python3
2022-08-07 21:32:28 +02:00
import sys
from pathlib import Path
2022-08-19 18:01:28 +02:00
# 2 letter language code: https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes
2024-09-17 11:24:56 +02:00
# 2 letter country code: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2
2022-08-19 18:01:28 +02:00
2022-08-07 21:32:28 +02:00
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()]
2022-08-07 21:32:28 +02:00
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')
2022-11-15 01:02:33 +01:00
print("Done. Don't forget to add the language to core/classes/Core/Language.php")