0.0.2 • Published 1 year ago

project-fluent-loader v0.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

project-fluent-loader

This loader is for webpack and loads translation files for project Fluent. It have very simple and naive realization, but works well.

Installation

Via npm:

npm install --save @fluent/bundle project-fluent-loader

Via yarn:

yarn add @fluent/bundle project-fluent-loader

Configuration

default extension for project-fluent files is .ftl. I recommend to use it. In this case we need to add only loader to webpack config to work with this kind of files:

/** @file webpack.config.js */

module.exports = {
  module: {
    rules: [
      {
        test: /\.ftl$/,
        loader: 'project-fluent-loader'
      }
    ]
  }
};

Usage

Importing file returns default instanced of FluentResource from @fluent/bundle:

/** @file translation.ts */
import enGB from './en-GB.ftl';

export const l10n = new ReactLocalization();
l10n.addBundle(enGB);

Typings

Just add "project-fluent-loader" to #compilerOptions.lib array in your tsconfig.json config:

{
  "compilerOptions": {
    "lib": [
      "project-fluent-loader"
    ]
  }
}

Or if you prefer to use different file format use declaration from this file.

0.0.2

1 year ago

0.0.1-b

1 year ago

0.0.1

1 year ago

0.0.1-a

1 year ago