globalizejs / globalize

A JavaScript library for internationalization and localization that leverages the official Unicode CLDR JSON data
https://globalizejs.com
MIT License
4.8k stars 603 forks source link

Automated loading of any cldr json file #762

Closed victoryifei closed 7 years ago

victoryifei commented 7 years ago

I am using globalize with webpack and globalize-webpack-plugin. I know the plugin will load required cldr json files automatically if I use let's say Currency module. But the plugin won't load cldr files that's not required by globalize modules.

Is there a way to ask the plugin to load any cldr file I want? For example, I want to get country name with country code. So I need main/<locale>/territories.json which is not loaded by any globalize module I believe.

Once it's loaded, I will be able to get country name with: Globalize.cldr.main('localeDisplayNames/territories/<country_code>'); Is that right?

rxaviers commented 7 years ago

Hi @victoryifei please could you move your question to Stack Overflow? Then post the link here. Thanks

victoryifei commented 7 years ago

@rxaviers sure SO link here

victoryifei commented 7 years ago

@rxaviers can you take a look at the SO question when you get a chance?