From: Markus S. <mar...@gm...> - 2010-08-19 23:24:54
|
Dear ICU team & users, I am looking at using MessageFormat, and the well-known issue of dealing with the single quote=apostrophe. We have MessageFormat.autoQuoteApostrophe() which will "do the right thing" in some cases. For example, it turns "I don't know {0}" into "I don''t know {0}". However, it does not modify any text inside {curly braces}. This is inconvenient, because inside braces we find not just syntax (e.g., number/date/time patterns) but also translatable text in choice/plural/select patterns. For example, MessageFormat.autoQuoteApostrophe() does not modify "{0, select, female {I don't know her} other {I don't know him}}" at all, resulting in a pattern parse error. I hesitate to just redefine and change MessageFormat.autoQuoteApostrophe(). I guess I should look at writing another version of it that deals with all apostrophes, including ones inside {braces}. (autoQuoteApostrophesAlsoNested()? autoQuoteApostrophe(String, enum QuotingStyle)?) *Question:* Why does MessageFormat.autoQuoteApostrophe() only handle top-level apostrophes? Is it so that embedded NumberFormat or DateFormat patterns can use single apostrophes? Does the MessageFormat parser not quote literals inside arguments? Thanks, markus |