@transferwise/components 0.0.0-experimental-09e50b0 → 0.0.0-experimental-52c0a68
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/build/index.esm.js +95 -13
- package/build/index.esm.js.map +1 -1
- package/build/index.js +95 -13
- package/build/index.js.map +1 -1
- package/build/types/common/locale/index.d.ts +1 -10
- package/build/types/common/locale/index.d.ts.map +1 -1
- package/build/types/i18n/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/common/locale/index.js +1 -10
- package/src/common/locale/index.spec.js +1 -34
- package/src/i18n/index.ts +6 -2
- package/build/i18n/zh_CN.json +0 -44
- package/src/i18n/zh_CN.json +0 -44
- /package/build/i18n/{zh.json → zh-HK.json} +0 -0
- /package/src/i18n/{zh.json → zh-HK.json} +0 -0
|
@@ -10,13 +10,8 @@ export function adjustLocale(locale: string): string | null;
|
|
|
10
10
|
* Provides corresponding lang (iso2) for provided locale
|
|
11
11
|
* if locale is invalid or language is unsupported returns null
|
|
12
12
|
*
|
|
13
|
-
* @deprecated The use of this function almost always breaks language variants
|
|
14
|
-
* e.g. Simplified and Traditional Chinese.
|
|
15
|
-
* There should be no use case for this function.
|
|
16
|
-
* To select the correct translations from a translations object, pass the
|
|
17
|
-
* locale directly into Crab's getLocalisedMessages.
|
|
18
13
|
* @param {string} locale (`es`, `es-ES`, `en-GB`, `en`, `ja`, `ja-JP` etc)
|
|
19
|
-
* @returns {string|null}
|
|
14
|
+
* @returns {string|null}
|
|
20
15
|
*/
|
|
21
16
|
export function getLangFromLocale(locale: string): string | null;
|
|
22
17
|
/**
|
|
@@ -53,10 +48,6 @@ export const DEFAULT_LOCALE: string;
|
|
|
53
48
|
* @type {string[]}
|
|
54
49
|
*/
|
|
55
50
|
export const RTL_LANGUAGES: string[];
|
|
56
|
-
/**
|
|
57
|
-
* @deprecated The source of truth for supported languages lives in Crab.
|
|
58
|
-
* @type {string[]}
|
|
59
|
-
*/
|
|
60
51
|
export const SUPPORTED_LANGUAGES: string[];
|
|
61
52
|
import { Direction } from "../direction";
|
|
62
53
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/common/locale/index.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/common/locale/index.js"],"names":[],"mappings":"AA0CA;;;;;;GAMG;AACH,qCAHW,MAAM,GACJ,MAAM,GAAC,IAAI,CAcvB;AAED;;;;;;GAMG;AACH,0CAHW,MAAM,GACJ,MAAM,GAAC,IAAI,CAmBvB;AAED;;;;;;GAMG;AACH,6CAHW,MAAM,GACJ,MAAM,GAAC,IAAI,CAevB;AAED;;;;;;GAMG;AACH,+CAHW,MAAM,GACJ,SAAS,CAarB;AA/HD;;;;GAIG;AACH,2BAFU,MAAM,CAEiB;AAEjC;;;;GAIG;AACH,6BAFU,MAAM,CAEsB;AAEtC;;;;GAIG;AACH,4BAFU,MAAM,EAAE,CAEwB;AAE1C,2CAiBE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/i18n/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/i18n/index.ts"],"names":[],"mappings":"AAmBA,QAAA,MAAM,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAmBxD,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
package/package.json
CHANGED
|
@@ -21,10 +21,6 @@ export const DEFAULT_LOCALE = 'en-GB';
|
|
|
21
21
|
*/
|
|
22
22
|
export const RTL_LANGUAGES = ['ar', 'he'];
|
|
23
23
|
|
|
24
|
-
/**
|
|
25
|
-
* @deprecated The source of truth for supported languages lives in Crab.
|
|
26
|
-
* @type {string[]}
|
|
27
|
-
*/
|
|
28
24
|
export const SUPPORTED_LANGUAGES = [
|
|
29
25
|
DEFAULT_LANG,
|
|
30
26
|
'de',
|
|
@@ -69,13 +65,8 @@ export function adjustLocale(locale) {
|
|
|
69
65
|
* Provides corresponding lang (iso2) for provided locale
|
|
70
66
|
* if locale is invalid or language is unsupported returns null
|
|
71
67
|
*
|
|
72
|
-
* @deprecated The use of this function almost always breaks language variants
|
|
73
|
-
* e.g. Simplified and Traditional Chinese.
|
|
74
|
-
* There should be no use case for this function.
|
|
75
|
-
* To select the correct translations from a translations object, pass the
|
|
76
|
-
* locale directly into Crab's getLocalisedMessages.
|
|
77
68
|
* @param {string} locale (`es`, `es-ES`, `en-GB`, `en`, `ja`, `ja-JP` etc)
|
|
78
|
-
* @returns {string|null}
|
|
69
|
+
* @returns {string|null}
|
|
79
70
|
*/
|
|
80
71
|
export function getLangFromLocale(locale) {
|
|
81
72
|
const adjustedLocale = adjustLocale(locale);
|
|
@@ -1,12 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
getLangFromLocale,
|
|
5
|
-
adjustLocale,
|
|
6
|
-
getCountryFromLocale,
|
|
7
|
-
SUPPORTED_LANGUAGES,
|
|
8
|
-
getDirectionFromLocale,
|
|
9
|
-
} from '.';
|
|
1
|
+
import { getLangFromLocale, adjustLocale, getCountryFromLocale, getDirectionFromLocale } from '.';
|
|
10
2
|
|
|
11
3
|
describe('locale utils', () => {
|
|
12
4
|
beforeAll(() => {
|
|
@@ -72,31 +64,6 @@ describe('locale utils', () => {
|
|
|
72
64
|
});
|
|
73
65
|
});
|
|
74
66
|
|
|
75
|
-
describe('contract between SUPPORTED_LANGUAGES and names of translations files', () => {
|
|
76
|
-
it('number of lang codes should be equal to number of translations files', () => {
|
|
77
|
-
expect(SUPPORTED_LANGUAGES).toHaveLength(Object.keys(translationFiles).length);
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
it('lang codes should match to names of translations object', () => {
|
|
81
|
-
Object.keys(translationFiles).forEach((property) => {
|
|
82
|
-
const result = SUPPORTED_LANGUAGES.includes(property);
|
|
83
|
-
if (!result) {
|
|
84
|
-
// eslint-disable-next-line no-console
|
|
85
|
-
console.log(`'${property}' doesn't exist in ${[SUPPORTED_LANGUAGES]}`);
|
|
86
|
-
}
|
|
87
|
-
expect(result).toBe(true);
|
|
88
|
-
});
|
|
89
|
-
});
|
|
90
|
-
|
|
91
|
-
it('lang codes should match with names of translations files', async () => {
|
|
92
|
-
for (const locale of SUPPORTED_LANGUAGES) {
|
|
93
|
-
const file = await import(`../../i18n/${locale}.json`);
|
|
94
|
-
expect(file).not.toBeNull();
|
|
95
|
-
expect(file.default).toBe(translationFiles[locale]);
|
|
96
|
-
}
|
|
97
|
-
});
|
|
98
|
-
});
|
|
99
|
-
|
|
100
67
|
describe('getCountryFromLocale', () => {
|
|
101
68
|
it.each([
|
|
102
69
|
['en', null],
|
package/src/i18n/index.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import cs from './cs.json';
|
|
1
2
|
import de from './de.json';
|
|
2
3
|
import en from './en.json';
|
|
3
4
|
import es from './es.json';
|
|
@@ -13,9 +14,11 @@ import ru from './ru.json';
|
|
|
13
14
|
import th from './th.json';
|
|
14
15
|
import tr from './tr.json';
|
|
15
16
|
import uk from './uk.json';
|
|
16
|
-
import
|
|
17
|
+
import zhCN from './zh-CN.json';
|
|
18
|
+
import zhHK from './zh-HK.json';
|
|
17
19
|
|
|
18
20
|
const translations: Record<string, Record<string, string>> = {
|
|
21
|
+
cs,
|
|
19
22
|
de,
|
|
20
23
|
en,
|
|
21
24
|
es,
|
|
@@ -31,7 +34,8 @@ const translations: Record<string, Record<string, string>> = {
|
|
|
31
34
|
th,
|
|
32
35
|
tr,
|
|
33
36
|
uk,
|
|
34
|
-
zh,
|
|
37
|
+
'zh-CN': zhCN,
|
|
38
|
+
'zh-HK': zhHK,
|
|
35
39
|
};
|
|
36
40
|
|
|
37
41
|
export default translations;
|
package/build/i18n/zh_CN.json
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"neptune.Chips.ariaLabel": "清除 {choice}",
|
|
3
|
-
"neptune.ClearButton.ariaLabel": "清晰",
|
|
4
|
-
"neptune.CloseButton.ariaLabel": "关闭",
|
|
5
|
-
"neptune.DateInput.day.label": "日",
|
|
6
|
-
"neptune.DateInput.month.label": "月",
|
|
7
|
-
"neptune.DateInput.year.label": "年",
|
|
8
|
-
"neptune.MoneyInput.Select.placeholder": "请选择...",
|
|
9
|
-
"neptune.Pagination.ariaLabel": "分页导航",
|
|
10
|
-
"neptune.PaginationLink.ariaLabel.active": "转到第 {pageNumber} 页",
|
|
11
|
-
"neptune.PaginationLink.ariaLabel.inactive": "当前页面,第 {pageNumber} 页",
|
|
12
|
-
"neptune.Select.searchPlaceholder": "搜索",
|
|
13
|
-
"neptune.Summary.statusDone": "已完成",
|
|
14
|
-
"neptune.Summary.statusNotDone": "未完成",
|
|
15
|
-
"neptune.Summary.statusPending": "待处理",
|
|
16
|
-
"neptune.Upload.csButtonText": "上传另一个文件?",
|
|
17
|
-
"neptune.Upload.csFailureText": "上传失败。请重试",
|
|
18
|
-
"neptune.Upload.csSuccessText": "上传完毕!",
|
|
19
|
-
"neptune.Upload.csTooLargeMessage": "请提供小于 5MB 的文件",
|
|
20
|
-
"neptune.Upload.csWrongTypeMessage": "不支持该文件类型,请试试其他文件",
|
|
21
|
-
"neptune.Upload.psButtonText": "取消",
|
|
22
|
-
"neptune.Upload.psProcessingText": "正在上传…",
|
|
23
|
-
"neptune.Upload.usButtonText": "或选择文件",
|
|
24
|
-
"neptune.Upload.usDropMessage": "拖放文件开始上传",
|
|
25
|
-
"neptune.Upload.usPlaceholder": "拖放小于 5MB 的文件",
|
|
26
|
-
"neptune.UploadButton.allFileTypes": "所有文件类型",
|
|
27
|
-
"neptune.UploadButton.dropFiles": "拖放文件开始上传",
|
|
28
|
-
"neptune.UploadButton.instructions": "{fileTypes},小于 {size}MB",
|
|
29
|
-
"neptune.UploadButton.uploadFile": "上传文件",
|
|
30
|
-
"neptune.UploadButton.uploadFiles": "上传文件",
|
|
31
|
-
"neptune.UploadInput.deleteModalBody": "删除此文件会将其从我们的系统中删除",
|
|
32
|
-
"neptune.UploadInput.deleteModalCancelButtonText": "取消",
|
|
33
|
-
"neptune.UploadInput.deleteModalConfirmButtonText": "删除",
|
|
34
|
-
"neptune.UploadInput.deleteModalTitle": "确定要删除此文件吗?",
|
|
35
|
-
"neptune.UploadInput.fileIsTooLarge": "文件太大",
|
|
36
|
-
"neptune.UploadInput.fileTypeNotSupported": "文件类型不受支持",
|
|
37
|
-
"neptune.UploadInput.maximumFilesAlreadyUploaded": "抱歉,此上传失败,因为我们一次只能接受 {maxFilesAllowed} 个文件。",
|
|
38
|
-
"neptune.UploadItem.deleting": "正在删除…",
|
|
39
|
-
"neptune.UploadItem.removeFile": "删除文件 {filename}",
|
|
40
|
-
"neptune.UploadItem.uploaded": "已上传",
|
|
41
|
-
"neptune.UploadItem.uploadedFile": "上传的文件",
|
|
42
|
-
"neptune.UploadItem.uploading": "正在上传…",
|
|
43
|
-
"neptune.UploadItem.uploadingFailed": "上传失败"
|
|
44
|
-
}
|
package/src/i18n/zh_CN.json
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"neptune.Chips.ariaLabel": "清除 {choice}",
|
|
3
|
-
"neptune.ClearButton.ariaLabel": "清晰",
|
|
4
|
-
"neptune.CloseButton.ariaLabel": "关闭",
|
|
5
|
-
"neptune.DateInput.day.label": "日",
|
|
6
|
-
"neptune.DateInput.month.label": "月",
|
|
7
|
-
"neptune.DateInput.year.label": "年",
|
|
8
|
-
"neptune.MoneyInput.Select.placeholder": "请选择...",
|
|
9
|
-
"neptune.Pagination.ariaLabel": "分页导航",
|
|
10
|
-
"neptune.PaginationLink.ariaLabel.active": "转到第 {pageNumber} 页",
|
|
11
|
-
"neptune.PaginationLink.ariaLabel.inactive": "当前页面,第 {pageNumber} 页",
|
|
12
|
-
"neptune.Select.searchPlaceholder": "搜索",
|
|
13
|
-
"neptune.Summary.statusDone": "已完成",
|
|
14
|
-
"neptune.Summary.statusNotDone": "未完成",
|
|
15
|
-
"neptune.Summary.statusPending": "待处理",
|
|
16
|
-
"neptune.Upload.csButtonText": "上传另一个文件?",
|
|
17
|
-
"neptune.Upload.csFailureText": "上传失败。请重试",
|
|
18
|
-
"neptune.Upload.csSuccessText": "上传完毕!",
|
|
19
|
-
"neptune.Upload.csTooLargeMessage": "请提供小于 5MB 的文件",
|
|
20
|
-
"neptune.Upload.csWrongTypeMessage": "不支持该文件类型,请试试其他文件",
|
|
21
|
-
"neptune.Upload.psButtonText": "取消",
|
|
22
|
-
"neptune.Upload.psProcessingText": "正在上传…",
|
|
23
|
-
"neptune.Upload.usButtonText": "或选择文件",
|
|
24
|
-
"neptune.Upload.usDropMessage": "拖放文件开始上传",
|
|
25
|
-
"neptune.Upload.usPlaceholder": "拖放小于 5MB 的文件",
|
|
26
|
-
"neptune.UploadButton.allFileTypes": "所有文件类型",
|
|
27
|
-
"neptune.UploadButton.dropFiles": "拖放文件开始上传",
|
|
28
|
-
"neptune.UploadButton.instructions": "{fileTypes},小于 {size}MB",
|
|
29
|
-
"neptune.UploadButton.uploadFile": "上传文件",
|
|
30
|
-
"neptune.UploadButton.uploadFiles": "上传文件",
|
|
31
|
-
"neptune.UploadInput.deleteModalBody": "删除此文件会将其从我们的系统中删除",
|
|
32
|
-
"neptune.UploadInput.deleteModalCancelButtonText": "取消",
|
|
33
|
-
"neptune.UploadInput.deleteModalConfirmButtonText": "删除",
|
|
34
|
-
"neptune.UploadInput.deleteModalTitle": "确定要删除此文件吗?",
|
|
35
|
-
"neptune.UploadInput.fileIsTooLarge": "文件太大",
|
|
36
|
-
"neptune.UploadInput.fileTypeNotSupported": "文件类型不受支持",
|
|
37
|
-
"neptune.UploadInput.maximumFilesAlreadyUploaded": "抱歉,此上传失败,因为我们一次只能接受 {maxFilesAllowed} 个文件。",
|
|
38
|
-
"neptune.UploadItem.deleting": "正在删除…",
|
|
39
|
-
"neptune.UploadItem.removeFile": "删除文件 {filename}",
|
|
40
|
-
"neptune.UploadItem.uploaded": "已上传",
|
|
41
|
-
"neptune.UploadItem.uploadedFile": "上传的文件",
|
|
42
|
-
"neptune.UploadItem.uploading": "正在上传…",
|
|
43
|
-
"neptune.UploadItem.uploadingFailed": "上传失败"
|
|
44
|
-
}
|
|
File without changes
|
|
File without changes
|