user-settings: avoid unknown translation keys

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
Patrik Oldsberg
2023-09-16 17:44:42 +02:00
parent 4051adf8fb
commit c83721fee5
4 changed files with 14 additions and 23 deletions
@@ -135,7 +135,7 @@ export const UserSettingsLanguageToggle = () => {
title={t('select_lng', { language })}
value={language}
>
<>{t('lng', { language })}</>
<>{language}</>
</TooltipToggleButton>
);
})}
@@ -142,24 +142,21 @@ export const UserSettingsThemeToggle = () => {
>
{themeIds.map(theme => {
const themeIcon = themeIds.find(it => it.id === theme.id)?.icon;
const themeId = theme.id as 'light' | 'dark';
const themeId = theme.id;
const themeTitle =
theme.title ||
(themeId === 'light' || themeId === 'dark'
? t(`theme_${themeId}`)
: themeId);
return (
<TooltipToggleButton
key={theme.id}
title={
theme.title
? t('select_theme_custom', { custom: theme.title })
: t(`select_theme_${themeId}`)
}
value={theme.id}
key={themeId}
title={t('select_theme', { theme: themeTitle })}
value={themeId}
>
<>
{theme.title || t(`theme_${themeId}`)}&nbsp;
<ThemeIcon
id={theme.id}
icon={themeIcon}
activeId={themeId}
/>
{themeTitle}&nbsp;
<ThemeIcon id={themeId} icon={themeIcon} activeId={themeId} />
</>
</TooltipToggleButton>
);
+1 -4
View File
@@ -27,11 +27,8 @@ export const userSettingsTranslationRef = createTranslationRef({
theme_dark: 'Dark',
theme_auto: 'Auto',
change_the_theme_mode: 'Change the theme mode',
select_theme_light: 'Select light',
select_theme_dark: 'Select dark',
select_theme: 'Select {{theme}}',
select_theme_auto: 'Select Auto Theme',
select_theme_custom: 'Select {{custom}}',
lng: '{{language}}',
select_lng: 'Select language {{language}}',
} as const,
});