Skip to content

Commit

Permalink
Add option to find missing strings in only some locales (#2356)
Browse files Browse the repository at this point in the history
This adds the option to filter the output of find-missing-locales.py by
passing locale codes (like ``en``) to it so that translators don't need
to search for their specific languages in the output.
  • Loading branch information
Psychpsyo committed Apr 14, 2023
1 parent ece3780 commit 96709cf
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
6 changes: 4 additions & 2 deletions scripts/frontend-development/find-missing-locales.py
@@ -1,3 +1,4 @@
import sys
from collections import defaultdict
from glob import glob
from json import load
Expand Down Expand Up @@ -46,9 +47,10 @@ def main():
for en_file in glob(path.join(DIR, EN_PATH)):
for file in glob(path.join(DIR, ALL_PATH)):
if path.basename(en_file) == path.basename(file) and file != en_file:
file_info = audit(file, en_file)
lang = path.basename(path.dirname(file))
per_language_dict[lang].append(file_info)
if len(sys.argv) == 0 or lang in sys.argv:
file_info = audit(file, en_file)
per_language_dict[lang].append(file_info)
for results in per_language_dict.values():
list(map(lambda args: print_result(*args), results))
print()
Expand Down
5 changes: 5 additions & 0 deletions website/docs/add_edit_translations.md
Expand Up @@ -35,4 +35,9 @@ When editing existing translations, follow these rules:
A script can be used to find missing and potentially untranslated locale files. Run the script from the root dir using
`python scripts/frontend-development/find-missing-locales.py`.

You may pass any languages you want to include in the search to the script like so:\
`python scripts/frontend-development/find-missing-locales.py de ja`\
This would only show missing/untranslated strings in the German (de) and Japanese (ja) locale files.\
Passing nothing will default to searching all locales instead.

If you have any questions or need further assistance, please reach out.

0 comments on commit 96709cf

Please sign in to comment.