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
diff --git a/tools/aapt2/ResourceParser.cpp b/tools/aapt2/ResourceParser.cpp
index 6a07873..1e879a0 100644
--- a/tools/aapt2/ResourceParser.cpp
+++ b/tools/aapt2/ResourceParser.cpp
@@ -564,8 +564,10 @@
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 @@
return false;
}
}
+
+ } else if (StyledString* stringValue = valueCast<StyledString>(outResource->value.get())) {
+ stringValue->setTranslateable(translateable);
}
return true;
}