Update i18n.py

Mainly so that it links to its new home at https://github.com/minetest-tools/update_translations and takes FaceDeer off the hook.
master
Treer 2020-04-12 13:07:30 +10:00
parent 82d4283f87
commit 3495f0edcb
1 changed files with 10 additions and 5 deletions

15
i18n.py
View File

@ -7,8 +7,8 @@
# Copyright (C) 2019 Joachim Stolberg, 2020 FaceDeer, 2020 Louis Royer
# LGPLv2.1+
#
# See https://github.com/FaceDeer/update_translations for
# documentation and updates.
# See https://github.com/minetest-tools/update_translations for
# potential future updates to this script.
from __future__ import print_function
import os, fnmatch, re, shutil, errno
@ -19,13 +19,15 @@ params = {"recursive": False,
"help": False,
"mods": False,
"verbose": False,
"folders": []
"folders": [],
"no-old-file": False
}
# Available CLI options
options = {"recursive": ['--recursive', '-r'],
"help": ['--help', '-h'],
"mods": ['--installed-mods'],
"verbose": ['--verbose', '-v']
"verbose": ['--verbose', '-v'],
"no-old-file": ['--no-old-file']
}
# Strings longer than this will have extra space added between
@ -64,6 +66,8 @@ DESCRIPTION
run on all subfolders of paths given
{', '.join(options["mods"])}
run on locally installed modules
{', '.join(options["no-old-file"])}
do not create *.old files
{', '.join(options["verbose"])}
add output information
''')
@ -381,7 +385,8 @@ def update_tr_file(dNew, mod_name, tr_file):
if textOld and textOld != textNew:
print(f"{tr_file} has changed.")
shutil.copyfile(tr_file, f"{tr_file}.old")
if not params["no-old-file"]:
shutil.copyfile(tr_file, f"{tr_file}.old")
with open(tr_file, "w", encoding='utf-8') as new_tr_file:
new_tr_file.write(textNew)