From 20e5100bc4c4d940371c02e3a16321b23cc96097 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=9D=B4=EA=B0=95=EC=A4=80?= Date: Sun, 27 Nov 2022 13:56:18 +0900 Subject: [PATCH] translate(frontend): update namespaces --- docker-compose.dev.yml | 1 + frontend/components/basic/layout.js | 14 +-- .../components/navigation/NavBarDashboard.js | 22 ++--- frontend/i18n.js | 3 +- frontend/locales/en-US/auth.json | 32 +++++++ frontend/locales/en-US/common.json | 54 ----------- frontend/locales/en-US/nav.json | 22 +++++ frontend/pages/login.js | 25 ++--- frontend/pages/signup.js | 91 ++++++++++--------- 9 files changed, 135 insertions(+), 129 deletions(-) create mode 100644 frontend/locales/en-US/auth.json create mode 100644 frontend/locales/en-US/nav.json diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml index 0fab869eb..ce234d12d 100644 --- a/docker-compose.dev.yml +++ b/docker-compose.dev.yml @@ -50,6 +50,7 @@ services: - ./frontend/styles:/app/styles - ./frontend/components:/app/components - ./frontend/locales:/app/locales + - ./frontend/i18n.js:/app/i18n.js env_file: .env environment: - NEXT_PUBLIC_ENV=development diff --git a/frontend/components/basic/layout.js b/frontend/components/basic/layout.js index 366368d9a..9530e5e66 100644 --- a/frontend/components/basic/layout.js +++ b/frontend/components/basic/layout.js @@ -106,7 +106,7 @@ export default function Layout({ children }) { setIsOpen(false); setNewWorkspaceName(""); } else { - setError(t("common:error_project-already-exists")); + setError(t("error_project-already-exists")); setLoading(false); } } @@ -121,22 +121,22 @@ export default function Layout({ children }) { "/dashboard/" + workspaceMapping[workspaceSelected] + "?Development", - title: t("common:nav.menu.secrets"), + title: t("nav:menu.secrets"), emoji: , }, { href: "/users/" + workspaceMapping[workspaceSelected], - title: t("common:nav.menu.members"), + title: t("nav:menu.members"), emoji: , }, { href: "/integrations/" + workspaceMapping[workspaceSelected], - title: t("common:nav.menu.integrations"), + title: t("nav:menu.integrations"), emoji: , }, { href: "/settings/project/" + workspaceMapping[workspaceSelected], - title: t("common:nav.menu.project-settings"), + title: t("nav:menu.project-settings"), emoji: , }, ]; @@ -238,7 +238,7 @@ export default function Layout({ children }) {
- {t("common:nav.menu.project")} + {t("nav:menu.project")}
{workspaceList.length > 0 ? (

- {` ${t("common:need-login")} `} + {` ${t("need-login")} `}

diff --git a/frontend/components/navigation/NavBarDashboard.js b/frontend/components/navigation/NavBarDashboard.js index d4429b00e..705d09251 100644 --- a/frontend/components/navigation/NavBarDashboard.js +++ b/frontend/components/navigation/NavBarDashboard.js @@ -29,22 +29,22 @@ import useTranslation from "next-translate/useTranslation"; const supportOptions = (t) => [ [ , - t("common:nav.support.slack"), + t("nav:support.slack"), "https://join.slack.com/t/infisical/shared_invite/zt-1dgg63ln8-G7PCNJdCymAT9YF3j1ewVA", ], [ , - t("common:nav.support.docs"), + t("nav:support.docs"), "https://infisical.com/docs/getting-started/introduction", ], [ , - t("common:nav.support.issue"), + t("nav:support.issue"), "https://github.com/Infisical/infisical-cli/issues", ], [ , - t("common:nav.support.email"), + t("nav:support.email"), "mailto:support@infisical.com", ], ]; @@ -55,7 +55,7 @@ export default function Navbar({ onButtonPressed }) { const [orgs, setOrgs] = useState([]); const [currentOrg, setCurrentOrg] = useState([]); - const { t } = useTranslation("common"); + const { t } = useTranslation(""); const supportOptionsList = useMemo(() => supportOptions(t), [t]); @@ -152,7 +152,7 @@ export default function Navbar({ onButtonPressed }) {
- {t("common:nav.user.signed-in-as")} + {t("nav:user.signed-in-as")}
@@ -187,7 +187,7 @@ export default function Navbar({ onButtonPressed }) {
- {t("common:nav.user.current-organization")} + {t("nav:user.current-organization")}
@@ -228,7 +228,7 @@ export default function Navbar({ onButtonPressed }) { icon={faCoins} />
- {t("common:nav.user.usage-billing")} + {t("nav:user.usage-billing")}
@@ -253,7 +253,7 @@ export default function Navbar({ onButtonPressed }) { />
- {t("common:nav.user.invite")} + {t("nav:user.invite")}
@@ -261,9 +261,7 @@ export default function Navbar({ onButtonPressed }) { {orgs?.length > 1 && (
- {t( - "common:nav.user.other-organizations" - )} + {t("nav:user.other-organizations")}
{orgs diff --git a/frontend/i18n.js b/frontend/i18n.js index 7538b1b84..7be79b767 100644 --- a/frontend/i18n.js +++ b/frontend/i18n.js @@ -2,6 +2,7 @@ module.exports = { locales: ["en-US", "ko-KR"], defaultLocale: "en-US", pages: { - "*": ["common"], + "*": ["common", "nav"], + "reg:^/(login|signup)": ["auth"], }, }; diff --git a/frontend/locales/en-US/auth.json b/frontend/locales/en-US/auth.json new file mode 100644 index 000000000..81c4918d0 --- /dev/null +++ b/frontend/locales/en-US/auth.json @@ -0,0 +1,32 @@ +{ + "meta": { + "login": { + "title": "Login | Infiscal", + "og-title": "Log In to Infisical", + "og-description": "Infisical a simple end-to-end encrypted platform that enables teams to sync and manage their .env files." + }, + "signup": { + "title": "Sign Up | Infiscal", + "og-title": "Replace .env files with 1 line of code. Sign Up for Infisical in 3 minutes.", + "og-description": "Infisical a simple end-to-end encrypted platform that enables teams to sync and manage API-keys and environemntal variables. Works with Node.js, Next.js, Gatsby, Nest.js..." + } + }, + "login": "Log In", + "signup": "Sign Up", + "need-account": "Need an Infisical account?", + "create-account": "Create an account", + "already-have-account": "Have an account? Log in", + "forgot-password": "Forgot your password?", + "step1-start": "Let's get started", + "step1-privacy": "By creating an account, you agree to our Terms and have read and acknowledged the Privacy Policy.", + "step1-submit": "Get Started", + "step2-message": "We've sent a verification email to{{email}}", + "step2-code-error": "Oops. Your code is wrong. Please try again.", + "step2-spam-alert": "Make sure to check your spam inbox.", + "step3-message": "Almost there!", + "step4-message": "Save your Emergency Kit", + "step4-description1": "If you get locked out of your account, your Emergency Kit is the only way to sign in.", + "step4-description2": "We recommend you download it and keep it somewhere safe.", + "step4-description3": "It contains your Secret Key which we cannot access or recover for you if you lose it.", + "step4-download": "Download PDF" +} diff --git a/frontend/locales/en-US/common.json b/frontend/locales/en-US/common.json index a50f0c204..41868c0bd 100644 --- a/frontend/locales/en-US/common.json +++ b/frontend/locales/en-US/common.json @@ -1,38 +1,4 @@ { - "meta": { - "login": { - "title": "Login | Infiscal", - "og-title": "Log In to Infisical", - "og-description": "Infisical a simple end-to-end encrypted platform that enables teams to sync and manage their .env files." - }, - "signup": { - "title": "Sign Up | Infiscal", - "og-title": "Replace .env files with 1 line of code. Sign Up for Infisical in 3 minutes.", - "og-description": "Infisical a simple end-to-end encrypted platform that enables teams to sync and manage API-keys and environemntal variables. Works with Node.js, Next.js, Gatsby, Nest.js..." - } - }, - "nav": { - "support": { - "slack": "[NEW] Join Slack Forum", - "docs": "Read Docs", - "issue": "Open a Github Issue", - "email": "Send us an Email" - }, - "user": { - "signed-in-as": "SIGNED IN AS", - "current-organization": "CURRENT ORGANIZATION", - "usage-billing": "Usage & Billing", - "invite": "Invite Members", - "other-organizations": "OTHER ORGANIZATION" - }, - "menu": { - "project": "PROJECT", - "secrets": "Secrets", - "members": "Members", - "integrations": "Integrations", - "project-settings": "Project Settings" - } - }, "error_project-already-exists": "A project with this name already exists.", "need-login": " To use Infisical, please log in through a device with larger dimensions. ", "email": "Email", @@ -46,25 +12,5 @@ "password-validate-length": "14 characters", "password-validate-case": "1 lowercase character", "password-validate-number": "1 number", - "auth": { - "login": "Log In", - "signup": "Sign Up", - "need-account": "Need an Infisical account?", - "create-account": "Create an account", - "already-have-account": "Have an account? Log in", - "forgot-password": "Forgot your password?", - "step1-start": "Let's get started", - "step1-privacy": "By creating an account, you agree to our Terms and have read and acknowledged the Privacy Policy.", - "step1-submit": "Get Started", - "step2-message": "We've sent a verification email to{{email}}", - "step2-code-error": "Oops. Your code is wrong. Please try again.", - "step2-spam-alert": "Make sure to check your spam inbox.", - "step3-message": "Almost there!", - "step4-message": "Save your Emergency Kit", - "step4-description1": "If you get locked out of your account, your Emergency Kit is the only way to sign in.", - "step4-description2": "We recommend you download it and keep it somewhere safe.", - "step4-description3": "It contains your Secret Key which we cannot access or recover for you if you lose it.", - "step4-download": "Download PDF" - }, "maintenance-alert": "We are experiencing minor technical difficulties. We are working on solving it right now. Please come back in a few minutes." } diff --git a/frontend/locales/en-US/nav.json b/frontend/locales/en-US/nav.json new file mode 100644 index 000000000..9448a53a7 --- /dev/null +++ b/frontend/locales/en-US/nav.json @@ -0,0 +1,22 @@ +{ + "support": { + "slack": "[NEW] Join Slack Forum", + "docs": "Read Docs", + "issue": "Open a Github Issue", + "email": "Send us an Email" + }, + "user": { + "signed-in-as": "SIGNED IN AS", + "current-organization": "CURRENT ORGANIZATION", + "usage-billing": "Usage & Billing", + "invite": "Invite Members", + "other-organizations": "OTHER ORGANIZATION" + }, + "menu": { + "project": "PROJECT", + "secrets": "Secrets", + "members": "Members", + "integrations": "Integrations", + "project-settings": "Project Settings" + } +} diff --git a/frontend/pages/login.js b/frontend/pages/login.js index 966774642..55c2be3d0 100644 --- a/frontend/pages/login.js +++ b/frontend/pages/login.js @@ -20,7 +20,7 @@ export default function Login() { const [errorLogin, setErrorLogin] = useState(false); const [isLoading, setIsLoading] = useState(false); const router = useRouter(); - const { t } = useTranslation("common"); + const { t } = useTranslation(""); useEffect(async () => { let userWorkspace; @@ -55,13 +55,16 @@ export default function Login() { return (
- {t("meta.login.title")} + {t("auth:meta.login.title")} - + @@ -76,25 +79,25 @@ export default function Login() {

- {t("auth.login")} + {t("auth:login")}

- {t("auth.need-account")} + {t("auth:need-account")}

)}
diff --git a/frontend/pages/signup.js b/frontend/pages/signup.js index eed571b5b..dd5f18b7e 100644 --- a/frontend/pages/signup.js +++ b/frontend/pages/signup.js @@ -87,16 +87,16 @@ export default function SignUp() { const [verificationToken, setVerificationToken] = useState(); const [backupKeyIssued, setBackupKeyIssued] = useState(false); - const { t } = useTranslation("common"); + const { t } = useTranslation(); useEffect(async () => { let userWorkspace; try { const userWorkspaces = await getWorkspaces(); userWorkspace = userWorkspaces[0]._id; - router.push("/dashboard/" + userWorkspace); + router.push("auth:/dashboard/" + userWorkspace); } catch (error) { - console.log("Error - Not logged in yet"); + console.log("auth:Error - Not logged in yet"); } }, []); @@ -130,15 +130,15 @@ export default function SignUp() { var emailCheckBool = false; if (!email) { setEmailError(true); - setEmailErrorMessage("Please enter your email."); + setEmailErrorMessage("auth:Please enter your email."); emailCheckBool = true; } else if ( - !email.includes("@") || - !email.includes(".") || + !email.includes("auth:@") || + !email.includes("auth:.") || !/[a-z]/.test(email) ) { setEmailError(true); - setEmailErrorMessage("Please enter a valid email."); + setEmailErrorMessage("auth:Please enter a valid email."); emailCheckBool = true; } else { setEmailError(false); @@ -194,7 +194,7 @@ export default function SignUp() { "0" ) ); - localStorage.setItem("PRIVATE_KEY", PRIVATE_KEY); + localStorage.setItem("auth:PRIVATE_KEY", PRIVATE_KEY); client.init( { @@ -223,13 +223,13 @@ export default function SignUp() { if (!errorCheck && response.status == "200") { response = await response.json(); - localStorage.setItem("publicKey", PUBLIC_KEY); + localStorage.setItem("auth:publicKey", PUBLIC_KEY); localStorage.setItem( "encryptedPrivateKey", ciphertext ); - localStorage.setItem("iv", iv); - localStorage.setItem("tag", tag); + localStorage.setItem("auth:iv", iv); + localStorage.setItem("auth:tag", tag); try { await attemptLogin( @@ -257,20 +257,20 @@ export default function SignUp() { const step1 = (

- {t("auth.step1-start")} + {t("auth:step1-start")}

*/}

- {t("auth.step2-spam-alert")} + {t("auth:step2-spam-alert")}

@@ -361,37 +361,37 @@ export default function SignUp() { const step3 = (

- {t("auth.step3-message")} + {t("auth:step3-message")}

{ setPassword(password); passwordCheck( @@ -416,7 +416,7 @@ export default function SignUp() { passwordErrorNumber ? (
- {t("password-validate")} + {t("auth:password-validate")}
{passwordErrorLength ? ( @@ -437,7 +437,7 @@ export default function SignUp() { : "text-gray-600" } text-sm`} > - {t("password-validate-length")} + {t("auth:password-validate-length")}
@@ -459,7 +459,7 @@ export default function SignUp() { : "text-gray-600" } text-sm`} > - {t("password-validate-case")} + {t("auth:password-validate-case")}
@@ -481,7 +481,7 @@ export default function SignUp() { : "text-gray-600" } text-sm`} > - {t("password-validate-number")} + {t("auth:password-validate-number")}
@@ -491,7 +491,7 @@ export default function SignUp() {