diff options
author | Steve Kondik <shade@chemlab.org> | 2013-05-05 21:40:28 -0700 |
---|---|---|
committer | Gerrit Code Review <gerrit@cyanogenmod.org> | 2013-05-05 21:40:28 -0700 |
commit | 923546df75cd564c53d7dd30dc141a033f090d27 (patch) | |
tree | 533b06e1cbec9d42a01b4e6556ca079fbd9a5fa3 | |
parent | c8f8aa0e4bd1a78a7f7cd9fc2fbd98a3f6087de1 (diff) | |
parent | 38c685c78878e761d79184de3c44c2f94e57a028 (diff) | |
download | frameworks_base-923546df75cd564c53d7dd30dc141a033f090d27.zip frameworks_base-923546df75cd564c53d7dd30dc141a033f090d27.tar.gz frameworks_base-923546df75cd564c53d7dd30dc141a033f090d27.tar.bz2 |
Merge "aapt: add check for untranslatable "string-array"s" into cm-10.1
-rw-r--r-- | tools/aapt/ResourceTable.cpp | 17 |
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; } } |