diff options
author | Timofey <t.danshin@corp.mail.ru> | 2016-12-07 19:53:51 +0300 |
---|---|---|
committer | Добрый Ээх <bukharaev@gmail.com> | 2016-12-09 20:11:35 +0300 |
commit | 1c4c3f2d27e2be10e26dd8391414305919661f87 (patch) | |
tree | 8831ee463cf7a9945a61923dbde68542e9e5884f /tools/python | |
parent | b0b6b22a33fc5cbec8fc374977b15eb6dd2af346 (diff) |
Made the script more general.
Diffstat (limited to 'tools/python')
-rwxr-xr-x | tools/python/find_untranslated_strings.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/tools/python/find_untranslated_strings.py b/tools/python/find_untranslated_strings.py index 84aed7dd8d..4abfd37e6f 100755 --- a/tools/python/find_untranslated_strings.py +++ b/tools/python/find_untranslated_strings.py @@ -9,7 +9,7 @@ from sys import argv TransAndKey = namedtuple("TransAndKey", "translation, key") -TRANSLATION = re.compile(r"([a-z]{2}|zh-Han[st]|en-GB)\s*=\s*.*$", re.S | re.MULTILINE) +TRANSLATION = re.compile(r"(.*)\s*=\s*.*$", re.S | re.MULTILINE) MANY_DOTS = re.compile(r"\.{4,}") SPACE_PUNCTUATION = re.compile(r"\s[.,?!:;]") PLACEHOLDERS = re.compile(r"(%\d*\$@|%[@dqus]|\^)") @@ -77,6 +77,11 @@ class StringsTxt: if TRANSLATION.match(line): lang, tran = self._parse_lang_and_translation(line) + + if lang == "comment" or lang == "tags": + self.comments_and_tags[current_key][lang] = tran + continue + self.translations[current_key][lang] = tran self.all_langs.add(lang) @@ -84,11 +89,6 @@ class StringsTxt: self.with_english.append(current_key) continue - if line.startswith("comment") or line.startswith("tags"): - lang, value = self._parse_lang_and_translation(line) - self.comments_and_tags[current_key][lang] = value - continue - def print_statistics(self): stats = map(lambda x: (x, len(self.translations[x])), self.translations.keys()) |