ibm-js/ecma402 — pull request #68 by rxaviers (2014-09-25 18:42:19+00:00)
Title: Fixes #66 (WIP - needs a little discussion)

#### Manage CLDR data as peer dependency

Since ibm-js/ecma402 already suggests `bower` usage to manage and install dependencies, the first change this PR does is to also manage [cldr-data][] using the same tool.

[cldr-data]: https://github.com/rxaviers/cldr-data-bower

```javascript
// bower.json
{
"dependencies": {
"cldr-data": ">= 25",
...
}
}
```

At this point, user is able to spot conflicting cldr-data peer dependency between this and other i18n libraries that leverage cldr-data (for example [jquery/globalize][], which has parsing methods that complements ecma402).

[jquery/globalize]: https://github.com/jquery/globalize/

#### Avoid duplicating CLDR data everywhere

The second step this PR could take, this is optional, is to rely on the above bower setup to avoid having CLDR data embedded in this library.

The benefits of this change are:

1. Never again have the trouble to mirror the CLDR JSON data yourself. Bower can
be used for that. By you (developing it), or by users (using it).

1. Avoid having CLDR data duplicated on each i18n library. Using the same example above (end application that depends on both ecma-402 and globalize), having both libraries to use the same peer dependency avoids having the same data duplicated on both libraries. It's avoided to have the same CLDR data on the two libraries. Yeap, I'm being repetitive. You see, duplication is awful :P. Note it's not only a matter of saving disk space during development. But, it's also about flattening the dependencies when serving to the client.

The changes involved here are:

rm -Rf cldr

```javascript
//.bowerrc
{
"scripts": {
"preinstall": "npm install cldr-data-downloader",
"postinstall": "./node_modules/cldr-data-downloader/bin/download.js -i bower_components/cldr-data/index.json -o bower_components/cldr-data/"
}
}
```

```javascript
require.config({
path: {
cldr: "bower_components/cldr-data"
}
});
```

Changes of the form:

```diff
- "requirejs-text/text!./cldr/supplemental/timeData.json",
+ "requirejs-text/text!cldr/supplemental/timeData.json",
```

#### Avoid duplicating CLDR logic (and save runtime memory)

This is about a step further and it's about our both projects using the same foundation low level CLDR traverser [cldrjs][]. But, I leave this for a next iteration after we talk about the above.

[cldrjs]: https://github.com/rxaviers/cldrjs

----

Obviously, my PR isn't complete. I want to discuss before implementing.