I'm using PHP 5.3's Intl extension for formatting strings on my website. However, I have happened upon a string that requires a list of items. The list given to the website can be any number of items, and should appear in however the language renders lists. In English, it would appear as "a, b, c, and d" or "a, b, c, d, e, f, g, and h". Rendering this English form is easy enough, but I don't know if this is a generic, international way of producing lists (I would bet that it isn't). Is there some way to do this with the intl extension, or ICU formatting?

有帮助吗?

解决方案

so, CLDR (from which ICU data comes) does have lists. However, it is not implemented in ICU yet- it's scheduled for ICU v49 (March, 2012) for both ICU4J and ICU4C. Then, php intl will need to pick it up. You might file a bug now on php intl to start tracking this.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top