From d282755ba9de57dfd4212df15938667f82633eab Mon Sep 17 00:00:00 2001 From: leguan <59799222+Leguan16@users.noreply.github.com> Date: Sat, 25 May 2024 10:28:04 +0200 Subject: [PATCH] i18n: Add more translatable fields (#1358) --- frontend/src/components/layout/Header.vue | 18 ++--- .../src/components/projects/ProjectCard.vue | 4 +- frontend/src/i18n/locales/en.json | 69 +++++++++++++++- frontend/src/pages/auth/settings/account.vue | 10 +-- frontend/src/pages/auth/settings/other.vue | 4 +- frontend/src/pages/auth/settings/profile.vue | 14 ++-- frontend/src/pages/auth/settings/security.vue | 81 ++++++++++++------- 7 files changed, 140 insertions(+), 60 deletions(-) diff --git a/frontend/src/components/layout/Header.vue b/frontend/src/components/layout/Header.vue index 27e90a2d..f1d69332 100644 --- a/frontend/src/components/layout/Header.vue +++ b/frontend/src/components/layout/Header.vue @@ -41,18 +41,18 @@ if (authStore.user) { type NavBarLinks = { link: string; label: string; icon?: any }[]; const navBarLinks: NavBarLinks = [ - { link: "index", label: "Home" }, - { link: "authors", label: "Authors" }, - { link: "staff", label: "Team" }, + { link: "index", label: t("nav.indexTitle") }, + { link: "authors", label: t("nav.authorsTitle") }, + { link: "staff", label: t("nav.staffTitle") }, ]; const navBarMenuLinksHangar: NavBarLinks = [ - { link: "index", label: "Home", icon: IconMdiHome }, - { link: "guidelines", label: "Resource Guidelines", icon: IconMdiFileDocumentAlert }, - { link: "new", label: "Create Project", icon: IconMdiFolderPlusOutline }, - { link: "neworganization", label: "Create Organization", icon: IconMdiFolderPlusOutline }, - { link: "authors", label: "Authors", icon: IconMdiAccountGroup }, - { link: "staff", label: "Team", icon: IconMdiAccountGroup }, + { link: "index", label: t("general.home"), icon: IconMdiHome }, + { link: "guidelines", label: t("guidelines.title"), icon: IconMdiFileDocumentAlert }, + { link: "new", label: t("nav.links.createProject"), icon: IconMdiFolderPlusOutline }, + { link: "neworganization", label: t("nav.links.createOrganization"), icon: IconMdiFolderPlusOutline }, + { link: "authors", label: t("nav.authorsTitle"), icon: IconMdiAccountGroup }, + { link: "staff", label: t("nav.staffTitle"), icon: IconMdiAccountGroup }, ]; if (!authStore.user) { navBarMenuLinksHangar.splice(2, 2); diff --git a/frontend/src/components/projects/ProjectCard.vue b/frontend/src/components/projects/ProjectCard.vue index 5db3fb07..d54a8fe4 100644 --- a/frontend/src/components/projects/ProjectCard.vue +++ b/frontend/src/components/projects/ProjectCard.vue @@ -25,9 +25,9 @@ defineProps<{

- {{ project.name }} + {{ project.name }}  + {{ i18n.t("general.by") }}  - by {{ project.namespace.owner }} diff --git a/frontend/src/i18n/locales/en.json b/frontend/src/i18n/locales/en.json index 6f8699ec..692533d8 100644 --- a/frontend/src/i18n/locales/en.json +++ b/frontend/src/i18n/locales/en.json @@ -6,6 +6,7 @@ "icon": "US" }, "general": { + "by": "by", "close": "Close", "submit": "Submit", "save": "Save", @@ -31,6 +32,8 @@ "today": "Today", "yesterday": "Yesterday", "tomorrow": "Tomorrow", + "used": "Used", + "reveal": "Reveal", "error": { "invalidUrl": "Invalid URL format", "nameEmpty": "Name cannot be empty", @@ -83,6 +86,9 @@ } }, "nav": { + "indexTitle": "Home", + "authorsTitle": "Authors", + "staffTitle": "Staff", "login": "Login", "signup": "Signup", "user": { @@ -133,6 +139,10 @@ "javadocs": "JavaDocs", "downloads": "Downloads", "community": "Community" + }, + "links": { + "createProject": "Create Project", + "createOrganization": "Create Organization" } }, "guidelines": { @@ -933,20 +943,71 @@ "auth": { "settings": { "profile": { - "header": "Profile" + "header": "Profile", + "avatar": "Avatar", + "tagline": "Tagline", + "social": "Social" }, "account": { - "header": "Account" + "header": "Account", + "username": "Username", + "verifyEmail": "Verify email", + "currentPassword": "Current Password", + "newPassword": "New Password (Optional)" }, "security": { - "header": "Security" + "header": "Security", + "authApp": "Authenticator App", + "devices": "Devices", + "button": { + "setupAuthApp": "Setup 2FA via authenticator app", + "setupSecurityKey": "Setup 2FA via security key", + "linkGithub": "Link a GitHub account", + "linkOther": "Link {0} account", + "unlinkAccount": "Unlink {0} account {1}" + }, + "authAppSetup": { + "scan": "Scan the QR code on the right using your favorite authenticator app", + "cantScan": "Can't scan? Enter the secret listed below the image!", + "enterTotp": "Enter a TOTP code generated by your authenticator app in the box below.", + "verifyTotp": "Verify TOTP code and activate" + }, + "securityKeys": { + "name": "Security Keys", + "keyName": "Name", + "unregister": "Unregister", + "rename": "Rename" + }, + "backupCodes": { + "name": "Backup Codes", + "generateNew": "Generate new codes", + "modal": { + "title": "Confirm backup codes", + "needConfigure": "You need to configure backup codes before you can activate 2fa. Please save these codes securely!", + "confirm": "Confirm that you saved the backup codes by entering one of them below", + "backupCode": "Backup Code" + } + }, + "unlinkOAuth": { + "cantUnlink": "You can't unlink your last oauth credential if you don't have a password set", + "modal": { + "title": "Successfully unlinked!", + "message": "Successfully unlinked your {0} account!", + "unlinkUrl": "Click here to remove the Hangar app from your {0} account" + } + } }, "apiKeys": { "header": "API keys" }, "misc": { "header": "Other", - "accentColor": "Accent Color" + "accentColor": "Accent Color", + "language": "Language", + "alert": { + "colorAlert": "The accent colors are mostly untested and full of contrast issues, proceed with caution!", + "languageAlert": "Translations are experimental!" + } } } }, diff --git a/frontend/src/pages/auth/settings/account.vue b/frontend/src/pages/auth/settings/account.vue index 42a34876..09c01f73 100644 --- a/frontend/src/pages/auth/settings/account.vue +++ b/frontend/src/pages/auth/settings/account.vue @@ -44,16 +44,16 @@ async function saveAccount() {
{{ t("auth.settings.account.header") }}
- + Note that you can only change your username once every 30 days.
{{ error }}
- +
diff --git a/frontend/src/pages/auth/settings/other.vue b/frontend/src/pages/auth/settings/other.vue index 00c8c543..5f4b2187 100644 --- a/frontend/src/pages/auth/settings/other.vue +++ b/frontend/src/pages/auth/settings/other.vue @@ -38,10 +38,10 @@ watch(locale, async (newLocale) => { diff --git a/frontend/src/pages/auth/settings/profile.vue b/frontend/src/pages/auth/settings/profile.vue index be213357..223ee576 100644 --- a/frontend/src/pages/auth/settings/profile.vue +++ b/frontend/src/pages/auth/settings/profile.vue @@ -51,7 +51,7 @@ async function saveProfile() {
{{ t("auth.settings.profile.header") }} -

Avatar

+

{{ t("auth.settings.profile.avatar") }}

@@ -61,15 +61,15 @@ async function saveProfile() {
-

Tagline

- +

{{ t("auth.settings.profile.tagline") }}

+ -

Social

+

{{ t("auth.settings.profile.social") }}

{{ linkTypes.find((e) => e.value === link[0])?.text }}
- +
@@ -78,10 +78,10 @@ async function saveProfile() {
- +
- + diff --git a/frontend/src/pages/auth/settings/security.vue b/frontend/src/pages/auth/settings/security.vue index ddd98fea..4d184d78 100644 --- a/frontend/src/pages/auth/settings/security.vue +++ b/frontend/src/pages/auth/settings/security.vue @@ -266,17 +266,17 @@ function closeUnlinkModal() {