Nunjucks i18n
Nunjucks extension to translate templates.
How to install it?
$ npm install nunjucks-i18n
How to use it?
var I18nExtension = nunjucks; env;
Block:
{% i18n 'HELLOWORLD' __name__=name %}Hello __name__{% endi18n %}
Filter:
{{ "Hello __name__"|i18n('HELLOWORLD', __name__=name) }}
The language is detected by default from the __locale__
variable, the name if the variable can be changed using the locale
option.