Make it an error to use a bare apostrophe in aapt, and adjust warnings/errors.
In practice, no one ever writes an apostrophe in an aapt string with the intent of using it to quote whitespace -- they always mean to include a literal apostrophe in the string and then are surprised when they find the apostrophe missing. Make this an error so that it is discovered right away instead of waiting until late in QA or after the strings have already been sent for translation. (And fix a recently-introduced string that has exactly this problem.) Silence the warning about an empty span in a string, since this seems to annoy people instead of finding any real problems. Make the error about having a translated string with no base string into a warning, since this is a big pain when making changes to an application that has already had some translations done, and the dead translations should be removed by a later translation import anyway.
This commit is contained in:
parent
023a9546ad
commit
7e3953f343
|
@ -3284,7 +3284,16 @@ bool ResTable::collectString(String16* outString,
|
|||
break;
|
||||
}
|
||||
if (c == '\'' && (quoted == 0 || quoted == '\'')) {
|
||||
break;
|
||||
/*
|
||||
* In practice, when people write ' instead of \'
|
||||
* in a string, they are doing it by accident
|
||||
* instead of really meaning to use ' as a quoting
|
||||
* character. Warn them so they don't lose it.
|
||||
*/
|
||||
if (outErrorMsg) {
|
||||
*outErrorMsg = "Apostrophe not preceded by \\";
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
p++;
|
||||
|
|
Loading…
Reference in New Issue