🏷️ Apply namespace types to translations

This commit is contained in:
Manuel
2023-08-05 17:45:50 +02:00
parent a287b87a4a
commit bd4b7b8c13
4 changed files with 11 additions and 4 deletions

View File

@@ -1,7 +1,6 @@
import { Button, Group, Stack, Text } from '@mantine/core'; import { Button, Group, Stack, Text } from '@mantine/core';
import { ContextModalProps } from '@mantine/modals'; import { ContextModalProps } from '@mantine/modals';
import { Trans, useTranslation } from 'next-i18next'; import { Trans, useTranslation } from 'next-i18next';
import React from 'react';
import { useConfigContext } from '../../../../config/provider'; import { useConfigContext } from '../../../../config/provider';
import { useConfigStore } from '../../../../config/store'; import { useConfigStore } from '../../../../config/store';

View File

@@ -68,7 +68,7 @@ const SettingsComponent = ({
country: language.country, country: language.country,
})); }));
const { t } = useTranslation('user/preferences'); const { t } = useTranslation(['user/preferences', 'common']);
const { i18nZodResolver } = useI18nZodResolver(); const { i18nZodResolver } = useI18nZodResolver();

View File

@@ -4,8 +4,12 @@ import { useTranslation } from 'next-i18next';
import { DashDotCompactNetwork, DashDotInfo } from './DashDotCompactNetwork'; import { DashDotCompactNetwork, DashDotInfo } from './DashDotCompactNetwork';
import { DashDotCompactStorage } from './DashDotCompactStorage'; import { DashDotCompactStorage } from './DashDotCompactStorage';
import { CustomTypeOptions } from 'i18next';
type GraphType = keyof CustomTypeOptions['resources']['modules/dashdot']['card']['graphs'];
interface DashDotGraphProps { interface DashDotGraphProps {
graph: string; graph: GraphType;
graphHeight: number; graphHeight: number;
isCompact: boolean; isCompact: boolean;
multiView: boolean; multiView: boolean;

View File

@@ -11,6 +11,8 @@ import {
IconSun, IconSun,
} from '@tabler/icons-react'; } from '@tabler/icons-react';
import { useTranslation } from 'next-i18next'; import { useTranslation } from 'next-i18next';
import { TranslationNamespace } from '~/i18n';
import { CustomTypeOptions } from 'i18next';
interface WeatherIconProps { interface WeatherIconProps {
code: number; code: number;
@@ -36,7 +38,9 @@ export const WeatherIcon = ({ code }: WeatherIconProps) => {
); );
}; };
type WeatherDefinitionType = { icon: Icon; name: string; codes: number[] };
type WeatherDescription = keyof CustomTypeOptions['resources']['modules/weather']['card']['weatherDescriptions'];
type WeatherDefinitionType = { icon: Icon; name: WeatherDescription; codes: number[] };
// 0 Clear sky // 0 Clear sky
// 1, 2, 3 Mainly clear, partly cloudy, and overcast // 1, 2, 3 Mainly clear, partly cloudy, and overcast