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

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: s/outputted/output 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
Index: grit/tool/android2grd.py
diff --git a/grit/tool/android2grd.py b/grit/tool/android2grd.py
index b4c136314bb5eae6ddd999bb58517122041122d5..d2c3716c72009214e67a63a9a4f98bde6dca2ec4 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: string name contains illegal characters: %s' % raw_name
Nico 2015/08/13 22:45:51 > 80 cols
newt (away) 2015/08/13 23:10:52 Done.
+ 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.

Powered by Google App Engine
This is Rietveld 408576698