diff --git a/public/locales/de/settings/general/config-changer.json b/public/locales/de/settings/general/config-changer.json index d33cd1514..975ef4539 100644 --- a/public/locales/de/settings/general/config-changer.json +++ b/public/locales/de/settings/general/config-changer.json @@ -9,8 +9,12 @@ "label": "Konfigurations Name", "placeholder": "Dein neuer Konfigurtionsname" }, - "buttons:": { - "submit": "Bestätigen" + "submitButton": "Bestätigen" + }, + "events": { + "configSaved": { + "title": "Konfiguration gespeichert", + "message": "Konfiguration gespeichert als {{configName}}" } } }, @@ -30,5 +34,22 @@ } }, "saveCopy": "Eine Kopie speichern" + }, + "dropzone": { + "notifications": { + "invalidConfig": { + "title": "Konfiguration konnte nicht geladen werden", + "message": "Konfiguration konnte nicht geladen werden. Invalides JSON" + }, + "loadedSuccessfully": { + "title": "Konfiguration {{configName}} wurde erfolgreich geladen" + } + }, + "accept": { + "text": "Ziehe Konfigurationen hier um sie hochzuladen. Es werden nur JSON Dateien unterstützt." + }, + "reject": { + "text": "Dieses Dateiformat wird nicht unterstützt. Bitte lade nur JSON hoch." + } } } \ No newline at end of file diff --git a/public/locales/en/settings/general/config-changer.json b/public/locales/en/settings/general/config-changer.json index 6256754e4..ad4ac012d 100644 --- a/public/locales/en/settings/general/config-changer.json +++ b/public/locales/en/settings/general/config-changer.json @@ -9,8 +9,12 @@ "label": "Config name", "placeholder": "Your new config name" }, - "buttons:": { - "submit": "Confirm" + "submitButton": "Confirm" + }, + "events": { + "configSaved": { + "title": "Config saved", + "message": "Config saved as {{configName}}" } } }, @@ -30,5 +34,22 @@ } }, "saveCopy": "Save a copy" + }, + "dropzone": { + "notifications": { + "invalidConfig": { + "title": "Unable to load config", + "message": "Could not load your config. Invalid JSON format." + }, + "loadedSuccessfully": { + "title": "Config {{configName}} loaded successfully" + } + }, + "accept": { + "text": "Drag files here to upload a config. Support for JSON only." + }, + "reject": { + "text": "This file format is not supported. Please only upload JSON." + } } } \ No newline at end of file diff --git a/src/components/Config/LoadConfig.tsx b/src/components/Config/LoadConfig.tsx index 75d6972fa..a41f0e027 100644 --- a/src/components/Config/LoadConfig.tsx +++ b/src/components/Config/LoadConfig.tsx @@ -3,6 +3,7 @@ import { IconX as X, IconCheck as Check, IconX, IconPhoto, IconUpload } from '@t import { showNotification } from '@mantine/notifications'; import { setCookie } from 'cookies-next'; import { Dropzone } from '@mantine/dropzone'; +import { useTranslation } from 'next-i18next'; import { useConfig } from '../../tools/state'; import { Config } from '../../tools/types'; import { migrateToIdConfig } from '../../tools/migrate'; @@ -10,6 +11,7 @@ import { migrateToIdConfig } from '../../tools/migrate'; export default function LoadConfigComponent(props: any) { const { setConfig } = useConfig(); const theme = useMantineTheme(); + const { t } = useTranslation('settings/general/config-changer'); return ( Error, + title: {t('dropzone.notifications.invalidConfig.title')}, color: 'red', icon: , - message: 'could not load your config. Invalid JSON format.', + message: t('dropzone.notifications.invalidConfig.message'), }); return; } @@ -33,7 +35,9 @@ export default function LoadConfigComponent(props: any) { radius: 'md', title: ( - Config {newConfig.name} loaded successfully + {t('dropzone.notifications.loadedSuccessfully.title', { + configName: newConfig.name, + })} ), color: 'green', @@ -58,7 +62,7 @@ export default function LoadConfigComponent(props: any) { stroke={1.5} color={theme.colors[theme.primaryColor][theme.colorScheme === 'dark' ? 4 : 6]} /> - Drag files here to upload a config. Support for JSON only. + {t('dropzone.accept.text')} @@ -68,7 +72,7 @@ export default function LoadConfigComponent(props: any) { stroke={1.5} color={theme.colors.red[theme.colorScheme === 'dark' ? 4 : 6]} /> - This file format is not supported. Please only upload JSON. + {t('dropzone.reject.text')} diff --git a/src/components/Config/SaveConfig.tsx b/src/components/Config/SaveConfig.tsx index 2f0c2c21b..327f50523 100644 --- a/src/components/Config/SaveConfig.tsx +++ b/src/components/Config/SaveConfig.tsx @@ -36,12 +36,12 @@ export default function SaveConfigComponent(props: any) { setConfig({ ...config, name: values.configName }); setOpened(false); showNotification({ - title: 'Config saved', + title: t('modal.events.configSaved.title'), icon: , color: 'green', autoClose: 1500, radius: 'md', - message: `Config saved as ${values.configName}`, + message: t('modal.events.configSaved.message', { configName: values.configName }), }); })} > @@ -52,7 +52,7 @@ export default function SaveConfigComponent(props: any) { {...form.getInputProps('configName')} /> - + @@ -68,22 +68,22 @@ export default function SaveConfigComponent(props: any) { .delete(`/api/configs/${config.name}`) .then(() => { showNotification({ - title: t('buttons.delete.deleted.title'), + title: t('buttons.delete.notifications.deleted.title'), icon: , color: 'green', autoClose: 1500, radius: 'md', - message: t('buttons.delete.deleted.message'), + message: t('buttons.delete.notifications.deleted.message'), }); }) .catch(() => { showNotification({ - title: t('buttons.delete.deleteFailed.title'), + title: t('buttons.delete.notifications.deleteFailed.title'), icon: , color: 'red', autoClose: 1500, radius: 'md', - message: t('buttons.delete.deleteFailed.message'), + message: t('buttons.delete.notifications.deleteFailed.message'), }); }); setConfig({ ...config, name: 'default' }); diff --git a/src/components/Settings/OpacitySelector.tsx b/src/components/Settings/OpacitySelector.tsx index 3cf49491a..cfcf89109 100644 --- a/src/components/Settings/OpacitySelector.tsx +++ b/src/components/Settings/OpacitySelector.tsx @@ -5,7 +5,7 @@ import { useConfig } from '../../tools/state'; export function OpacitySelector() { const { config, setConfig } = useConfig(); - const { t } = useTranslation('settings/customization/shade-selector'); + const { t } = useTranslation('settings/customization/opacity-selector'); const MARKS = [ { value: 10, label: '10' }, diff --git a/src/components/Settings/ShadeSelector.tsx b/src/components/Settings/ShadeSelector.tsx index 6dc2f8c36..a7dc85dfa 100644 --- a/src/components/Settings/ShadeSelector.tsx +++ b/src/components/Settings/ShadeSelector.tsx @@ -16,7 +16,7 @@ import { useColorTheme } from '../../tools/color'; export function ShadeSelector() { const { config, setConfig } = useConfig(); const [opened, setOpened] = useState(false); - const { t } = useTranslation('settings/general/shade-selector'); + const { t } = useTranslation('settings/customization/shade-selector'); const { primaryColor, secondaryColor, primaryShade, setPrimaryShade } = useColorTheme(); diff --git a/src/pages/index.tsx b/src/pages/index.tsx index 682938572..e52fd7ac1 100644 --- a/src/pages/index.tsx +++ b/src/pages/index.tsx @@ -44,6 +44,7 @@ export async function getServerSideProps({ 'settings/customization/page-appearance', 'settings/customization/shade-selector', 'settings/customization/app-width', + 'settings/customization/opacity-selector', 'modules/search-module', 'modules/downloads-module', 'modules/weather-module',