@bloom-housing/ui-components 4.2.2-alpha.28 → 4.2.2-alpha.30

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 CHANGED
@@ -3,6 +3,25 @@
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.2.2-alpha.30](https://github.com/bloom-housing/bloom/compare/@bloom-housing/ui-components@4.2.2-alpha.29...@bloom-housing/ui-components@4.2.2-alpha.30) (2022-05-13)
7
+
8
+
9
+ ### Features
10
+
11
+ * missing translations, script to merge new translations ([#2728](https://github.com/bloom-housing/bloom/issues/2728)) ([1abc50d](https://github.com/bloom-housing/bloom/commit/1abc50de6b3311e92d47292b6f5ec69bf4c5094a))
12
+
13
+
14
+
15
+
16
+
17
+ ## [4.2.2-alpha.29](https://github.com/bloom-housing/bloom/compare/@bloom-housing/ui-components@4.2.2-alpha.28...@bloom-housing/ui-components@4.2.2-alpha.29) (2022-05-11)
18
+
19
+ **Note:** Version bump only for package @bloom-housing/ui-components
20
+
21
+
22
+
23
+
24
+
6
25
  ## [4.2.2-alpha.28](https://github.com/bloom-housing/bloom/compare/@bloom-housing/ui-components@4.2.2-alpha.27...@bloom-housing/ui-components@4.2.2-alpha.28) (2022-05-11)
7
26
 
8
27
  **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.2.2-alpha.28",
3
+ "version": "4.2.2-alpha.30",
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",
@@ -66,11 +66,11 @@
66
66
  "style-loader": "^1.1.3",
67
67
  "ts-jest": "^26.4.1",
68
68
  "ts-loader": "^8.0.4",
69
- "typescript": "^3.9.7",
69
+ "typescript": "^4.5.5",
70
70
  "webpack": "^4.44.2"
71
71
  },
72
72
  "dependencies": {
73
- "@bloom-housing/backend-core": "^4.2.2-alpha.8",
73
+ "@bloom-housing/backend-core": "^4.2.2-alpha.9",
74
74
  "@mapbox/mapbox-sdk": "^0.13.0",
75
75
  "@types/body-scroll-lock": "^2.6.1",
76
76
  "@types/jwt-decode": "^2.2.1",
@@ -102,5 +102,5 @@
102
102
  "tailwindcss": "2.2.10",
103
103
  "typesafe-actions": "^5.1.0"
104
104
  },
105
- "gitHead": "2363f2964008487d5c6d2e2917a891591b539016"
105
+ "gitHead": "45e070c511b6c92e239780f025a8e546a797faf5"
106
106
  }
@@ -0,0 +1,60 @@
1
+ /* eslint-disable @typescript-eslint/no-var-requires */
2
+ // Prints out a combination of an inputted csv file and existing translations file
3
+ // The CSV of the new translations must be in the format "key,value"
4
+ // Temporarily update the ui-components tsconfig to include `"module": "commonjs"`
5
+ // example: `ts-node generate-translations es new-spanish.csv > merged-spanish-translations.json`
6
+ const fs = require("fs")
7
+ const general = require("../src/locales/general.json")
8
+ const es = require("../src/locales/es.json")
9
+ const zh = require("../src/locales/zh.json")
10
+ const vi = require("../src/locales/vi.json")
11
+ const tl = require("../src/locales/tl.json")
12
+
13
+ function main() {
14
+ if (process.argv.length < 4) {
15
+ console.log(
16
+ "usage: ts-node generate-translations es new-spanish.csv > merged-spanish-translations.json"
17
+ )
18
+ process.exit(1)
19
+ }
20
+
21
+ const languageMap = {
22
+ general: general,
23
+ es: es,
24
+ zh: zh,
25
+ vi: vi,
26
+ tl: tl,
27
+ }
28
+
29
+ const [language, filePath] = process.argv.slice(2)
30
+
31
+ // Process existing keys
32
+ const mergedTranslations: string[] = []
33
+ Object.keys(languageMap[language]).forEach((key) => {
34
+ const formattedTranslation = `"${key}": "${languageMap[language][key]}",`
35
+ mergedTranslations.push(JSON.stringify(formattedTranslation))
36
+ })
37
+
38
+ // Add new keys if not present
39
+ const newTranslationsFile: any = fs.readFileSync(filePath, "utf-8")
40
+ const newTranslations = newTranslationsFile.split("\n")
41
+ newTranslations.forEach((translation: string) => {
42
+ const [key, ...values] = translation.split(",")
43
+ const value = values.join("_")
44
+ if (!mergedTranslations[key]) {
45
+ const formattedTranslation = `"${key}": "${value}",`
46
+ mergedTranslations.push(JSON.stringify(formattedTranslation))
47
+ }
48
+ })
49
+
50
+ mergedTranslations.sort()
51
+ console.log("{")
52
+ mergedTranslations.forEach((translation) => {
53
+ console.log(JSON.parse(translation))
54
+ })
55
+ console.log("}")
56
+ }
57
+
58
+ void main()
59
+
60
+ export {}
@@ -143,6 +143,7 @@ const SiteHeader = (props: SiteHeaderProps) => {
143
143
  }
144
144
  dropdownOptionKeyDown(event, index)
145
145
  }}
146
+ data-test-id={`${option.title}-${index}`}
146
147
  >
147
148
  {dropdownOptionContent(option)}
148
149
  </button>
@@ -296,6 +297,7 @@ const SiteHeader = (props: SiteHeaderProps) => {
296
297
  className={`navbar-link ${props.menuItemClassName && props.menuItemClassName}`}
297
298
  href={menuLink.href}
298
299
  key={`${menuLink.title}-${index}`}
300
+ data-test-id={`${menuLink.title}-${index}`}
299
301
  >
300
302
  {menuContent}
301
303
  </LinkComponent>
@@ -334,6 +336,7 @@ const SiteHeader = (props: SiteHeaderProps) => {
334
336
  }}
335
337
  onMouseEnter={() => changeMenuShow(menuLink.title, activeMenus, setActiveMenus)}
336
338
  onMouseLeave={() => changeMenuShow(menuLink.title, activeMenus, setActiveMenus)}
339
+ data-test-id={`${menuLink.title}-${index}`}
337
340
  >
338
341
  {menuContent}
339
342
  </span>