Fix usage message, fix README, small code improvement

master
Louis Royer 2020-02-19 22:07:12 +01:00
parent ba6ef62133
commit f24397908e
2 changed files with 10 additions and 10 deletions

View File

@ -9,10 +9,10 @@ It has the following command line options:
```
i18n.py [OPTIONS] [PATHS...]
-help : prints this help message
-recursive : run on all subfolders of paths given
-mods : run on installed locally installed modules
-verbose : add output information
--help, -h : prints this help message
--recursive, -r : run on all subfolders of paths given
--installed-mods : run on locally installed modules
--verbose, -v : add output information
```
The script will preserve any comments in the template.txt or the various .tr files, associating them with the line that follows them. So for example:
@ -32,4 +32,4 @@ If the mod's source changes in such a way that a line with an existing translati
```
##### not used anymore #####
```
```

10
i18n.py
View File

@ -52,12 +52,12 @@ def print_help(name):
print(f'''SYNOPSIS
{name} [OPTIONS] [PATHS...]
DESCRIPTION
{' ,'.join(options["help"])}
{', '.join(options["help"])}
prints this help message
{' ,'.join(options["recursive"])}
{', '.join(options["recursive"])}
run on all subfolders of paths given
{' ,'.join(options["mods"])}
run on installed locally installed modules
{', '.join(options["mods"])}
run on locally installed modules
{', '.join(options["verbose"])}
add output information
''')
@ -128,7 +128,7 @@ def get_modname(folder):
#If there are already .tr files in /locale, returns a list of their names
def get_existing_tr_files(folder):
out = []
for root, dirs, files in os.walk(os.path.join(folder + '/locale/')):
for root, dirs, files in os.walk(os.path.join(folder, 'locale/')):
for name in files:
if pattern_tr_filename.search(name):
out.append(name)