Add theme mode translation

This commit is contained in:
Nicola Benaglia 2025-04-23 19:16:31 +02:00
parent 09dfc51366
commit b3a4d4c5d6
2 changed files with 18 additions and 2 deletions

View File

@ -25,11 +25,15 @@
} }
}, },
"save_options": { "save_options": {
"publish_qdn": "Would you like to publish your settings to QDN (encrypted) ?", "publish_qdn": "Would you like to publish your settings to QDN (encrypted)?",
"save": "save" "save": "save"
}, },
"settings": "settings", "settings": "settings",
"supply": "supply", "supply": "supply",
"theme": {
"dark": "dark mode",
"light": "light mode"
},
"title": "title", "title": "title",
"tutorial": "tutorial", "tutorial": "tutorial",
"your_account": "your account", "your_account": "your account",

View File

@ -2,8 +2,10 @@ import { useThemeContext } from './ThemeContext';
import { IconButton, Tooltip } from '@mui/material'; import { IconButton, Tooltip } from '@mui/material';
import LightModeIcon from '@mui/icons-material/LightMode'; import LightModeIcon from '@mui/icons-material/LightMode';
import DarkModeIcon from '@mui/icons-material/DarkMode'; import DarkModeIcon from '@mui/icons-material/DarkMode';
import { useTranslation } from 'react-i18next';
const ThemeSelector = () => { const ThemeSelector = () => {
const { t } = useTranslation(['core']);
const { themeMode, toggleTheme } = useThemeContext(); const { themeMode, toggleTheme } = useThemeContext();
return ( return (
@ -16,7 +18,17 @@ const ThemeSelector = () => {
position: 'absolute', position: 'absolute',
}} }}
> >
<Tooltip title={themeMode === 'dark' ? 'Light mode' : 'Dark mode'}> <Tooltip
title={
themeMode === 'dark'
? t('core:theme.light', {
postProcess: 'capitalize',
})
: t('core:theme.light', {
postProcess: 'capitalize',
})
}
>
<IconButton onClick={toggleTheme}> <IconButton onClick={toggleTheme}>
{themeMode === 'dark' ? <LightModeIcon /> : <DarkModeIcon />} {themeMode === 'dark' ? <LightModeIcon /> : <DarkModeIcon />}
</IconButton> </IconButton>