From b22dd2aa4423c21204c33e2867b8e1ca2090d915 Mon Sep 17 00:00:00 2001 From: Observer KRypt0n_ Date: Thu, 6 Jan 2022 22:39:29 +0200 Subject: [PATCH] 2.0.0 beta 8 - added Italian - added `Locales.supported()` and `Locales.fallback()` methods now launcher can have locales unsupported by the game From previous commits: - fixed shaders work - made `Tray` class to manage tray features - added tray icon - added `folders` field in config file and now you can specify some pathes - added `constants.paths.tempDir` field - Discord RPC icons were moved to `src/assets/images/discord` folder and highly optimized - added templates for `fr-fr`, `es-es` and `vi-vn` translations - added Discord RPC icons selection - added windows centering; also added `Window.current.center()` method - added custom shaders option in settings menu - fixed `applied` patch info field caching - decreased splash screen timings --- neutralino.config.json | 2 +- package.json | 2 +- public/locales/de-de.yaml | 1 + public/locales/en-us.yaml | 1 + public/locales/es-es.yaml | 1 + public/locales/fr-fr.yaml | 3 +- public/locales/it-it.yaml | 113 ++++++++++++++++++++++++++++++++++ public/locales/ru-ru.yaml | 1 + public/locales/vi-vn.yaml | 1 + scripts/bundle-appimage.cjs | 2 +- src/i18n.ts | 1 + src/ts/Launcher.ts | 5 +- src/ts/core/Locales.ts | 33 +++++++++- src/ts/launcher/Background.ts | 4 +- 14 files changed, 160 insertions(+), 10 deletions(-) create mode 100644 public/locales/it-it.yaml diff --git a/neutralino.config.json b/neutralino.config.json index ac5e415..e3a1a42 100644 --- a/neutralino.config.json +++ b/neutralino.config.json @@ -1,6 +1,6 @@ { "applicationId": "com.krypt0nn.an-anime-game-launcher", - "version": "2.0.0-beta-7", + "version": "2.0.0-beta-8", "defaultMode": "window", "port": 0, "documentRoot": "/bundle/", diff --git a/package.json b/package.json index 7e5d2cc..9b7645e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "an-anime-game-launcher", - "version": "2.0.0-beta-7", + "version": "2.0.0-beta-8", "license": "GPL-3.0", "type": "module", "scripts": { diff --git a/public/locales/de-de.yaml b/public/locales/de-de.yaml index 855ed74..20909ae 100644 --- a/public/locales/de-de.yaml +++ b/public/locales/de-de.yaml @@ -27,6 +27,7 @@ settings: de-de: Deutsch fr-fr: Français es-es: Español + it-it: Italiano vi-vn: Tiếng Việt # Spiel sprachpaket auswahl diff --git a/public/locales/en-us.yaml b/public/locales/en-us.yaml index fde526a..3f0be9e 100644 --- a/public/locales/en-us.yaml +++ b/public/locales/en-us.yaml @@ -27,6 +27,7 @@ settings: de-de: Deutsch fr-fr: Français es-es: Español + it-it: Italiano vi-vn: Tiếng Việt # Game voice pack language diff --git a/public/locales/es-es.yaml b/public/locales/es-es.yaml index 76e75c6..df3fd1d 100644 --- a/public/locales/es-es.yaml +++ b/public/locales/es-es.yaml @@ -27,6 +27,7 @@ settings: de-de: Deutsch fr-fr: Français es-es: Español + it-it: Italiano vi-vn: Tiếng Việt # Game voice pack language diff --git a/public/locales/fr-fr.yaml b/public/locales/fr-fr.yaml index 795815d..dabad39 100644 --- a/public/locales/fr-fr.yaml +++ b/public/locales/fr-fr.yaml @@ -27,6 +27,7 @@ settings: de-de: Deutsch fr-fr: Français es-es: Español + it-it: Italiano vi-vn: Tiếng Việt # Game voice pack language @@ -117,4 +118,4 @@ settings: ou désactiver les effets visuels items: none: None - custom: Custom + custom: Custom \ No newline at end of file diff --git a/public/locales/it-it.yaml b/public/locales/it-it.yaml new file mode 100644 index 0000000..0eb69b3 --- /dev/null +++ b/public/locales/it-it.yaml @@ -0,0 +1,113 @@ +# Splash window +splash: + title: Caricando il launcher + phrases: + - Facendo attività molto importanti... + - Bullizzando Paimon... + - Pullando per Yae... + +# Launcher window +launcher: + predownload: Pre-scarica l'aggiornamento + +# Settings window +settings: + # General + general: + title: Generale + items: + # Language selection + lang: + # Launcher language + launcher: + title: Launcher + items: + en-us: English (US) + ru-ru: Русский + de-de: Deutsch + fr-fr: Français + es-es: Español + it-it: Italiano + vi-vn: Tiếng Việt + + # Game voice pack language + voice: + title: Doppiaggio + tooltip: Dovrai manualmente configurare il voice pack in gioco + items: + en-us: Inglese (US) + ja-jp: Giapponese + ko-kr: Coreano + zn-cn: Cinese + + # Launcher theme + theme: + title: Tema + items: + system: Sistema + light: Chiaro + dark: Scuro + + # Discord RPC + discord: + title: Integrazione Discord + settings: + title: Impostazioni di integrazione con Discord + items: + timer: Mostra il tempo di gioco + in-launcher: Testo nel launcher + in-game: Testo in gioco + + # Enhancements + enhancements: + title: Miglioramenti + items: + # HUD + hud: + title: Interfaccia + items: + none: None + dxvk: DXVK + mangohud: MangoHUD + + # GameMode + gamemode: + title: Usa GameMode + tooltip: È un software che può migliorare le prestazioni in gioco + + # Unlock FPS + fps_unlocker: + title: Sblocca gli FPS + tooltip: Questa opzione rimuoverà la limitazione di 60 FPS in gioco + + # Delete DXVK logs + purge_dxvk_logs: + title: Cancella i log DXVK + tooltip: Con questa opzione attiva, il launcher cancellerà automaticamente i file di log DXVK + + # Runners + runners: + title: Versione di Wine + items: + recommended: + title: Mostra solo le consigliate + tooltip: Questa opzione nasconderà le versioni di Wine non giocabili + + # DXVKs + dxvks: + title: DXVK + items: + recommended: + title: Mostra solo le consigliate + tooltip: Questa opzione nasconderà le vecchie versioni di DXVK + + # Shaders + shaders: + title: Shaders + items: + shaders: + title: Shaders + tooltip: Usa il bottone Home per attivare/disattivare le shaders in gioco + items: + none: None + custom: Custom \ No newline at end of file diff --git a/public/locales/ru-ru.yaml b/public/locales/ru-ru.yaml index f6d34ff..2a02045 100644 --- a/public/locales/ru-ru.yaml +++ b/public/locales/ru-ru.yaml @@ -27,6 +27,7 @@ settings: de-de: Deutsch fr-fr: Français es-es: Español + it-it: Italiano vi-vn: Tiếng Việt # Язык озвучки в игре diff --git a/public/locales/vi-vn.yaml b/public/locales/vi-vn.yaml index 76e75c6..df3fd1d 100644 --- a/public/locales/vi-vn.yaml +++ b/public/locales/vi-vn.yaml @@ -27,6 +27,7 @@ settings: de-de: Deutsch fr-fr: Français es-es: Español + it-it: Italiano vi-vn: Tiếng Việt # Game voice pack language diff --git a/scripts/bundle-appimage.cjs b/scripts/bundle-appimage.cjs index 6386e81..1dd343a 100644 --- a/scripts/bundle-appimage.cjs +++ b/scripts/bundle-appimage.cjs @@ -39,7 +39,7 @@ const bundler = new Bundler({ output: path.join(__dirname, '../dist/An Anime Game Launcher.AppImage'), // Application version - version: '2.0.0-beta-7' + version: '2.0.0-beta-8' }); // Bundle project diff --git a/src/i18n.ts b/src/i18n.ts index 0e399e8..0627398 100644 --- a/src/i18n.ts +++ b/src/i18n.ts @@ -7,6 +7,7 @@ register('ru-ru', () => Locales.get('ru-ru')); register('de-de', () => Locales.get('de-de')); register('fr-fr', () => Locales.get('fr-fr')); register('es-es', () => Locales.get('es-es')); +register('it-it', () => Locales.get('it-it')); register('vi-vn', () => Locales.get('vi-vn')); Locales.default().then((locale) => { diff --git a/src/ts/Launcher.ts b/src/ts/Launcher.ts index d6bbb65..1d1d7b1 100644 --- a/src/ts/Launcher.ts +++ b/src/ts/Launcher.ts @@ -7,6 +7,7 @@ import Configs from './Configs'; import Debug from './core/Debug'; import IPC from './core/IPC'; import DiscordRPC from './core/DiscordRPC'; +import Locales from './core/Locales'; import ProgressBar from './launcher/ProgressBar'; import State from './launcher/State'; @@ -22,7 +23,7 @@ export default class Launcher public constructor(onMount) { - this.tray = new Tray('/public/icons/256x256.png'); + this.tray = new Tray(`/public/icons/256x256.png`); this.tray.update(); this.updateDiscordRPC('in-launcher'); @@ -90,7 +91,7 @@ export default class Launcher public getSocial(): Promise { return new Promise(async (resolve) => { - resolve(`https://${constants.placeholders.lowercase.first}.${constants.placeholders.lowercase.company}.com/launcher/10/${await Configs.get('lang.launcher')}?api_url=https%3A%2F%2Fapi-os-takumi.${constants.placeholders.lowercase.company}.com%2Fhk4e_global&key=gcStgarh&prev=false`); + resolve(`https://${constants.placeholders.lowercase.first}.${constants.placeholders.lowercase.company}.com/launcher/10/${Locales.fallback((await Locales.default()) ?? 'en-us')}?api_url=https%3A%2F%2Fapi-os-takumi.${constants.placeholders.lowercase.company}.com%2Fhk4e_global&key=gcStgarh&prev=false`); }); } diff --git a/src/ts/core/Locales.ts b/src/ts/core/Locales.ts index 077a205..2235933 100644 --- a/src/ts/core/Locales.ts +++ b/src/ts/core/Locales.ts @@ -10,21 +10,30 @@ type AvailableLocales = | 'de-de' | 'fr-fr' | 'es-es' + | 'it-it' | 'vi-vn'; declare const Neutralino; export default class Locales { + /** + * List of locales supported by the game's API + */ + public static readonly supportedLocales: AvailableLocales[] = [ + 'en-us', 'ru-ru', 'de-de', + 'fr-fr', 'es-es', 'vi-vn' + ]; + /** * Get or update the default locale */ - public static default(lang: AvailableLocales|null = null): Promise + public static default(lang: AvailableLocales|null = null): Promise { if (lang !== null) Configs.set('lang.launcher', lang); - return Configs.get('lang.launcher') as Promise; + return Configs.get('lang.launcher') as Promise; } /** @@ -70,4 +79,24 @@ export default class Locales .then((locale) => resolve(YAML.parse(locale))); }); } + + /** + * Checks if the specified language supported + * by the game's API + */ + public static supported(lang: AvailableLocales): boolean + { + return this.supportedLocales.includes(lang); + } + + /** + * Returns provided language if it is supported + * by the game's API. Otherwise returns fallback language (en-us by default) + */ + public static fallback(lang: AvailableLocales, fallback: AvailableLocales = 'en-us'): AvailableLocales + { + return this.supported(lang) ? lang : fallback; + } }; + +export type { AvailableLocales }; diff --git a/src/ts/launcher/Background.ts b/src/ts/launcher/Background.ts index bc18f09..afd31f7 100644 --- a/src/ts/launcher/Background.ts +++ b/src/ts/launcher/Background.ts @@ -1,6 +1,6 @@ import constants from '../Constants'; -import Configs from '../Configs'; import fetch from '../core/Fetch'; +import Locales from '../core/Locales'; export default class Background { @@ -10,7 +10,7 @@ export default class Background public static get(): Promise { return new Promise(async (resolve) => { - fetch(constants.backgroundUri + await Configs.get('lang.launcher')) + fetch(constants.backgroundUri + Locales.fallback((await Locales.default()) ?? 'en-us')) .then((header) => header.body().then((body) => { resolve(JSON.parse(body).data.adv.background); }));