inital commit

This commit is contained in:
2026-01-01 15:25:19 +05:30
commit f0ae49465a
36361 changed files with 4894111 additions and 0 deletions

View File

@@ -0,0 +1,3 @@
import * as index from './index.js'
export default index.default

View File

@@ -0,0 +1,7 @@
import { BackendModule, Resource, ReadCallback, ResourceKey } from 'i18next'
type ImportFn<L, N> = ((language: L, namespace: N, callback: ReadCallback) => void) | ((language: L, namespace: N) => Promise<ResourceKey | boolean | null | undefined>)
declare function resourcesToBackend<L = string, N = string>(res: Resource | ImportFn<L, N>): BackendModule
export default resourcesToBackend

View File

@@ -0,0 +1,30 @@
var resourcesToBackend = function resourcesToBackend(res) {
return {
type: 'backend',
init: function init(services, backendOptions, i18nextOptions) {},
read: function read(language, namespace, callback) {
if (typeof res === 'function') {
if (res.length < 3) {
try {
var r = res(language, namespace);
if (r && typeof r.then === 'function') {
r.then(function (data) {
return callback(null, data && data.default || data);
}).catch(callback);
} else {
callback(null, r);
}
} catch (err) {
callback(err);
}
return;
}
res(language, namespace, callback);
return;
}
callback(null, res && res[language] && res[language][namespace]);
}
};
};
export { resourcesToBackend as default };