1.0.1 • Published 5 years ago

twing-translation v1.0.1

Weekly downloads
2
License
MIT
Repository
github
Last release
5 years ago

Twig Translation Filter Extension

Usage

Twig:

{{ 'test[0]'|t }}
{{ 'test[1]'|t(12, 'London Zoo') }}

Js:

// ...

let TwingTranslationExtension = require('twing-translation')

// Use similar structure:
let strings = {
	en: {
		test: [
			'Hello',
			'There are %d monkeys in the %s'
		]
	},
	ru: {
		test: [
			'Привет',
			'%d обезьян в %s'
		]
	}
}

twing.addExtension(
	new TwingTranslationExtension(strings, 'ru') // Can receive promises!
)

// ...
// Use twing context.language to change language

Result:

Привет
12 обезьян в London Zoo
1.0.1

5 years ago

1.0.0

5 years ago