summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorChirayu Desai <cdesai@cyanogenmod.org>2013-05-05 19:35:45 +0530
committerChirayu Desai <cdesai@cyanogenmod.org>2013-05-05 19:35:45 +0530
commit38c685c78878e761d79184de3c44c2f94e57a028 (patch)
tree6710ed8f922473da9e95b7ed97abe56a9d8e9403 /tools
parenta1810eff06acf67b9fae62cb7b58fb31af41318c (diff)
downloadframeworks_base-38c685c78878e761d79184de3c44c2f94e57a028.zip
frameworks_base-38c685c78878e761d79184de3c44c2f94e57a028.tar.gz
frameworks_base-38c685c78878e761d79184de3c44c2f94e57a028.tar.bz2
aapt: add check for untranslatable "string-array"s
Change-Id: Id884af0505c0bcdfa20b400fcdd54f699f8ef38f Signed-off-by: Chirayu Desai <cdesai@cyanogenmod.org>
Diffstat (limited to 'tools')
-rw-r--r--tools/aapt/ResourceTable.cpp17
1 files changed, 16 insertions, 1 deletions
diff --git a/tools/aapt/ResourceTable.cpp b/tools/aapt/ResourceTable.cpp
index 4f7fee3..61d62fd 100644
--- a/tools/aapt/ResourceTable.cpp
+++ b/tools/aapt/ResourceTable.cpp
@@ -1369,17 +1369,32 @@ status_t compileResourceFile(Bundle* bundle,
}
}
} else if (strcmp16(block.getElementName(&len), string_array16.string()) == 0) {
+ // Note the existence and locale of every string we process
+ char rawLocale[16];
+ curParams.getLocale(rawLocale);
+ String8 locale(rawLocale);
+ String16 name;
// Check whether these strings need valid formats.
// (simplified form of what string16 does above)
size_t n = block.getAttributeCount();
for (size_t i = 0; i < n; i++) {
size_t length;
const uint16_t* attr = block.getAttributeName(i, &length);
- if (strcmp16(attr, translatable16.string()) == 0
+ if (strcmp16(attr, name16.string()) == 0) {
+ name.setTo(block.getAttributeStringValue(i, &length));
+ } else if (strcmp16(attr, translatable16.string()) == 0
|| strcmp16(attr, formatted16.string()) == 0) {
const uint16_t* value = block.getAttributeStringValue(i, &length);
if (strcmp16(value, false16.string()) == 0) {
curIsFormatted = false;
+ // Untranslatable strings must only exist in the default [empty] locale
+ if (locale.size() > 0) {
+ fprintf(stderr, "aapt: error: string-array '%s' in %s marked untranslatable but exists"
+ " in locale '%s'\n", String8(name).string(),
+ bundle->getResourceSourceDirs()[0],
+ locale.string());
+ hasErrors = localHasErrors = true;
+ }
break;
}
}