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

@@ -2,8 +2,10 @@ import { useThemeContext } from './ThemeContext';
import { IconButton, Tooltip } from '@mui/material';
import LightModeIcon from '@mui/icons-material/LightMode';
import DarkModeIcon from '@mui/icons-material/DarkMode';
import { useTranslation } from 'react-i18next';
const ThemeSelector = () => {
const { t } = useTranslation(['core']);
const { themeMode, toggleTheme } = useThemeContext();
return (
@@ -16,7 +18,17 @@ const ThemeSelector = () => {
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}>
{themeMode === 'dark' ? <LightModeIcon /> : <DarkModeIcon />}
</IconButton>