Skip to content

Commit

Permalink
feat: translate StudioFilter component's strings
Browse files Browse the repository at this point in the history
  • Loading branch information
notwindstone committed Jun 23, 2024
1 parent 2203229 commit 0945685
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions messages/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"locale": "en"
},
"Translations": {
"component__studio-filter__studio-placeholder-label": "Studio",
"component__status-filter__status-label": "Status",
"common__season-winter": "Winter",
"common__season-spring": "Spring",
Expand Down
1 change: 1 addition & 0 deletions messages/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"locale": "ru"
},
"Translations": {
"component__studio-filter__studio-placeholder-label": "Студия",
"component__status-filter__status-label": "Статус",
"common__season-winter": "Зима",
"common__season-spring": "Весна",
Expand Down
8 changes: 6 additions & 2 deletions src/components/Filters/StudioFilter/StudioFilter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {useDisclosure} from "@mantine/hooks";
import calculateColor from "@/utils/Misc/calculateColor";
import {useQuery} from "@tanstack/react-query";
import {client} from "@/lib/shikimori/client";
import {useTranslations} from "next-intl";

export default (function StudioFilter({
studio,
Expand All @@ -14,6 +15,7 @@ export default (function StudioFilter({
studio: string | null,
setStudio: Dispatch<SetStateAction<string | null>>
}) {
const translate = useTranslations('Translations');
const [studiosData, setStudiosData] = useState<{ label: string, value: string }[]>([]);
const shikimori = client();
const { theme } = useCustomTheme();
Expand Down Expand Up @@ -66,7 +68,9 @@ export default (function StudioFilter({

if (error) {
return (
<>Ошибка: {error.message}</>
<>
{translate('common__error-label')}: {error.message}
</>
);
}

Expand All @@ -83,7 +87,7 @@ export default (function StudioFilter({
}
}}
classNames={classes}
placeholder="Студия"
placeholder={translate('component__studio-filter__studio-placeholder-label')}
value={studio}
onChange={setStudio}
data={studiosData}
Expand Down

0 comments on commit 0945685

Please sign in to comment.