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")`...
This commit is contained in:
Bastien Montagne
2015-05-25 21:17:49 +02:00
parent 5e66827029
commit e092a58fb5

View File

@@ -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 dont 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}