1.0.0 • Published 7 years ago
babel-plugin-tagged-translations v1.0.0
tagged-translations
A dead simple babel-plugin
for translating texts in React applications.
Input
<Header>
{t`Hello ${name}!`}
</Header>
Output
<Header>
{`Xin chào ${name} 🤣!`}
</Header>
Features
- Build time translation: build app with minimal footprint.
- Based on ES6 tagged template literals: really helpful for readability/ maintaination/ integrations.
- Translations are configured in a JSON file.
Usage
Via .babelrc
{
"plugins": [
["tagged-translations", {
"translation": "./translation.json",
"tagName": "t"
}]
]
}
translation
: the location of translation json.tagName
: translation tag name. Default:t
.
Notes
- We don't cover 100% cases: don't support
\n
characters.