ICU-3383 add utility to 'autoquote' unquoted apostrophes in message format

X-SVN-Rev: 17829
This commit is contained in:
Doug Felt 2005-06-08 16:07:41 +00:00
parent 6f062073be
commit 2114b5d0a5
2 changed files with 18 additions and 0 deletions

View File

@ -179,6 +179,21 @@ class DateFormat;
* If a pattern is used, then unquoted braces in the pattern, if any,
* must match: that is, "ab {0} de" and "ab '}' de" are ok, but "ab
* {0'}' de" and "ab } de" are not.
* <p>
* <dl><dt><b>Warning:</b><dd>The rules for using quotes within message
* format patterns unfortunately have shown to be somewhat confusing.
* In particular, it isn't always obvious to localizers whether single
* quotes need to be doubled or not. Make sure to inform localizers about
* the rules, and tell them (for example, by using comments in resource
* bundle source files) which strings will be processed by MessageFormat.
* Note that localizers may need to use single quotes in translated
* strings where the original version doesn't have them.
* <br>Note also that the simplest way to avoid the problem is to
* use the real apostrophe (single quote) character \u2019 (') for
* human-readable text, and to use the ASCII apostrophe (\u0027 ' )
* only in program syntax, like quoting in MessageFormat.
* See the annotations for U+0027 Apostrophe in The Unicode Standard.</p>
* </dl>
* <P>
* The argumentIndex is a non-negative integer, which corresponds to the
* index of the arguments presented in an array to be formatted. The

View File

@ -1225,6 +1225,9 @@ void TestMessageFormat::testAutoQuoteApostrophe(void) {
"{'", "{'",
"{'a", "{'a",
"{'a{}'a}'a", "{'a{}'a}''a",
"'}'", "'}'",
"'} '{'}'", "'} '{'}''",
"'} {{{''", "'} {{{'''",
};
int32_t pattern_count = sizeof(patterns)/sizeof(patterns[0]);