Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(411)

Unified Diff: grit/node/misc.py

Issue 9958067: Fixing a bug in GRIT where messages with substitutions would (Closed) Base URL: https://grit-i18n.googlecode.com/svn/trunk
Patch Set: Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « grit/node/base.py ('k') | grit/test_suite_all.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: grit/node/misc.py
diff --git a/grit/node/misc.py b/grit/node/misc.py
index 60a0e0ae5150842cdd10895374cd1d048e450970..ec514bd081ea42c795ac79670ec370a08e6dd55f 100644
--- a/grit/node/misc.py
+++ b/grit/node/misc.py
@@ -433,20 +433,35 @@ class GritNode(base.Node):
% (first_ids_filename, filename, node.name))
def RunGatherers(self, recursive=0, debug=False):
- '''Gathers information for the structure nodes, then apply substitutions.
+ '''Gathers information for the top-level nodes, then apply substitutions,
+ then gather the <translations> node (all substitutions must be done before
+ it is gathered so that they can match up correctly).
The substitutions step requires that the OutputContext has been set.
Locally, get the Substitution messages
and add them to the substituter. Also add substitutions for language codes
in the Rc.
+ Gatherers for <translations> child nodes will always be run after all other
+ child nodes have been gathered.
+
Args:
recursive: will call RunGatherers() recursively on all child nodes first.
debug: will print information while running gatherers.
'''
- base.Node.RunGatherers(self, recursive, False)
- assert self.output_language
- self.SubstituteMessages(self.substituter)
+ if recursive:
+ process_last = []
+ for child in self.children:
+ if child.name == 'translations':
+ process_last.append(child)
+ else:
+ child.RunGatherers(recursive=recursive, debug=debug)
+
+ assert self.output_language
+ self.SubstituteMessages(self.substituter)
+
+ for child in process_last:
+ child.RunGatherers(recursive=recursive, debug=debug)
class IdentifierNode(base.Node):
« no previous file with comments | « grit/node/base.py ('k') | grit/test_suite_all.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698