feat: adding translation for catalogue

This commit is contained in:
Chubby Granny Chaser 2024-12-23 21:52:01 +00:00
parent 4aa7df65f5
commit d072a14aa3
No known key found for this signature in database
6 changed files with 44 additions and 15 deletions

View File

@ -46,8 +46,15 @@
"checking_files": "Checking {{title}} files… ({{percentage}} complete)" "checking_files": "Checking {{title}} files… ({{percentage}} complete)"
}, },
"catalogue": { "catalogue": {
"next_page": "Next page", "search": "Filter…",
"previous_page": "Previous page" "developers": "Developers",
"genres": "Genres",
"tags": "Tags",
"publishers": "Publishers",
"download_sources": "Download sources",
"result_count": "{{count}} results",
"filter_count": "{{count}} available",
"clear_filters": "Clear {{count}} selected"
}, },
"game_details": { "game_details": {
"open_download_options": "Open download options", "open_download_options": "Open download options",

View File

@ -46,8 +46,15 @@
"checking_files": "Verificando archivos de {{title}}… ({{percentage}} completado)" "checking_files": "Verificando archivos de {{title}}… ({{percentage}} completado)"
}, },
"catalogue": { "catalogue": {
"next_page": "Siguiente página", "search": "Filtrar…",
"previous_page": "Pagina anterior" "developers": "Desarrolladores",
"genres": "Géneros",
"tags": "Marcadores",
"publishers": "Distribuidoras",
"download_sources": "Fuentes de descarga",
"result_count": "{{count}} resultados",
"filter_count": "{{count}} disponibles",
"clear_filters": "Limpiar {{count}} seleccionados"
}, },
"game_details": { "game_details": {
"open_download_options": "Ver opciones de descargas", "open_download_options": "Ver opciones de descargas",

View File

@ -284,11 +284,15 @@
"instructions": "Verifique a forma correta de instalar algum deles no seu distro Linux, garantindo assim a execução normal do jogo" "instructions": "Verifique a forma correta de instalar algum deles no seu distro Linux, garantindo assim a execução normal do jogo"
}, },
"catalogue": { "catalogue": {
"search": "Pesquisar…", "search": "Filtrar…",
"developers": "Desenvolvedores", "developers": "Desenvolvedores",
"genres": "Gêneros", "genres": "Gêneros",
"tags": "Tags", "tags": "Marcadores",
"download_sources": "Fontes de download" "publishers": "Distribuidoras",
"download_sources": "Fontes de download",
"result_count": "{{count}} resultados",
"filter_count": "{{count}} disponíveis",
"clear_filters": "Limpar {{count}} selecionados"
}, },
"modal": { "modal": {
"close": "Botão de fechar" "close": "Botão de fechar"

View File

@ -46,8 +46,15 @@
"checking_files": "Проверка файлов {{title}}… ({{percentage}} завершено)" "checking_files": "Проверка файлов {{title}}… ({{percentage}} завершено)"
}, },
"catalogue": { "catalogue": {
"next_page": "Следующая страница", "search": "Фильтр…",
"previous_page": "Предыдущая страница" "developers": "Разработчики",
"genres": "Жанры",
"tags": "Маркеры",
"publishers": "Издательства",
"download_sources": "Источники загрузки",
"result_count": "{{count}} результатов",
"filter_count": "{{count}} доступных",
"clear_filters": "Очистить {{count}} выбранных"
}, },
"game_details": { "game_details": {
"open_download_options": "Открыть источники", "open_download_options": "Открыть источники",

View File

@ -301,7 +301,9 @@ export default function Catalogue() {
marginTop: 16, marginTop: 16,
}} }}
> >
<span>{formatNumber(itemsCount)} resultados</span> <span style={{ fontSize: 12 }}>
{t("result_count", { count: formatNumber(itemsCount) })}
</span>
<Pagination <Pagination
page={page} page={page}

View File

@ -3,6 +3,8 @@ import { useFormat } from "@renderer/hooks";
import { useCallback, useMemo, useState } from "react"; import { useCallback, useMemo, useState } from "react";
import List from "rc-virtual-list"; import List from "rc-virtual-list";
import { vars } from "@renderer/theme.css";
import { useTranslation } from "react-i18next";
export interface FilterSectionProps { export interface FilterSectionProps {
title: string; title: string;
@ -24,6 +26,7 @@ export function FilterSection({
onClear, onClear,
}: FilterSectionProps) { }: FilterSectionProps) {
const [search, setSearch] = useState(""); const [search, setSearch] = useState("");
const { t } = useTranslation("catalogue");
const filteredItems = useMemo(() => { const filteredItems = useMemo(() => {
if (search.length > 0) { if (search.length > 0) {
@ -64,7 +67,6 @@ export function FilterSection({
style={{ style={{
fontSize: 16, fontSize: 16,
fontWeight: 500, fontWeight: 500,
color: "#fff",
}} }}
> >
{title} {title}
@ -78,22 +80,22 @@ export function FilterSection({
fontSize: 12, fontSize: 12,
marginBottom: 12, marginBottom: 12,
display: "block", display: "block",
color: "#fff", color: vars.color.body,
cursor: "pointer", cursor: "pointer",
textDecoration: "underline", textDecoration: "underline",
}} }}
onClick={onClear} onClick={onClear}
> >
Limpar {formatNumber(selectedItemsCount)} selecionados {t("clear_filters", { count: formatNumber(selectedItemsCount) })}
</button> </button>
) : ( ) : (
<span style={{ fontSize: 12, marginBottom: 12, display: "block" }}> <span style={{ fontSize: 12, marginBottom: 12, display: "block" }}>
{formatNumber(items.length)} disponíveis {t("filter_count", { count: formatNumber(items.length) })}
</span> </span>
)} )}
<TextField <TextField
placeholder="Search..." placeholder={t("search")}
onChange={(e) => onSearch(e.target.value)} onChange={(e) => onSearch(e.target.value)}
value={search} value={search}
containerProps={{ style: { marginBottom: 16 } }} containerProps={{ style: { marginBottom: 16 } }}