diff --git a/public/locales/en-US/aliases.json b/public/locales/en-US/aliases.json new file mode 100644 index 0000000..b08ad11 --- /dev/null +++ b/public/locales/en-US/aliases.json @@ -0,0 +1,31 @@ +{ + "title": "Aliases", + "isInCopyMode": "You are in copy mode. Click on an alias to copy it to your clipboard.", + "emptyState": { + "title": "Welcome to your Aliases!", + "description": "Create your first Alias to get started." + }, + "pageActions": { + "search": { + "placeholder": "Search for names" + }, + "searchFilter": { + "active": "Active", + "inactive": "Inactive" + }, + "typeFilter": { + "custom": "Custom made", + "random": "Randomly generated" + } + }, + "actions": { + "createRandomAlias": { + "title": "Create Random Alias" + }, + "createCustomAlias": { + "title": "Create Custom Alias", + "description": "You can define your own custom alias. Note that a random suffix will be added at the end to avoid duplicates.", + "continueActionLabel": "Create Alias" + } + } +} diff --git a/public/locales/en-US/common.json b/public/locales/en-US/common.json index cd42469..820fe8e 100644 --- a/public/locales/en-US/common.json +++ b/public/locales/en-US/common.json @@ -24,11 +24,23 @@ "errors": { "mismatch": "Passwords do not match." } + }, + "customAliasLocal": { + "label": "Address", + "placeholder": "awesome-fish" + }, + "search": { + "label": "Search" } }, "messages": { "errors": { - "unknown": "An unknown error occurred." + "unknown": "An unknown error occurred.", + "copyFailed": "Copying to clipboard did not work. Please copy the text manually." + }, + "alias": { + "addressCopied": "Address has been copied to your clipboard!", + "created": "Alias has been created successfully!" } }, "general": { @@ -36,5 +48,9 @@ "yesLabel": "Yes", "noLabel": "No", "continueLabel": "Continue" + }, + "noSearchResults": { + "title": "Nothing found", + "description": "We couldn't find anything for your search query. Try again with a different query." } } diff --git a/public/locales/en-US/translation.json b/public/locales/en-US/translation.json index bf0d437..3c80795 100644 --- a/public/locales/en-US/translation.json +++ b/public/locales/en-US/translation.json @@ -26,52 +26,6 @@ "title": "Overview", "description": "Not much to see here, yet." }, - "CompleteAccountRoute": { - "forms": { - "available": { - "title": "Encryption already enabled", - "description": "You already have encryption enabled. Changing passwords is currently not supported." - } - } - }, - "AliasesRoute": { - "title": "Aliases", - "isInCopyMode": "You are in copy mode. Click on an alias to copy it to your clipboard.", - "emptyState": { - "title": "Welcome to your Aliases!", - "description": "Create your first Alias to get started." - }, - "pageActions": { - "search": { - "label": "Search", - "placeholder": "Search for names" - }, - "searchFilter": { - "active": "Active", - "inactive": "Inactive" - }, - "typeFilter": { - "custom": "Custom made", - "random": "Randomly generated" - } - }, - "actions": { - "createRandomAlias": { - "label": "Create Random Alias" - }, - "createCustomAlias": { - "label": "Create Custom Alias", - "description": "You can define your own custom alias. Note that a random suffix will be added at the end to avoid duplicates.", - "continueAction": "Create Alias", - "form": { - "address": { - "label": "Address", - "placeholder": "awesome-fish" - } - } - } - } - }, "AliasDetailRoute": { "title": "Alias Details", "sections": { @@ -236,10 +190,6 @@ } } }, - "LogoutRoute": { - "title": "Log out", - "description": "We are logging you out..." - }, "ReservedAliasesRoute": { "title": "Reserved Aliases", "pageActions": { @@ -448,10 +398,6 @@ "random": "This is a randomly generated alias", "custom": "This is a custom-made alias" }, - "NoSearchResults": { - "title": "Nothing found", - "description": "We couldn't find anything for your search query. Try again with a different query." - }, "LockNavigationContextProvider": { "title": "Are you sure you want to leave?", "description": "You have unsaved changes. If you leave, your changes will be lost.", diff --git a/src/components/widgets/NoSearchResults.tsx b/src/components/widgets/NoSearchResults.tsx index 12a0ca9..1c09fc4 100644 --- a/src/components/widgets/NoSearchResults.tsx +++ b/src/components/widgets/NoSearchResults.tsx @@ -5,20 +5,18 @@ import {FaQuestion} from "react-icons/fa" import {Grid, Typography} from "@mui/material" export default function NoSearchResults(): ReactElement { - const {t} = useTranslation() + const {t} = useTranslation("common") return ( - {t("components.NoSearchResults.title")} + {t("noSearchResults.title")} - - {t("components.NoSearchResults.description")} - + {t("noSearchResults.description")} ) diff --git a/src/init-i18n.ts b/src/init-i18n.ts index f2275df..bdb19b0 100644 --- a/src/init-i18n.ts +++ b/src/init-i18n.ts @@ -15,6 +15,7 @@ i18n.use(HttpApi) .init({ debug: isDev, fallbackLng: "en-US", + load: "all", backend: { loadPath: "/locales/{{lng}}/{{ns}}.json", }, diff --git a/src/route-widgets/AliasesRoute/CreateAliasButton.tsx b/src/route-widgets/AliasesRoute/CreateAliasButton.tsx index 4423ae3..ba14833 100644 --- a/src/route-widgets/AliasesRoute/CreateAliasButton.tsx +++ b/src/route-widgets/AliasesRoute/CreateAliasButton.tsx @@ -26,7 +26,7 @@ import {AuthContext, EncryptionStatus} from "~/components" import CustomAliasDialog from "~/route-widgets/AliasesRoute/CustomAliasDialog" export function CreateAliasButton(): ReactElement { - const {t} = useTranslation() + const {t} = useTranslation(["aliases", "common"]) const {showSuccess, showError} = useErrorSuccessSnacks() const {_encryptUsingMasterPassword, encryptionStatus} = useContext(AuthContext) @@ -54,7 +54,7 @@ export function CreateAliasButton(): ReactElement { { onError: showError, onSuccess: async alias => { - showSuccess(t("relations.alias.mutations.success.aliasCreation")) + showSuccess(t("messages.alias.created", {ns: "common"})) await queryClient.invalidateQueries({ queryKey: ["get_aliases"], @@ -82,7 +82,7 @@ export function CreateAliasButton(): ReactElement { }) } > - {t("routes.AliasesRoute.actions.createRandomAlias.label")} + {t("actions.createRandomAlias.title")} diff --git a/src/route-widgets/AliasesRoute/EmptyStateScreen.tsx b/src/route-widgets/AliasesRoute/EmptyStateScreen.tsx index 5c2ed45..84907c4 100644 --- a/src/route-widgets/AliasesRoute/EmptyStateScreen.tsx +++ b/src/route-widgets/AliasesRoute/EmptyStateScreen.tsx @@ -5,7 +5,7 @@ import {FaMask} from "react-icons/fa" import {Container, Grid, Typography} from "@mui/material" export default function EmptyStateScreen(): ReactElement { - const {t} = useTranslation() + const {t} = useTranslation("aliases") return ( @@ -20,16 +20,14 @@ export default function EmptyStateScreen(): ReactElement { > - {t("routes.AliasesRoute.emptyState.title")} + {t("emptyState.title")} - - {t("routes.AliasesRoute.emptyState.description")} - + {t("emptyState.description")} diff --git a/src/routes/AliasesRoute.tsx b/src/routes/AliasesRoute.tsx index 8e74b1d..7bffdfe 100644 --- a/src/routes/AliasesRoute.tsx +++ b/src/routes/AliasesRoute.tsx @@ -36,7 +36,7 @@ enum TypeFilter { } export default function AliasesRoute(): ReactElement { - const {t} = useTranslation() + const {t} = useTranslation(["aliases", "common"]) const [searchValue, setSearchValue] = useState("") const [queryValue, setQueryValue] = useState("") @@ -131,7 +131,7 @@ export default function AliasesRoute(): ReactElement { return ( @@ -146,10 +146,8 @@ export default function AliasesRoute(): ReactElement { setQueryValue(event.target.value) }) }} - label={t("routes.AliasesRoute.pageActions.search.label")} - placeholder={t( - "routes.AliasesRoute.pageActions.search.placeholder", - )} + label={t("fields.search.label", {ns: "common"})} + placeholder={t("pageActions.search.placeholder")} id="search" InputProps={{ startAdornment: ( @@ -166,9 +164,7 @@ export default function AliasesRoute(): ReactElement { + - - {t("routes.AliasesRoute.isInCopyMode")} + {t("isInCopyMode")}