[Bf-blender-cvs] [e092a58] master: I18n message extractor script: py code: do not consider strings inside 'Compare' AST nodes.

Bastien Montagne noreply at git.blender.org
Mon May 25 21:19:24 CEST 2015


Commit: e092a58fb53ce1dbf5387af1690f08be7bf7a5a6
Author: Bastien Montagne
Date:   Mon May 25 21:17:49 2015 +0200
Branches: master
https://developer.blender.org/rBe092a58fb53ce1dbf5387af1690f08be7bf7a5a6

I18n message extractor script: py code: do not consider strings inside 'Compare' AST nodes.

Otherwise, we'd get 'MOVIE' from `text="Build Proxy / Timecode" if clip.source == 'MOVIE' else "Build Proxy")`...

===================================================================

M	release/scripts/modules/bl_i18n_utils/bl_extract_messages.py

===================================================================

diff --git a/release/scripts/modules/bl_i18n_utils/bl_extract_messages.py b/release/scripts/modules/bl_i18n_utils/bl_extract_messages.py
index c3b2ae9..527bb71 100644
--- a/release/scripts/modules/bl_i18n_utils/bl_extract_messages.py
+++ b/release/scripts/modules/bl_i18n_utils/bl_extract_messages.py
@@ -576,8 +576,9 @@ def dump_py_messages_from_files(msgs, reports, files, settings):
     #print(func_translate_args)
 
     # Break recursive nodes look up on some kind of nodes.
-    # E.g. we don’t want to get strings inside subscripts (blah["foo"])!
-    stopper_nodes = {ast.Subscript}
+    # E.g. we don't want to get strings inside subscripts (blah["foo"])!
+    #      we don't want to get strings from comparisons (foo.type == 'BAR').
+    stopper_nodes = {ast.Subscript, ast.Compare}
     # Consider strings separate: ("a" if test else "b")
     separate_nodes = {ast.IfExp}




More information about the Bf-blender-cvs mailing list