import createLocaleMiddleware from 'express-middleware-locale';
const locales = {
vi: {
key: {
code: "hello {{{name}}}"
}
}
};
// express
server.use(createLocaleMiddleware({
detect: (req, res, next) => req.headers['x-locale'] || 'en',
locales
}));
// translate
server.get('/', (req, res, next) => req.t('key.code', { name: 'world' }));
vuquangthinh/express-middleware-locale
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
Because i18next is stupid :))
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published