3.3.3 • Published 6 years ago
@motorjs/plugin-i18n v3.3.3
Motor plugin-html
Installation
using yarn
yarn add @motorjs/plugin-htmlusing npm
npm i -S @motorjs/plugin-htmlUsage
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
- __lis used to change the link path according to the current page language and country
// lang >> en
// country >> gb
__l('/de-de/shop')  // >> /en-gb/shop