summaryrefslogtreecommitdiffstats
path: root/remoting/tools
diff options
context:
space:
mode:
authorlambroslambrou@chromium.org <lambroslambrou@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-02-21 23:26:20 +0000
committerlambroslambrou@chromium.org <lambroslambrou@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-02-21 23:26:20 +0000
commite908b234787a8f216ca36ac0f531a1cde04e3152 (patch)
treee0777c08f4de38f5c9b3392b482895301fcc3c3b /remoting/tools
parent2308fc3757835099b363c252cad1a4de6f83c63a (diff)
downloadchromium_src-e908b234787a8f216ca36ac0f531a1cde04e3152.zip
chromium_src-e908b234787a8f216ca36ac0f531a1cde04e3152.tar.gz
chromium_src-e908b234787a8f216ca36ac0f531a1cde04e3152.tar.bz2
Add strings and placeholder menu items for Android Chromoting help
This updates the verify_resources.py tool to exempt Android strings from the "resource in use" check. BUG=333129,270362 Review URL: https://codereview.chromium.org/168283008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@252684 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting/tools')
-rwxr-xr-xremoting/tools/verify_resources.py26
1 files changed, 19 insertions, 7 deletions
diff --git a/remoting/tools/verify_resources.py b/remoting/tools/verify_resources.py
index 1f5d8d4..1b082a5 100755
--- a/remoting/tools/verify_resources.py
+++ b/remoting/tools/verify_resources.py
@@ -40,15 +40,21 @@ prefix /*i18n-content*/
def LoadTagsFromGrd(filename):
xml = minidom.parse(filename)
- tags = []
+ android_tags = []
+ other_tags = []
msgs_and_structs = xml.getElementsByTagName("message")
msgs_and_structs.extend(xml.getElementsByTagName("structure"))
for res in msgs_and_structs:
name = res.getAttribute("name")
if not name or not name.startswith("IDS_"):
raise Exception("Tag name doesn't start with IDS_: %s" % name)
- tags.append(name[4:])
- return tags
+ name = name[4:]
+ if 'android_java' in res.getAttribute('formatter_data'):
+ android_tags.append(name)
+ else:
+ other_tags.append(name)
+ return android_tags, other_tags
+
def ExtractTagFromLine(file_type, line):
"""Extract a tag from a line of HTML, C++, JS or JSON."""
@@ -132,18 +138,24 @@ def main():
print 'At least one GRD file needs to be specified.'
return 1
- resources = []
+ all_resources = []
+ non_android_resources = []
for f in options.grd:
- resources.extend(LoadTagsFromGrd(f))
+ android_tags, other_tags = LoadTagsFromGrd(f)
+ all_resources.extend(android_tags + other_tags)
+ non_android_resources.extend(other_tags)
used_tags = set([])
exit_code = 0
for f in args:
- if not VerifyFile(f, resources, used_tags):
+ if not VerifyFile(f, all_resources, used_tags):
exit_code = 1
+ # Determining if a resource is being used in the Android app is tricky
+ # because it requires annotating and parsing Android XML layout files.
+ # For now, exclude Android strings from this check.
warnings = False
- for tag in resources:
+ for tag in non_android_resources:
if tag not in used_tags:
print ('%s/%s:0: warning: %s is defined but not used') % \
(os.getcwd(), sys.argv[2], tag)