@bloom-housing/ui-components 4.1.3-alpha.0 → 4.1.3-alpha.1
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/CHANGELOG.md +8 -0
- package/package.json +2 -2
- package/scripts/duplicate-translations.ts +50 -0
- package/scripts/missing-translations.ts +52 -0
- package/scripts/reformat-strings.ts +68 -0
- package/scripts/unused-foreign-keys.ts +50 -0
- package/src/forms/DOBField.tsx +3 -3
- package/src/forms/DateField.tsx +3 -3
- package/src/forms/HouseholdSizeField.tsx +1 -1
- package/src/forms/TimeField.tsx +1 -1
- package/src/locales/es.json +629 -900
- package/src/locales/general.json +913 -1764
- package/src/locales/tl.json +1 -3
- package/src/locales/vi.json +631 -901
- package/src/locales/zh.json +631 -901
- package/src/locales/general_OLD.json +0 -868
- package/src/locales/missing-translations.ts +0 -72
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [4.1.3-alpha.1](https://github.com/bloom-housing/bloom/compare/@bloom-housing/ui-components@4.1.3-alpha.0...@bloom-housing/ui-components@4.1.3-alpha.1) (2022-04-04)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @bloom-housing/ui-components
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
6
14
|
## [4.1.3-alpha.0](https://github.com/bloom-housing/bloom/compare/@bloom-housing/ui-components@4.1.2-alpha.3...@bloom-housing/ui-components@4.1.3-alpha.0) (2022-03-30)
|
|
7
15
|
|
|
8
16
|
**Note:** Version bump only for package @bloom-housing/ui-components
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bloom-housing/ui-components",
|
|
3
|
-
"version": "4.1.3-alpha.
|
|
3
|
+
"version": "4.1.3-alpha.1",
|
|
4
4
|
"author": "Sean Albert <sean.albert@exygy.com>",
|
|
5
5
|
"description": "Shared user interface components for Bloom affordable housing system",
|
|
6
6
|
"homepage": "https://github.com/bloom-housing/bloom/tree/master/shared/ui-components",
|
|
@@ -100,5 +100,5 @@
|
|
|
100
100
|
"tailwindcss": "2.2.10",
|
|
101
101
|
"typesafe-actions": "^5.1.0"
|
|
102
102
|
},
|
|
103
|
-
"gitHead": "
|
|
103
|
+
"gitHead": "cf5c2f24a088665630fd3830bb6758e316b2cbb4"
|
|
104
104
|
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-var-requires */
|
|
2
|
+
// Prints duplicate translation strings for cleanup
|
|
3
|
+
// example: `ts-node duplicate-translations > duplicated-keys.json`
|
|
4
|
+
const englishTranslations = require("../src/locales/general.json")
|
|
5
|
+
const spanishTranslations = require("../src/locales/es.json")
|
|
6
|
+
const chineseTranslations = require("../src/locales/zh.json")
|
|
7
|
+
const vietnameseTranslations = require("../src/locales/vi.json")
|
|
8
|
+
const tagalogTranslations = require("../src/locales/tl.json")
|
|
9
|
+
|
|
10
|
+
function main() {
|
|
11
|
+
type TranslationsType = {
|
|
12
|
+
[key: string]: string
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const allTranslations = [
|
|
16
|
+
{ translationKeys: englishTranslations, language: "English" },
|
|
17
|
+
{ translationKeys: spanishTranslations, language: "Spanish" },
|
|
18
|
+
{ translationKeys: chineseTranslations, language: "Chinese" },
|
|
19
|
+
{ translationKeys: vietnameseTranslations, language: "Vietnamese" },
|
|
20
|
+
{ translationKeys: tagalogTranslations, language: "Tagalog" },
|
|
21
|
+
]
|
|
22
|
+
|
|
23
|
+
const getDuplicateStrings = (translations: TranslationsType) => {
|
|
24
|
+
const translationValues = Object.values(translations)
|
|
25
|
+
translationValues.forEach(() => {
|
|
26
|
+
translationValues.filter((value, index) => translationValues.indexOf(value) !== index)
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
const duplicates: string[] = translationValues.reduce(
|
|
30
|
+
(acc: string[], val, index, translationValues) => {
|
|
31
|
+
if (translationValues.indexOf(val) !== index && acc.indexOf(val) < 0) acc.push(val)
|
|
32
|
+
return acc
|
|
33
|
+
},
|
|
34
|
+
[]
|
|
35
|
+
)
|
|
36
|
+
|
|
37
|
+
return duplicates
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
allTranslations.forEach((foreignKeys) => {
|
|
41
|
+
console.log("--------------------")
|
|
42
|
+
console.log(`Duplicate Public Site ${foreignKeys.language} Translations:`)
|
|
43
|
+
const duplicatePublicSiteTranslations = getDuplicateStrings(foreignKeys.translationKeys)
|
|
44
|
+
duplicatePublicSiteTranslations.forEach((duplicateValue) => console.log(duplicateValue))
|
|
45
|
+
})
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
void main()
|
|
49
|
+
|
|
50
|
+
export {}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-var-requires */
|
|
2
|
+
// Prints out keys/strings that exist in the english file but not in a foreign language translation file
|
|
3
|
+
// example: `ts-node missing-translations > missing-foreign-keys.json`
|
|
4
|
+
const englishTranslations = require("../src/locales/general.json")
|
|
5
|
+
const spanishTranslations = require("../src/locales/es.json")
|
|
6
|
+
const chineseTranslations = require("../src/locales/zh.json")
|
|
7
|
+
const vietnameseTranslations = require("../src/locales/vi.json")
|
|
8
|
+
const tagalogTranslations = require("../src/locales/tl.json")
|
|
9
|
+
|
|
10
|
+
function main() {
|
|
11
|
+
type TranslationsType = {
|
|
12
|
+
[key: string]: string
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const allTranslations = [
|
|
16
|
+
{ translationKeys: spanishTranslations, language: "Spanish" },
|
|
17
|
+
{ translationKeys: chineseTranslations, language: "Chinese" },
|
|
18
|
+
{ translationKeys: vietnameseTranslations, language: "Vietnamese" },
|
|
19
|
+
{ translationKeys: tagalogTranslations, language: "Tagalog" },
|
|
20
|
+
]
|
|
21
|
+
|
|
22
|
+
const findMissingStrings = (
|
|
23
|
+
baseTranslations: TranslationsType,
|
|
24
|
+
checkedTranslations: TranslationsType
|
|
25
|
+
) => {
|
|
26
|
+
const baseKeys = Object.keys(baseTranslations)
|
|
27
|
+
const checkedKeys = Object.keys(checkedTranslations)
|
|
28
|
+
const missingKeys: string[] = []
|
|
29
|
+
baseKeys.forEach((key) => {
|
|
30
|
+
if (checkedKeys.indexOf(key) < 0) {
|
|
31
|
+
missingKeys.push(key)
|
|
32
|
+
}
|
|
33
|
+
})
|
|
34
|
+
return missingKeys
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
allTranslations.forEach((foreignKeys) => {
|
|
38
|
+
console.log("--------------------")
|
|
39
|
+
console.log(`Missing Public Site ${foreignKeys.language} Translations:`)
|
|
40
|
+
const missingPublicSiteTranslations = findMissingStrings(
|
|
41
|
+
englishTranslations,
|
|
42
|
+
foreignKeys.translationKeys
|
|
43
|
+
)
|
|
44
|
+
missingPublicSiteTranslations.forEach((missingKey) =>
|
|
45
|
+
console.log(`${missingKey}, ${JSON.stringify(englishTranslations[missingKey])}`)
|
|
46
|
+
)
|
|
47
|
+
})
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
void main()
|
|
51
|
+
|
|
52
|
+
export {}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-var-requires */
|
|
2
|
+
// Reformats strings to flatten the object structure
|
|
3
|
+
// example: `ts-node reformat-strings > flattened-keys.json`
|
|
4
|
+
|
|
5
|
+
const englishTranslations = require("../src/locales/general.json")
|
|
6
|
+
const spanishTranslations = require("../src/locales/es.json")
|
|
7
|
+
const chineseTranslations = require("../src/locales/zh.json")
|
|
8
|
+
const vietnameseTranslations = require("../src/locales/vi.json")
|
|
9
|
+
const tagalogTranslations = require("../src/locales/tl.json")
|
|
10
|
+
|
|
11
|
+
function main() {
|
|
12
|
+
type TranslationsType = {
|
|
13
|
+
[key: string]: string | TranslationsType
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const allTranslations = [
|
|
17
|
+
{ translationKeys: englishTranslations, language: "English" },
|
|
18
|
+
{ translationKeys: spanishTranslations, language: "Spanish" },
|
|
19
|
+
{ translationKeys: chineseTranslations, language: "Chinese" },
|
|
20
|
+
{ translationKeys: vietnameseTranslations, language: "Vietnamese" },
|
|
21
|
+
{ translationKeys: tagalogTranslations, language: "Tagalog" },
|
|
22
|
+
]
|
|
23
|
+
|
|
24
|
+
const addEntry = (
|
|
25
|
+
translationKey: string,
|
|
26
|
+
parentKey: string,
|
|
27
|
+
baseTranslations: TranslationsType | string,
|
|
28
|
+
flattenedKeys: { [key: string]: string }[]
|
|
29
|
+
) => {
|
|
30
|
+
flattenedKeys.push({
|
|
31
|
+
key: parentKey ? `${parentKey}.${translationKey}` : translationKey,
|
|
32
|
+
value: baseTranslations[translationKey],
|
|
33
|
+
})
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const flattenKeys = (
|
|
37
|
+
baseTranslations: TranslationsType | string,
|
|
38
|
+
flattenedKeys: { [key: string]: string }[],
|
|
39
|
+
parentKey?: string
|
|
40
|
+
) => {
|
|
41
|
+
Object.keys(baseTranslations).forEach((translationKey) => {
|
|
42
|
+
if (typeof baseTranslations[translationKey] === "string") {
|
|
43
|
+
addEntry(translationKey, parentKey || "", baseTranslations, flattenedKeys)
|
|
44
|
+
}
|
|
45
|
+
if (typeof baseTranslations[translationKey] !== "string") {
|
|
46
|
+
flattenKeys(
|
|
47
|
+
baseTranslations[translationKey],
|
|
48
|
+
flattenedKeys,
|
|
49
|
+
parentKey ? `${parentKey}.${translationKey}` : translationKey
|
|
50
|
+
)
|
|
51
|
+
}
|
|
52
|
+
})
|
|
53
|
+
return flattenedKeys
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
let flattenedKeys: { [key: string]: string }[] = []
|
|
57
|
+
|
|
58
|
+
allTranslations.forEach((foreignKeys) => {
|
|
59
|
+
console.log("--------------------")
|
|
60
|
+
console.log(`Flattened keys for ${foreignKeys.language} translations:`)
|
|
61
|
+
flattenedKeys = flattenKeys(foreignKeys.translationKeys, flattenedKeys, "")
|
|
62
|
+
flattenedKeys.forEach((keys) => console.log(`"${keys.key}": ${JSON.stringify(keys.value)},`))
|
|
63
|
+
})
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
void main()
|
|
67
|
+
|
|
68
|
+
export {}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-var-requires */
|
|
2
|
+
// Prints keys that are in a foreign language translations file that do not exist in the english file for cleanup
|
|
3
|
+
// example: `ts-node unused-foreign-keys > unused-foreign-keys.json`
|
|
4
|
+
const englishTranslations = require("../src/locales/general.json")
|
|
5
|
+
const spanishTranslations = require("../src/locales/es.json")
|
|
6
|
+
const chineseTranslations = require("../src/locales/zh.json")
|
|
7
|
+
const vietnameseTranslations = require("../src/locales/vi.json")
|
|
8
|
+
const tagalogTranslations = require("../src/locales/tl.json")
|
|
9
|
+
|
|
10
|
+
function main() {
|
|
11
|
+
type TranslationsType = {
|
|
12
|
+
[key: string]: string
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const allTranslations = [
|
|
16
|
+
{ translationKeys: spanishTranslations, language: "Spanish" },
|
|
17
|
+
{ translationKeys: chineseTranslations, language: "Chinese" },
|
|
18
|
+
{ translationKeys: vietnameseTranslations, language: "Vietnamese" },
|
|
19
|
+
{ translationKeys: tagalogTranslations, language: "Tagalog" },
|
|
20
|
+
]
|
|
21
|
+
|
|
22
|
+
const getUnusedForeignKeys = (
|
|
23
|
+
baseTranslations: TranslationsType,
|
|
24
|
+
checkedTranslations: TranslationsType
|
|
25
|
+
) => {
|
|
26
|
+
const baseTranslationsKeys = Object.keys(baseTranslations)
|
|
27
|
+
const checkedTranslationsKeys = Object.keys(checkedTranslations)
|
|
28
|
+
const unusedKeys: string[] = []
|
|
29
|
+
checkedTranslationsKeys.forEach((key) => {
|
|
30
|
+
if (!baseTranslationsKeys.find((item) => key === item)) {
|
|
31
|
+
unusedKeys.push(key)
|
|
32
|
+
}
|
|
33
|
+
})
|
|
34
|
+
return unusedKeys
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
allTranslations.forEach((foreignKeys) => {
|
|
38
|
+
console.log("--------------------")
|
|
39
|
+
console.log(`Unused Public Site ${foreignKeys.language} Keys:`)
|
|
40
|
+
const unusedForeignKeys: string[] = getUnusedForeignKeys(
|
|
41
|
+
englishTranslations,
|
|
42
|
+
foreignKeys.translationKeys
|
|
43
|
+
)
|
|
44
|
+
unusedForeignKeys.forEach((unusedKey) => console.log(unusedKey))
|
|
45
|
+
})
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
void main()
|
|
49
|
+
|
|
50
|
+
export {}
|
package/src/forms/DOBField.tsx
CHANGED
|
@@ -58,7 +58,7 @@ const DOBField = (props: DOBFieldProps) => {
|
|
|
58
58
|
label={t("t.month")}
|
|
59
59
|
disabled={props.disabled}
|
|
60
60
|
readerOnly={true}
|
|
61
|
-
placeholder="
|
|
61
|
+
placeholder={t("account.settings.placeholders.month")}
|
|
62
62
|
defaultValue={defaultDOB?.birthMonth ? defaultDOB.birthMonth : ""}
|
|
63
63
|
error={error?.birthMonth !== undefined}
|
|
64
64
|
validation={{
|
|
@@ -80,7 +80,7 @@ const DOBField = (props: DOBFieldProps) => {
|
|
|
80
80
|
label={t("t.day")}
|
|
81
81
|
disabled={props.disabled}
|
|
82
82
|
readerOnly={true}
|
|
83
|
-
placeholder="
|
|
83
|
+
placeholder={t("account.settings.placeholders.day")}
|
|
84
84
|
defaultValue={defaultDOB?.birthDay ? defaultDOB.birthDay : ""}
|
|
85
85
|
error={error?.birthDay !== undefined}
|
|
86
86
|
validation={{
|
|
@@ -102,7 +102,7 @@ const DOBField = (props: DOBFieldProps) => {
|
|
|
102
102
|
label={t("t.year")}
|
|
103
103
|
disabled={props.disabled}
|
|
104
104
|
readerOnly={true}
|
|
105
|
-
placeholder="
|
|
105
|
+
placeholder={t("account.settings.placeholders.year")}
|
|
106
106
|
defaultValue={defaultDOB?.birthYear ? defaultDOB.birthYear : ""}
|
|
107
107
|
error={error?.birthYear !== undefined}
|
|
108
108
|
validation={{
|
package/src/forms/DateField.tsx
CHANGED
|
@@ -47,7 +47,7 @@ const DateField = (props: DateFieldProps) => {
|
|
|
47
47
|
label={t("t.month")}
|
|
48
48
|
disabled={props.disabled}
|
|
49
49
|
readerOnly={true}
|
|
50
|
-
placeholder="
|
|
50
|
+
placeholder={t("account.settings.placeholders.month")}
|
|
51
51
|
defaultValue={defaultDate?.month ?? ""}
|
|
52
52
|
error={error?.month !== undefined}
|
|
53
53
|
validation={{
|
|
@@ -68,7 +68,7 @@ const DateField = (props: DateFieldProps) => {
|
|
|
68
68
|
label={t("t.day")}
|
|
69
69
|
disabled={props.disabled}
|
|
70
70
|
readerOnly={true}
|
|
71
|
-
placeholder="
|
|
71
|
+
placeholder={t("account.settings.placeholders.day")}
|
|
72
72
|
defaultValue={defaultDate?.day ?? ""}
|
|
73
73
|
error={error?.day !== undefined}
|
|
74
74
|
validation={{
|
|
@@ -89,7 +89,7 @@ const DateField = (props: DateFieldProps) => {
|
|
|
89
89
|
label={t("t.year")}
|
|
90
90
|
disabled={props.disabled}
|
|
91
91
|
readerOnly={true}
|
|
92
|
-
placeholder="
|
|
92
|
+
placeholder={t("account.settings.placeholders.year")}
|
|
93
93
|
defaultValue={defaultDate?.year ?? ""}
|
|
94
94
|
error={error?.year !== undefined}
|
|
95
95
|
validation={{
|
|
@@ -61,7 +61,7 @@ const HouseholdSizeField = (props: HouseholdSizeFieldProps) => {
|
|
|
61
61
|
<AlertNotice title={error?.message} type="alert" inverted>
|
|
62
62
|
<p className="mb-2">{t("application.household.dontQualifyInfo")}</p>
|
|
63
63
|
<p>
|
|
64
|
-
<a href={assistanceUrl}>{t("
|
|
64
|
+
<a href={assistanceUrl}>{t("pageTitle.getAssistance")}</a>
|
|
65
65
|
</p>
|
|
66
66
|
</AlertNotice>
|
|
67
67
|
</ErrorMessage>
|
package/src/forms/TimeField.tsx
CHANGED
|
@@ -109,7 +109,7 @@ const TimeField = ({
|
|
|
109
109
|
label={t("t.minutes")}
|
|
110
110
|
defaultValue={defaultValues?.minutes ?? ""}
|
|
111
111
|
readerOnly={true}
|
|
112
|
-
placeholder="
|
|
112
|
+
placeholder={t("account.settings.placeholders.month")}
|
|
113
113
|
error={error}
|
|
114
114
|
validation={{
|
|
115
115
|
required: required || innerRequiredRule,
|