koa-i18n-2
I18n for koa, based on [i18n-2]. NOTE: If want to use koa-i18n-2, [koa-locale] must be required!
Differences with koa-i18n
koa-i18n-2 will attempt to find the best match from the supported locales, whereas koa-i18n will only find exact matches.
For example, if a user requests es-MX
and you support ['en-US', 'es-ES']
, koa-i18n will use en-US
, while koa-i18n-2 will use es-ES
.
Installation
$ npm install koa-i18n-2
Usage
var app = ;var locale = ; // detect the localevar render = ; // swig rendervar i18n = ; // Required!; appcontextrender = ; app; app; app;
Tip: We can change position of the elements in the
modes
array. If one mode finds a match, the modes after it will be ignored.
License
MIT