mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
* Remove i18next and i18next-express-middleware * Update i18next-node-fs and i18next-printf-postprocessor to use bundled i18next typings. * Update i18next-ko
43 lines
1.0 KiB
TypeScript
43 lines
1.0 KiB
TypeScript
import * as i18next from "i18next";
|
|
import * as Backend from "i18next-node-fs-backend";
|
|
|
|
var options = {
|
|
backend: {
|
|
// path where resources get loaded from
|
|
loadPath: "/locales/{{lng}}/{{ns}}.json",
|
|
|
|
// path to post missing resources
|
|
addPath: "/locales/{{lng}}/{{ns}}.missing.json",
|
|
|
|
// jsonIndent to use when storing json files
|
|
jsonIndent: 2
|
|
}
|
|
};
|
|
|
|
i18next.use(Backend).init(options);
|
|
i18next.use(Backend).init({ backend: options.backend });
|
|
|
|
var parseOptions = {
|
|
backend: {
|
|
// path where resources get loaded from
|
|
loadPath: "/locales/{{lng}}/{{ns}}.json",
|
|
|
|
// path to post missing resources
|
|
addPath: "/locales/{{lng}}/{{ns}}.missing.json",
|
|
|
|
// jsonIndent to use when storing json files
|
|
jsonIndent: 2,
|
|
|
|
parse: (data: any) => {
|
|
return data;
|
|
},
|
|
}
|
|
};
|
|
|
|
i18next.use(Backend).init({ backend: parseOptions });
|
|
|
|
var backend = new Backend(null, options.backend);
|
|
|
|
backend = new Backend();
|
|
backend.init(i18next.services, options.backend);
|