You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

23 lines
1.0 KiB

#!/usr/bin/env python
import csv
import pathlib
root = pathlib.Path(__file__).resolve().parent.parent
translation_dummy_path = root.joinpath("Source/translation_dummy.cpp")
monstdat_path = root.joinpath("Packaging/resources/assets/txtdata/monsters/monstdat.tsv")
with open(translation_dummy_path, 'w') as temp_source:
temp_source.write(f'/**\n')
temp_source.write(f' * @file translation_dummy.cpp\n')
temp_source.write(f' *\n')
temp_source.write(f' * Do not edit this file manually, it is automatically generated\n')
temp_source.write(f' * and updated by the extract_translation_data.py script.\n')
temp_source.write(f' */\n')
temp_source.write(f'#include "utils/language.h\n')
temp_source.write(f'\n')
with open(monstdat_path, 'r') as tsv:
reader = csv.DictReader(tsv, delimiter='\t')
for row in reader:
translation_key = row['_monster_id'] + "_NAME"
name = row['name'];
temp_source.write(f'const char *' + translation_key + ' = P_("monster", "' + name + '");\n')