Option for listing all available locales from ICU
rywilson-ibm opened this issue · 7 comments
@srl295 I'm looking for a way in nodejs (or clientside) to enumerate all locales. This is needed to create a language selection dropdown list. Past projects used the icuj library to accomplish this but I could not find anything equivalent in nodejs.
Assuming that different components will be able to support locales at different pace, maybe this is simply a method that should be placed on locale-aware objects. For example, DateTimeFormat already has something like "supportedLocalesOf". Does that seem reasonable? I can imagine a similar method on NumberFormat, etc.
@rywilson-ibm @joconner It makes sense. I think something at the ecma402 level may be best.
Node however could list which locales it has available, as that information is available at runtime.
what about process.binding('icu').supportedLocales()
?
I think something like that would work.
Since process.binding
is for internal codes, I though it's better to have it in somewhere else.
How about updating the config variable called icu_locales
?
process.config.variables.icu_locales
https://github.com/nodejs/node/blob/master/configure#L1114
May be better to request at https://github.com/tc39/proposal-intl-locale or a feature request in the main Node repo
May be better to request at https://github.com/tc39/proposal-intl-locale or a feature request in the main Node repo
@rywilson-ibm closing this for now, as this repo will be archived.