egg-i18next

[![NPM version][npm-image]][npm-url] [![build status][travis-image]][travis-url] [![Test coverage][codecov-image]][codecov-url] [![David deps][david-image]][david-url] [![Known Vulnerabilities][snyk-image]][snyk-url] [![npm download][download-image]][down

Usage no npm install needed!

<script type="module">
  import eggI18next from 'https://cdn.skypack.dev/egg-i18next';
</script>

README

egg-i18next

NPM version build status Test coverage David deps Known Vulnerabilities npm download

Install

$ npm i egg-i18next --save

Usage

// {app_root}/config/plugin.js
exports.i18next = {
  enable: true,
  package: 'egg-i18next',
};

Configuration

// {app_root}/config/config.default.js
exports.i18next = {
  queryField: 'locale',
  cookieField: 'locale',
  cookieMaxAge: 365 * 24 * 60 * 60 * 1000, // 1 year
  loadPath: '/config/locale/{{lng}}.yml',
  init: { // initialization config for i18next, refer to https://www.i18next.com/configuration-options.html for more details.
    fallbackLng: 'en-US',
  },
};

see config/config.default.js for more detail.

Example

Questions & Suggestions

Please open an issue here.

License

MIT