Skip to content

Commit

Permalink
allowMultiLoading not needed anymore
Browse files Browse the repository at this point in the history
  • Loading branch information
adrai committed Jul 4, 2023
1 parent 7f2d2c7 commit 68d84ff
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 22 deletions.
28 changes: 13 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,28 +93,26 @@ for plain browser:
// the function might return a promise
// returning falsy will abort the download
//
// If allowMultiLoading is false, lngs and namespaces will have only one element each,
// If allowMultiLoading is true, lngs and namespaces can have multiple elements
// If not used with i18next-multiload-backend-adapter, lngs and namespaces will have only one element each,
// If used with i18next-multiload-backend-adapter, lngs and namespaces can have multiple elements
// and also your server needs to support multiloading
// /locales/resources.json?lng=de+en&ns=ns1+ns2
// Adapter is needed to enable MultiLoading https://github.com/i18next/i18next-multiload-backend-adapter
// Returned JSON structure in this case is
// {
// lang : {
// namespaceA: {},
// namespaceB: {},
// ...etc
// }
// }
loadPath: '/locales/{{lng}}/{{ns}}.json',

// path to post missing resources, or a function
// function(lng, namespace) { return customPath; }
// the returned path will interpolate lng, ns if provided like giving a static path
addPath: '/locales/add/{{lng}}/{{ns}}',

// your backend server supports multiloading
// /locales/resources.json?lng=de+en&ns=ns1+ns2
// Adapter is needed to enable MultiLoading https://github.com/i18next/i18next-multiload-backend-adapter
// Returned JSON structure in this case is
// {
// lang : {
// namespaceA: {},
// namespaceB: {},
// ...etc
// }
// }
allowMultiLoading: false, // set loadPath: '/locales/resources.json?lng={{lng}}&ns={{ns}}' to adapt to multiLoading

// parse data after it has been fetched
// in example use https://www.npmjs.com/package/json5
// here it removes the letter a from the json (bad idea)
Expand Down
6 changes: 0 additions & 6 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,6 @@ export interface HttpBackendOptions {
* function(lng, namespace) { return customPath; }
*/
addPath?: AddPathOption;
/**
* your backend server supports multiLoading
* locales/resources.json?lng=de+en&ns=ns1+ns2
* set loadPath: '/locales/resources.json?lng={{lng}}&ns={{ns}}' to adapt to multiLoading
*/
allowMultiLoading?: boolean;
/**
* parse data after it has been fetched
* in example use https://www.npmjs.com/package/json5
Expand Down
1 change: 0 additions & 1 deletion lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ const getDefaults = () => {
return {
loadPath: '/locales/{{lng}}/{{ns}}.json',
addPath: '/locales/add/{{lng}}/{{ns}}',
allowMultiLoading: false,
parse: data => JSON.parse(data),
stringify: JSON.stringify,
parsePayload: (namespace, key, fallbackValue) => ({ [key]: fallbackValue || '' }),
Expand Down

0 comments on commit 68d84ff

Please sign in to comment.