Skip to content

Commit

Permalink
Merge branch 'main' into missing-translations-job
Browse files Browse the repository at this point in the history
  • Loading branch information
emilyjablonski authored May 8, 2024
2 parents d9fa1e5 + 6cb126f commit 8be34ee
Show file tree
Hide file tree
Showing 12 changed files with 661 additions and 133 deletions.
2 changes: 1 addition & 1 deletion doorway-ui-components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@
"typescript": "^4.9.4"
},
"dependencies": {
"@bloom-housing/ui-components": "12.1.0",
"@bloom-housing/ui-components": "12.1.6",
"@fortawesome/fontawesome-svg-core": "^6.1.1",
"@fortawesome/free-regular-svg-icons": "^6.1.1",
"@fortawesome/free-solid-svg-icons": "^6.1.1",
Expand Down
2 changes: 1 addition & 1 deletion shared-helpers/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
},
"dependencies": {
"@bloom-housing/doorway-ui-components": "^1.0.0",
"@bloom-housing/ui-components": "12.1.0",
"@bloom-housing/ui-components": "12.1.6",
"@bloom-housing/ui-seeds": "1.12.3",
"axios-cookiejar-support": "4.0.6",
"tough-cookie": "4.1.3"
Expand Down
161 changes: 127 additions & 34 deletions shared-helpers/src/locales/es.json

Large diffs are not rendered by default.

4 changes: 0 additions & 4 deletions shared-helpers/src/locales/general.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,13 @@
"account.application.noAccessError": "You are unauthorized to view this application",
"account.application.noApplicationError": "No application with that ID exists",
"account.application.return": "Return to applications",
"account.application.iconTitle": "application with checkmarks",
"account.createAccount": "Create Account",
"account.errorFetchingApplications": "Error fetching applications",
"account.haveAnAccount": "Already have an account?",
"account.myApplications": "My Applications",
"account.viewApplications": "View applications",
"account.myApplicationsSubtitle": "See lottery dates and listings for properties for which you've applied",
"account.noApplications": "It looks like you haven't applied to any listings yet.",
"account.reviewTerms": "Review Terms of Use",
"account.reviewTermsHelper": "You must accept the terms of use before creating an account.",
"account.signUpSaveTime.applyFaster": "Apply faster with saved application details",
"account.signUpSaveTime.checkStatus": "Check on the status of an application at any time",
"account.signUpSaveTime.resetPassword": "Simply reset your password if you forget it",
Expand All @@ -40,7 +37,6 @@
"account.settings.placeholders.month": "MM",
"account.settings.placeholders.year": "YYYY",
"account.settings.update": "Update",
"account.settings.iconTitle": "generic user",
"account.pwdless.code": "Your code",
"account.pwdless.createMessage": "We sent a code to %{email} to finish signing up. Be aware, the code will expire in 5 minutes.",
"account.pwdless.loginMessage": "If there is an account made with %{email}, we’ll send a code within 5 minutes. If you don’t receive a code, sign in with your password and confirm your email address under account settings.",
Expand Down
184 changes: 156 additions & 28 deletions shared-helpers/src/locales/tl.json

Large diffs are not rendered by default.

176 changes: 145 additions & 31 deletions shared-helpers/src/locales/vi.json

Large diffs are not rendered by default.

191 changes: 165 additions & 26 deletions shared-helpers/src/locales/zh.json

Large diffs are not rendered by default.

60 changes: 60 additions & 0 deletions shared-helpers/src/scripts/get-machine-translations.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/* eslint-disable @typescript-eslint/no-var-requires, import/no-unresolved */

// Takes in a CSV file with two columns (t_key,t_value) with the key being the translation file key and the value being the associated English string, and prints out in the JSON translation file format the "key": "translated string"
// Temporarily update the shared-helpers tsconfig to include `"module": "commonjs"`
// example from within this directory, first argument is one of LanguagesEnum and second argument is the formatted CSV filename with keys and english strings, piped to a new file: `ts-node get-machine-translations es english-keys.csv > any-filename-here.json`
import fs from "node:fs"
import { parse } from "csv-parse/sync"

import { Translate } from "@google-cloud/translate/build/src/v2"

async function main(argv: string[]) {
enum LanguagesEnum {
"en" = "en",
"es" = "es",
"vi" = "vi",
"zh" = "zh",
"tl" = "tl",
}

const GOOGLE_API_EMAIL = "SECRET_VALUE"
const GOOGLE_API_ID = "SECRET_VALUE"
const GOOGLE_API_KEY = "SECRET_VALUE"

const makeTranslateService = () => {
return new Translate({
credentials: {
private_key: GOOGLE_API_KEY.replace(/\\n/gm, "\n"),
client_email: GOOGLE_API_EMAIL,
},
projectId: GOOGLE_API_ID,
})
}

const fetch = async (values: string[], language: LanguagesEnum) => {
return await makeTranslateService().translate(values, {
from: LanguagesEnum.en,
to: language,
})
}

const [language, englishStringsCsv] = argv.slice(2)

const csvFile = fs.readFileSync(englishStringsCsv)

const csvData = parse(csvFile, {
columns: true,
skip_empty_lines: true,
})

for (const row of csvData) {
const tKey = row["t_key"].trim()
const tValue = row["t_value"].trim()
const translatedValue = await fetch([tValue], language as LanguagesEnum)
console.log(`"${tKey}": "${translatedValue[0][0]}",`)
}
}

void main(process.argv)

export {}
2 changes: 0 additions & 2 deletions shared-helpers/src/views/accounts/CustomIcons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ export const Application = (
fill="none"
role="img"
>
<title>{t("account.application.iconTitle")}</title>
<path d="M36.7665 11.439L25.3275 0H0V47.388H36.765V11.439H36.7665Z" fill="#EDEBDA" />
<path d="M25.3286 0V11.439H36.7676L25.3286 0Z" fill="#CEC9AE" />
<path
Expand Down Expand Up @@ -49,7 +48,6 @@ export const Profile = (
fill="none"
role="img"
>
<title>{t("account.settings.iconTitle")}</title>
<path
d="M16.8447 37.6683L9.68974 41.5631C9.23674 41.8346 8.87374 42.106 8.51074 42.379C12.6777 45.9108 18.1107 47.9939 23.9982 47.9939C29.8857 47.9939 35.2272 45.9108 39.3942 42.4704C39.0312 42.1075 38.5782 41.8376 38.1267 41.6546L30.4272 37.8513C29.4312 37.3984 28.7982 36.3111 28.7982 35.2268V32.2394C28.9782 31.9679 29.2512 31.6965 29.5227 31.335C30.6102 29.8863 31.3347 28.2561 31.8777 26.5359C32.8737 26.2645 33.5982 25.3572 33.5982 24.2729V21.1024C33.5982 20.3781 33.3267 19.7437 32.7822 19.2908V14.4917C32.7822 14.4917 33.7782 7.24805 23.9067 7.24805C14.0352 7.24805 15.0312 14.4917 15.0312 14.4917V19.1108C14.5782 19.5637 14.2152 20.1981 14.2152 20.9225V24.0929C14.2152 24.9087 14.6682 25.7216 15.3027 26.0845C16.1187 29.6164 18.2022 32.0624 18.2022 32.0624V34.9614C18.3822 36.1401 17.7492 37.1359 16.8432 37.6773L16.8447 37.6683Z"
fill="#E7ECED"
Expand Down
2 changes: 1 addition & 1 deletion sites/partners/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"dependencies": {
"@bloom-housing/shared-helpers": "^7.7.1",
"@bloom-housing/doorway-ui-components": "^1.0.0",
"@bloom-housing/ui-components": "12.1.0",
"@bloom-housing/ui-components": "12.1.6",
"@bloom-housing/ui-seeds": "1.12.3",
"@mapbox/mapbox-sdk": "^0.13.0",
"ag-grid-community": "^26.0.0",
Expand Down
2 changes: 1 addition & 1 deletion sites/public/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"dependencies": {
"@bloom-housing/doorway-ui-components": "^1.0.0",
"@bloom-housing/shared-helpers": "^7.7.1",
"@bloom-housing/ui-components": "12.1.0",
"@bloom-housing/ui-components": "12.1.6",
"@bloom-housing/ui-seeds": "1.12.3",
"@fortawesome/fontawesome-svg-core": "^6.1.1",
"@fortawesome/free-regular-svg-icons": "^6.1.1",
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3129,10 +3129,10 @@
resolved "https://registry.npmjs.org/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz"
integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==

"@bloom-housing/[email protected].0":
version "12.1.0"
resolved "https://registry.yarnpkg.com/@bloom-housing/ui-components/-/ui-components-12.1.0.tgz#c6066ed097887820bf2195c748ac2862fb171eef"
integrity sha512-xFW4IlPw9v9OJCkEQiKdIiN4csJyHuuaz1GmZGD33+m2phU79f5he2zBw0/qZogqpmP8aYsuzzKHAigHKXNhdQ==
"@bloom-housing/[email protected].6":
version "12.1.6"
resolved "https://registry.yarnpkg.com/@bloom-housing/ui-components/-/ui-components-12.1.6.tgz#e451ceb89f03044cfeb7e6995fd088f11712b9af"
integrity sha512-FjoRwau2o3jTgBtuRFLEcM5nhSxjr2n5pzNyx8bjGHZbX/721EYpR/RL2dJekTxYaUgHsI9vK5d9BK74IZxzMA==
dependencies:
"@fortawesome/fontawesome-svg-core" "^6.1.1"
"@fortawesome/free-regular-svg-icons" "^6.1.1"
Expand Down

0 comments on commit 8be34ee

Please sign in to comment.