Refactor to use scan.priority.region for IGDB localization

Remove provider-specific locale configuration and use existing scan.priority.region for IGDB regional variants.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Tanguy Mazé
2025-11-23 02:01:13 +01:00
parent 6a85f9a439
commit 28823d39dd
26 changed files with 31 additions and 231 deletions

View File

@@ -84,7 +84,6 @@ class Config:
SCAN_REGION_PRIORITY: list[str]
SCAN_LANGUAGE_PRIORITY: list[str]
SCAN_MEDIA: list[str]
METADATA_PROVIDER_LOCALES: dict[str, str]
def __init__(self, **entries):
self.__dict__.update(entries)
@@ -273,11 +272,6 @@ class ConfigManager:
"manual",
],
),
METADATA_PROVIDER_LOCALES=pydash.get(
self._raw_config,
"scan.provider_locales",
{},
),
)
def _get_ejs_controls(self) -> dict[str, EjsControls]:
@@ -467,19 +461,6 @@ class ConfigManager:
)
sys.exit(3)
if not isinstance(self.config.METADATA_PROVIDER_LOCALES, dict):
log.critical(
"Invalid config.yml: scan.provider_locales must be a dictionary"
)
sys.exit(3)
else:
for provider, locale in self.config.METADATA_PROVIDER_LOCALES.items():
if not isinstance(locale, str):
log.critical(
f"Invalid config.yml: scan.provider_locales.{provider} must be a string"
)
sys.exit(3)
def get_config(self) -> Config:
try:
with open(self.config_file, "r") as config_file:
@@ -535,7 +516,6 @@ class ConfigManager:
"region": self.config.SCAN_REGION_PRIORITY,
"language": self.config.SCAN_LANGUAGE_PRIORITY,
},
"provider_locales": self.config.METADATA_PROVIDER_LOCALES,
},
}
@@ -614,9 +594,5 @@ class ConfigManager:
self.config.__setattr__(exclusion_type, config_item)
self._update_config_file()
def update_provider_locales(self, locales: dict[str, str]) -> None:
self.config.METADATA_PROVIDER_LOCALES = locales
self._update_config_file()
config_manager = ConfigManager()

View File

@@ -43,7 +43,6 @@ def get_config() -> ConfigResponse:
SCAN_ARTWORK_PRIORITY=cfg.SCAN_ARTWORK_PRIORITY,
SCAN_REGION_PRIORITY=cfg.SCAN_REGION_PRIORITY,
SCAN_LANGUAGE_PRIORITY=cfg.SCAN_LANGUAGE_PRIORITY,
METADATA_PROVIDER_LOCALES=cfg.METADATA_PROVIDER_LOCALES,
)
@@ -140,19 +139,3 @@ async def delete_exclusion(
raise HTTPException(
status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, detail=exc.message
) from exc
@protected_route(router.put, "/provider-locales", [Scope.PLATFORMS_WRITE])
async def update_provider_locales(request: Request) -> None:
"""Update metadata provider locales in the configuration"""
data = await request.json()
locales = data.get("locales", {})
try:
cm.update_provider_locales(locales)
except ConfigNotWritableException as exc:
log.critical(exc.message)
raise HTTPException(
status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, detail=exc.message
) from exc

View File

@@ -23,4 +23,3 @@ class ConfigResponse(TypedDict):
SCAN_ARTWORK_PRIORITY: list[str]
SCAN_REGION_PRIORITY: list[str]
SCAN_LANGUAGE_PRIORITY: list[str]
METADATA_PROVIDER_LOCALES: dict[str, str]

View File

@@ -210,10 +210,37 @@ def extract_metadata_from_igdb_rom(self: MetadataHandler, rom: Game) -> IGDBMeta
)
# Mapping from scan.priority.region codes to IGDB game_localizations region identifiers
# IGDB's game_localizations provides regional titles and cover art, but NOT localized descriptions
REGION_TO_IGDB_LOCALE: dict[str, str | None] = {
"us": None, # United States - use default (no localization needed)
"wor": None, # World - use default
"eu": "EU", # Europe region
"jp": "ja-JP", # Japan
"kr": "ko-KR", # Korea
"cn": "zh-CN", # China (Simplified Chinese)
"tw": "zh-TW", # Taiwan (Traditional Chinese)
}
def get_igdb_preferred_locale() -> str | None:
"""Get IGDB-specific locale from config, if set."""
"""Get IGDB locale from scan.priority.region configuration.
Maps region priority codes to IGDB's game_localizations region identifiers.
Returns the first matching region from the priority list, or None for default.
Returns:
IGDB region identifier (e.g., "ja-JP", "EU") or None for default
"""
config = cm.get_config()
return config.METADATA_PROVIDER_LOCALES.get("igdb")
# Check each region in priority order and return first match
for region in config.SCAN_REGION_PRIORITY:
igdb_locale = REGION_TO_IGDB_LOCALE.get(region.lower())
if igdb_locale is not None:
return igdb_locale
return None # Default - no localization
def extract_localized_data(rom: Game, preferred_locale: str | None) -> tuple[str, str]:

View File

@@ -39,20 +39,11 @@ def get_preferred_regions() -> list[str]:
def get_preferred_languages() -> list[str]:
"""Get preferred languages from config
"""Get preferred languages from config.
Uses provider-specific locale if set, otherwise falls back to language priority list.
Always includes English as final fallback.
Returns language priority list with default fallbacks.
"""
config = cm.get_config()
# Check for provider-specific locale first
provider_locale = config.METADATA_PROVIDER_LOCALES.get("ss")
if provider_locale:
# Use provider locale with English fallback
return list(dict.fromkeys([provider_locale, "en"]))
# Fall back to language priority list
return list(dict.fromkeys(config.SCAN_LANGUAGE_PRIORITY + ["en", "fr"]))

View File

@@ -23,6 +23,5 @@ export type ConfigResponse = {
SCAN_ARTWORK_PRIORITY: Array<string>;
SCAN_REGION_PRIORITY: Array<string>;
SCAN_LANGUAGE_PRIORITY: Array<string>;
METADATA_PROVIDER_LOCALES: Record<string, string>;
};

View File

@@ -15,17 +15,12 @@
"disabled-by-admin": "Zakázáno administrátorem",
"hashes": "Přepočítat hashe",
"hashes-desc": "Přepočítá hashe pro vybrané platformy",
<<<<<<< HEAD
"hashes-disabled-tooltip": "Výpočet hashů zakázán.<br><br>Hashe (MD5, SHA1, CRC32) jsou jedinečné otisky, které přesně identifikují soubory ROM.<br><br>Bez nich nemohou Hasheous a RetroAchievements porovnávat hry se svými databázemi, ale skenování bude rychlejší.",
"hashes-enabled-tooltip": "Výpočet hashů povolen.<br><br>Budou vypočítány hashe (MD5, SHA1, CRC32) pro vytvoření jedinečných otisků každého souboru ROM.<br><br>To umožňuje Hasheous a RetroAchievements přesně identifikovat hry ve svých databázích.",
"hash-calculation-disabled": "Výpočet hash je zakázán",
"hasheous-requires-hashes": "Hasheous vyžaduje povolené počítání hashů",
"retroachievements-requires-hashes": "RetroAchievements vyžaduje povolené počítání hashů",
"manage-library": "Správa knihovny",
=======
"locale-not-supported": "Nepodporováno",
"manage-library": "Spravovat knihovnu",
>>>>>>> da0735a29 (Add metadata locale selection for IGDB and ScreenScraper)
"metadata-sources": "Zdroje metadat",
"new-platforms": "Nové platformy",
"new-platforms-desc": "Skenovat pouze nové platformy (nejrychlejší)",

View File

@@ -14,17 +14,12 @@
"connection-successful": "Verbindung erfolgreich",
"disabled-by-admin": "Vom Administrator deaktiviert",
"hashes": "Hashes neu berechnen",
<<<<<<< HEAD
"hashes-desc": "Berechnet Hashes für ausgewählte Plattformen neu",
"hashes-disabled-tooltip": "Hash-Berechnung deaktiviert.<br><br>Hashes (MD5, SHA1, CRC32) sind eindeutige Fingerabdrücke, die ROM-Dateien präzise identifizieren.<br><br>Ohne sie können Hasheous und RetroAchievements Spiele nicht mit ihren Datenbanken abgleichen, aber das Scannen wird schneller.",
"hashes-enabled-tooltip": "Hash-Berechnung aktiviert.<br><br>Hashes (MD5, SHA1, CRC32) werden berechnet, um eindeutige Fingerabdrücke für jede ROM-Datei zu erstellen.<br><br>Dies ermöglicht es Hasheous und RetroAchievements, Spiele in ihren Datenbanken genau zu identifizieren.",
"hash-calculation-disabled": "Hash-Berechnung ist deaktiviert",
"hasheous-requires-hashes": "Hasheous erfordert aktivierte Hash-Berechnung",
"retroachievements-requires-hashes": "RetroAchievements erfordert aktivierte Hash-Berechnung",
=======
"hashes-desc": "Berechne Hashes für ausgewählte Plattformen neu",
"locale-not-supported": "Nicht unterstützt",
>>>>>>> da0735a29 (Add metadata locale selection for IGDB and ScreenScraper)
"manage-library": "Bibliothek verwalten",
"metadata-sources": "Quellen für Metadaten",
"new-platforms": "Neue Platformen",

View File

@@ -1,7 +1,5 @@
{
"about": "About",
"default": "Default",
"language": "Language",
"add": "Add",
"administration": "Administration",
"apply": "Apply",

View File

@@ -15,14 +15,10 @@
"disabled-by-admin": "Disabled by the administrator",
"hashes": "Recalculate hashes",
"hashes-desc": "Recalculates hashes for selected platforms",
<<<<<<< HEAD
"hashes-disabled-tooltip": "File hash calculation disabled.<br><br>Hashes (MD5, SHA1, CRC32) are unique fingerprints that identify ROM files precisely.<br><br>Without them, Hasheous and RetroAchievements cannot match games to their databases, but scanning will be faster.",
"hashes-enabled-tooltip": "File hash calculation enabled.<br><br>Hashes (MD5, SHA1, CRC32) will be calculated to create unique fingerprints for each ROM file.<br><br>This enables Hasheous and RetroAchievements to accurately identify games in their databases.",
"hash-calculation-disabled": "Hash calculation is disabled",
"hasheous-requires-hashes": "Hasheous requires hash calculation to be enabled",
=======
"locale-not-supported": "Not supported",
>>>>>>> da0735a29 (Add metadata locale selection for IGDB and ScreenScraper)
"manage-library": "Manage library",
"metadata-sources": "Metadata sources",
"new-platforms": "New platforms",

View File

@@ -14,11 +14,7 @@
"confirm-deletion": "Confirm Deletion",
"core": "Core",
"create": "Create",
<<<<<<< HEAD
"delete": "Delete",
=======
"default": "Default",
>>>>>>> da0735a29 (Add metadata locale selection for IGDB and ScreenScraper)
"dropzone-description": "Drag and drop your ROM files here, or click to browse",
"dropzone-drag-over": "Release to upload",
"dropzone-title": "Drop files here",
@@ -29,11 +25,7 @@
"games-n": "{n} Game | {n} Games",
"invalid-email": "Invalid email",
"invalid-name": "Invalid name",
<<<<<<< HEAD
"last-updated": "Last updated",
=======
"language": "Language",
>>>>>>> da0735a29 (Add metadata locale selection for IGDB and ScreenScraper)
"library-management": "Library management",
"logout": "Logout",
"name": "Name",

View File

@@ -15,15 +15,11 @@
"disabled-by-admin": "Disabled by the administrator",
"hashes": "Recalculate hashes",
"hashes-desc": "Recalculates hashes for selected platforms",
<<<<<<< HEAD
"hashes-disabled-tooltip": "File hash calculation disabled.<br><br>Hashes (MD5, SHA1, CRC32) are unique fingerprints that identify ROM files precisely.<br><br>Without them, Hasheous and RetroAchievements cannot match games to their databases, but scanning will be faster.",
"hashes-enabled-tooltip": "File hash calculation enabled.<br><br>Hashes (MD5, SHA1, CRC32) will be calculated to create unique fingerprints for each ROM file.<br><br>This enables Hasheous and RetroAchievements to accurately identify games in their databases.",
"hash-calculation-disabled": "Hash calculation is disabled",
"hasheous-requires-hashes": "Hasheous requires hash calculation to be enabled",
"retroachievements-requires-hashes": "RetroAchievements requires hash calculation to be enabled",
=======
"locale-not-supported": "Not supported",
>>>>>>> da0735a29 (Add metadata locale selection for IGDB and ScreenScraper)
"manage-library": "Manage library",
"metadata-sources": "Metadata sources",
"new-platforms": "New platforms",

View File

@@ -15,15 +15,11 @@
"disabled-by-admin": "Deshabilitado por el administrador",
"hashes": "Recalcular hashes",
"hashes-desc": "Recalcula los hashes de las plataformas seleccionadas",
<<<<<<< HEAD
"hashes-disabled-tooltip": "Cálculo de hash deshabilitado.<br><br>Los hashes (MD5, SHA1, CRC32) son huellas digitales únicas que identifican archivos ROM con precisión.<br><br>Sin ellos, Hasheous y RetroAchievements no pueden comparar juegos con sus bases de datos, pero el escaneo será más rápido.",
"hashes-enabled-tooltip": "Cálculo de hash habilitado.<br><br>Se calcularán hashes (MD5, SHA1, CRC32) para crear huellas digitales únicas de cada archivo ROM.<br><br>Esto permite a Hasheous y RetroAchievements identificar juegos con precisión en sus bases de datos.",
"hash-calculation-disabled": "El cálculo de hash está deshabilitado",
"hasheous-requires-hashes": "Hasheous requiere que el cálculo de hashes esté habilitado",
"retroachievements-requires-hashes": "RetroAchievements requiere que el cálculo de hashes esté habilitado",
=======
"locale-not-supported": "No compatible",
>>>>>>> da0735a29 (Add metadata locale selection for IGDB and ScreenScraper)
"manage-library": "Gestionar biblioteca",
"metadata-sources": "Fuentes de metadatos",
"new-platforms": "Plataformas nuevas",

View File

@@ -15,15 +15,11 @@
"disabled-by-admin": "Désactivé par l'administrateur",
"hashes": "Recalculer les hachages",
"hashes-desc": "Recalculer les hachages des plateformes sélectionnées",
<<<<<<< HEAD
"hashes-disabled-tooltip": "Calcul de hachage désactivé.<br><br>Les hachages (MD5, SHA1, CRC32) sont des empreintes uniques qui identifient les fichiers ROM avec précision.<br><br>Sans eux, Hasheous et RetroAchievements ne peuvent pas faire correspondre les jeux à leurs bases de données, mais l'analyse sera plus rapide.",
"hashes-enabled-tooltip": "Calcul de hachage de fichier activé.<br><br>Les hachages (MD5, SHA1, CRC32) seront calculés pour créer des empreintes uniques pour chaque fichier ROM.<br><br>Ceci permet à Hasheous et RetroAchievements d'identifier précisément les jeux dans leurs bases de données.",
"hash-calculation-disabled": "Le calcul de hachage est désactivé",
"hasheous-requires-hashes": "Hasheous nécessite que le calcul de hachage soit activé",
"retroachievements-requires-hashes": "RetroAchievements nécessite que le calcul de hachage soit activé",
=======
"locale-not-supported": "Non pris en charge",
>>>>>>> da0735a29 (Add metadata locale selection for IGDB and ScreenScraper)
"manage-library": "Gérer la bibliothèque",
"metadata-sources": "Sources de métadonnées",
"new-platforms": "Nouvelles plateformes",

View File

@@ -15,15 +15,11 @@
"disabled-by-admin": "Disabilitato dall'amministratore",
"hashes": "Ricalcola hash",
"hashes-desc": "Ricalcola gli hash per le piattaforme selezionate",
<<<<<<< HEAD
"hashes-disabled-tooltip": "Calcolo hash disabilitato.<br><br>Gli hash (MD5, SHA1, CRC32) sono impronte digitali uniche che identificano i file ROM con precisione.<br><br>Senza di essi, Hasheous e RetroAchievements non possono confrontare i giochi con i loro database, ma la scansione sarà più veloce.",
"hashes-enabled-tooltip": "Calcolo hash abilitato.<br><br>Verranno calcolati gli hash (MD5, SHA1, CRC32) per creare impronte digitali uniche di ogni file ROM.<br><br>Questo consente a Hasheous e RetroAchievements di identificare accuratamente i giochi nei loro database.",
"hash-calculation-disabled": "Il calcolo dell'hash è disabilitato",
"hasheous-requires-hashes": "Hasheous richiede che il calcolo degli hash sia abilitato",
"retroachievements-requires-hashes": "RetroAchievements richiede che il calcolo degli hash sia abilitato",
=======
"locale-not-supported": "Non supportato",
>>>>>>> da0735a29 (Add metadata locale selection for IGDB and ScreenScraper)
"manage-library": "Gestisci libreria",
"metadata-sources": "Fonti metadati",
"new-platforms": "Nuove piattaforme",

View File

@@ -15,14 +15,10 @@
"disabled-by-admin": "管理者によって無効化されています",
"hashes": "ハッシュ値の再計算",
"hashes-desc": "選択されたプラットフォームのハッシュ値を再計算します",
<<<<<<< HEAD
"hashes-disabled-tooltip": "ファイルハッシュ計算が無効。<br><br>ハッシュMD5、SHA1、CRC32はROMファイルを正確に識別するユニークな指紋です。<br><br>これがないと、HasheousやRetroAchievementsはゲームをデータベースとマッチングできませんが、スキャンは高速になります。",
"hashes-enabled-tooltip": "ファイルハッシュ計算が有効です。<br><br>各ROMファイルの一意の指紋を作成するために、ハッシュMD5、SHA1、CRC32が計算されます。<br><br>これにより、HasheousとRetroAchievementsがデータベース内のゲームを正確に識別できます。",
"hash-calculation-disabled": "ハッシュ計算が無効になっています",
"hasheous-requires-hashes": "Hasheousはファイルハッシュが必要です",
=======
"locale-not-supported": "非対応",
>>>>>>> da0735a29 (Add metadata locale selection for IGDB and ScreenScraper)
"manage-library": "ライブラリを編集",
"metadata-sources": "メタデータ取得元",
"new-platforms": "新規プラットフォーム",

View File

@@ -15,14 +15,10 @@
"disabled-by-admin": "관리자에 의해 비활성화됨",
"hashes": "해시",
"hashes-desc": "선택된 플랫폼의 해시를 다시 계산",
<<<<<<< HEAD
"hashes-disabled-tooltip": "해시 계산이 비활성화됨.<br><br>해시(MD5, SHA1, CRC32)는 ROM 파일을 정확히 식별하는 고유한 지문입니다.<br><br>해시 없이는 Hasheous와 RetroAchievements가 데이터베이스와 게임을 매치할 수 없지만, 스캔이 더 빨라집니다.",
"hashes-enabled-tooltip": "해시 계산이 활성화됨.<br><br>각 ROM 파일의 고유한 지문을 생성하기 위해 해시(MD5, SHA1, CRC32)가 계산됩니다.<br><br>이를 통해 Hasheous와 RetroAchievements가 데이터베이스에서 게임을 정확히 식별할 수 있습니다.",
"hash-calculation-disabled": "해시 계산이 비활성화되어 있습니다",
"hasheous-requires-hashes": "Hasheous는 파일 해시가 필요합니다",
=======
"locale-not-supported": "지원되지 않음",
>>>>>>> da0735a29 (Add metadata locale selection for IGDB and ScreenScraper)
"manage-library": "라이브러리 관리",
"metadata-sources": "메타데이터 DB",
"new-platforms": "새 플랫폼",

View File

@@ -15,15 +15,11 @@
"disabled-by-admin": "Wyłączone przez administratora",
"hashes": "Przelicz sumy kontrolne",
"hashes-desc": "Przelicza sumy kontrolne dla wybranych platform",
<<<<<<< HEAD
"hashes-disabled-tooltip": "Obliczanie skrótów wyłączone.<br><br>Skróty (MD5, SHA1, CRC32) to unikalne odciski palców, które precyzyjnie identyfikują pliki ROM.<br><br>Bez nich Hasheous i RetroAchievements nie mogą dopasować gier do swoich baz danych, ale skanowanie będzie szybsze.",
"hashes-enabled-tooltip": "Obliczanie skrótów włączone.<br><br>Zostaną obliczone skróty (MD5, SHA1, CRC32) w celu utworzenia unikalnych odcisków palców każdego pliku ROM.<br><br>To pozwala Hasheous i RetroAchievements na dokładną identyfikację gier w ich bazach danych.",
"hash-calculation-disabled": "Obliczanie skrótów jest wyłączone",
"hasheous-requires-hashes": "Hasheous wymaga włączonego obliczania skrótów",
"retroachievements-requires-hashes": "RetroAchievements wymaga włączonego obliczania skrótów",
=======
"locale-not-supported": "Nieobsługiwane",
>>>>>>> da0735a29 (Add metadata locale selection for IGDB and ScreenScraper)
"manage-library": "Zarządzaj biblioteką",
"metadata-sources": "Źródła metadanych",
"new-platforms": "Nowe platformy",

View File

@@ -14,17 +14,12 @@
"connection-successful": "Conexão bem-sucedida",
"disabled-by-admin": "Desativado pelo administrador",
"hashes": "Recalcular hashes",
<<<<<<< HEAD
"hashes-desc": "Recalcula hashes das plataformas selecionadas",
"hashes-disabled-tooltip": "Cálculo de hash desabilitado.<br><br>Hashes (MD5, SHA1, CRC32) são impressões digitais únicas que identificam arquivos ROM com precisão.<br><br>Sem eles, Hasheous e RetroAchievements não podem comparar jogos com seus bancos de dados, mas a varredura será mais rápida.",
"hashes-enabled-tooltip": "Cálculo de hash habilitado.<br><br>Hashes (MD5, SHA1, CRC32) serão calculados para criar impressões digitais únicas de cada arquivo ROM.<br><br>Isso permite que Hasheous e RetroAchievements identifiquem jogos com precisão em seus bancos de dados.",
"hash-calculation-disabled": "O cálculo de hash está desabilitado",
"hasheous-requires-hashes": "Hasheous requer que o cálculo de hash esteja habilitado",
"retroachievements-requires-hashes": "RetroAchievements requer que o cálculo de hash esteja habilitado",
=======
"hashes-desc": "Recalcular hashes para as plataformas selecionadas",
"locale-not-supported": "Não suportado",
>>>>>>> da0735a29 (Add metadata locale selection for IGDB and ScreenScraper)
"manage-library": "Gerenciar biblioteca",
"metadata-sources": "Fontes de metadados",
"new-platforms": "Novas plataformas",

View File

@@ -14,16 +14,11 @@
"connection-successful": "Conexiune reușită",
"disabled-by-admin": "Dezactivat de administrator",
"hashes": "Recalculează hash-urile",
<<<<<<< HEAD
"hashes-desc": "Recalculează hash-urile pentru platformele selectate",
"hashes-disabled-tooltip": "Calculul hash-urilor dezactivat.<br><br>Hash-urile (MD5, SHA1, CRC32) sunt amprente digitale unice care identifică fișierele ROM cu precizie.<br><br>Fără ele, Hasheous și RetroAchievements nu pot potrivi jocurile cu bazele lor de date, dar scanarea va fi mai rapidă.",
"hashes-enabled-tooltip": "Calculul hash-urilor activat.<br><br>Se vor calcula hash-uri (MD5, SHA1, CRC32) pentru a crea amprente digitale unice pentru fiecare fișier ROM.<br><br>Aceasta permite lui Hasheous și RetroAchievements să identifice cu precizie jocurile în bazele lor de date.",
"hash-calculation-disabled": "Calculul hash-ului este dezactivat",
"hasheous-requires-hashes": "Hasheous necesită hash-uri de fișiere",
=======
"hashes-desc": "Recalculează hash-urile platformelor selectate",
"locale-not-supported": "Nesuportat",
>>>>>>> da0735a29 (Add metadata locale selection for IGDB and ScreenScraper)
"manage-library": "Gestionează biblioteca",
"metadata-sources": "Surse de metadate",
"new-platforms": "Platforme noi",

View File

@@ -14,16 +14,11 @@
"connection-successful": "Соединение успешно установлено",
"disabled-by-admin": "Отключено администратором",
"hashes": "Пересчитать хеши",
<<<<<<< HEAD
"hashes-desc": "Пересчитывает хеши для выбранных платформ",
"hashes-disabled-tooltip": "Вычисление хешей отключено.<br><br>Хеши (MD5, SHA1, CRC32) - это уникальные отпечатки, которые точно идентифицируют файлы ROM.<br><br>Без них Hasheous и RetroAchievements не могут сопоставить игры с своими базами данных, но сканирование будет быстрее.",
"hashes-enabled-tooltip": "Вычисление хешей включено.<br><br>Будут вычислены хеши (MD5, SHA1, CRC32) для создания уникальных отпечатков каждого файла ROM.<br><br>Это позволяет Hasheous и RetroAchievements точно идентифицировать игры в своих базах данных.",
"hash-calculation-disabled": "Вычисление хешей отключено",
"hasheous-requires-hashes": "Hasheous требует хеши файлов",
=======
"hashes-desc": "Пересчитать хеши для выбранных платформ",
"locale-not-supported": "Не поддерживается",
>>>>>>> da0735a29 (Add metadata locale selection for IGDB and ScreenScraper)
"manage-library": "Управление библиотекой",
"metadata-sources": "Источники мета<D182><D0B0>анных",
"new-platforms": "Новые платформы",

View File

@@ -15,14 +15,10 @@
"disabled-by-admin": "已被管理员禁用",
"hashes": "哈希",
"hashes-desc": "重新计算选定平台的哈希值",
<<<<<<< HEAD
"hashes-disabled-tooltip": "哈希计算已禁用。<br><br>哈希值MD5、SHA1、CRC32是精确识别 ROM 文件的唯一指纹。<br><br>没有它们Hasheous 和 RetroAchievements 无法将游戏与其数据库进行匹配,但扫描速度会更快。",
"hashes-enabled-tooltip": "文件哈希计算已启用。<br><br>将计算哈希值MD5、SHA1、CRC32为每个 ROM 文件创建唯一指纹。<br><br>这使得 Hasheous 和 RetroAchievements 能够在其数据库中准确识别游戏。",
"hash-calculation-disabled": "哈希计算已禁用",
"hasheous-requires-hashes": "Hasheous 需要文件哈希",
=======
"locale-not-supported": "不支持",
>>>>>>> da0735a29 (Add metadata locale selection for IGDB and ScreenScraper)
"manage-library": "管理游戏库",
"metadata-sources": "元数据源",
"new-platforms": "新平台",

View File

@@ -15,14 +15,10 @@
"disabled-by-admin": "已被管理員禁用",
"hashes": "雜湊",
"hashes-desc": "重新計算選定平台的雜湊值",
<<<<<<< HEAD
"hashes-disabled-tooltip": "哈希計算已停用。<br><br>哈希值MD5、SHA1、CRC32是唯一識別 ROM 檔案的數字指紋。<br><br>沒有它們Hasheous 和 RetroAchievements 無法將遊戲與資料庫匹配,但掃描速度會更快。",
"hashes-enabled-tooltip": "哈希計算已啟用。<br><br>將計算哈希值MD5、SHA1、CRC32為每個 ROM 檔案建立唯一指紋。<br><br>這使 Hasheous 和 RetroAchievements 能夠準確識別其資料庫中的遊戲。",
"hash-calculation-disabled": "雜湊計算已停用",
"hasheous-requires-hashes": "Hasheous 需要檔案哈希",
=======
"locale-not-supported": "不支援",
>>>>>>> da0735a29 (Add metadata locale selection for IGDB and ScreenScraper)
"manage-library": "管理遊戲庫",
"metadata-sources": "元數據來源",
"new-platforms": "新平台",

View File

@@ -53,14 +53,6 @@ async function deleteExclusion({
return api.delete(`/config/exclude/${exclusionType}/${exclusionValue}`);
}
async function updateProviderLocales({
locales,
}: {
locales: Record<string, string>;
}) {
return api.put("/config/provider-locales", { locales });
}
export default {
addPlatformBindConfig,
deletePlatformBindConfig,
@@ -68,5 +60,4 @@ export default {
deletePlatformVersionConfig,
addExclusion,
deleteExclusion,
updateProviderLocales,
};

View File

@@ -31,7 +31,6 @@ const defaultConfig = {
SCAN_ARTWORK_PRIORITY: [],
SCAN_REGION_PRIORITY: [],
SCAN_LANGUAGE_PRIORITY: [],
METADATA_PROVIDER_LOCALES: {},
} as ConfigResponse;
export default defineStore("config", {

View File

@@ -4,56 +4,11 @@ import { useI18n } from "vue-i18n";
import RSection from "@/components/common/RSection.vue";
import storeHeartbeat from "@/stores/heartbeat";
import storeConfig from "@/stores/config";
import configApi from "@/services/api/config";
const { t } = useI18n();
const heartbeat = storeHeartbeat();
const configStore = storeConfig();
// Available locales for providers that support them
const ssLocales = computed(() => [
{ title: t("common.default"), value: "" },
{ title: "English", value: "en" },
{ title: "Français", value: "fr" },
{ title: "Deutsch", value: "de" },
{ title: "Español", value: "es" },
{ title: "Italiano", value: "it" },
{ title: "Português", value: "pt" },
]);
// IGDB locales (uses full region codes like ja-JP)
const igdbLocales = computed(() => [
{ title: t("common.default"), value: "" },
{ title: "日本語 (Japanese)", value: "ja-JP" },
{ title: "한국어 (Korean)", value: "ko-KR" },
{ title: "简体中文 (Chinese Simplified)", value: "zh-CN" },
{ title: "繁體中文 (Chinese Traditional)", value: "zh-TW" },
{ title: "Europe", value: "EU" },
]);
// Get the current locale for a provider
function getProviderLocale(provider: string): string {
return configStore.config.METADATA_PROVIDER_LOCALES[provider] || "";
}
// Update locale for a provider
async function updateProviderLocale(provider: string, locale: string) {
const newLocales = { ...configStore.config.METADATA_PROVIDER_LOCALES };
if (locale) {
newLocales[provider] = locale;
} else {
delete newLocales[provider];
}
try {
await configApi.updateProviderLocales({ locales: newLocales });
configStore.config.METADATA_PROVIDER_LOCALES = newLocales;
} catch (error) {
console.error("Error updating provider locale:", error);
}
}
const heartbeatStatus = ref<Record<string, boolean | undefined>>({
igdb: undefined,
moby: undefined,
@@ -74,8 +29,6 @@ const metadataOptions = computed(() => [
logo_path: "/assets/scrappers/igdb.png",
disabled: !heartbeat.value.METADATA_SOURCES?.IGDB_API_ENABLED,
heartbeat: heartbeatStatus.value.igdb,
supportsLocale: true,
locales: igdbLocales.value,
},
{
name: "MobyGames",
@@ -83,8 +36,6 @@ const metadataOptions = computed(() => [
logo_path: "/assets/scrappers/moby.png",
disabled: !heartbeat.value.METADATA_SOURCES?.MOBY_API_ENABLED,
heartbeat: heartbeatStatus.value.moby,
supportsLocale: false,
locales: [],
},
{
name: "ScreenScrapper",
@@ -92,8 +43,6 @@ const metadataOptions = computed(() => [
logo_path: "/assets/scrappers/ss.png",
disabled: !heartbeat.value.METADATA_SOURCES?.SS_API_ENABLED,
heartbeat: heartbeatStatus.value.ss,
supportsLocale: true,
locales: ssLocales.value,
},
{
name: "RetroAchievements",
@@ -101,8 +50,6 @@ const metadataOptions = computed(() => [
logo_path: "/assets/scrappers/ra.png",
disabled: !heartbeat.value.METADATA_SOURCES?.RA_API_ENABLED,
heartbeat: heartbeatStatus.value.ra,
supportsLocale: false,
locales: [],
},
{
name: "Hasheous",
@@ -110,8 +57,6 @@ const metadataOptions = computed(() => [
logo_path: "/assets/scrappers/hasheous.png",
disabled: !heartbeat.value.METADATA_SOURCES?.HASHEOUS_API_ENABLED,
heartbeat: heartbeatStatus.value.hasheous,
supportsLocale: false,
locales: [],
},
{
name: "Launchbox",
@@ -119,8 +64,6 @@ const metadataOptions = computed(() => [
logo_path: "/assets/scrappers/launchbox.png",
disabled: !heartbeat.value.METADATA_SOURCES?.LAUNCHBOX_API_ENABLED,
heartbeat: heartbeatStatus.value.launchbox,
supportsLocale: false,
locales: [],
},
{
name: "Flashpoint Project",
@@ -128,8 +71,6 @@ const metadataOptions = computed(() => [
logo_path: "/assets/scrappers/flashpoint.png",
disabled: !heartbeat.value.METADATA_SOURCES?.FLASHPOINT_API_ENABLED,
heartbeat: heartbeatStatus.value.flashpoint,
supportsLocale: false,
locales: [],
},
{
name: "HowLongToBeat",
@@ -137,8 +78,6 @@ const metadataOptions = computed(() => [
logo_path: "/assets/scrappers/hltb.png",
disabled: !heartbeat.value.METADATA_SOURCES?.HLTB_API_ENABLED,
heartbeat: heartbeatStatus.value.hltb,
supportsLocale: false,
locales: [],
},
{
name: "SteamgridDB",
@@ -146,8 +85,6 @@ const metadataOptions = computed(() => [
logo_path: "/assets/scrappers/sgdb.png",
disabled: !heartbeat.value.METADATA_SOURCES?.STEAMGRIDDB_API_ENABLED,
heartbeat: heartbeatStatus.value.sgdb,
supportsLocale: false,
locales: [],
},
]);
@@ -273,33 +210,6 @@ onMounted(() => {
</v-icon>
</v-avatar>
</v-row>
<!-- Locale selector -->
<v-row no-gutters class="mt-3">
<v-col>
<v-select
v-if="source.supportsLocale"
:model-value="getProviderLocale(source.value)"
:items="source.locales"
:label="t('common.language')"
density="compact"
variant="outlined"
hide-details
@update:model-value="
(value: string) => updateProviderLocale(source.value, value)
"
/>
<v-select
v-else
:label="t('common.language')"
:placeholder="t('scan.locale-not-supported')"
density="compact"
variant="outlined"
hide-details
disabled
/>
</v-col>
</v-row>
</v-card>
</v-col>
</v-row>