diff --git a/public/locales/en-US/admin-global-settings.json b/public/locales/en-US/admin-global-settings.json
new file mode 100644
index 0000000..155606c
--- /dev/null
+++ b/public/locales/en-US/admin-global-settings.json
@@ -0,0 +1,71 @@
+{
+ "title": "Global Settings",
+ "description": "Configure global settings for your instance.",
+ "updatedSuccessfullyMessage": "Settings have been saved successfully!",
+ "randomAliasesPreview": {
+ "title": "Random aliases will look like this",
+ "helperText": "This is just a preview. Those are not real aliases."
+ },
+ "randomAliasesIncreaseExplanation": "Random aliases' length will be increased from {{originalLength}} to {{increasedLength}} characters after {{amount}} aliases have been created.",
+ "resetLabel": "Reset to defaults",
+ "disabled": {
+ "title": "Global settings are disabled",
+ "description": "Global settings have been disabled. You can enable them in the configuration file."
+ },
+ "fields": {
+ "randomEmailIdMinLength": {
+ "label": "Minimum random alias ID length",
+ "description": "The minimum length for randomly generated emails. The server will automatically increase the length if required so."
+ },
+ "randomEmailIdChars": {
+ "label": "Random alias character pool",
+ "description": "Characters that are used to generate random emails."
+ },
+ "randomEmailLengthIncreaseOnPercentage": {
+ "label": "Percentage of used aliases",
+ "description": "If the percentage of used random email IDs is higher than this value, the length of the random email ID will be increased. This is used to prevent spammers from guessing the email ID."
+ },
+ "customEmailSuffixLength": {
+ "label": "Custom email suffix length",
+ "description": "The length of the custom email suffix."
+ },
+ "customEmailSuffixChars": {
+ "label": "Custom email suffix character pool",
+ "description": "Characters that are used to generate custom email suffixes."
+ },
+ "imageProxyStorageLifeTimeInHours": {
+ "label": "Image proxy storage lifetime",
+ "description": "The lifetime of images that are stored on the server in hours. After this time, the image will be deleted.",
+ "unit_one": "hour",
+ "unit_other": "hours"
+ },
+ "enableImageProxy": {
+ "label": "Enable image proxy",
+ "description": "If enabled, images will be proxied through the server. This enhances your user's privacy as their ip address will not be leaked."
+ },
+ "enableImageProxyStorage": {
+ "label": "Enable image proxy storage",
+ "description": "If enabled, images will be stored on the server and forwarded to the user. This makes email tracking nearly impossible as every message will be marked as read instantly, which is obviously not true as a user is typically not able to view an email in just a few seconds after it has been sent. This will only affect new images."
+ },
+ "userEmailEnableDisposableEmails": {
+ "label": "Enable disposable emails for new accounts",
+ "description": "If enabled, users will be able to use disposable emails when creating a new account. This will only affect new accounts."
+ },
+ "userEmailEnableOtherRelays": {
+ "label": "Enable other relays for new accounts",
+ "description": "If enabled, users will be able to use other relays (such as SimpleLogin or DuckDuckGo's Email Tracking Protection) when creating a new account. This will only affect new accounts."
+ },
+ "allowStatistics": {
+ "label": "Allow statistics",
+ "description": "If enabled, your instance will collect anonymous statistics and share them. They will only be stored locally on this instance but made public."
+ },
+ "allowAliasDeletion": {
+ "label": "Allow alias deletion",
+ "description": "If enabled, users will be able to delete their aliases."
+ },
+ "maxAliasesPerUser": {
+ "label": "Maximum aliases per user",
+ "description": "The maximum number of aliases a user can create. 0 means unlimited. Existing aliases will not be affected."
+ }
+ }
+}
diff --git a/public/locales/en-US/admin.json b/public/locales/en-US/admin.json
new file mode 100644
index 0000000..7eb0c5d
--- /dev/null
+++ b/public/locales/en-US/admin.json
@@ -0,0 +1,7 @@
+{
+ "title": "Site configuration",
+ "routes": {
+ "reservedAliases": "Reserved Aliases",
+ "settings": "Global Settings"
+ }
+}
diff --git a/public/locales/en-US/common.json b/public/locales/en-US/common.json
index 2aa8ffc..ebc82d5 100644
--- a/public/locales/en-US/common.json
+++ b/public/locales/en-US/common.json
@@ -56,7 +56,9 @@
"noLabel": "No",
"continueLabel": "Continue",
"unavailableValue": "Unavailable",
- "experimentalFeatureExplanation": "This is an experimental feature."
+ "experimentalFeatureExplanation": "This is an experimental feature.",
+ "saveLabel": "Save",
+ "resetLabel": "Reset"
},
"noSearchResults": {
"title": "Nothing found",
diff --git a/public/locales/en-US/translation.json b/public/locales/en-US/translation.json
index 5610130..bcfb7d6 100644
--- a/public/locales/en-US/translation.json
+++ b/public/locales/en-US/translation.json
@@ -129,98 +129,6 @@
"reservedAliases": "Reserved Aliases",
"settings": "Global Settings"
},
- "forms": {
- "reservedAliases": {
- "title": "Reserved Aliases",
- "description": "Define what alias should forward to whom.",
- "saveAction": "Create Alias",
- "fields": {
- "local": {
- "label": "Local"
- },
- "users": {
- "label": "Users",
- "me": "{{email}} (Me)"
- }
- },
- "explanation": {
- "step1": "User from outside",
- "step2": "Sends mail to",
- "step4": "KleckRelay forwards to"
- }
- },
- "settings": {
- "randomEmailIdMinLength": {
- "label": "Minimum random alias ID length",
- "description": "The minimum length for randomly generated emails. The server will automatically increase the length if required so."
- },
- "randomEmailIdChars": {
- "label": "Random alias character pool",
- "description": "Characters that are used to generate random emails."
- },
- "randomEmailLengthIncreaseOnPercentage": {
- "label": "Percentage of used aliases",
- "description": "If the percentage of used random email IDs is higher than this value, the length of the random email ID will be increased. This is used to prevent spammers from guessing the email ID."
- },
- "customEmailSuffixLength": {
- "label": "Custom email suffix length",
- "description": "The length of the custom email suffix."
- },
- "customEmailSuffixChars": {
- "label": "Custom email suffix character pool",
- "description": "Characters that are used to generate custom email suffixes."
- },
- "imageProxyStorageLifeTimeInHours": {
- "label": "Image proxy storage lifetime",
- "description": "The lifetime of images that are stored on the server in hours. After this time, the image will be deleted.",
- "unit_one": "hour",
- "unit_other": "hours"
- },
- "enableImageProxy": {
- "label": "Enable image proxy",
- "description": "If enabled, images will be proxied through the server. This enhances your user's privacy as their ip address will not be leaked."
- },
- "enableImageProxyStorage": {
- "label": "Enable image proxy storage",
- "description": "If enabled, images will be stored on the server and forwarded to the user. This makes email tracking nearly impossible as every message will be marked as read instantly, which is obviously not true as a user is typically not able to view an email in just a few seconds after it has been sent. This will only affect new images."
- },
- "userEmailEnableDisposableEmails": {
- "label": "Enable disposable emails for new accounts",
- "description": "If enabled, users will be able to use disposable emails when creating a new account. This will only affect new accounts."
- },
- "userEmailEnableOtherRelays": {
- "label": "Enable other relays for new accounts",
- "description": "If enabled, users will be able to use other relays (such as SimpleLogin or DuckDuckGo's Email Tracking Protection) when creating a new account. This will only affect new accounts."
- },
- "allowStatistics": {
- "label": "Allow statistics",
- "description": "If enabled, your instance will collect anonymous statistics and share them. They will only be stored locally on this instance but made public."
- },
- "allowAliasDeletion": {
- "label": "Allow alias deletion",
- "description": "If enabled, users will be able to delete their aliases."
- },
- "maxAliasesPerUser": {
- "label": "Maximum aliases per user",
- "description": "The maximum number of aliases a user can create. 0 means unlimited. Existing aliases will not be affected."
- }
- }
- },
- "settings": {
- "title": "Global Settings",
- "description": "Configure global settings for your instance.",
- "successMessage": "Settings have been saved successfully!",
- "randomAliasesPreview": {
- "title": "Random aliases will look like this",
- "helperText": "This is just a preview. Those are not real aliases."
- },
- "randomAliasesIncreaseExplanation": "Random aliases' length will be increased from {{originalLength}} to {{increasedLength}} characters after {{amount}} aliases have been created.",
- "resetLabel": "Reset to defaults",
- "disabled": {
- "title": "Global settings are disabled",
- "description": "Global settings have been disabled. You can enable them in the configuration file."
- }
- },
"reservedAlias": {
"actions": {
"delete": {
diff --git a/src/route-widgets/GlobalSettingsRoute/SettingsDisabled.tsx b/src/route-widgets/GlobalSettingsRoute/SettingsDisabled.tsx
index 79a15e3..692f9f6 100644
--- a/src/route-widgets/GlobalSettingsRoute/SettingsDisabled.tsx
+++ b/src/route-widgets/GlobalSettingsRoute/SettingsDisabled.tsx
@@ -5,8 +5,7 @@ import {useTranslation} from "react-i18next"
import {Container, Grid, Typography} from "@mui/material"
export default function SettingsDisabled(): ReactElement {
- console.log("asdas")
- const {t} = useTranslation()
+ const {t} = useTranslation("admin-global-settings")
return (
@@ -21,16 +20,14 @@ export default function SettingsDisabled(): ReactElement {
>
- {t("routes.AdminRoute.settings.disabled.title")}
+ {t("disabled.title")}
-
- {t("routes.AdminRoute.settings.disabled.description")}
-
+ {t("disabled.description")}
diff --git a/src/route-widgets/GlobalSettingsRoute/SettingsForm.tsx b/src/route-widgets/GlobalSettingsRoute/SettingsForm.tsx
index 81f91d7..948867a 100644
--- a/src/route-widgets/GlobalSettingsRoute/SettingsForm.tsx
+++ b/src/route-widgets/GlobalSettingsRoute/SettingsForm.tsx
@@ -44,7 +44,7 @@ const DEFAULT_POOLS = createPool({
})
export default function SettingsForm({settings, queryKey}: SettingsFormProps) {
- const {t} = useTranslation()
+ const {t} = useTranslation(["admin-global-settings", "common"])
const {showSuccess, showError} = useErrorSuccessSnacks()
const validationSchema = yup.object().shape({
@@ -52,50 +52,33 @@ export default function SettingsForm({settings, queryKey}: SettingsFormProps) {
.number()
.min(1)
.max(1_023)
- .label(t("routes.AdminRoute.forms.settings.randomEmailIdMinLength.label")),
- randomEmailIdChars: yup
- .string()
- .label(t("routes.AdminRoute.forms.settings.randomEmailIdChars.label")),
+ .label(t("fields.randomEmailIdMinLength.label")),
+ randomEmailIdChars: yup.string().label(t("fields.randomEmailIdChars.label")),
randomEmailLengthIncreaseOnPercentage: yup
.number()
.min(0)
.max(1)
- .label(
- t("routes.AdminRoute.forms.settings.randomEmailLengthIncreaseOnPercentage.label"),
- ),
+ .label(t("fields.randomEmailLengthIncreaseOnPercentage.label")),
imageProxyStorageLifeTimeInHours: yup
.number()
- .label(t("routes.AdminRoute.forms.settings.imageProxyStorageLifeTimeInHours.label")),
+ .label(t("fields.imageProxyStorageLifeTimeInHours.label")),
customEmailSuffixLength: yup
.number()
.min(1)
.max(1_023)
- .label(t("routes.AdminRoute.forms.settings.customEmailSuffixLength-label")),
- customEmailSuffixChars: yup
- .string()
- .label(t("routes.AdminRoute.forms.settings.customEmailSuffixChars.label")),
+ .label(t("fields.customEmailSuffixLength.label")),
+ customEmailSuffixChars: yup.string().label(t("fields.customEmailSuffixChars.label")),
userEmailEnableDisposableEmails: yup
.boolean()
- .label(t("routes.AdminRoute.forms.settings.userEmailEnableDisposableEmails.label")),
+ .label(t("fields.userEmailEnableDisposableEmails.label")),
userEmailEnableOtherRelays: yup
.boolean()
- .label(t("routes.AdminRoute.forms.settings.userEmailEnableOtherRelays.label")),
- enableImageProxy: yup
- .boolean()
- .label(t("routes.AdminRoute.forms.settings.enableImageProxy.label")),
- enableImageProxyStorage: yup
- .boolean()
- .label(t("routes.AdminRoute.forms.settings.enableImageProxyStorage.label")),
- allowStatistics: yup
- .boolean()
- .label(t("routes.AdminRoute.forms.settings.allowStatistics.label")),
- allowAliasDeletion: yup
- .boolean()
- .label(t("routes.AdminRoute.forms.settings.allowAliasDeletion.label")),
- maxAliasesPerUser: yup
- .number()
- .label(t("routes.AdminRoute.forms.settings.maxAliasesPerUser.label"))
- .min(0),
+ .label(t("fields.userEmailEnableOtherRelays.label")),
+ enableImageProxy: yup.boolean().label(t("fields.enableImageProxy.label")),
+ enableImageProxyStorage: yup.boolean().label(t("fields.enableImageProxyStorage.label")),
+ allowStatistics: yup.boolean().label(t("fields.allowStatistics.label")),
+ allowAliasDeletion: yup.boolean().label(t("fields.allowAliasDeletion.label")),
+ maxAliasesPerUser: yup.number().label(t("fields.maxAliasesPerUser.label")).min(0),
} as Record)
const {mutateAsync} = useMutation<
@@ -109,7 +92,7 @@ export default function SettingsForm({settings, queryKey}: SettingsFormProps) {
return
}
- showSuccess(t("routes.AdminRoute.settings.successMessage"))
+ showSuccess(t("updatedSuccessfullyMessage"))
queryClient.setQueryData>(queryKey, newSettings)
},
@@ -144,12 +127,12 @@ export default function SettingsForm({settings, queryKey}: SettingsFormProps) {
- {t("routes.AdminRoute.settings.title")}
+ {t("title")}
- {t("routes.AdminRoute.settings.description")}
+ {t("description")}
@@ -160,9 +143,7 @@ export default function SettingsForm({settings, queryKey}: SettingsFormProps) {
- {t(
- "routes.AdminRoute.forms.settings.imageProxyStorageLifeTimeInHours.unit",
- {
- count:
- formik.values
- .imageProxyStorageLifeTimeInHours || 0,
- },
- )}
+ {t("fields.imageProxyStorageLifeTimeInHours.unit", {
+ count:
+ formik.values
+ .imageProxyStorageLifeTimeInHours || 0,
+ })}
),
}}
@@ -421,9 +373,7 @@ export default function SettingsForm({settings, queryKey}: SettingsFormProps) {
/>
}
disabled={formik.isSubmitting}
- label={t(
- "routes.AdminRoute.forms.settings.userEmailEnableDisposableEmails.label",
- )}
+ label={t("fields.userEmailEnableDisposableEmails.label")}
/>
{(formik.touched.userEmailEnableDisposableEmails &&
formik.errors.userEmailEnableDisposableEmails) ||
- t(
- "routes.AdminRoute.forms.settings.userEmailEnableDisposableEmails.description",
- )}
+ t("fields.userEmailEnableDisposableEmails.description")}
@@ -450,9 +398,7 @@ export default function SettingsForm({settings, queryKey}: SettingsFormProps) {
/>
}
disabled={formik.isSubmitting}
- label={t(
- "routes.AdminRoute.forms.settings.userEmailEnableOtherRelays.label",
- )}
+ label={t("fields.userEmailEnableOtherRelays.label")}
/>
{(formik.touched.userEmailEnableOtherRelays &&
formik.errors.userEmailEnableOtherRelays) ||
- t(
- "routes.AdminRoute.forms.settings.userEmailEnableOtherRelays.description",
- )}
+ t("fields.userEmailEnableOtherRelays.description")}
@@ -481,9 +425,7 @@ export default function SettingsForm({settings, queryKey}: SettingsFormProps) {
/>
}
disabled={formik.isSubmitting}
- label={t(
- "routes.AdminRoute.forms.settings.enableImageProxy.label",
- )}
+ label={t("fields.enableImageProxy.label")}
/>
{(formik.touched.enableImageProxy &&
formik.errors.enableImageProxy) ||
- t(
- "routes.AdminRoute.forms.settings.enableImageProxy.description",
- )}
+ t("fields.enableImageProxy.description")}
@@ -513,9 +453,7 @@ export default function SettingsForm({settings, queryKey}: SettingsFormProps) {
/>
}
disabled={formik.isSubmitting}
- label={t(
- "routes.AdminRoute.forms.settings.enableImageProxyStorage.label",
- )}
+ label={t("fields.enableImageProxyStorage.label")}
/>
{(formik.touched.enableImageProxyStorage &&
formik.errors.enableImageProxyStorage) ||
- t(
- "routes.AdminRoute.forms.settings.enableImageProxyStorage.description",
- )}
+ t("fields.enableImageProxyStorage.description")}
@@ -545,9 +481,7 @@ export default function SettingsForm({settings, queryKey}: SettingsFormProps) {
/>
}
disabled={formik.isSubmitting}
- label={t(
- "routes.AdminRoute.forms.settings.allowStatistics.label",
- )}
+ label={t("fields.allowStatistics.label")}
/>
{(formik.touched.allowStatistics &&
formik.errors.allowStatistics) ||
- t(
- "routes.AdminRoute.forms.settings.allowStatistics.description",
- )}
+ t("fields.allowStatistics.description")}
@@ -574,9 +506,7 @@ export default function SettingsForm({settings, queryKey}: SettingsFormProps) {
/>
}
disabled={formik.isSubmitting}
- label={t(
- "routes.AdminRoute.forms.settings.allowAliasDeletion.label",
- )}
+ label={t("fields.allowAliasDeletion.label")}
/>
{(formik.touched.allowAliasDeletion &&
formik.errors.allowAliasDeletion) ||
- t(
- "routes.AdminRoute.forms.settings.allowAliasDeletion.description",
- )}
+ t("fields.allowAliasDeletion.description")}
@@ -608,7 +536,7 @@ export default function SettingsForm({settings, queryKey}: SettingsFormProps) {
formik.submitForm()
}}
>
- {t("routes.AdminRoute.settings.resetLabel")}
+ {t("general.resetLabel", {ns: "common"})}
@@ -618,7 +546,7 @@ export default function SettingsForm({settings, queryKey}: SettingsFormProps) {
type="submit"
startIcon={}
>
- {t("general.saveLabel")}
+ {t("general.saveLabel", {ns: "common"})}
diff --git a/src/routes/AdminRoute.tsx b/src/routes/AdminRoute.tsx
index 994dc15..e1eab67 100644
--- a/src/routes/AdminRoute.tsx
+++ b/src/routes/AdminRoute.tsx
@@ -11,7 +11,7 @@ import {useNavigateToNext, useUser} from "~/hooks"
import ServerStatus from "~/route-widgets/AdminRoute/ServerStatus"
export default function AdminRoute(): ReactElement {
- const {t} = useTranslation()
+ const {t} = useTranslation("title")
const navigateToNext = useNavigateToNext()
const user = useUser()
@@ -22,20 +22,20 @@ export default function AdminRoute(): ReactElement {
}, [user.isAdmin, navigateToNext])
return (
-
+
-
+
-
+