Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@atlassian/i18n-properties-loader

atlassianlabs1.9kApache-2.01.0.16

A webpack loader for i18n *.properties files that can be used in Atlassian Server products

react, i18n, frontend, server, atlassian, dc, front-end, bitbucket, jira, confluence, jsd, webpack, loader, wrm

readme

@atlassian/i18n-properties-loader

node version webpack peer dependency version npm downloads

A webpack loader for i18n *.properties files that can be used in Atlassian Server products and plugins.

Motivation

If your work with the modern Front-End Server code there is a good chance you are already using the Atlassian Web-Resource webpack Plugin. If you did configure your webpack to use development server you might be missing displaying translation phrases right now.

The @atlassian/i18n-properties-loader can help you with solving that problem. It's a webpack loader that allows you displaying translation phrases during your development workflow and at the same time uses the WRM.

For more information about the translations system check the Atlassian Development documentation page:

Installation

npm install @atlassian/i18n-properties-loader --save-dev

Usage example

// webpack.config.js

const myI18nFiles = [
  'foo/i18n/my-translation-file.properties',
  'foo/bar/i18n/my-other-translation-file.properties',
  'bar/i18n/some-translation-file.properties',
];

module.exports = {
  module: {
    rules: [
      {
        test: /\.jsx?$/,
        include: ['src'],

        use: [
          {
            loader: '@atlassian/i18n-properties-loader',
            options: {
              i18nFiles: myI18nFiles,
            },
          },

          {
            loader: 'babel-loader',
          },
        ],
      },
    ],
  },
};

Options

  • i18nFiles list of paths to your *.properties files (required)
  • disabled disables the loader; can we used to disabled in production bundle (optional, default false)

Creating production bundle

The loader is required only in development mode. You should remember to disable it when you are creaing production bundle.

With webpack and its mode configuration you can intercept the currently selected mode inside your webpack configuration and disable the loader accoridngly:

// webpack.config.js

module.exports = (env, argv) => {
  const isDevelopmentMode = argv.mode === 'development'; // 1. Check if we are running webpack in "development" mode

  return {
    module: {
      rules: [
        {
          test: /\.jsx?$/,
          include: ['src'],

          use: [
            {
              loader: '@atlassian/i18n-properties-loader',
              options: {
                i18nFiles,
                disabled: !isDevelopmentMode, // 2. Skip and disable loader when webpack is running in "production" mode
              },
            },

            {
              loader: 'babel-loader',
            },
          ],
        },
      ],
    },
  };
};

React i18n helper

This package plays nice with the @atlassian/wrm-react-i18n when you want to use I18n.getText() translation helper with React components.

You can check the package description for more details and learn how to integrate it with your webpack configuration.

Minimum requirements

This plugin is compatible with:

  • webpack 4.0+ and 5.0+
  • Node 12+

changelog

Change Log

All notable changes to this project will be documented in this file. See Conventional Commits for commit guidelines.

1.0.16 (2025-05-29)

Note: Version bump only for package @atlassian/i18n-properties-loader

1.0.15 (2025-04-17)

Note: Version bump only for package @atlassian/i18n-properties-loader

1.0.14 (2024-11-19)

Reverts

  • Revert "chore: changelog linting and postrelease step" (9eb1420)

1.0.13 (2024-06-25)

Bug Fixes

  • soy-loader: SPFE-1067 - ensure soy-loader accepts webpack 4 as a peer dependency and add system-level tests for working with all supported webpack versions (3d8fe4e)

1.0.12 (2024-05-28)

Bug Fixes

1.0.11 (2024-05-13)

Note: Version bump only for package @atlassian/i18n-properties-loader

1.0.10 (2024-04-05)

Note: Version bump only for package @atlassian/i18n-properties-loader

1.0.9 (2022-02-10)

Note: Version bump only for package @atlassian/i18n-properties-loader

1.0.8 (2021-11-17)

Bug Fixes

  • Update webpack depndency (00fc73e)

1.0.7 (2021-10-26)

Note: Version bump only for package @atlassian/i18n-properties-loader

1.0.6 (2021-10-22)

Bug Fixes

  • ci: update webpack versions when running integration tests (009dd61)

1.0.5 (2021-10-14)

Note: Version bump only for package @atlassian/i18n-properties-loader

1.0.4 (2021-10-08)

Note: Version bump only for package @atlassian/i18n-properties-loader

1.0.3 (2021-09-24)

Note: Version bump only for package @atlassian/i18n-properties-loader

1.0.2 (2021-09-22)

  • Update internal dependencies

Bug Fixes

  • rename configuration passed to schema validation util (bb4b6a2)
  • release: fix release script for the wrm package (482efe2)

1.0.1 (2021-08-26)

Note: We updated internal dependencies

1.0.0 (2021-07-01)

⚠ BREAKING CHANGES

  • We removed support for Node 10. The minimum required version is Node 12 now.

Features

  • drop support for Node 10 (2ef1e83)

0.10.1 (2021-03-08)

Bug Fixes

  • deps: remove webpack cli dependency (c957fb3)
  • deps: SPFE-346 Update ajv to fix vulnerabilities (10cba18)
  • deps: update dependency schema-utils to v3 (ce193c2)
  • deps: Update Node version (1dadcca)

0.10.0 (2021-01-18)

  • feat: SPFE-275 Add support for webpack 5 to soy-loader (edc7190)

0.10.0-alpha.0 (2021-01-13)

  • feat: SPFE-268 Add support for webpack 5 (5a8b215)

0.9.0 (2020-06-25)

  • chore: mark the exported RegExp as internals (b487105)
  • chore: migrate soy-loader tests to jest (148dbef)
  • chore: run all tests with jest (bd4f4e2)
  • chore: update script commands (d717342)
  • fix(issue #4): add test cases that prove the quotations doesn't work well (1012d1b), closes #4
  • fix(issue #4): Fix the message quotation that was inconsistent with Java MessageFormat spec https:// (1572341)
  • chore: update dependencies (38f5a33)

0.8.0 (2020-05-11)

  • chore: Add note about minimal requirements (ee38cec)
  • chore: downgrade to Node version 10 (9fc7bab)
  • chore: Update minimal Node version to version 12 so we can support 'String.proptotype.matchall' (cb0ed25)

0.7.4 (2020-04-21)

Note: Version bump only for package @atlassian/i18n-properties-loader

0.7.3 (2020-02-07)

Bug Fixes

0.7.2 (2020-01-28)

Bug Fixes

0.7.1 (2020-01-27)

Note: Version bump only for package @atlassian/i18n-properties-loader

0.7.0 (2020-01-25)

Features

  • webpack: Add missing compatibility for native ESM and ts-loader (afa4a1f)

0.6.0 (2020-01-25)