import { Badge } from 'terra-i18n/package.json?dev-site-package';

<Badge />

# Terra i18n Upgrade Guide

## Changes from 3.0 to 4.0

The terra-i18n `aggregate-translations` pre-build tool has been removed from this package.

Along with this, the post-install script which wrote default intl and translation loaders has been removed.

To upgrade, use the [`aggregate-translations` pre-build tool](https://github.com/cerner/terra-aggregate-translations#--terra-aggregate-translations) to generate `intlLoaders` and `translationLoaders` files needed for internationalizing terra components instead of relying on the `intlLoaders` and `translationLoaders` files being generated by the terra-i18n postinstall step.

If you require translations in your Jest tests, you can create a `jestglobalsetup.js` file for your app to call the aggregate-translations pre-build tool.

Add the following code to `jestglobalsetup.js`:

```js
const aggregateTranslations = require('terra-aggregate-translations');

module.exports = () => {
  aggregateTranslations();
};
```

In your app's jest config file, add the following:

```js
globalSetup: './jestglobalsetup.js',
// This allows jest to resolve files from the generated aggregated-translations in addition to node_modules
moduleDirectories: [
  'aggregated-translations',
  'node_modules',
],
```

Alternatively, you can use [terra-enzyme-intl](https://github.com/cerner/terra-enzyme-intl), which will make aggregating translations for Jest tests unnecessary. The [terra-enzyme-intl](https://github.com/cerner/terra-enzyme-intl) package will use the translation keys for the translation strings instead of the actual translations. If you want to test the actual translation string values, we recommend testing translations with a tool like webdriver.io.

## Changes from 2.0 to 3.0

### Changes to CSS Custom Properties

The following transitive dependency had breaking changes. See its upgrade guide for more information.
* terra-doc-template
