Automattic / wp-cldr

Use CLDR localization data in WordPress
GNU General Public License v2.0
24 stars 6 forks source link

Pull in data files as an external resource #37

Open jblz opened 9 years ago

jblz commented 9 years ago

...instead of including them in this repo.

Would help with versioning.

Related: #35

stuwest commented 9 years ago

Something along these lines?

git submodule add git://github.com/unicode-cldr/cldr-localenames-modern.git json-files/v27
git submodule add git://github.com/unicode-cldr/cldr-numbers-modern.git json-files/v27
git submodule add git://github.com/unicode-cldr/cldr-core.git json-files/v27

CLDR repo's don't appear to be versioned at least in the URL but are in the JSON itself.

stuwest commented 8 years ago

took a first step toward this with #47. included a bash script that uses npm to get the JSON files, then cleaned up and included the PHP script that prunes the excess locales and data files. next steps would be to eliminate the bash script and build it into plugin.

stuwest commented 8 years ago

Ultimately it feels like the underlying CLDR JSON files could be available via a wpcom API and/or through wporg's language packs.

Right now language packs (see list at https://api.wordpress.org/translations/core/1.0/?version=4.4) include a few files e.g. for Swiss German at https://downloads.wordpress.org/translation/core/4.4/de_CH.zip:

One approach could be to excerpt the 5-6 CLDR JSON files for each locale (e.g. timeZoneNames.json, territories.json, languages.json, currencies.json, numbers.json) and bundle them with language packs. That would allow us to remove the two continents-cities files. Not sure how much pressure there is to keep language packs small; each seems about 1.5 MB now so the few hundred K of CLDR JSON wouldn't be a big change. The bigger effort would be fixing any hardcoded references to English strings e.g. switching them to use a call to a CLDR method with the relevant country_code.