summaryrefslogtreecommitdiff
path: root/tools/aapt2/ResourceParser.cpp
diff options
context:
space:
mode:
author Adam Lesinski <adamlesinski@google.com> 2015-12-17 13:03:11 -0800
committer Adam Lesinski <adamlesinski@google.com> 2016-01-06 12:05:41 -0800
commit393b5f0d6130d3848dd82075986a5cf40c09ce44 (patch)
tree5643311ac74ad383b2efa37fee2f3d21878cf6d8 /tools/aapt2/ResourceParser.cpp
parent24b8ff0faf7c59323d0171cdd825ca09e712aa1e (diff)
AAPT2: Port AAPT pseudolocalization to AAPT2
Pseudolocalization happens at the compile phase. Pseudolocalized values are weak, such that manually specified values will take precedence. Change-Id: I5e064ce0d270c9f4f9022f75aecedab9d45bc980
Diffstat (limited to 'tools/aapt2/ResourceParser.cpp')
-rw-r--r--tools/aapt2/ResourceParser.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/tools/aapt2/ResourceParser.cpp b/tools/aapt2/ResourceParser.cpp
index 6a0787331e02..1e879a0e5f49 100644
--- a/tools/aapt2/ResourceParser.cpp
+++ b/tools/aapt2/ResourceParser.cpp
@@ -564,8 +564,10 @@ bool ResourceParser::parseString(xml::XmlPullParser* parser, ParsedResource* out
return false;
}
- if (formatted && translateable) {
- if (String* stringValue = valueCast<String>(outResource->value.get())) {
+ if (String* stringValue = valueCast<String>(outResource->value.get())) {
+ stringValue->setTranslateable(translateable);
+
+ if (formatted && translateable) {
if (!util::verifyJavaStringFormat(*stringValue->value)) {
mDiag->error(DiagMessage(outResource->source)
<< "multiple substitutions specified in non-positional format; "
@@ -573,6 +575,9 @@ bool ResourceParser::parseString(xml::XmlPullParser* parser, ParsedResource* out
return false;
}
}
+
+ } else if (StyledString* stringValue = valueCast<StyledString>(outResource->value.get())) {
+ stringValue->setTranslateable(translateable);
}
return true;
}