Skip to content

Commit

Permalink
document: .i18nrc is conf file, not .babelrc (#10)
Browse files Browse the repository at this point in the history
* document: .i18nrc is conf file, not .babelrc

Extracting msgids fails if no .i18nrc file is provided

* Remove extra/gettext wrapping
  • Loading branch information
TimKam authored and jfschwarz committed Mar 3, 2017
1 parent 889a555 commit 9ec659d
Showing 1 changed file with 11 additions and 15 deletions.
26 changes: 11 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,34 +18,30 @@ npm install --save signavio-i18n

## Setup

Add the configuration for gettext message extraction to your `.babelrc`:
Add a section like the following to your `packages.json`:

```json
{
"extra": {
"gettext": {
"headers": "<POT_HEADERS>",
"fileName": "<PATH_TO_POT>",
"baseDirectory": "<PATH_TO_BASEDIR>"
}
"scripts": {
"i18n-init": "cd src/locales && msginit --no-translator --input messages.pot --locale",
"i18n": "i18n-extract \"src/**/*.js\" src/locales/messages.pot && i18n-merge src/locales/messages.pot src/locales/*.po"
}
}
```

All available options are documented here: https://github.com/getsentry/babel-gettext-extractor


Add a section like the following to the `packages.json`:
Create the file `.i18nrc` and add a configuration object for gettext message extraction:

```json
{
"scripts": {
"i18n-init": "cd src/locales && msginit --no-translator --input messages.pot --locale",
"i18n": "i18n-extract \"src/**/*.js\" src/locales/messages.pot && i18n-merge src/locales/messages.pot src/locales/*.po"
}
"headers": "<POT_HEADERS>",
"fileName": "<PATH_TO_POT>",
"baseDirectory": "<PATH_TO_BASEDIR>"
}
```

All available options are documented here: https://github.com/getsentry/babel-gettext-extractor


## Usage

Add the translations to the PO files, and initialize the i18n module in your application using the `init` function:
Expand Down

0 comments on commit 9ec659d

Please sign in to comment.