mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-03-09 15:40:26 +00:00
refactor: Remove unused "repack_language_code" translations from multiple locale files
This commit is contained in:
parent
0333282915
commit
6053b7cd67
13 changed files with 18 additions and 106 deletions
|
@ -10,10 +10,21 @@ export const supportMultiLanguage = (title: string) => {
|
|||
return multiFollowedByDigitsRegex.test(title.toLowerCase());
|
||||
}
|
||||
|
||||
// const languageCode = 'en';
|
||||
// const displayNames = new Intl.DisplayNames([languageCode], { type: 'language' });
|
||||
// const englishLanguage = displayNames.of(languageCode);
|
||||
|
||||
// console.log(englishLanguage); // Output: "English"
|
||||
|
||||
|
||||
export const getRepackLanguageBasedOnRepacker = (repacker: string) => {
|
||||
const repackMap = {
|
||||
'xatab': 'ru',
|
||||
const languageCodes = {
|
||||
xatab: 'ru',
|
||||
}
|
||||
|
||||
return repackMap[repacker.toLowerCase()] || 'en';
|
||||
const languageCode = languageCodes[repacker.toLowerCase()] || 'en';
|
||||
|
||||
const displayNames = new Intl.DisplayNames([languageCode], { type: 'language' });
|
||||
|
||||
return displayNames.of(languageCode);
|
||||
}
|
||||
|
|
|
@ -109,7 +109,7 @@ export function RepacksModal({
|
|||
{repack.uploadDate
|
||||
? format(repack.uploadDate, "dd/MM/yyyy")
|
||||
: ""}
|
||||
{" - " + t(`repack_language_code.${getRepackLanguageBasedOnRepacker(repack.repacker)}`)}
|
||||
{" - " + getRepackLanguageBasedOnRepacker(repack.repacker)}
|
||||
</p>
|
||||
</div>
|
||||
<SeedersAndPeers
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { GameRepack } from "@types";
|
||||
import { Sprout, Users } from "lucide-react";
|
||||
|
||||
import { useMagnetData } from "./useMagnetData";
|
||||
import { useMagnetHealth } from "./useMagnetHealth";
|
||||
import { Tooltip } from "@renderer/components/tooltip/tooltip";
|
||||
import { SeedersAndPeersSkeleton } from "./seeders-and-peers-skeleton";
|
||||
import { vars } from "@renderer/theme.css";
|
||||
|
@ -11,7 +11,7 @@ interface SeedersAndPeersProps {
|
|||
}
|
||||
|
||||
export function SeedersAndPeers({ repack }: Readonly<SeedersAndPeersProps>) {
|
||||
const { magnetData, isLoading, error } = useMagnetData(repack.magnet);
|
||||
const { magnetData, isLoading, error } = useMagnetHealth(repack.magnet);
|
||||
|
||||
if (isLoading) {
|
||||
return <SeedersAndPeersSkeleton />;
|
||||
|
|
|
@ -3,7 +3,7 @@ import { TorrentData } from "./types";
|
|||
|
||||
const cache: Record<string, TorrentData> = {};
|
||||
|
||||
export function useMagnetData(magnet: string) {
|
||||
export function useMagnetHealth(magnet: string) {
|
||||
const [magnetData, setMagnetData] = useState<TorrentData | null>(
|
||||
cache[magnet] || null
|
||||
);
|
Loading…
Add table
Add a link
Reference in a new issue