#!/usr/bin/env python3

# Generate strings that are intended to be translated
import os

import utils

cur_dir = os.path.dirname(__file__)

strings = []
for row in utils.csv_to_reader(os.path.join(cur_dir, 'csv', 'strings.csv')):
    if not any(row): # Ignore empty lines
        continue
    strings.append((row[0], row[1]))

with open(os.path.join(cur_dir, 'lang', 'english.base')) as f:
    base = f.read()

with open(os.path.join(cur_dir, 'lang', 'english.lng'), 'w') as f:
    f.write(base)
    f.write('\n')
    for code, string in sorted(strings):
        f.write('{} :{}\n'.format(code, string))
