简体   繁体   中英

Producing lists in Intl/ICU with PHP

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM