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

Unified Diff: tools/grit/grit/node/message.py

Issue 39152: Take 2 at using grit to generate locale rc files. (Closed)
Patch Set: Created 11 years, 10 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 | « tools/grit/build/grit_localized_resources.rules ('k') | tools/grit/grit/tclib.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/grit/grit/node/message.py
diff --git a/tools/grit/grit/node/message.py b/tools/grit/grit/node/message.py
index 449238b8c81495918b92128fe902b311fe461228..70865387274b81f6db6895d2bc5ef1555bde5c31 100644
--- a/tools/grit/grit/node/message.py
+++ b/tools/grit/grit/node/message.py
@@ -54,7 +54,7 @@ class MessageNode(base.ContentNode):
def _IsValidAttribute(self, name, value):
if name not in ['name', 'offset', 'translateable', 'desc', 'meaning',
'internal_comment', 'shortcut_groups', 'custom_type',
- 'validation_expr']:
+ 'validation_expr', 'use_name_for_id']:
return False
if name == 'translateable' and value not in ['true', 'false']:
return False
@@ -72,6 +72,7 @@ class MessageNode(base.ContentNode):
'shortcut_groups' : '',
'custom_type' : '',
'validation_expr' : '',
+ 'use_name_for_id' : 'false',
}
def GetTextualIds(self):
@@ -139,10 +140,14 @@ class MessageNode(base.ContentNode):
description_or_id = self.attrs['desc']
if description_or_id == '' and 'name' in self.attrs:
description_or_id = 'ID: %s' % self.attrs['name']
-
+
+ assigned_id = None
+ if self.attrs['use_name_for_id'] == 'true':
+ assigned_id = self.attrs['name']
message = tclib.Message(text=text, placeholders=placeholders,
description=description_or_id,
- meaning=self.attrs['meaning'])
+ meaning=self.attrs['meaning'],
+ assigned_id=assigned_id)
self.clique = self.UberClique().MakeClique(message, self.IsTranslateable())
for group in self.shortcut_groups_:
self.clique.AddToShortcutGroup(group)
« no previous file with comments | « tools/grit/build/grit_localized_resources.rules ('k') | tools/grit/grit/tclib.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698