generaltranslation 5.0.0 → 5.0.2
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.
- package/dist/api/batch/_translateBatch.d.ts +1 -0
- package/dist/api/batch/translateBatch.d.ts +1 -0
- package/dist/api/jsx/_translateJsx.d.ts +1 -0
- package/dist/api/jsx/translateJsx.d.ts +1 -0
- package/dist/api/translate/_translate.d.ts +1 -0
- package/dist/api/translate/translate.d.ts +1 -0
- package/dist/client/_translateBatchFromClient.d.ts +10 -0
- package/dist/client/_translateFromClient.d.ts +10 -0
- package/dist/index.cjs.min.cjs +1 -1
- package/dist/index.cjs.min.cjs.map +1 -1
- package/dist/index.d.ts +18 -47
- package/dist/index.esm.min.mjs +1 -1
- package/dist/index.esm.min.mjs.map +1 -1
- package/dist/internal.cjs.min.cjs +1 -1
- package/dist/internal.cjs.min.cjs.map +1 -1
- package/dist/internal.d.ts +5 -3
- package/dist/internal.esm.min.mjs +1 -1
- package/dist/internal.esm.min.mjs.map +1 -1
- package/dist/locales/determineLocale.d.ts +1 -0
- package/dist/locales/getLocaleDirection.d.ts +1 -0
- package/dist/locales/getLocaleEmoji.d.ts +1 -0
- package/dist/locales/getLocaleName.d.ts +1 -0
- package/dist/locales/getLocaleProperties.d.ts +1 -0
- package/dist/locales/isSameLanguage.d.ts +1 -0
- package/dist/locales/isValidLocale.d.ts +1 -0
- package/dist/locales/requiresTranslation.d.ts +1 -0
- package/dist/projects/getProjectLocales.d.ts +1 -0
- package/dist/projects/updateProjectTranslations.d.ts +1 -0
- package/dist/settings/{defaultUrls.d.ts → _defaultUrls.d.ts} +0 -1
- package/dist/settings/defaultURLs.d.ts +5 -0
- package/dist/settings/settings.d.ts +0 -2
- package/dist/settings/settingsUrls.d.ts +8 -0
- package/dist/translation/batch/_translateBatchFromClient.d.ts +2 -2
- package/dist/types.d.ts +12 -4
- package/package.json +1 -1
- package/dist/translation/batch/_translateJsxBatchFromClient.d.ts +0 -5
- package/dist/types/types.d.ts +0 -63
package/dist/internal.d.ts
CHANGED
@@ -1,9 +1,11 @@
|
|
1
|
+
declare const defaultCacheUrl: "https://cdn.gtx.dev";
|
2
|
+
declare const defaultBaseUrl: "https://api.gtx.dev";
|
3
|
+
declare const defaultRuntimeApiUrl: "https://runtime.gtx.dev";
|
4
|
+
|
1
5
|
declare const libraryDefaultLocale: "en-US";
|
2
6
|
declare const localeCookieName: "generaltranslation.locale";
|
3
7
|
declare const pluralForms: readonly ["singular", "plural", "dual", "zero", "one", "two", "few", "many", "other"];
|
4
|
-
declare const defaultCacheUrl: "https://cache.gtx.dev";
|
5
|
-
declare const defaultBaseUrl: "https://prod.gtx.dev";
|
6
8
|
declare const localeHeaderName = "x-generaltranslation-locale";
|
7
9
|
declare function isAcceptedPluralForm(form: string): form is (typeof pluralForms)[number];
|
8
10
|
|
9
|
-
export { defaultBaseUrl, defaultCacheUrl, isAcceptedPluralForm, libraryDefaultLocale, localeCookieName, localeHeaderName, pluralForms };
|
11
|
+
export { defaultBaseUrl, defaultCacheUrl, defaultRuntimeApiUrl, isAcceptedPluralForm, libraryDefaultLocale, localeCookieName, localeHeaderName, pluralForms };
|
@@ -1,2 +1,2 @@
|
|
1
|
-
var e="en-US",
|
1
|
+
var t="https://cdn.gtx.dev",e="https://api.gtx.dev",n="https://runtime.gtx.dev",a="en-US",l="generaltranslation.locale",r=["singular","plural","dual","zero","one","two","few","many","other"],o="x-generaltranslation-locale";function i(t){return r.includes(t)}export{e as defaultBaseUrl,t as defaultCacheUrl,n as defaultRuntimeApiUrl,i as isAcceptedPluralForm,a as libraryDefaultLocale,l as localeCookieName,o as localeHeaderName,r as pluralForms};
|
2
2
|
//# sourceMappingURL=internal.esm.min.mjs.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"internal.esm.min.mjs","sources":["../src/settings/settings.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
|
1
|
+
{"version":3,"file":"internal.esm.min.mjs","sources":["../src/settings/settingsUrls.ts","../src/settings/settings.ts"],"sourcesContent":["export const defaultCacheUrl = \"https://cdn.gtx.dev\" as const;\nexport const defaultBaseUrl = \"https://api.gtx.dev\" as const;\nexport const defaultRuntimeApiUrl = \"https://runtime.gtx.dev\" as const;\nexport const translateBatchUrl = \"/v1/translate/batch\" as const;\nexport const translateJsxUrl = \"/v1/translate/react\" as const;\nexport const translateContentUrl = \"/v1/translate/content\" as const;\nexport const updateProjectTranslationsUrl = \"/v1/project/translations/update\" as const;\nexport const getProjectLocalesUrl = \"/v1/project/locales\" as const;","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 localeHeaderName = \"x-generaltranslation-locale\";\nexport const maxTimeout = 60000;\nexport function isAcceptedPluralForm(\n form: string\n ): form is (typeof pluralForms)[number] {\n return pluralForms.includes(form as (typeof pluralForms)[number]);\n}"],"names":["defaultCacheUrl","defaultBaseUrl","defaultRuntimeApiUrl","libraryDefaultLocale","localeCookieName","pluralForms","localeHeaderName","isAcceptedPluralForm","form","includes"],"mappings":"AAAO,IAAMA,EAAkB,sBAClBC,EAAiB,sBACjBC,EAAuB,0BCFvBC,EAAuB,QACvBC,EAAmB,4BACnBC,EAAc,CAAC,WAAY,SAAU,OAAQ,OAAQ,MAAO,MAAO,MAAO,OAAQ,SAClFC,EAAmB,8BAE1B,SAAUC,EACZC,GAEA,OAAOH,EAAYI,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 {};
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -3,4 +3,3 @@ export declare const translateJsxUrl: "/v1/translate/react";
|
|
3
3
|
export declare const translateContentUrl: "/v1/translate/content";
|
4
4
|
export declare const updateProjectTranslationsUrl: "/v1/project/translations/update";
|
5
5
|
export declare const getProjectLocalesUrl: "/v1/project/locales";
|
6
|
-
export declare const _translateJsxBatchFromClientUrl: "/v1/translate/client/batch";
|
@@ -0,0 +1,5 @@
|
|
1
|
+
export declare const translateBatchUrl: "/v1/translate/batch";
|
2
|
+
export declare const translateJsxUrl: "/v1/translate/react";
|
3
|
+
export declare const translateContentUrl: "/v1/translate/content";
|
4
|
+
export declare const updateProjectTranslationsUrl: "/v1/project/translations/update";
|
5
|
+
export declare const getProjectLocalesUrl: "/v1/project/locales";
|
@@ -1,8 +1,6 @@
|
|
1
1
|
export declare const libraryDefaultLocale: "en-US";
|
2
2
|
export declare const localeCookieName: "generaltranslation.locale";
|
3
3
|
export declare const pluralForms: readonly ["singular", "plural", "dual", "zero", "one", "two", "few", "many", "other"];
|
4
|
-
export declare const defaultCacheUrl: "https://cache.gtx.dev";
|
5
|
-
export declare const defaultBaseUrl: "https://prod.gtx.dev";
|
6
4
|
export declare const localeHeaderName = "x-generaltranslation-locale";
|
7
5
|
export declare const maxTimeout = 60000;
|
8
6
|
export declare function isAcceptedPluralForm(form: string): form is (typeof pluralForms)[number];
|
@@ -0,0 +1,8 @@
|
|
1
|
+
export declare const defaultCacheUrl: "https://cdn.gtx.dev";
|
2
|
+
export declare const defaultBaseUrl: "https://api.gtx.dev";
|
3
|
+
export declare const defaultRuntimeApiUrl: "https://runtime.gtx.dev";
|
4
|
+
export declare const translateBatchUrl: "/v1/translate/batch";
|
5
|
+
export declare const translateJsxUrl: "/v1/translate/react";
|
6
|
+
export declare const translateContentUrl: "/v1/translate/content";
|
7
|
+
export declare const updateProjectTranslationsUrl: "/v1/project/translations/update";
|
8
|
+
export declare const getProjectLocalesUrl: "/v1/project/locales";
|
@@ -1,8 +1,8 @@
|
|
1
|
-
import { ContentTranslationResult, JsxTranslationResult, Request } from '../../types';
|
1
|
+
import { ContentTranslationResult, JsxTranslationResult, Request, TranslationError } from '../../types';
|
2
2
|
/**
|
3
3
|
* Translates where a translation already exists in another language, used for updating websites with a new language in real-time.
|
4
4
|
*/
|
5
5
|
export declare function _translateBatchFromClient(gt: {
|
6
6
|
baseUrl: string;
|
7
7
|
devApiKey?: string;
|
8
|
-
}, requests: Request[]): Promise<Array<JsxTranslationResult | ContentTranslationResult>>;
|
8
|
+
}, requests: Request[]): Promise<Array<JsxTranslationResult | ContentTranslationResult | TranslationError>>;
|
package/dist/types.d.ts
CHANGED
@@ -17,17 +17,20 @@ export type JsxElement = {
|
|
17
17
|
};
|
18
18
|
export type JsxChild = string | JsxElement | Variable;
|
19
19
|
export type JsxChildren = JsxChild | JsxChild[];
|
20
|
+
type Metadata = {
|
21
|
+
[key: string]: any;
|
22
|
+
};
|
20
23
|
export type Update = {
|
21
24
|
type: 'content';
|
22
25
|
data: {
|
23
26
|
source: Content;
|
24
|
-
metadata:
|
27
|
+
metadata: Metadata;
|
25
28
|
};
|
26
29
|
} | {
|
27
30
|
type: 'jsx';
|
28
31
|
data: {
|
29
32
|
source: JsxChildren;
|
30
|
-
metadata:
|
33
|
+
metadata: Metadata;
|
31
34
|
};
|
32
35
|
};
|
33
36
|
export type Request = {
|
@@ -35,14 +38,14 @@ export type Request = {
|
|
35
38
|
data: {
|
36
39
|
source: Content;
|
37
40
|
targetLocale: string;
|
38
|
-
metadata:
|
41
|
+
metadata: Metadata;
|
39
42
|
};
|
40
43
|
} | {
|
41
44
|
type: 'jsx';
|
42
45
|
data: {
|
43
46
|
source: JsxChildren;
|
44
47
|
targetLocale: string;
|
45
|
-
metadata:
|
48
|
+
metadata: Metadata;
|
46
49
|
};
|
47
50
|
};
|
48
51
|
export type ContentTranslationResult = {
|
@@ -64,4 +67,9 @@ export type JsxTranslationResult = {
|
|
64
67
|
export type TranslationError = {
|
65
68
|
error: string;
|
66
69
|
code: number;
|
70
|
+
reference?: {
|
71
|
+
id: string;
|
72
|
+
key: string;
|
73
|
+
};
|
67
74
|
};
|
75
|
+
export {};
|
package/package.json
CHANGED
@@ -1,5 +0,0 @@
|
|
1
|
-
import { ContentTranslationResult, JsxTranslationResult, Request } from '../../types/types';
|
2
|
-
/**
|
3
|
-
* Translates where a translation already exists in another language, used for updating websites with a new language in real-time.
|
4
|
-
*/
|
5
|
-
export declare function _translateJsxBatchFromClient(requests: Request[], baseURL?: string): Promise<Array<JsxTranslationResult | ContentTranslationResult>>;
|
package/dist/types/types.d.ts
DELETED
@@ -1,63 +0,0 @@
|
|
1
|
-
export type Variable = {
|
2
|
-
variable?: string;
|
3
|
-
id?: string | number;
|
4
|
-
key: string;
|
5
|
-
};
|
6
|
-
export type Content = string | Array<string | Variable>;
|
7
|
-
export type JsxElement = {
|
8
|
-
type: string;
|
9
|
-
props: {
|
10
|
-
'data-_gt'?: {
|
11
|
-
id: number;
|
12
|
-
[key: string]: any;
|
13
|
-
};
|
14
|
-
children?: JsxChildren;
|
15
|
-
[key: string]: any;
|
16
|
-
};
|
17
|
-
};
|
18
|
-
export type JsxChild = string | JsxElement | Variable;
|
19
|
-
export type JsxChildren = JsxChild | JsxChild[];
|
20
|
-
export type Update = {
|
21
|
-
type: 'content';
|
22
|
-
data: {
|
23
|
-
source: Content;
|
24
|
-
metadata: Record<string, any>;
|
25
|
-
};
|
26
|
-
} | {
|
27
|
-
type: 'jsx';
|
28
|
-
data: {
|
29
|
-
source: JsxChildren;
|
30
|
-
metadata: Record<string, any>;
|
31
|
-
};
|
32
|
-
};
|
33
|
-
export type Request = {
|
34
|
-
type: 'content';
|
35
|
-
data: {
|
36
|
-
source: Content;
|
37
|
-
targetLocale: string;
|
38
|
-
metadata: Record<string, any>;
|
39
|
-
};
|
40
|
-
} | {
|
41
|
-
type: 'jsx';
|
42
|
-
data: {
|
43
|
-
source: JsxChildren;
|
44
|
-
targetLocale: string;
|
45
|
-
metadata: Record<string, any>;
|
46
|
-
};
|
47
|
-
};
|
48
|
-
export type ContentTranslationResult = {
|
49
|
-
translation: Content;
|
50
|
-
locale: string;
|
51
|
-
reference?: {
|
52
|
-
id: string;
|
53
|
-
key: string;
|
54
|
-
};
|
55
|
-
};
|
56
|
-
export type JsxTranslationResult = {
|
57
|
-
translation: JsxChildren;
|
58
|
-
locale: string;
|
59
|
-
reference?: {
|
60
|
-
id: string;
|
61
|
-
key: string;
|
62
|
-
};
|
63
|
-
};
|