Skip to content

Commit

Permalink
translate(frontend): update namespaces
Browse files Browse the repository at this point in the history
  • Loading branch information
gangjun06 committed Nov 27, 2022
1 parent 4bdb48d commit 20e5100
Show file tree
Hide file tree
Showing 9 changed files with 135 additions and 129 deletions.
1 change: 1 addition & 0 deletions docker-compose.dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 7 additions & 7 deletions frontend/components/basic/layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand All @@ -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: <FontAwesomeIcon icon={faHouse} />,
},
{
href: "/users/" + workspaceMapping[workspaceSelected],
title: t("common:nav.menu.members"),
title: t("nav:menu.members"),
emoji: <FontAwesomeIcon icon={faUser} />,
},
{
href: "/integrations/" + workspaceMapping[workspaceSelected],
title: t("common:nav.menu.integrations"),
title: t("nav:menu.integrations"),
emoji: <FontAwesomeIcon icon={faLink} />,
},
{
href: "/settings/project/" + workspaceMapping[workspaceSelected],
title: t("common:nav.menu.project-settings"),
title: t("nav:menu.project-settings"),
emoji: <FontAwesomeIcon icon={faGear} />,
},
];
Expand Down Expand Up @@ -238,7 +238,7 @@ export default function Layout({ children }) {
<div className="py-6"></div>
<div className="flex justify-center w-full mt-7 mb-8 bg-bunker-600 w-full h-full flex flex-col items-center px-4">
<div className="text-gray-400 self-start ml-1 mb-1 text-xs font-semibold tracking-wide">
{t("common:nav.menu.project")}
{t("nav:menu.project")}
</div>
{workspaceList.length > 0 ? (
<Listbox
Expand Down Expand Up @@ -331,7 +331,7 @@ export default function Layout({ children }) {
className="text-gray-300 text-7xl mb-8"
/>
<p className="text-gray-200 px-6 text-center text-lg max-w-sm">
{` ${t("common:need-login")} `}
{` ${t("need-login")} `}
</p>
</div>
</>
Expand Down
22 changes: 10 additions & 12 deletions frontend/components/navigation/NavBarDashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,22 +29,22 @@ import useTranslation from "next-translate/useTranslation";
const supportOptions = (t) => [
[
<FontAwesomeIcon className="text-lg pl-1.5 pr-3" icon={faSlack} />,
t("common:nav.support.slack"),
t("nav:support.slack"),
"https://join.slack.com/t/infisical/shared_invite/zt-1dgg63ln8-G7PCNJdCymAT9YF3j1ewVA",
],
[
<FontAwesomeIcon className="text-lg pl-1.5 pr-3" icon={faBook} />,
t("common:nav.support.docs"),
t("nav:support.docs"),
"https://infisical.com/docs/getting-started/introduction",
],
[
<FontAwesomeIcon className="text-lg pl-1.5 pr-3" icon={faGithub} />,
t("common:nav.support.issue"),
t("nav:support.issue"),
"https://github.com/Infisical/infisical-cli/issues",
],
[
<FontAwesomeIcon className="text-lg pl-1.5 pr-3" icon={faEnvelope} />,
t("common:nav.support.email"),
t("nav:support.email"),
"mailto:[email protected]",
],
];
Expand All @@ -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]);

Expand Down Expand Up @@ -152,7 +152,7 @@ export default function Navbar({ onButtonPressed }) {
<Menu.Items className="absolute right-0 mt-0.5 w-64 origin-top-right divide-y divide-gray-700 rounded-md bg-bunker border border-mineshaft-700 shadow-lg ring-1 ring-black z-20 ring-opacity-5 focus:outline-none">
<div className="px-1 py-1 ">
<div className="text-gray-400 self-start ml-2 mt-2 text-xs font-semibold tracking-wide">
{t("common:nav.user.signed-in-as")}
{t("nav:user.signed-in-as")}
</div>
<div
onClick={() =>
Expand Down Expand Up @@ -187,7 +187,7 @@ export default function Navbar({ onButtonPressed }) {
</div>
<div className="px-2 pt-2">
<div className="text-gray-400 self-start ml-2 mt-2 text-xs font-semibold tracking-wide">
{t("common:nav.user.current-organization")}
{t("nav:user.current-organization")}
</div>
<div
onClick={() =>
Expand Down Expand Up @@ -228,7 +228,7 @@ export default function Navbar({ onButtonPressed }) {
icon={faCoins}
/>
<div className="text-sm">
{t("common:nav.user.usage-billing")}
{t("nav:user.usage-billing")}
</div>
</div>
</button>
Expand All @@ -253,17 +253,15 @@ export default function Navbar({ onButtonPressed }) {
/>
</span>
<div className="text-sm ml-1">
{t("common:nav.user.invite")}
{t("nav:user.invite")}
</div>
</div>
</button>
</div>
{orgs?.length > 1 && (
<div className="px-1 pt-1">
<div className="text-gray-400 self-start ml-2 mt-2 text-xs font-semibold tracking-wide">
{t(
"common:nav.user.other-organizations"
)}
{t("nav:user.other-organizations")}
</div>
<div className="flex flex-col items-start px-1 mt-3 mb-2">
{orgs
Expand Down
3 changes: 2 additions & 1 deletion frontend/i18n.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ module.exports = {
locales: ["en-US", "ko-KR"],
defaultLocale: "en-US",
pages: {
"*": ["common"],
"*": ["common", "nav"],
"reg:^/(login|signup)": ["auth"],
},
};
32 changes: 32 additions & 0 deletions frontend/locales/en-US/auth.json
Original file line number Diff line number Diff line change
@@ -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": "<wrapper>We've sent a verification email to</wrapper><email>{{email}}</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"
}
54 changes: 0 additions & 54 deletions frontend/locales/en-US/common.json
Original file line number Diff line number Diff line change
@@ -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",
Expand All @@ -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": "<wrapper>We've sent a verification email to</wrapper><email>{{email}}</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."
}
22 changes: 22 additions & 0 deletions frontend/locales/en-US/nav.json
Original file line number Diff line number Diff line change
@@ -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"
}
}
25 changes: 14 additions & 11 deletions frontend/pages/login.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -55,13 +55,16 @@ export default function Login() {
return (
<div className="bg-bunker-800 h-screen flex flex-col justify-start px-6">
<Head>
<title>{t("meta.login.title")}</title>
<title>{t("auth:meta.login.title")}</title>
<link rel="icon" href="/infisical.ico" />
<meta property="og:image" content="/images/message.png" />
<meta property="og:title" content={t("meta.login.og-title")} />
<meta
property="og:title"
content={t("auth:meta.login.og-title")}
/>
<meta
name="og:description"
content={t("meta.login.og-description")}
content={t("auth:meta.login.og-description")}
/>
</Head>
<Link href="/">
Expand All @@ -76,25 +79,25 @@ export default function Login() {
</Link>
<div className="bg-bunker w-full max-w-md mx-auto h-7/12 py-4 pt-8 px-6 rounded-xl drop-shadow-xl">
<p className="text-4xl flex justify-center font-semibold text-transparent bg-clip-text bg-gradient-to-br from-sky-400 to-primary">
{t("auth.login")}
{t("auth:login")}
</p>
<div className="flex flex-row items-center justify-center">
<p className="text-md flex justify-center mt-2 text-gray-400">
{t("auth.need-account")}
{t("auth:need-account")}
</p>
</div>
<div className="flex flex-col items-center justify-center w-full md:pb-4 max-h-24 max-w-md mx-auto">
<Link href="/signup">
<button className="w-full pb-3 hover:opacity-90 duration-200">
<u className="font-normal text-md text-sky-500">
{t("auth.create-account")}
{t("auth:create-account")}
</u>
</button>
</Link>
</div>
<div className="flex items-center justify-center w-full md:p-2 rounded-lg mt-4 md:mt-0 max-h-24 md:max-h-28">
<InputField
label={t("email")}
label={t("common:email")}
onChangeHandler={setEmail}
type="email"
value={email}
Expand All @@ -104,7 +107,7 @@ export default function Login() {
</div>
<div className="flex items-center justify-center w-full md:p-2 rounded-lg md:mt-2 mt-6 max-h-24 md:max-h-28">
<InputField
label={t("password")}
label={t("common:password")}
onChangeHandler={setPassword}
type="password"
value={password}
Expand All @@ -118,7 +121,7 @@ export default function Login() {
<div className="flex flex-col items-center justify-center w-full md:p-2 max-h-20 max-w-md mt-4 mx-auto text-sm">
<div className="text-l mt-6 m-8 px-8 py-3 text-lg">
<Button
text={t("login")}
text={t("auth:login")}
onButtonPressed={loginCheck}
loading={isLoading}
size="lg"
Expand All @@ -136,7 +139,7 @@ export default function Login() {
className="ml-2 mr-6 text-6xl"
/>

{t("maintenance-alert")}
{t("auth:maintenance-alert")}
</div>
)}
</div>
Expand Down
Loading

0 comments on commit 20e5100

Please sign in to comment.