Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pavelivanov/babel-plugin-rintlmg
Babel plugin to transform compact messages to react-intl format
https://github.com/pavelivanov/babel-plugin-rintlmg
Last synced: about 2 months ago
JSON representation
Babel plugin to transform compact messages to react-intl format
- Host: GitHub
- URL: https://github.com/pavelivanov/babel-plugin-rintlmg
- Owner: pavelivanov
- Created: 2016-07-12T08:44:47.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2018-11-16T20:59:43.000Z (about 6 years ago)
- Last Synced: 2024-10-15T04:33:10.939Z (3 months ago)
- Language: JavaScript
- Homepage:
- Size: 22.5 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# babel-plugin-rintlmg
Babel plugin for transforming compact messages to `react-intl` (https://github.com/yahoo/react-intl) format### Usage
`.babelrc`
```
"plugins": [
[ "babel-plugin-rintlmg", { messages: true, indexedIds: true } ]
]
```### How it works
Plugin transforms following code:
```javascript
import { defineMessages } from 'react-intl'export default defineMessages({
string: {
en: 'String',
es: 'Cuerda',
},
withChildren: {
title: {
en: 'Nested title',
es: 'Título anidado',
}
}
})
```with plugin option `{ messages: true }` to
```javascript
import { defineMessages } from 'react-intl';export default defineMessages({
string: {
en: 'String',
es: 'Cuerda',
id: 'test.string'
},
withChildren: {
title: {
en: 'Nested title',
es: 'Título anidado',
id: 'test.withChildren.title'
}
}
});
```and without options to
```
import { defineMessages } from 'react-intl';export default defineMessages({
string: {
id: 'test.string'
},
withChildren: {
title: {
id: 'test.withChildren.title'
}
}
});
```