i18next 15.0.10 → 15.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/CHANGELOG.md +13 -1
  2. package/index.d.ts +136 -2
  3. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,4 +1,16 @@
1
- ### 15.0.10
1
+ ### 15.1.3
2
+
3
+ - typescript: Fix type error when init with locize plugin options [1248](https://github.com/i18next/i18next/pull/1248)
4
+
5
+ ### 15.1.2
6
+
7
+ - typescript: types(ReactOptions): Add missing props to React Options interface [1247](https://github.com/i18next/i18next/pull/1247)
8
+
9
+ ### 15.1.1
10
+
11
+ - typescript: Update BackendModule interface to allow null or undefined for the callback [1244](https://github.com/i18next/i18next/pull/1244)
12
+
13
+ ### 15.1.0
2
14
 
3
15
  - trigger a languageChanging event
4
16
 
package/index.d.ts CHANGED
@@ -151,6 +151,16 @@ declare namespace i18next {
151
151
  * @default undefined
152
152
  */
153
153
  hashTransKey?(defaultValue: TOptionsBase['defaultValue']): TOptionsBase['defaultValue'];
154
+ /**
155
+ * Convert eg. <br/> found in translations to a react component of type br
156
+ * @default true
157
+ */
158
+ transSupportBasicHtmlNodes?: boolean;
159
+ /**
160
+ * Which nodes not to convert in defaultValue generation in the Trans component.
161
+ * @default ['br', 'strong', 'i', 'p']
162
+ */
163
+ transKeepBasicHtmlNodesFor?: string[];
154
164
  }
155
165
 
156
166
  interface InitOptions {
@@ -407,6 +417,125 @@ declare namespace i18next {
407
417
  * @default 'v3'
408
418
  */
409
419
  compatibilityJSON?: 'v1' | 'v2' | 'v3';
420
+
421
+ /**
422
+ * Options for https://github.com/locize/locize-editor
423
+ * @default undefined
424
+ */
425
+ editor?: {
426
+ /**
427
+ * Enable on init without the need of adding querystring locize=true
428
+ * @default false
429
+ */
430
+ enabled?: boolean;
431
+ /**
432
+ * If set to false you will need to open the editor via API
433
+ * @default true
434
+ */
435
+ autoOpen?: boolean;
436
+
437
+ /**
438
+ * Enable by adding querystring locize=true; can be set to another value or turned off by setting to false
439
+ * @default 'locize'
440
+ */
441
+ enableByQS?: string | false;
442
+
443
+ /**
444
+ * Turn on/off by pressing key combination. Combine this with `toggleKeyCode`
445
+ * @default 'ctrlKey'
446
+ */
447
+ toggleKeyModifier?: 'ctrlKey' | 'metaKey' | 'altKey' | 'shiftKey';
448
+ /**
449
+ * Turn on/off by pressing key combination. Combine this with `toggleKeyModifier`
450
+ * @default 24 (x)
451
+ */
452
+ toggleKeyCode?: number;
453
+
454
+ /**
455
+ * Use lng in editor taken from query string, eg. if running with lng=cimode (i18next, locize)
456
+ * @default 'useLng'
457
+ */
458
+ lngOverrideQS?: string;
459
+
460
+ /**
461
+ * Use lng in editor, eg. if running with lng=cimode (i18next, locize)
462
+ * @default null
463
+ */
464
+ lngOverride?: string | null;
465
+
466
+ /**
467
+ * How the editor will open.
468
+ * Setting to window will open a new window/tab instead
469
+ * @default 'iframe'
470
+ */
471
+ mode?: 'iframe' | 'window';
472
+
473
+ /**
474
+ * Styles to adapt layout in iframe mode to your website layout.
475
+ * This will add a style to the `<iframe>`
476
+ * @default 'z-index: 2000; position: fixed; top: 0; right: 0; bottom: 0; width: 600px; box-shadow: -3px 0 5px 0 rgba(0,0,0,0.5);'
477
+ */
478
+ iframeContainerStyle?: string;
479
+ /**
480
+ * Styles to adapt layout in iframe mode to your website layout.
481
+ * This will add a style to the parent of `<iframe>`
482
+ * @default 'height: 100%; width: 600px; border: none;'
483
+ */
484
+ iframeStyle?: string;
485
+ /**
486
+ * Styles to adapt layout in iframe mode to your website layout.
487
+ * This will add a style to `<body>`
488
+ * @default 'margin-right: 605px;'
489
+ */
490
+ bodyStyle?: string;
491
+
492
+ /**
493
+ * Handle when locize saved the edited translations, eg. reload website
494
+ * @default noop
495
+ */
496
+ onEditorSaved?: (lng: null, ns: string | string[]) => void;
497
+ };
498
+
499
+ /**
500
+ * Options for https://github.com/locize/locize-lastused
501
+ * @default undefined
502
+ */
503
+ locizeLastUsed?: {
504
+ /**
505
+ * The id of your locize project
506
+ */
507
+ projectId: string;
508
+
509
+ /**
510
+ * An api key if you want to send missing keys
511
+ */
512
+ apiKey?: string;
513
+
514
+ /**
515
+ * The reference language of your project
516
+ * @default 'en'
517
+ */
518
+ referenceLng?: string;
519
+
520
+ /**
521
+ * Version
522
+ * @default 'latest'
523
+ */
524
+ version?: string;
525
+
526
+ /**
527
+ * Debounce interval to send data in milliseconds
528
+ * @default 90000
529
+ */
530
+ debounceSubmit?: number;
531
+
532
+ /**
533
+ * Hostnames that are allowed to send last used data.
534
+ * Please keep those to your local system, staging, test servers (not production)
535
+ * @default ['localhost']
536
+ */
537
+ allowedHosts?: string[];
538
+ };
410
539
  }
411
540
 
412
541
  interface TOptionsBase {
@@ -544,7 +673,7 @@ declare namespace i18next {
544
673
  read(
545
674
  language: string,
546
675
  namespace: string,
547
- callback: (err: Error, data: ResourceLanguage) => void,
676
+ callback: (err: Error | null | undefined, data: ResourceLanguage) => void,
548
677
  ): void;
549
678
  /** Save the missing translation */
550
679
  create(languages: string[], namespace: string, key: string, fallbackValue: string): void;
@@ -552,7 +681,7 @@ declare namespace i18next {
552
681
  readMulti?(
553
682
  languages: string[],
554
683
  namespaces: string[],
555
- callback: (err: Error, data: Resource) => void,
684
+ callback: (err: Error | null | undefined, data: Resource) => void,
556
685
  ): void;
557
686
  /** Store the translation. For backends acting as cache layer */
558
687
  save?(language: string, namespace: string, data: ResourceLanguage): void;
@@ -834,6 +963,11 @@ declare namespace i18next {
834
963
  * Is initialized
835
964
  */
836
965
  isInitialized: boolean;
966
+
967
+ /**
968
+ * Emit event
969
+ */
970
+ emit(eventName: string): void;
837
971
  }
838
972
  }
839
973
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "i18next",
3
- "version": "15.0.10",
3
+ "version": "15.1.3",
4
4
  "description": "i18next internationalization framework",
5
5
  "main": "./index.js",
6
6
  "types": "index.d.ts",