diff options
author | tc@google.com <tc@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-05 01:32:47 +0000 |
---|---|---|
committer | tc@google.com <tc@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-05 01:32:47 +0000 |
commit | 6607e4d0790b7c16370d532d6bb7f045a88c19b9 (patch) | |
tree | 2ef117f846b86e457d6e93daa63463eb86bc6078 /tools/grit | |
parent | 7950e31931438b182662ce54c187f288aa613f41 (diff) | |
download | chromium_src-6607e4d0790b7c16370d532d6bb7f045a88c19b9.zip chromium_src-6607e4d0790b7c16370d532d6bb7f045a88c19b9.tar.gz chromium_src-6607e4d0790b7c16370d532d6bb7f045a88c19b9.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.
The old locale_settings*.rc files would #include the google_strings.rc or chromium_strings.rc. Instead, I added it to the vcproj file using $(CHROMIUM_BUILD) to grab the right file. This required changing the output names in the grd files.
TBR=deanm
Review URL: http://codereview.chromium.org/39152
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@10955 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'tools/grit')
-rw-r--r-- | tools/grit/build/grit_localized_resources.rules | 52 | ||||
-rw-r--r-- | tools/grit/grit/node/message.py | 11 | ||||
-rw-r--r-- | tools/grit/grit/tclib.py | 12 |
3 files changed, 20 insertions, 55 deletions
diff --git a/tools/grit/build/grit_localized_resources.rules b/tools/grit/build/grit_localized_resources.rules index 4faa7fc..b75b37c 100644 --- a/tools/grit/build/grit_localized_resources.rules +++ b/tools/grit/build/grit_localized_resources.rules @@ -8,57 +8,7 @@ Name="GRIT Generated Localized Resources" DisplayName="GRIT Generated Localized Resources" CommandLine="$(SolutionDir)..\tools\grit\build\grit_resource_file.bat [inputs] "$(SolutionDir)" "$(OutDir)\grit_derived_sources" [AllOptions]" - Outputs="$(OutDir)\grit_derived_sources\grit\$(InputName).h; - $(OutDir)\grit_derived_sources\$(InputName)_ar.rc; - $(OutDir)\grit_derived_sources\$(InputName)_bg.rc; - $(OutDir)\grit_derived_sources\$(InputName)_bn.rc; - $(OutDir)\grit_derived_sources\$(InputName)_ca.rc; - $(OutDir)\grit_derived_sources\$(InputName)_cs.rc; - $(OutDir)\grit_derived_sources\$(InputName)_da.rc; - $(OutDir)\grit_derived_sources\$(InputName)_de.rc; - $(OutDir)\grit_derived_sources\$(InputName)_el.rc; - $(OutDir)\grit_derived_sources\$(InputName)_en-GB.rc; - $(OutDir)\grit_derived_sources\$(InputName)_en-US.rc; - $(OutDir)\grit_derived_sources\$(InputName)_es.rc; - $(OutDir)\grit_derived_sources\$(InputName)_es-419.rc; - $(OutDir)\grit_derived_sources\$(InputName)_et.rc; - $(OutDir)\grit_derived_sources\$(InputName)_fi.rc; - $(OutDir)\grit_derived_sources\$(InputName)_fil.rc; - $(OutDir)\grit_derived_sources\$(InputName)_fr.rc; - $(OutDir)\grit_derived_sources\$(InputName)_gu.rc; - $(OutDir)\grit_derived_sources\$(InputName)_he.rc; - $(OutDir)\grit_derived_sources\$(InputName)_hi.rc; - $(OutDir)\grit_derived_sources\$(InputName)_hr.rc; - $(OutDir)\grit_derived_sources\$(InputName)_hu.rc; - $(OutDir)\grit_derived_sources\$(InputName)_id.rc; - $(OutDir)\grit_derived_sources\$(InputName)_it.rc; - $(OutDir)\grit_derived_sources\$(InputName)_ja.rc; - $(OutDir)\grit_derived_sources\$(InputName)_kn.rc; - $(OutDir)\grit_derived_sources\$(InputName)_ko.rc; - $(OutDir)\grit_derived_sources\$(InputName)_lt.rc; - $(OutDir)\grit_derived_sources\$(InputName)_lv.rc; - $(OutDir)\grit_derived_sources\$(InputName)_ml.rc; - $(OutDir)\grit_derived_sources\$(InputName)_mr.rc; - $(OutDir)\grit_derived_sources\$(InputName)_nl.rc; - $(OutDir)\grit_derived_sources\$(InputName)_nb.rc; - $(OutDir)\grit_derived_sources\$(InputName)_or.rc; - $(OutDir)\grit_derived_sources\$(InputName)_pl.rc; - $(OutDir)\grit_derived_sources\$(InputName)_pt-BR.rc; - $(OutDir)\grit_derived_sources\$(InputName)_pt-PT.rc; - $(OutDir)\grit_derived_sources\$(InputName)_ro.rc; - $(OutDir)\grit_derived_sources\$(InputName)_ru.rc; - $(OutDir)\grit_derived_sources\$(InputName)_sk.rc; - $(OutDir)\grit_derived_sources\$(InputName)_sl.rc; - $(OutDir)\grit_derived_sources\$(InputName)_sr.rc; - $(OutDir)\grit_derived_sources\$(InputName)_sv.rc; - $(OutDir)\grit_derived_sources\$(InputName)_ta.rc; - $(OutDir)\grit_derived_sources\$(InputName)_te.rc; - $(OutDir)\grit_derived_sources\$(InputName)_th.rc; - $(OutDir)\grit_derived_sources\$(InputName)_tr.rc; - $(OutDir)\grit_derived_sources\$(InputName)_uk.rc; - $(OutDir)\grit_derived_sources\$(InputName)_vi.rc; - $(OutDir)\grit_derived_sources\$(InputName)_zh-CN.rc; - $(OutDir)\grit_derived_sources\$(InputName)_zh-TW.rc;" + Outputs="$(OutDir)\grit_derived_sources\grit\$(InputName).h" AdditionalDependencies="$(SolutionDir)..\tools\grit\build\grit_resource_file.bat;$(SolutionDir)..\tools\grit\grit.py; resources\$(InputName)_ar.xtb; resources\$(InputName)_bg.xtb; 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 915082c..bfacb94 100644 --- a/tools/grit/grit/tclib.py +++ b/tools/grit/grit/tclib.py @@ -141,14 +141,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.''' |