i18n-keyless-react 1.7.3 → 1.7.5

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.
@@ -1,11 +1,32 @@
1
1
  import React from "react";
2
2
  import { TranslationOptions } from "i18n-keyless-core";
3
- interface I18nKeylessTextProps {
3
+ export interface I18nKeylessTextProps {
4
+ /**
5
+ * children must be a string
6
+ * it's the text to translate from your primary language
7
+ */
4
8
  children: string;
9
+ /**
10
+ * the keys to replace in the text
11
+ * it's an object where the key is the placeholder and the value is the replacement
12
+ * example: { "{{name}}": "John" } will replace all the {{name}} in the text with "John"
13
+ * RegEx is `key.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"))` so you can use use your own syntax
14
+ */
5
15
  replace?: Record<string, string>;
16
+ /**
17
+ * the context of the translation
18
+ * it's useful for ambiguous translations, like "8 heures" in French could be "8 AM" or "8 hours"
19
+ */
6
20
  context?: string;
21
+ /**
22
+ * if true, some helpful logs will be displayed in the console
23
+ */
7
24
  debug?: boolean;
25
+ /**
26
+ * if true, the translation will be saved as temporary
27
+ * it's useful if you want to use the translation in a different context
28
+ * you can leave it there forever, or remove it once your translation is saved
29
+ */
8
30
  forceTemporary?: TranslationOptions["forceTemporary"];
9
31
  }
10
32
  export declare const I18nKeylessText: React.FC<I18nKeylessTextProps>;
11
- export {};
package/dist/index.d.ts CHANGED
@@ -1,2 +1,3 @@
1
1
  export { I18nKeylessText } from "./I18nKeylessText";
2
2
  export { init, getTranslation, setCurrentLanguage, useCurrentLanguage, clearI18nKeylessStorage, fetchAllTranslations, } from "./store";
3
+ export type { I18nKeylessTextProps } from "./I18nKeylessText";
package/dist/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "i18n-keyless-react",
3
3
  "private": false,
4
- "version": "1.7.3",
4
+ "version": "1.7.5",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
7
7
  "module": "./dist/index.js",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "i18n-keyless-react",
3
3
  "private": false,
4
- "version": "1.7.3",
4
+ "version": "1.7.5",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
7
7
  "module": "./dist/index.js",