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

Unified Diff: grit/grd_reader.py

Issue 9802029: Make first_ids_file an optional attribute of the .grd file. (Closed) Base URL: http://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 | « no previous file | grit/grd_reader_unittest.py » ('j') | grit/node/misc.py » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: grit/grd_reader.py
===================================================================
--- grit/grd_reader.py (revision 18)
+++ grit/grd_reader.py (working copy)
@@ -108,7 +108,7 @@
def Parse(filename_or_stream, dir=None, flexible_root=False,
- stop_after=None, debug=False, first_id_filename=None,
+ stop_after=None, first_ids_file=None, debug=False,
defines=None, tags_to_ignore=None):
'''Parses a GRD file into a tree of nodes (from grit.node).
@@ -125,16 +125,16 @@
If 'debug' is true, lots of information about the parsing events will be
printed out during parsing of the file.
- If first_id_filename is provided, then we use the provided path instead of
- resources_id to gather the first id values for resources.
+ If 'first_ids_file' is non-empty, it is used to override the setting
+ for the first_ids_file attribute of the <grit> root node.
Args:
filename_or_stream: './bla.xml' (must be filename if dir is None)
dir: '.' or None (only if filename_or_stream is a filename)
flexible_root: True | False
stop_after: 'inputs'
+ first_ids_file: 'GRIT_DIR/../gritsettings/resource_ids'
debug: False
- first_id_filename: None
defines: dictionary of defines, like {'chromeos': '1'}
Return:
@@ -164,9 +164,11 @@
# Fix up the base_dir so it is relative to the input file.
handler.root.SetOwnDir(dir)
- # Assign first ids to the nodes that don't have them.
- if isinstance(handler.root, misc.GritNode) and first_id_filename != '':
- handler.root.AssignFirstIds(filename_or_stream, first_id_filename, defines)
+ if isinstance(handler.root, misc.GritNode):
+ if first_ids_file:
+ handler.root.attrs['first_ids_file'] = first_ids_file
+ # Assign first ids to the nodes that don't have them.
+ handler.root.AssignFirstIds(filename_or_stream, defines)
return handler.root
« no previous file with comments | « no previous file | grit/grd_reader_unittest.py » ('j') | grit/node/misc.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698