mirror of
https://github.com/hydralauncher/hydra.git
synced 2026-01-27 04:41:03 +00:00
40 lines
1.0 KiB
TypeScript
40 lines
1.0 KiB
TypeScript
import { toCapitalize } from "./string";
|
|
|
|
export const isMultiplayerRepack = (title: string, repacker: string) => {
|
|
const titleToLower = title.toLowerCase();
|
|
const repackerToLower = repacker.toLowerCase();
|
|
|
|
return (
|
|
titleToLower.includes("multiplayer") ||
|
|
titleToLower.includes("onlinefix") ||
|
|
titleToLower.includes("online fix") ||
|
|
repackerToLower.includes("onlinefix") ||
|
|
repackerToLower.includes("online fix")
|
|
);
|
|
};
|
|
|
|
export const supportMultiLanguage = (title: string) => {
|
|
const multiFollowedByDigitsRegex = /multi\d+/;
|
|
|
|
return multiFollowedByDigitsRegex.test(title.toLowerCase());
|
|
};
|
|
|
|
export const getRepackLanguageBasedOnRepacker = (
|
|
repacker: string,
|
|
userLanguage: string
|
|
) => {
|
|
const languageCodes = {
|
|
xatab: "ru",
|
|
};
|
|
|
|
const languageCode = languageCodes[repacker.toLowerCase()] || "en";
|
|
|
|
const displayNames = new Intl.DisplayNames([userLanguage], {
|
|
type: "language",
|
|
});
|
|
|
|
const language = displayNames.of(languageCode);
|
|
|
|
return language ? toCapitalize(language) : "English";
|
|
};
|