summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authortc@google.com <tc@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-03 18:28:18 +0000
committertc@google.com <tc@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-03 18:28:18 +0000
commitef8e07c5c3ae4738d249b318b41e71df91887d29 (patch)
tree208f70a6dad83d4d823a2450471e17911c3e28f8 /tools
parent9958c8ab6f76da35fbf30272b2b82d26bf823230 (diff)
downloadchromium_src-ef8e07c5c3ae4738d249b318b41e71df91887d29.zip
chromium_src-ef8e07c5c3ae4738d249b318b41e71df91887d29.tar.gz
chromium_src-ef8e07c5c3ae4738d249b318b41e71df91887d29.tar.bz2
Use grit to generate locale rc files and remove the old locale rc files from the tree.
I made a small change to grit so we can use our resource ID as the translation ID making it a bit easier to read. I also used a script to convert the existing .rc files to .xtb files. Review URL: http://codereview.chromium.org/28327 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@10809 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'tools')
-rw-r--r--tools/grit/grit/node/message.py11
-rw-r--r--tools/grit/grit/tclib.py12
2 files changed, 19 insertions, 4 deletions
diff --git a/tools/grit/grit/node/message.py b/tools/grit/grit/node/message.py
index 449238b..7086538 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)
diff --git a/tools/grit/grit/tclib.py b/tools/grit/grit/tclib.py
index 846ce15..d97d675 100644
--- a/tools/grit/grit/tclib.py
+++ b/tools/grit/grit/tclib.py
@@ -144,14 +144,24 @@ class BaseMessage(object):
class Message(BaseMessage):
'''A message.'''
- def __init__(self, text='', placeholders=[], description='', meaning=''):
+ def __init__(self, text='', placeholders=[], description='', meaning='',
+ assigned_id=None):
BaseMessage.__init__(self, text, placeholders, description, meaning)
+ self.assigned_id = assigned_id
def ToTclibMessage(self):
msg = grit.extern.tclib.Message('utf-8', meaning=self.meaning)
self.FillTclibBaseMessage(msg)
return msg
+ def GetId(self):
+ '''Use the assigned id if we have one.'''
+ if self.assigned_id:
+ return self.assigned_id
+
+ return BaseMessage.GetId(self)
+
+
class Translation(BaseMessage):
'''A translation.'''