From b6f9467fc15f91c5ee54d0fcba26dbf284cde619 Mon Sep 17 00:00:00 2001 From: Tagaishi Date: Tue, 22 Aug 2023 23:31:20 +0200 Subject: [PATCH 1/6] =?UTF-8?q?=F0=9F=8C=90=20better=20handle=20of=20multi?= =?UTF-8?q?part=20string=20for=20category?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/locales/en/layout/common.json | 2 +- .../Dashboard/Wrappers/Category/CategoryEditMenu.tsx | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/public/locales/en/layout/common.json b/public/locales/en/layout/common.json index b676bd888..e11d064d4 100644 --- a/public/locales/en/layout/common.json +++ b/public/locales/en/layout/common.json @@ -18,7 +18,7 @@ "menu": { "moveUp": "Move up", "moveDown": "Move down", - "addCategory": "Add category", + "addCategory": "Add category {{location}}", "addAbove": "above", "addBelow": "below" } diff --git a/src/components/Dashboard/Wrappers/Category/CategoryEditMenu.tsx b/src/components/Dashboard/Wrappers/Category/CategoryEditMenu.tsx index 2f5557088..3d68e4241 100644 --- a/src/components/Dashboard/Wrappers/Category/CategoryEditMenu.tsx +++ b/src/components/Dashboard/Wrappers/Category/CategoryEditMenu.tsx @@ -48,13 +48,13 @@ export const CategoryEditMenu = ({ category }: CategoryEditMenuProps) => { {t('menu.moveDown')} - {t('menu.addCategory')} + {t('menu.addCategory',{location: ''})} } onClick={addCategoryAbove}> - {t('menu.addCategory') + ' ' + t('menu.addAbove')} + {t('menu.addCategory',{location: t('menu.addAbove')})} } onClick={addCategoryBelow}> - {t('menu.addCategory') + ' ' + t('menu.addBelow')} + {t('menu.addCategory',{location: t('menu.addBelow')})} From 558c731c6b77827968e08469c89ddfa17c755d1e Mon Sep 17 00:00:00 2001 From: Tagaishi Date: Tue, 22 Aug 2023 23:31:56 +0200 Subject: [PATCH 2/6] =?UTF-8?q?=F0=9F=8C=90=20between=20x=20and=20y=20stri?= =?UTF-8?q?ng=20repetition=20change?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/locales/en/modules/bookmark.json | 4 +--- src/widgets/bookmark/BookmarkWidgetTile.tsx | 6 +++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/public/locales/en/modules/bookmark.json b/public/locales/en/modules/bookmark.json index 43ede12c2..f9e68bebe 100644 --- a/public/locales/en/modules/bookmark.json +++ b/public/locales/en/modules/bookmark.json @@ -29,9 +29,7 @@ }, "item": { "validation": { - "length100": "Length must be between 1 and 100", - "length200": "Length must be between 1 and 200", - "length400": "Length must be between 1 and 400", + "length": "Length must be between {{shortest}} and {{longest}}", "invalidLink": "Not a valid link", "errorMsg": "Did not save, because there were validation errors. Please adust your inputs" }, diff --git a/src/widgets/bookmark/BookmarkWidgetTile.tsx b/src/widgets/bookmark/BookmarkWidgetTile.tsx index 6969bc18d..102302fec 100644 --- a/src/widgets/bookmark/BookmarkWidgetTile.tsx +++ b/src/widgets/bookmark/BookmarkWidgetTile.tsx @@ -84,11 +84,11 @@ const definition = defineWidget({ return undefined; } - return t('item.validation.length100'); + return t('item.validation.length', {shortest: "1", longest: "100"}); }, href: (value) => { if (!z.string().min(1).max(200).safeParse(value).success) { - return t('item.validation.length200'); + return t('item.validation.length', {shortest: "1", longest: "200"}); } if (!z.string().url().safeParse(value).success) { @@ -102,7 +102,7 @@ const definition = defineWidget({ return undefined; } - return t('item.validation.length400'); + return t('item.validation.length', {shortest: "1", longest: "400"}); }, }, validateInputOnChange: true, From 6c3421f9417cf8c06f394ddb43ae14df7b5d36bd Mon Sep 17 00:00:00 2001 From: Tagaishi Date: Wed, 23 Aug 2023 15:07:38 +0200 Subject: [PATCH 3/6] =?UTF-8?q?=F0=9F=8C=90=20Missing=20strings=20reported?= =?UTF-8?q?=20on=20discord?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../header/actions/toggle-edit-mode.json | 3 ++- .../en/settings/general/edit-mode-toggle.json | 22 ++++++++++++++++ .../Actions/ToggleEditMode/ToggleEditMode.tsx | 4 +-- .../header/SettingsMenu/EditModeToggle.tsx | 26 +++++++++++-------- src/tools/server/translation-namespaces.ts | 1 + 5 files changed, 41 insertions(+), 15 deletions(-) create mode 100644 public/locales/en/settings/general/edit-mode-toggle.json diff --git a/public/locales/en/layout/header/actions/toggle-edit-mode.json b/public/locales/en/layout/header/actions/toggle-edit-mode.json index e99d62915..601ffefa3 100644 --- a/public/locales/en/layout/header/actions/toggle-edit-mode.json +++ b/public/locales/en/layout/header/actions/toggle-edit-mode.json @@ -7,5 +7,6 @@ "popover": { "title": "Edit mode is enabled for <1>{{size}} size", "text": "You can adjust and configure your apps now. Changes are not saved until you exit edit mode" - } + }, + "unloadEvent": "Exit the edit mode to save your changes" } diff --git a/public/locales/en/settings/general/edit-mode-toggle.json b/public/locales/en/settings/general/edit-mode-toggle.json new file mode 100644 index 000000000..6b630888a --- /dev/null +++ b/public/locales/en/settings/general/edit-mode-toggle.json @@ -0,0 +1,22 @@ +{ + "menu": { + "toggle": "Toggle edit mode", + "enable": "Enable edit mode", + "disable": "Disable edit mode" + }, + "form": { + "label": "Edit password", + "message": "In order to toggle edit mode, you need to enter the password you entered in the environment variable named EDIT_MODE_PASSWORD . If it is not set, you are not able to toggle edit mode on and off.", + "submit": "Submit" + }, + "notification": { + "success": { + "title": "Success", + "message": "Successfully toggled edit mode, reloading the page..." + }, + "error": { + "title": "Error", + "message": "Failed to toggle edit mode, please try again." + } + } +} \ No newline at end of file diff --git a/src/components/layout/header/Actions/ToggleEditMode/ToggleEditMode.tsx b/src/components/layout/header/Actions/ToggleEditMode/ToggleEditMode.tsx index 3103b8ee4..3495b113d 100644 --- a/src/components/layout/header/Actions/ToggleEditMode/ToggleEditMode.tsx +++ b/src/components/layout/header/Actions/ToggleEditMode/ToggleEditMode.tsx @@ -14,8 +14,6 @@ import { useNamedWrapperColumnCount } from '../../../../Dashboard/Wrappers/grids import { useCardStyles } from '../../../useCardStyles'; import { AddElementAction } from '../AddElementAction/AddElementAction'; -const beforeUnloadEventText = 'Exit the edit mode to save your changes'; - export const ToggleEditModeAction = () => { const { enabled, toggleEditMode } = useEditModeStore(); const namedWrapperColumnCount = useNamedWrapperColumnCount(); @@ -24,7 +22,7 @@ export const ToggleEditModeAction = () => { namedWrapperColumnCount !== null ? t(`common:breakPoints.${namedWrapperColumnCount}`) : t('common:loading'); - + const beforeUnloadEventText = t('unloadEvent'); const smallerThanSm = useScreenSmallerThan('sm'); const { config } = useConfigContext(); const { classes } = useCardStyles(true); diff --git a/src/components/layout/header/SettingsMenu/EditModeToggle.tsx b/src/components/layout/header/SettingsMenu/EditModeToggle.tsx index 6e53bd768..4615edefb 100644 --- a/src/components/layout/header/SettingsMenu/EditModeToggle.tsx +++ b/src/components/layout/header/SettingsMenu/EditModeToggle.tsx @@ -4,10 +4,12 @@ import { openModal } from '@mantine/modals'; import { showNotification } from '@mantine/notifications'; import { IconEdit, IconEditOff } from '@tabler/icons-react'; import axios from 'axios'; +import { Trans, useTranslation } from 'next-i18next'; import { useEditModeInformationStore } from '../../../../hooks/useEditModeInformation'; function ModalContent() { + const { t } = useTranslation('settings/general/edit-mode-toggle'); const form = useForm({ initialValues: { triedPassword: '', @@ -20,8 +22,8 @@ function ModalContent() { .post('/api/configs/tryPassword', { tried: values.triedPassword, type: 'edit' }) .then((res) => { showNotification({ - title: 'Success', - message: 'Successfully toggled edit mode, reloading the page...', + title: t('notification.success.title'), + message: t('notification.success.message'), color: 'green', }); setTimeout(() => { @@ -30,8 +32,8 @@ function ModalContent() { }) .catch((_) => { showNotification({ - title: 'Error', - message: 'Failed to toggle edit mode, please try again.', + title: t('notification.error.title'), + message: t('notification.error.message'), color: 'red', }); }); @@ -39,18 +41,19 @@ function ModalContent() { > - In order to toggle edit mode, you need to enter the password you entered in the - environment variable named EDIT_MODE_PASSWORD . If it is not set, you are not - able to toggle edit mode on and off. + }} + /> - + ); @@ -59,6 +62,7 @@ function ModalContent() { export function EditModeToggle() { const { editModeEnabled } = useEditModeInformationStore(); const Icon = editModeEnabled ? IconEdit : IconEditOff; + const { t } = useTranslation('settings/general/edit-mode-toggle'); return ( } onClick={() => openModal({ - title: 'Toggle edit mode', + title: t('menu.toggle'), centered: true, size: 'lg', children: , }) } > - {editModeEnabled ? 'Enable edit mode' : 'Disable edit mode'} + {editModeEnabled ? t('menu.enable') : t('menu.disable')} ); } diff --git a/src/tools/server/translation-namespaces.ts b/src/tools/server/translation-namespaces.ts index e9a03ee5c..73e464e5d 100644 --- a/src/tools/server/translation-namespaces.ts +++ b/src/tools/server/translation-namespaces.ts @@ -10,6 +10,7 @@ export const dashboardNamespaces = [ 'settings/common', 'settings/general/theme-selector', 'settings/general/config-changer', + 'settings/general/edit-mode-toggle', 'settings/general/internationalization', 'settings/general/search-engine', 'settings/general/widget-positions', From 4bd5d82da3fcc0e67f5bba0804e28ce0a42df1c0 Mon Sep 17 00:00:00 2001 From: Tagaishi Date: Wed, 23 Aug 2023 23:39:19 +0200 Subject: [PATCH 4/6] =?UTF-8?q?=F0=9F=8C=90=20About=20page=20new=20version?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/locales/en/layout/modals/about.json | 6 ++++- .../Modals/AboutModal/AboutModal.tsx | 27 ++++++++++--------- 2 files changed, 20 insertions(+), 13 deletions(-) diff --git a/public/locales/en/layout/modals/about.json b/public/locales/en/layout/modals/about.json index 01a8f5d09..fdca91f6d 100644 --- a/public/locales/en/layout/modals/about.json +++ b/public/locales/en/layout/modals/about.json @@ -6,6 +6,7 @@ "key": "Shortcut key", "action": "Action", "keybinds": "Keybinds", + "documentation": "Documentation", "actions": { "toggleTheme": "Toggle light/dark mode", "focusSearchBar": "Focus on search bar", @@ -20,6 +21,9 @@ "i18n": "Loaded I18n translation namespaces", "locales": "Configured I18n locales", "experimental_disableEditMode": "EXPERIMENTAL: Disable edit mode" + }, + "version": { + "new": "New: {{newVersion}}", + "dropdown": "Version {{newVersion}} is available! Current Version is {{currentVersion}}" } - } \ No newline at end of file diff --git a/src/components/Dashboard/Modals/AboutModal/AboutModal.tsx b/src/components/Dashboard/Modals/AboutModal/AboutModal.tsx index 64174046d..19b2252d6 100644 --- a/src/components/Dashboard/Modals/AboutModal/AboutModal.tsx +++ b/src/components/Dashboard/Modals/AboutModal/AboutModal.tsx @@ -167,7 +167,7 @@ export const AboutModal = ({ opened, closeModal, newVersionAvailable }: AboutMod variant="default" fullWidth > - Documentation + {t('layout/modals/about:documentation')} @@ -203,6 +203,7 @@ const useInformationTableItems = (newVersionAvailable?: string): InformationTabl const { attributes } = usePackageAttributesStore(); const { editModeEnabled } = useEditModeInformationStore(); const { primaryColor } = useColorTheme(); + const { t } = useTranslation(['layout/modals/about']); const { configVersion } = useConfigContext(); const { configs } = useConfigStore(); @@ -300,21 +301,23 @@ const useInformationTableItems = (newVersionAvailable?: string): InformationTabl transition={{ duration: 0.8, ease: 'easeInOut' }} > - new: {newVersionAvailable} + {t('version.new',{ newVersion: newVersionAvailable})} - Version{' '} - - - {newVersionAvailable} - - {' '} - is available ! Current version: {attributes.packageVersion} + + {t('version.dropdown', {currentVersion: attributes.packageVersion}).split('{{newVersion}}')[0]} + + + {newVersionAvailable} + + + {t('version.dropdown', {currentVersion: attributes.packageVersion}).split('{{newVersion}}')[1]} + )} From 8d2aa51f2b983a2a34fe6bd3271db5ac585f3661 Mon Sep 17 00:00:00 2001 From: Tagaishi Date: Thu, 24 Aug 2023 00:06:14 +0200 Subject: [PATCH 5/6] =?UTF-8?q?=F0=9F=8C=90=20Cache=20settings?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../en/settings/general/cache-buttons.json | 24 ++++++++++++ .../Settings/Common/CacheButtons.tsx | 37 +++++++++++-------- src/tools/server/translation-namespaces.ts | 3 +- 3 files changed, 48 insertions(+), 16 deletions(-) create mode 100644 public/locales/en/settings/general/cache-buttons.json diff --git a/public/locales/en/settings/general/cache-buttons.json b/public/locales/en/settings/general/cache-buttons.json new file mode 100644 index 000000000..d52609075 --- /dev/null +++ b/public/locales/en/settings/general/cache-buttons.json @@ -0,0 +1,24 @@ +{ + "title": "Cache cleaning", + "selector": { + "label": "Select the cache(s) to clear", + "data": { + "ping": "Ping queries", + "repositoryIcons": "Remote/Local icons", + "calendar&medias": "Medias from the Calendar", + "weather": "Weather data" + } + }, + "buttons": { + "notificationTitle": "Cache Cleared", + "clearAll":{ + "text": "Clear all cache", + "notificationMessage": "All cache has been cleared" + }, + "clearSelect":{ + "text": "Clear selected queries", + "notificationMessageSingle": "Cache for {{value}} has been cleared", + "notificationMessageMulti": "Cache for {{values}} have been cleared" + } + } +} \ No newline at end of file diff --git a/src/components/Settings/Common/CacheButtons.tsx b/src/components/Settings/Common/CacheButtons.tsx index eb35ae99c..409ededfc 100644 --- a/src/components/Settings/Common/CacheButtons.tsx +++ b/src/components/Settings/Common/CacheButtons.tsx @@ -4,25 +4,29 @@ import { IconTrash } from '@tabler/icons-react'; import { useState } from 'react'; import { queryClient } from '../../../tools/server/configurations/tanstack/queryClient.tool'; - -const data = [ - { value: 'ping', label: 'Ping queries' }, - { value: 'repository-icons', label: 'Remote/Local icons' }, - { value: 'calendar/medias', label: 'Medais from the Calendar' }, - { value: 'weather', label: 'Weather data' }, -]; +import { useTranslation } from 'react-i18next'; export function CacheButtons() { const [value, setValue] = useState([]); + + const { t } = useTranslation('settings/general/cache-buttons') + + const data = [ + { value: 'ping', label: t('selector.data.ping') }, + { value: 'repository-icons', label: t('selector.data.repositoryIcons') }, + { value: 'calendar/medias', label: t('selector.data.calendar&medias') }, + { value: 'weather', label: t('selector.data.weather') }, + ]; + return ( - Cache cleaning + {t('title')} diff --git a/src/tools/server/translation-namespaces.ts b/src/tools/server/translation-namespaces.ts index 73e464e5d..e9d399316 100644 --- a/src/tools/server/translation-namespaces.ts +++ b/src/tools/server/translation-namespaces.ts @@ -8,11 +8,12 @@ export const dashboardNamespaces = [ 'layout/header/actions/toggle-edit-mode', 'layout/mobile/drawer', 'settings/common', - 'settings/general/theme-selector', + 'settings/general/cache-buttons', 'settings/general/config-changer', 'settings/general/edit-mode-toggle', 'settings/general/internationalization', 'settings/general/search-engine', + 'settings/general/theme-selector', 'settings/general/widget-positions', 'settings/customization/accessibility', 'settings/customization/general', From 5ccc094ad15176f1812f2c815921fae44d9bed41 Mon Sep 17 00:00:00 2001 From: Tagaishi Date: Thu, 24 Aug 2023 00:21:02 +0200 Subject: [PATCH 6/6] =?UTF-8?q?=F0=9F=8C=90=20Search=20engine=20custom=20b?= =?UTF-8?q?utton?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../locales/en/settings/general/search-engine.json | 1 + .../Common/SearchEngine/SearchEngineSelector.tsx | 14 +++++++------- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/public/locales/en/settings/general/search-engine.json b/public/locales/en/settings/general/search-engine.json index a7a40fc83..13acf8694 100644 --- a/public/locales/en/settings/general/search-engine.json +++ b/public/locales/en/settings/general/search-engine.json @@ -1,6 +1,7 @@ { "title": "Search engine", "configurationName": "Search engine configuration", + "custom": "Custom", "tips": { "generalTip": "There are multiple prefixes you can use! Adding these in front of your query will filter the results. !s (Web), !t (Torrents), !y (YouTube), and !m (Media).", "placeholderTip": "%s can be used as a placeholder for the query." diff --git a/src/components/Settings/Common/SearchEngine/SearchEngineSelector.tsx b/src/components/Settings/Common/SearchEngine/SearchEngineSelector.tsx index eb0fa634d..54270f0b2 100644 --- a/src/components/Settings/Common/SearchEngine/SearchEngineSelector.tsx +++ b/src/components/Settings/Common/SearchEngine/SearchEngineSelector.tsx @@ -35,6 +35,13 @@ export const SearchEngineSelector = ({ searchEngine }: Props) => { updateSearchEngineConfig(engine, url); }; + const searchEngineOptions: { label: string; value: EngineType }[] = [ + { label: 'Google', value: 'google' }, + { label: 'DuckDuckGo', value: 'duckDuckGo' }, + { label: 'Bing', value: 'bing' }, + { label: t('custom'), value: 'custom' }, + ]; + return ( @@ -77,13 +84,6 @@ export const SearchEngineSelector = ({ searchEngine }: Props) => { ); }; -const searchEngineOptions: { label: string; value: EngineType }[] = [ - { label: 'Google', value: 'google' }, - { label: 'DuckDuckGo', value: 'duckDuckGo' }, - { label: 'Bing', value: 'bing' }, - { label: 'Custom', value: 'custom' }, -]; - export const searchUrls: { [key in CommonSearchEngineCommonSettingsType['type']]: string } = { google: 'https://google.com/search?q=', duckDuckGo: 'https://duckduckgo.com/?q=',