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

X-SVN-Rev: 17816
This commit is contained in:
Doug Felt 2005-06-07 22:23:26 +00:00
parent 8582b61f90
commit 31a6e6ac7a
2 changed files with 10 additions and 2 deletions

View file

@ -1,6 +1,6 @@
/*
**********************************************************************
* Copyright (c) 2004, International Business Machines
* Copyright (c) 2005, International Business Machines
* Corporation and others. All Rights Reserved.
**********************************************************************
* Author: Alan Liu
@ -924,6 +924,9 @@ public class TestMessageFormat extends com.ibm.icu.dev.test.TestFmwk {
"{'", "{'",
"{'a", "{'a",
"{'a{}'a}'a", "{'a{}'a}''a",
"'}'", "'}'",
"'} '{'}'", "'} '{'}''",
"'} {{{''", "'} {{{'''",
};
for (int i = 0; i < patterns.length; i += 2) {
assertEquals("[" + (i/2) + "] \"" + patterns[i] + "\"", patterns[i+1], MessageFormat.autoQuoteApostrophe(patterns[i]));

View file

@ -1,6 +1,6 @@
/*
**********************************************************************
* Copyright (c) 2004, International Business Machines
* Copyright (c) 2005, International Business Machines
* Corporation and others. All Rights Reserved.
**********************************************************************
* Author: Alan Liu
@ -118,6 +118,11 @@ import com.ibm.icu.util.ULocale;
* 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 <i>ArgumentIndex</i> value is a non-negative integer written