nunjucks-i18n

Nunjucks i18n extension

Apache 2 2 个版本
安装
npm install nunjucks-i18n
yarn add nunjucks-i18n
pnpm add nunjucks-i18n
bun add nunjucks-i18n
README

Nunjucks i18n

Build Status NPM version

Nunjucks extension to translate templates.

How to install it?

$ npm install nunjucks-i18n

How to use it?

var I18nExtension = require("nunjucks-i18n")(nunjucks);

env.addExtension('I18nExtension', new I18nExtension({
	env: env,
	translations: {
		fr: {
			HELLOWORLD: "Bonjour __name__"
		}
	}
}));

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.

版本列表
2.0.0 2015-05-28
1.0.0 2015-01-23