rollup-plugin-i18n
Embed your localized text into your bundle.
How to use
In your source code, for example if you have a key called 'msg_hello', to translate it use __('msg_hello')
Config
; entry: 'index.js' plugins:
// index.js console;
Output
Hello World!
Options
language: {[key:string]: string}
: an object that map from a string key to the localized message
Limitations
Currently we are using a regex to replace all instances of __(<msg>)
with their translation. In the future if rollup decides to open up access to the AST we can do a better job of replacement.