From c67af660ab96234a750ff9537ab1e07f19d9b41c Mon Sep 17 00:00:00 2001 From: sua yoo Date: Tue, 17 Jan 2023 14:51:03 -0800 Subject: [PATCH] Fix localization build (#488) * fix localization issues * don't track translation files --- frontend/.gitignore | 4 + frontend/package.json | 4 +- frontend/src/__generated__/.keep | 0 frontend/src/__generated__/locale-codes.ts | 23 ------ frontend/src/__generated__/locales/en-US.ts | 85 --------------------- frontend/src/pages/archive/crawls-list.ts | 4 +- frontend/src/pages/archive/index.ts | 2 +- frontend/yarn.lock | 67 +++++++++++----- 8 files changed, 56 insertions(+), 133 deletions(-) create mode 100644 frontend/src/__generated__/.keep delete mode 100644 frontend/src/__generated__/locale-codes.ts delete mode 100644 frontend/src/__generated__/locales/en-US.ts diff --git a/frontend/.gitignore b/frontend/.gitignore index 35a4c157..5d05b598 100644 --- a/frontend/.gitignore +++ b/frontend/.gitignore @@ -23,5 +23,9 @@ .env.local .env.*.local +# translation files +src/__generated__/**/*.ts +xliff/*.xlf + storybook-static custom-elements.json diff --git a/frontend/package.json b/frontend/package.json index f253aa0c..756efba4 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -28,12 +28,14 @@ "scripts": { "prepare": "cd .. && husky install frontend/.husky", "test": "web-test-runner \"src/**/*.test.{ts,js}\" --node-resolve --playwright --browsers chromium", - "prebuild": "del-cli ./dist", + "prebuild": "del-cli ./dist && yarn localize:prepare", "build": "webpack --config webpack.prod.js", "build-dev": "webpack --mode development", + "prestart": "yarn localize:prepare", "start": "webpack serve --mode=development --config webpack.dev.js", "lint": "eslint --fix \"src/**/*.{ts,js}\"", "format": "prettier --write \"src/**/*.{ts,js,html,css,json}\"", + "localize:prepare": "yarn localize:extract && yarn localize:build", "localize:extract": "lit-localize extract", "localize:build": "lit-localize build" }, diff --git a/frontend/src/__generated__/.keep b/frontend/src/__generated__/.keep new file mode 100644 index 00000000..e69de29b diff --git a/frontend/src/__generated__/locale-codes.ts b/frontend/src/__generated__/locale-codes.ts deleted file mode 100644 index 8ab8586d..00000000 --- a/frontend/src/__generated__/locale-codes.ts +++ /dev/null @@ -1,23 +0,0 @@ -// Do not modify this file by hand! -// Re-generate this file by running lit-localize. - -/** - * The locale code that templates in this source code are written in. - */ -export const sourceLocale = `en`; - -/** - * The other locale codes that this application is localized into. Sorted - * lexicographically. - */ -export const targetLocales = [ - `en-US`, -] as const; - -/** - * All valid project locale codes. Sorted lexicographically. - */ -export const allLocales = [ - `en`, - `en-US`, -] as const; diff --git a/frontend/src/__generated__/locales/en-US.ts b/frontend/src/__generated__/locales/en-US.ts deleted file mode 100644 index 8b3c31e8..00000000 --- a/frontend/src/__generated__/locales/en-US.ts +++ /dev/null @@ -1,85 +0,0 @@ - - // Do not modify this file by hand! - // Re-generate this file by running lit-localize - - - import {str} from '@lit/localize'; - - /* eslint-disable no-irregular-whitespace */ - /* eslint-disable @typescript-eslint/no-explicit-any */ - - export const templates = { - 's9d8b8aa2b404c2c8': `Settings`, -'s9f5a5f23312798f0': `Members`, -'sec0b5ace6765b2a5': str`Successfully invited ${0}`, -'s5e155029a998ab6e': `Add Member`, -'sef49aec68fd1dc66': `Name`, -'s6b2beba7ab637e9e': `Roles`, -'s751678adb0aa2b23': `Member`, -'saae1c70e168b45b4': `Admin`, -'s70b4765cad7bc7cf': `Viewer`, -'s30b4465e07017074': `Back to members list`, -'s049cf53ee4e03bd8': `Add New Member`, -'s57ade424d57c6edf': `Sent`, -'s686306cdb839fb8d': `Sending...`, -'s97ee1bd2cffede65': `Resend verification email`, -'sb64c8390aa317e05': `verified`, -'s4b8701e4b2749e82': `unverified`, -'se85a9ddb91124b39': `Account settings`, -'sd1f44f1a8bc20e67': `Email`, -'sff50532a2d85e32e': `Change password`, -'sfee74640068abc13': `Current password`, -'s3490e2c8b9ec6ad2': `New password`, -'s3794c596ee7964ad': `Update password`, -'s2ceb11be2290bb1b': `Cancel`, -'s60de4a2ab0305e6f': `Wrong password`, -'s3acf6c15de666f7a': `Something went wrong changing password`, -'s36443da197811866': `team-member@email.com`, -'s3de802d9375580c8': `Can start & configure crawls and invite others`, -'s091bfc93121283a6': `Can view crawls`, -'s2afc9a717c161490': `Invite`, -'s2f30d4261790b785': `Something unexpected went wrong`, -'s13786b2be911ee8b': `person@email.com`, -'s9ad1286ef798a58d': `Joining as`, -'s67a47f83f4c07f04': `Enter your email`, -'s115ed3de58eca847': `you@email.com`, -'s6880074d73c3156b': `Create a password`, -'sa9d1dd5d6142477d': `Your name`, -'sc90335b573830bad': `Lisa Simpson`, -'s137af9f7040dc2d2': `(optional)`, -'sdf57c174052aef12': `Your name will be visible to archive collaborators.`, -'s5e6b698a2ec87331': `Sign up`, -'sa2a3411699d81b86': `Invalid email address or password`, -'sec77d4da6a57f2b7': `Page not found`, -'s8f392679ac01fa81': `Successfully signed up`, -'s694b98572e690336': `Click the link in the verification email we sent you to log in.`, -'s67c74844cd95f5fe': `Sign in with password`, -'s7d44a141de0e2c9b': `Forgot your password?`, -'sf6e1665c7022a1f8': `Password`, -'scb04435672ac5410': `Log in`, -'s9ada74585cd89b16': `Your email address`, -'sb6f5b47cf81180bc': `Request password reset`, -'sbf550ad9b31a5f6d': `Sorry, invalid username or password`, -'s43ae2b49c3470555': `Something went wrong, couldn't sign you in`, -'sd3fd65e8d242ed24': `Successfully received your request. You will receive an email to reset your password if your email is found in our system.`, -'s6d37a6bebbc3f8a8': `That email is not a valid email address`, -'s4bfc62609ee1cee2': `Archives`, -'sb971debc37bf0b54': `Owner`, -'s97f86b9ebc519523': `Join archive`, -'s90e89da8d3140a87': `This invitation is not valid.`, -'s7ebc4f216d73836f': `This verification email is not valid.`, -'s95689a99051fa841': `Email address verified`, -'s8759f1186d757714': `Log in to continue.`, -'s3f35c026ab278525': `Resend password reset email?`, -'s00ac24e5b7cc64c2': `Password reset email is not valid. Request a new password reset email`, -'s0aaaa9b770ff1a59': `Invalid password`, -'s7d90fb0e2d1684a7': str`Sent invite to ${0}`, -'s586d6bd2eca2da93': `Users`, -'se5cde7fdda328454': `admin`, -'s5b8c89c6fdc51c40': `Invite Users`, -'s47d31e4dbe55f7d9': `Browsertrix Cloud`, -'s48fd2ebd801bef61': `Your account`, -'sa03807e44737a915': `Log Out`, -'sca974356724f8230': `Log In`, - }; - \ No newline at end of file diff --git a/frontend/src/pages/archive/crawls-list.ts b/frontend/src/pages/archive/crawls-list.ts index f9b3a42b..81d09349 100644 --- a/frontend/src/pages/archive/crawls-list.ts +++ b/frontend/src/pages/archive/crawls-list.ts @@ -159,7 +159,7 @@ export class CrawlsList extends LiteElement { ${this.lastFetched ? msg(html`Last updated: ` diff --git a/frontend/src/pages/archive/index.ts b/frontend/src/pages/archive/index.ts index 02e71b02..94acb509 100644 --- a/frontend/src/pages/archive/index.ts +++ b/frontend/src/pages/archive/index.ts @@ -256,7 +256,7 @@ export class Archive extends LiteElement {
- ${msg("Name", { desc: "Team member's name" })} + ${msg("Name")}
${msg("Role", { desc: "Team member's role" })} diff --git a/frontend/yarn.lock b/frontend/yarn.lock index 66b66224..db253817 100644 --- a/frontend/yarn.lock +++ b/frontend/yarn.lock @@ -138,31 +138,28 @@ resolved "https://registry.yarnpkg.com/@lit-labs/react/-/react-1.1.0.tgz#665cf27cc83c5d0c6782ead5b906bd250619442b" integrity sha512-uvdOtzACm1WzTySpKnqXth62iPL+4yDow7cSZH7m7jHbDr+tZVXn44DJ5IoJuMjEevORRe57lNrOywFW6d4Fyg== +"@lit-labs/ssr-dom-shim@^1.0.0": + version "1.0.0" + resolved "https://registry.yarnpkg.com/@lit-labs/ssr-dom-shim/-/ssr-dom-shim-1.0.0.tgz#427e19a2765681fd83411cd72c55ba80a01e0523" + integrity sha512-ic93MBXfApIFTrup4a70M/+ddD8xdt2zxxj9sRwHQzhS9ag/syqkD8JPdTXsc1gUy2K8TTirhlCqyTEM/sifNw== + "@lit/localize-tools@^0.6.5": - version "0.6.5" - resolved "https://registry.yarnpkg.com/@lit/localize-tools/-/localize-tools-0.6.5.tgz#d510f8bd6d0fc3fa469e53c09552febc5c3b64c0" - integrity sha512-/zBl7PuY5ZKCHD5quqF2SgGpJejPEK6ae6G8r1YJjbK7edTH4Ukaha+c5cBmtyIagFVCD6DpQDBkiLYUZ92UoQ== + version "0.6.6" + resolved "https://registry.yarnpkg.com/@lit/localize-tools/-/localize-tools-0.6.6.tgz#418bb36b3849f3eae5184fab40cd122d7af9c821" + integrity sha512-Lv47Kp+wElypqTtlaybJnp3Ew+jECaeUYrRBHqtQhDOpnz2DjW9+Jt+zwVpU8VAM8Z7aspceBpSyqm9HTuwKhw== dependencies: "@lit/localize" "^0.11.0" "@xmldom/xmldom" "^0.8.2" fast-glob "^3.2.7" fs-extra "^10.0.0" jsonschema "^1.4.0" - lit "^2.2.0" + lit "^2.6.0" minimist "^1.2.5" parse5 "^6.0.1" source-map-support "^0.5.19" typescript "~4.7.4" -"@lit/localize@^0.11.0": - version "0.11.1" - resolved "https://registry.yarnpkg.com/@lit/localize/-/localize-0.11.1.tgz#eda104ee88ee1f2e820729918b04c560cf3ebf90" - integrity sha512-8LVAZy38QxPAEaz2iKAaaUWuH9Tv2YiQcAcQIC9Cx+L9MG9fBk6yFFQ0QTtZwDE4A8pL4A2w99jRHl3VKUtCaA== - dependencies: - "@lit/reactive-element" "^1.0.0" - lit "^2.0.0" - -"@lit/localize@^0.11.4": +"@lit/localize@^0.11.0", "@lit/localize@^0.11.4": version "0.11.4" resolved "https://registry.yarnpkg.com/@lit/localize/-/localize-0.11.4.tgz#4a5758965977828c10c51738fbb1890decb3d8f6" integrity sha512-RRIwIX2tAm3+DuEndoXSJrFjGrAK5cb5IXo5K6jcJ6sbgD829B8rSqHC5MaKVUmXTVLIR1bk5IZOZDf9wFereA== @@ -180,6 +177,13 @@ resolved "https://registry.yarnpkg.com/@lit/reactive-element/-/reactive-element-1.4.2.tgz#65d659e89d1a7e2f4f2b547182aef0a224f4adb7" integrity sha512-VMOxsWh/QDwrxPsgkSQnuZ+8mfNy1OTjzzUdLBvvZtpahwPTHTeVZ51RZRqO4xfKVrR+btIPA8D01IL3xeG66w== +"@lit/reactive-element@^1.6.0": + version "1.6.1" + resolved "https://registry.yarnpkg.com/@lit/reactive-element/-/reactive-element-1.6.1.tgz#0d958b6d479d0e3db5fc1132ecc4fa84be3f0b93" + integrity sha512-va15kYZr7KZNNPZdxONGQzpUr+4sxVu7V/VG7a8mRfPPXUyhEYj5RzXCQmGrlP3tAh0L3HHm5AjBMFYRqlM9SA== + dependencies: + "@lit-labs/ssr-dom-shim" "^1.0.0" + "@mdn/browser-compat-data@^4.0.0": version "4.0.11" resolved "https://registry.yarnpkg.com/@mdn/browser-compat-data/-/browser-compat-data-4.0.11.tgz#c49a72db566e9d4651f43398da276289811c868f" @@ -2796,9 +2800,9 @@ fs-constants@^1.0.0: integrity sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow== fs-extra@^10.0.0: - version "10.0.0" - resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-10.0.0.tgz#9ff61b655dde53fb34a82df84bb214ce802e17c1" - integrity sha512-C5owb14u9eJwizKGdchcDUQeFtlSHHthBk8pbX9Vc1PFZrLombudjDnNns88aYslCyF6IY5SUw3Roz6xShcEIQ== + version "10.1.0" + resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-10.1.0.tgz#02873cfbc4084dde127eaa5f9905eef2325d1abf" + integrity sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ== dependencies: graceful-fs "^4.2.0" jsonfile "^6.0.1" @@ -2905,11 +2909,16 @@ globby@^11.0.1, globby@^11.0.3, globby@^11.0.4: merge2 "^1.3.0" slash "^3.0.0" -graceful-fs@^4.1.2, graceful-fs@^4.1.6, graceful-fs@^4.2.0, graceful-fs@^4.2.4, graceful-fs@^4.2.6: +graceful-fs@^4.1.2, graceful-fs@^4.2.4, graceful-fs@^4.2.6: version "4.2.8" resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.8.tgz#e412b8d33f5e006593cbd3cee6df9f2cebbe802a" integrity sha512-qkIilPUYcNhJpd33n0GBXTB1MMPp14TxEsEs0pTrsSVucApsYzW5V+Q8Qxhik6KU3evy+qkAAowTByymK0avdg== +graceful-fs@^4.1.6, graceful-fs@^4.2.0: + version "4.2.10" + resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.10.tgz#147d3a006da4ca3ce14728c7aefc287c367d7a6c" + integrity sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA== + handle-thing@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/handle-thing/-/handle-thing-2.0.1.tgz#857f79ce359580c340d43081cc648970d0bb234e" @@ -3543,9 +3552,9 @@ jsonfile@^6.0.1: graceful-fs "^4.1.6" jsonschema@^1.4.0: - version "1.4.0" - resolved "https://registry.yarnpkg.com/jsonschema/-/jsonschema-1.4.0.tgz#1afa34c4bc22190d8e42271ec17ac8b3404f87b2" - integrity sha512-/YgW6pRMr6M7C+4o8kS+B/2myEpHCrxO4PEWnqJNBFMjn7EWXqlQ4tGwL6xTHeRplwuZmcAncdvfOad1nT2yMw== + version "1.4.1" + resolved "https://registry.yarnpkg.com/jsonschema/-/jsonschema-1.4.1.tgz#cc4c3f0077fb4542982973d8a083b6b34f482dab" + integrity sha512-S6cATIPVv1z0IlxdN+zUk5EPjkGCdnhN4wVSBlvoUO1tOLJootbo9CquNJmbIh4yikWHiUedhRYrNPn1arpEmQ== just-extend@^4.0.2: version "4.2.1" @@ -3724,6 +3733,13 @@ lit-html@^2.2.0, lit-html@^2.4.0: dependencies: "@types/trusted-types" "^2.0.2" +lit-html@^2.6.0: + version "2.6.1" + resolved "https://registry.yarnpkg.com/lit-html/-/lit-html-2.6.1.tgz#eb29f0b0c2ab54ea77379db11fc011b0c71f1cda" + integrity sha512-Z3iw+E+3KKFn9t2YKNjsXNEu/LRLI98mtH/C6lnFg7kvaqPIzPn124Yd4eT/43lyqrejpc5Wb6BHq3fdv4S8Rw== + dependencies: + "@types/trusted-types" "^2.0.2" + lit@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/lit/-/lit-2.0.0.tgz#7710095dc518d9858dde579e9c76b9eed71e98ba" @@ -3733,7 +3749,16 @@ lit@^2.0.0: lit-element "^3.0.0" lit-html "^2.0.0" -lit@^2.2.0, lit@^2.3.0, lit@^2.4.1: +lit@^2.3.0, lit@^2.6.0: + version "2.6.1" + resolved "https://registry.yarnpkg.com/lit/-/lit-2.6.1.tgz#5951a2098b9bde5b328c73b55c15fdc0eefd96d7" + integrity sha512-DT87LD64f8acR7uVp7kZfhLRrHkfC/N4BVzAtnw9Yg8087mbBJ//qedwdwX0kzDbxgPccWRW6mFwGbRQIxy0pw== + dependencies: + "@lit/reactive-element" "^1.6.0" + lit-element "^3.2.0" + lit-html "^2.6.0" + +lit@^2.4.1: version "2.4.1" resolved "https://registry.yarnpkg.com/lit/-/lit-2.4.1.tgz#21251ac14eb1ec8ca7cd15c9ac3564359809f7b5" integrity sha512-qohSgLiyN1cFnJG26dIiY03S4F49857A0AHQfnS0zYtnUVnD2MFvx+UT52rtXsIuNFQrnUupX+zyGSATlk1f/A==