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") }}
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) => {
{{ i18n.t("auth.settings.misc.header") }}
-
The accent colors are mostly untested and full of contrast issues, proceed with caution!
+
{{ i18n.t("auth.settings.misc.alert.colorAlert") }}
-
Translations are experimental!
+
{{ i18n.t("auth.settings.misc.alert.languageAlert") }}
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() {
Add link
-
+
-
Save
+
{{ t("general.save") }}
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() {
{{ t("auth.settings.security.header") }}
-
Authenticator App
+
{{ t("auth.settings.security.authApp") }}
Unlink totp
-
Setup 2FA via authenticator app
+
{{ t("auth.settings.security.button.setupAuthApp") }}
-
Scan the QR code on the right using your favorite authenticator app
-
Can't scan? Enter the secret listed below the image!
+
{{ t("auth.settings.security.authAppSetup.scan") }}
+
{{ t("auth.settings.security.authAppSetup.cantScan") }}
-
Enter a TOTP code generated by your authenticator app in the box below.
+
{{ t("auth.settings.security.authAppSetup.enterTotp") }}
-
Verify TOTP code and activate
+
{{ t("auth.settings.security.authAppSetup.verifyTotp") }}
@@ -285,12 +285,16 @@ function closeUnlinkModal() {
-
Security Keys
+
{{ t("auth.settings.security.securityKeys.name") }}
{{ authenticator.displayName }} (added at )
- Unregister
- Rename
+
+ {{ t("auth.settings.security.securityKeys.unregister") }}
+
+
+ {{ t("auth.settings.security.securityKeys.rename") }}
+
-
- Rename
+
+
+ {{ t("auth.settings.security.securityKeys.rename") }}
+
-
+
-
Setup 2FA via security key
+
{{ t("auth.settings.security.button.setupSecurityKey") }}
- Backup Codes
+ {{ t("auth.settings.security.backupCodes.name") }}
- {{ code["used_at"] ? "Used" : code.code }}
+ {{ code["used_at"] ? t("general.used") : code.code }}
- Reveal
- Generate new codes
+ {{ t("general.reveal") }}
+ {{ t("auth.settings.security.backupCodes.generateNew") }}
@@ -327,9 +341,9 @@ function closeUnlinkModal() {
- Link a GitHub account
+ {{ t("auth.settings.security.button.linkGithub") }}
- Link {{ provider }} account
+ {{ t("auth.settings.security.button.linkOther", [provider]) }}
@@ -339,37 +353,42 @@ function closeUnlinkModal() {
:disabled="!settings?.hasPassword && settings?.oauthConnections.length === 1"
:title="
!settings?.hasPassword && settings?.oauthConnections.length === 1
- ? 'You can\'t unlink your last oauth credential if you don\'t have a password set'
+ ? // ? t('auth.settings.security.unlinkOAuth.cantUnlink') Doesn't work
+ 'You can\'t unlink your last oauth credential if you don\'t have a password set'
: undefined
"
@click="unlinkOAuth(credential.provider, credential.id)"
>
- Unlink GitHub account {{ credential.name }}
+ {{ t("auth.settings.security.button.unlinkAccount", ["GitHub", credential.name]) }}
- Unlink {{ credential.provider }} account {{ credential.name }}
+ {{ t("auth.settings.security.button.unlinkAccount", [credential.provider, credential.name]) }}
-
- Successfully unlinked your {{ currentlyUnlinkingProvider }} account!
- Click here to remove the Hangar app from your {{ currentlyUnlinkingProvider }} account
+
+ {{ t("auth.settings.security.unlinkOAuth.modal.message", [currentlyUnlinkingProvider]) }}
+ {{ t("auth.settings.security.unlinkOAuth.modal.unlinkUrl", [currentlyUnlinkingProvider]) }}
-
- You need to configure backup codes before you can activate 2fa. Please save these codes securely!
+
+ {{ t("auth.settings.security.backupCodes.modal.needConfigure") }}
- Confirm that you saved the backup codes by entering one of them below
-
- Confirm
+ {{ t("auth.settings.security.backupCodes.modal.confirm") }}
+
+ {{ t("general.confirm") }}
- Devices
+ {{ t("auth.settings.security.devices") }}
last login
on revoke iphone