1.0.4 • Published 4 years ago

translate-maker-loader v1.0.4

Weekly downloads
8
License
MIT
Repository
github
Last release
4 years ago

Locale Modules

A Locale Module is a translation file in which all properties and translations are scoped locally by default.

/* ./locale/en_US.js */
export default {
  button: {
    next: 'Next'
  }
}
/* ./locale/sk_SK.js */
export default {
  button: {
    next: 'Dalej'
  }
}
/* ./Example.jsx  */
import React, { Component } from 'react';
import Translate from 'react-translate-maker';
import locale from './locale';

export default class Example extends Component {
  render() {
    return (
      <Translate path={locale.button.next} defaultValue="Next" />
    );
  }
}

Naming

For local path camelCase naming is recommended, but not enforced.

Why?

modular and reusable translations

  • No more conflicts
  • Explicit dependencies
  • No global scope
  • Automatic extraction of the translations

Implementation

The main idea is very similar to CSS Modules. We already implemented webpack plugin for the locales modules named translate-maker-loader which you are able to use on the server too with the babel-plugin-webpack-loaders. This loader also contains locale extractor (plugin). This plugin will extract all translations into the locale files. You can load this files with the adapter of the translate-maker available for the React too react-translate-maker.

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

5 years ago

1.0.1

5 years ago

0.2.23

7 years ago

0.2.22

7 years ago

0.2.21

7 years ago

0.2.20

7 years ago

0.2.19

7 years ago

0.2.18

7 years ago

0.2.17

7 years ago

0.2.16

8 years ago

0.2.15

8 years ago

0.2.14

8 years ago

0.2.13

8 years ago

0.2.11

8 years ago

0.2.10

8 years ago

0.2.9

8 years ago

0.2.8

8 years ago

0.2.6

8 years ago

0.2.5

8 years ago

0.2.4

8 years ago

0.2.3

8 years ago

0.2.2

8 years ago

0.1.17

8 years ago

0.1.16

8 years ago

0.1.15

8 years ago

0.1.14

8 years ago

0.1.13

8 years ago

0.1.11

8 years ago

0.1.10

8 years ago

0.1.9

8 years ago

0.1.8

8 years ago

0.1.7

8 years ago

0.1.6

8 years ago

0.1.4

8 years ago

0.1.3

8 years ago

0.1.2

8 years ago

0.1.1

8 years ago