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

Unified Diff: grit/format/resource_map.py

Issue 23090002: Make grit resource maps generate maps for strings. (Closed) Base URL: http://grit-i18n.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 4 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 | « no previous file | grit/format/resource_map_unittest.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: grit/format/resource_map.py
===================================================================
--- grit/format/resource_map.py (revision 132)
+++ grit/format/resource_map.py (working copy)
@@ -104,17 +104,23 @@
def _FormatSource(get_key, root, lang, output_dir):
from grit.format import rc_header
- from grit.node import include, structure
+ from grit.node import include, structure, message
yield _FormatSourceHeader(root)
tids = rc_header.GetIds(root)
seen = set()
+ active_descendants = [item for item in root.ActiveDescendants()]
for item in root:
- if isinstance(item, (include.IncludeNode, structure.StructureNode)):
+ if isinstance(item, (include.IncludeNode,
+ structure.StructureNode,
+ message.MessageNode)):
key = get_key(item)
tid = item.attrs['name']
if tid in tids and key not in seen:
seen.add(key)
- yield ' {"%s", %s},\n' % (key, tid)
+ # For messages, only include the active ones
+ if not isinstance(item, message.MessageNode) \
+ or item in active_descendants:
+ yield ' {"%s", %s},\n' % (key, tid)
yield _FormatSourceFooter(root)
« no previous file with comments | « no previous file | grit/format/resource_map_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698