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

Unified Diff: grit/tool/android2grd.py

Issue 1291173002: Remove support for product attributes in Android xml files. (Closed) Base URL: http://grit-i18n.googlecode.com/svn/trunk
Patch Set: fixed >80 line Created 5 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 | « grit/testdata/android.xml ('k') | grit/tool/android2grd_unittest.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: grit/tool/android2grd.py
diff --git a/grit/tool/android2grd.py b/grit/tool/android2grd.py
index b4c136314bb5eae6ddd999bb58517122041122d5..c0538ed9f71157d5f9295d272035df3d6aae40b5 100644
--- a/grit/tool/android2grd.py
+++ b/grit/tool/android2grd.py
@@ -243,8 +243,9 @@ OPTIONS may be any of the following:
else:
translatable = self.IsTranslatable(child)
raw_name = child.getAttribute('name')
- product = child.getAttribute('product') or None
- grd_name = self.__FormatName(raw_name, product)
+ if not _STRING_NAME.match(raw_name):
+ print 'Error: illegal string name: %s' % raw_name
+ grd_name = 'IDS_' + raw_name.upper()
# Transform the <string> node contents into a tclib.Message, taking
# care to handle whitespace transformations and escaped characters,
# and coverting <xliff:g> placeholders into <ph> placeholders.
@@ -255,27 +256,6 @@ OPTIONS may be any of the following:
# Reset the description once a message has been parsed.
description = ''
- def __FormatName(self, name, product=None):
- """Formats the message name.
-
- Names in the strings.xml files should be lowercase with underscores. In grd
- files message names should be mostly uppercase with a IDS prefix. We also
- will annotate names with product information (lowercase) where appropriate.
-
- Args:
- name: The message name as found in the string.xml file.
- product: An optional product annotation.
-
- Returns:
- String containing the grd style name that will be used in the translation
- console.
- """
- if not _STRING_NAME.match(name):
- print 'Error: string name contains illegal characters: %s' % name
- grd_name = 'IDS_%s' % name.upper()
- product_suffix = ('_product_%s' % product.lower()) if product else ''
- return grd_name + product_suffix
-
def CreateTclibMessage(self, android_string):
"""Transforms a <string/> element from strings.xml into a tclib.Message.
« no previous file with comments | « grit/testdata/android.xml ('k') | grit/tool/android2grd_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698