motor plugin i18n
npm install @motorjs/plugin-i18nbash
yarn add @motorjs/plugin-html
`using npm
`bash
npm i -S @motorjs/plugin-html
`Usage
`js
const motor = require('@motorjs/engine')
const I18n = require('@motorjs/plugin-i18n')const motorConfig = {
templatesDir : path.resolve('templates'),
outputDir : path.resolve('output'),
viewsDir : path.resolve('views'),
plugins: [
new I18n({
translations: {
en: require('./i18n/en.json'),
de: require('./i18n/de.json')
}
}),
// other plugins
]
}
motor(motorConfig)
`this plugin will add
__ and __l to the context of the page*
__ is an alias of malal
* __l is used to change the link path according to the current page language and country`js
// lang >> en
// country >> gb
__l('/de-de/shop') // >> /en-gb/shop
``