i18next-http-backend
Advanced tools
Comparing version 1.1.1 to 1.2.0
@@ -1,4 +0,6 @@ | ||
import { BackendModule, MultiReadCallback, ReadCallback } from 'i18next'; | ||
import { BackendModule, MultiReadCallback, ReadCallback } from "i18next"; | ||
type LoadPathOption = string | ((lngs: string[], namespaces: string[]) => string); | ||
type LoadPathOption = | ||
| string | ||
| ((lngs: string[], namespaces: string[]) => string); | ||
@@ -28,7 +30,15 @@ interface BackendOptions { | ||
*/ | ||
parse?(data: string, languages?: string | string[], namespaces?: string | string[]): string; | ||
parse?( | ||
data: string, | ||
languages?: string | string[], | ||
namespaces?: string | string[] | ||
): string; | ||
/** | ||
* parse data before it has been sent by addPath | ||
*/ | ||
parsePayload?(namespace: string, key: string, fallbackValue?: string): { [key: string]: any }; | ||
parsePayload?( | ||
namespace: string, | ||
key: string, | ||
fallbackValue?: string | ||
): { [key: string]: any }; | ||
/** | ||
@@ -50,3 +60,3 @@ * allow cross domain requests | ||
payload: {} | string, | ||
callback: RequestCallback, | ||
callback: RequestCallback | ||
): void; | ||
@@ -64,16 +74,37 @@ /** | ||
interface RequestResponse { | ||
status: number, | ||
data: string | ||
status: number; | ||
data: string; | ||
} | ||
export default class I18NextHttpBackend implements BackendModule<BackendOptions> { | ||
export default class I18NextHttpBackend | ||
implements BackendModule<BackendOptions> { | ||
constructor(services?: any, options?: BackendOptions); | ||
init(services?: any, options?: BackendOptions): void; | ||
readMulti?(languages: string[], namespaces: string[], callback: MultiReadCallback): void; | ||
readMulti?( | ||
languages: string[], | ||
namespaces: string[], | ||
callback: MultiReadCallback | ||
): void; | ||
read(language: string, namespace: string, callback: ReadCallback): void; | ||
loadUrl(url: string, callback: ReadCallback, languages?: string | string[], namespaces?: string | string[]): void; | ||
create?(languages: string | string[], namespace: string, key: string, fallbackValue: string): void; | ||
type: 'backend'; | ||
loadUrl( | ||
url: string, | ||
callback: ReadCallback, | ||
languages?: string | string[], | ||
namespaces?: string | string[] | ||
): void; | ||
create?( | ||
languages: string | string[], | ||
namespace: string, | ||
key: string, | ||
fallbackValue: string | ||
): void; | ||
type: "backend"; | ||
services: any; | ||
options: BackendOptions; | ||
} | ||
declare module "i18next" { | ||
interface PluginOptions { | ||
backend?: BackendOptions; | ||
} | ||
} |
{ | ||
"name": "i18next-http-backend", | ||
"version": "1.1.1", | ||
"version": "1.2.0", | ||
"private": false, | ||
@@ -39,3 +39,3 @@ "type": "module", | ||
"expect.js": "0.3.1", | ||
"i18next": "19.9.0", | ||
"i18next": "20.0.0", | ||
"json-server": "0.16.3", | ||
@@ -42,0 +42,0 @@ "json5": "2.2.0", |
@@ -14,2 +14,6 @@ # Introduction | ||
## Advice: | ||
If you don't want to manage your translation files manually or are simply looking for a better management solution, take a look at [i18next-locize-backend](https://github.com/locize/i18next-locize-backend). | ||
# Getting started | ||
@@ -16,0 +20,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
77215
1422
181