generaltranslation 3.3.3 → 4.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,2 +1,2 @@
1
- import t from"xxhashjs";function r(r){return t.h64().update(r).digest().toString(16)}export{r as hashString};
1
+ var e="en-US",t="generaltranslation.locale",n=["singular","plural","dual","zero","one","two","few","many","other"],r="https://cache.gtx.dev",a="https://prod.gtx.dev";function l(e){return n.includes(e)}export{a as defaultAPIURL,r as defaultCacheURL,l as isAcceptedPluralForm,e as libraryDefaultLocale,t as localeCookieName,n as pluralForms};
2
2
  //# sourceMappingURL=internal.esm.min.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"internal.esm.min.mjs","sources":["../src/internal.ts"],"sourcesContent":["// Functions provided to other GT libraries\n\nimport XXH from 'xxhashjs';\n\n/**\n * Calculates a unique hash for a given string using xxhash.\n * \n * @param {string} string - The string to be hashed.\n * @returns {string} - The resulting hash as a hexadecimal string.\n */\nexport function hashString(string: string): string {\n return XXH.h64().update(string).digest().toString(16);\n}\n"],"names":["hashString","string","XXH","h64","update","digest","toString"],"mappings":"wBAUM,SAAUA,EAAWC,GACvB,OAAOC,EAAIC,MAAMC,OAAOH,GAAQI,SAASC,SAAS,GACtD"}
1
+ {"version":3,"file":"internal.esm.min.mjs","sources":["../src/internal.ts"],"sourcesContent":["export const libraryDefaultLocale = \"en-US\" as const;\nexport const localeCookieName = \"generaltranslation.locale\" as const;\nexport const pluralForms = [\"singular\", \"plural\", \"dual\", \"zero\", \"one\", \"two\", \"few\", \"many\", \"other\"] as const;\nexport const defaultCacheURL = \"https://cache.gtx.dev\" as const;\nexport const defaultAPIURL = \"https://prod.gtx.dev\" as const;\nexport function isAcceptedPluralForm(\n form: string\n ): form is (typeof pluralForms)[number] {\n return pluralForms.includes(form as (typeof pluralForms)[number]);\n}"],"names":["libraryDefaultLocale","localeCookieName","pluralForms","defaultCacheURL","defaultAPIURL","isAcceptedPluralForm","form","includes"],"mappings":"AAAO,IAAMA,EAAuB,QACvBC,EAAmB,4BACnBC,EAAc,CAAC,WAAY,SAAU,OAAQ,OAAQ,MAAO,MAAO,MAAO,OAAQ,SAClFC,EAAkB,wBAClBC,EAAgB,uBACvB,SAAUC,EACZC,GAEA,OAAOJ,EAAYK,SAASD,EAChC"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export declare const defaultEmoji = "\uD83C\uDF0D";
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -3,6 +3,6 @@ declare const defaultAPIRoutes: {
3
3
  readonly translateReact: "/v1/translate/react";
4
4
  readonly translateContent: "/v1/translate/content";
5
5
  readonly updateProjectDictionary: "/v1/project/dictionary/update";
6
- readonly getProjectLanguages: "/v1/project/languages";
6
+ readonly getProjectLocales: "/v1/project/locales";
7
7
  };
8
8
  export default defaultAPIRoutes;
@@ -1,2 +1,2 @@
1
- declare const libraryDefaultLanguage = "en";
1
+ declare const libraryDefaultLanguage = "en-US";
2
2
  export default libraryDefaultLanguage;
@@ -0,0 +1,2 @@
1
+ declare const libraryDefaultLocale = "en-US";
2
+ export default libraryDefaultLocale;
@@ -33,28 +33,28 @@ export type Request = {
33
33
  type: 'string';
34
34
  data: {
35
35
  content: Content;
36
- targetLanguage: string;
36
+ targetLocale: string;
37
37
  metadata: Record<string, any>;
38
38
  };
39
39
  } | {
40
40
  type: 'react';
41
41
  data: {
42
42
  children: any;
43
- targetLanguage: string;
43
+ targetLocale: string;
44
44
  metadata: Record<string, any>;
45
45
  };
46
46
  };
47
47
  export type ContentTranslationResult = {
48
48
  translation: Content;
49
- language: string;
49
+ locale: string;
50
50
  reference?: {
51
51
  id: string;
52
52
  key: string;
53
53
  };
54
54
  };
55
55
  export type ReactTranslationResult = {
56
- translation: Content;
57
- language: string;
56
+ translation: ReactChildrenAsObject;
57
+ locale: string;
58
58
  reference?: {
59
59
  id: string;
60
60
  key: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "generaltranslation",
3
- "version": "3.3.3",
3
+ "version": "4.0.0",
4
4
  "description": "A language toolkit for AI developers",
5
5
  "main": "dist/index.cjs.min.cjs",
6
6
  "module": "dist/index.esm.min.mjs",
@@ -21,6 +21,7 @@
21
21
  "internationalization",
22
22
  "localization",
23
23
  "translate",
24
+ "locale",
24
25
  "i18n",
25
26
  "toolkit"
26
27
  ],
@@ -53,6 +54,11 @@
53
54
  "require": "./dist/index.cjs.min.cjs",
54
55
  "import": "./dist/index.esm.min.mjs"
55
56
  },
57
+ "./id": {
58
+ "types": "./dist/id.d.ts",
59
+ "require": "./dist/id.cjs.min.cjs",
60
+ "import": "./dist/id.esm.min.mjs"
61
+ },
56
62
  "./internal": {
57
63
  "types": "./dist/internal.d.ts",
58
64
  "require": "./dist/internal.cjs.min.cjs",
@@ -63,6 +69,9 @@
63
69
  "*": {
64
70
  "internal": [
65
71
  "./dist/internal.d.ts"
72
+ ],
73
+ "id": [
74
+ "./dist/id.d.ts"
66
75
  ]
67
76
  }
68
77
  },
@@ -71,6 +80,9 @@
71
80
  "paths": {
72
81
  "generaltranslation/internal": [
73
82
  "/dist/internal"
83
+ ],
84
+ "generaltranslation/id": [
85
+ "/dist/id"
74
86
  ]
75
87
  }
76
88
  }