Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Montagne <montagne29@wanadoo.fr>2012-10-14 18:18:30 +0400
committerBastien Montagne <montagne29@wanadoo.fr>2012-10-14 18:18:30 +0400
commit7b8dc4be0d6eb68f6bf8439993aa0421112188cf (patch)
treee24118a85616e8fa86118536b0d21d85ad0c0458 /release
parent459a2b38e0e8a7e36032f0f691d9ea515971e4e5 (diff)
Few minor fixes to i18n tools (mostly use ordered dicts too for "xgettexted" messages...).
Diffstat (limited to 'release')
-rwxr-xr-xrelease/scripts/modules/bl_i18n_utils/update_pot.py36
-rw-r--r--release/scripts/modules/bl_i18n_utils/utils.py8
2 files changed, 25 insertions, 19 deletions
diff --git a/release/scripts/modules/bl_i18n_utils/update_pot.py b/release/scripts/modules/bl_i18n_utils/update_pot.py
index f98fc5d7705..6a7efddda6c 100755
--- a/release/scripts/modules/bl_i18n_utils/update_pot.py
+++ b/release/scripts/modules/bl_i18n_utils/update_pot.py
@@ -117,28 +117,30 @@ def check_file(path, rel_path, messages):
def py_xgettext(messages):
+ forbidden = set()
+ forced = set()
with open(SRC_POTFILES) as src:
- forbidden = set()
- forced = set()
for l in src:
if l[0] == '-':
forbidden.add(l[1:].rstrip('\n'))
elif l[0] != '#':
forced.add(l.rstrip('\n'))
- for root, dirs, files in os.walk(POTFILES_DIR):
- if "/.svn" in root:
+ for root, dirs, files in os.walk(POTFILES_DIR):
+ if "/.svn" in root:
+ continue
+ for fname in files:
+ if os.path.splitext(fname)[1] not in PYGETTEXT_ALLOWED_EXTS:
+ continue
+ path = os.path.join(root, fname)
+ rel_path = os.path.relpath(path, SOURCE_DIR)
+ if rel_path in forbidden:
continue
- for fname in files:
- if os.path.splitext(fname)[1] not in PYGETTEXT_ALLOWED_EXTS:
- continue
- path = os.path.join(root, fname)
- rel_path = os.path.relpath(path, SOURCE_DIR)
- if rel_path in forbidden | forced:
- continue
- check_file(path, rel_path, messages)
- for path in forced:
- if os.path.exists(path):
- check_file(os.path.join(SOURCE_DIR, path), path, messages)
+ elif rel_path in forced:
+ forced.remove(rel_path)
+ check_file(path, rel_path, messages)
+ for path in forced:
+ if os.path.exists(path):
+ check_file(os.path.join(SOURCE_DIR, path), path, messages)
# Spell checking!
@@ -250,7 +252,7 @@ def main():
print("Running fake py gettext…")
# Not using any more xgettext, simpler to do it ourself!
- messages = {}
+ messages = utils.new_messages()
py_xgettext(messages)
print("Finished, found {} messages.".format(len(messages)))
@@ -268,7 +270,7 @@ def main():
# add messages collected automatically from RNA
print("\tMerging RNA messages from {}…".format(FILE_NAME_MESSAGES))
- messages = {}
+ messages = utils.new_messages()
with open(FILE_NAME_MESSAGES, encoding="utf-8") as f:
srcs = []
context = ""
diff --git a/release/scripts/modules/bl_i18n_utils/utils.py b/release/scripts/modules/bl_i18n_utils/utils.py
index 25b9daa99e5..9481f750092 100644
--- a/release/scripts/modules/bl_i18n_utils/utils.py
+++ b/release/scripts/modules/bl_i18n_utils/utils.py
@@ -41,6 +41,10 @@ def is_tooltip(msgid):
return len(msgid) > 30
+def new_messages():
+ return getattr(collections, 'OrderedDict', dict)()
+
+
def parse_messages(fname):
"""
Returns a tupple (messages, states, stats).
@@ -78,7 +82,7 @@ def parse_messages(fname):
msgctxt_lines = []
comment_lines = []
- messages = getattr(collections, 'OrderedDict', dict)()
+ messages = new_messages()
translated_messages = set()
fuzzy_messages = set()
commented_messages = set()
@@ -282,7 +286,7 @@ def gen_empty_messages(blender_rev, time_str, year_str):
"""Generate an empty messages & state data (only header if present!)."""
header_key = ("", "")
- messages = getattr(collections, 'OrderedDict', dict)()
+ messages = new_messages()
messages[header_key] = {
"msgid_lines": [""],
"msgctxt_lines": [],