v1.0.1 — Support for Browserify/Webpack
This patch release improves support for using Browserify or Webpack to bundle intl-relativeformat
. Since the context of these tools is to bundle for the browser, this release will only include the English locale data in the bundle by default. (Previously the data for all locales would be included when bundling with Browserify or Webpack.)
When you need to support another locale in your app and you're using Browserify or Webpack, we recommend the following approach:
// app.js
var IntlRelativeFormat = window.IntlRelativeFormat = require('intl-relativeformat');
// ...
<script src="/app.bundle.js"></script>
<script src="/intl-relativeformat/dist/locale-data/fr.js"></script>
This will expose IntlRelativeFormat
as a global object in the browser, allowing you to load the script for the locale data you need for the page or current request.
Propagate Original locales
Value
Fixed issue #17 where the original locales
value the user passed to the IntlRelativeFormat
constructor was not being propagated to the internal IntlMessageFormat
instances. Instead, only the resolved root locale was being propagated. This issue would arise when using the Intl.js polyfill.
Source Maps Improvements
This release also includes improvements to source maps, making debugging easier.