1
0
Fork 0
freesewing/packages/i18n
2019-04-19 17:31:44 +02:00
..
src Merge pull request #8 from Kittycatou/patch-5 2019-04-19 08:14:37 +02:00
tests white_check_mark: Fixed tests after switching to named exports 2019-04-19 08:14:34 +02:00
.editorconfig tada: Initial commit 2019-04-19 08:14:33 +02:00
.gitignore tada: Initial commit 2019-04-19 08:14:33 +02:00
.npmignore tada: Initial commit 2019-04-19 08:14:33 +02:00
.travis.yml construction_worker: Added travis config file and coverage 2019-04-19 08:14:33 +02:00
LICENSE Initial commit 2019-04-19 08:14:33 +02:00
package.json 🔧 Centrally confifured package and rollup files 2019-04-19 17:31:44 +02:00
README.md sparkles: Last strings for editor (for now) 2019-04-19 08:14:35 +02:00
rollup.config.js 🔧 Centrally confifured package and rollup files 2019-04-19 17:31:44 +02:00
rollup.js sparkles: More strings (what else?) 2019-04-19 08:14:35 +02:00
sort.sh recycle: Splitted plugin translations in patterns and plugins 2019-04-19 08:14:35 +02:00

Freesewing logo

 freesewing
a library for made-to-measure sewing patterns

Travis build Version License Code coverage Chat on Gitter Become a Patron

i18n

These are the translation files for the Freesewing project.

We currently provide translation in 5 languages:

  • English
  • German
  • Spanish
  • French
  • Dutch

Install

npm install --save @freesewing/i18n

How to use these translations

We use these translations in our website repository to translate react components with react-intl:

import { strings } from "@freesewing/i18n";
import { IntlProvider } from "react-intl";

class Base extends React.Component {
  render() {
    const { language } = this.props;

    return (
      <IntlProvider locale={language} messages={strings[language]}>
        {...children}
      </IntlProvier>
    )
  }
}

Now all components below will be able to translate messages:

import React from "react";
import { FormattedMessage } from "react-intl";

const Example = props => {
  return <p><FormattedMessage id={"app.aboutFreesewing"} /></p>
};

export default Example;

For all details, please refer to the react-intl documentation.

We also use it in our backend repository to translate the emails we send out to users.