diff options
author | Narayan Kamath <narayan@google.com> | 2013-12-18 12:46:40 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2013-12-18 12:46:41 +0000 |
commit | 3da645f307695949623d78f280ce12e932eb057c (patch) | |
tree | 33b99b0a1866377ecf30495bcae74c0d6ce9783c /tools | |
parent | c978799c4a7cc8339d560bb47a029861230fa2a6 (diff) | |
parent | 7e1b8ff3e15b35b92978e572ccbfbc47cedce242 (diff) | |
download | frameworks_base-3da645f307695949623d78f280ce12e932eb057c.zip frameworks_base-3da645f307695949623d78f280ce12e932eb057c.tar.gz frameworks_base-3da645f307695949623d78f280ce12e932eb057c.tar.bz2 |
Merge "Don't pseudolocalize untranslatable strings."
Diffstat (limited to 'tools')
-rw-r--r-- | tools/aapt/ResourceTable.cpp | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/tools/aapt/ResourceTable.cpp b/tools/aapt/ResourceTable.cpp index f2e5254..6ced8b3 100644 --- a/tools/aapt/ResourceTable.cpp +++ b/tools/aapt/ResourceTable.cpp @@ -1342,7 +1342,7 @@ status_t compileResourceFile(Bundle* bundle, curType = string16; curFormat = ResTable_map::TYPE_REFERENCE|ResTable_map::TYPE_STRING; curIsStyled = true; - curIsPseudolocalizable = true; + curIsPseudolocalizable = (translatable != false16); } else if (strcmp16(block.getElementName(&len), drawable16.string()) == 0) { curTag = &drawable16; curType = drawable16; @@ -1408,15 +1408,24 @@ status_t compileResourceFile(Bundle* bundle, // Check whether these strings need valid formats. // (simplified form of what string16 does above) size_t n = block.getAttributeCount(); + + // Pseudolocalizable by default, unless this string array isn't + // translatable. + curIsPseudolocalizable = true; 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 - || strcmp16(attr, formatted16.string()) == 0) { + if (strcmp16(attr, translatable16.string()) == 0) { + const uint16_t* value = block.getAttributeStringValue(i, &length); + if (strcmp16(value, false16.string()) == 0) { + curIsPseudolocalizable = false; + } + } + + if (strcmp16(attr, formatted16.string()) == 0) { const uint16_t* value = block.getAttributeStringValue(i, &length); if (strcmp16(value, false16.string()) == 0) { curIsFormatted = false; - break; } } } @@ -1426,7 +1435,6 @@ status_t compileResourceFile(Bundle* bundle, curFormat = ResTable_map::TYPE_REFERENCE|ResTable_map::TYPE_STRING; curIsBag = true; curIsBagReplaceOnOverwrite = true; - curIsPseudolocalizable = true; } else if (strcmp16(block.getElementName(&len), integer_array16.string()) == 0) { curTag = &integer_array16; curType = array16; |