A dead simple babel-plugin
for translating texts in React applications.
Input
<Header>
t`Hello ${name}!`
</Header>
Output
<Header>
`Xin chào ${name} 🤣!`
</Header>
- 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.
Via .babelrc
{
"plugins": [
["tagged-translations", {
"translation": "./translation.json",
"tagName": "t"
}]
]
}
-
translation
: the location of translation json. -
tagName
: translation tag name. Default:t
.
- We don't cover 100% cases: don't support
\n
characters.