Several changes

- updated readme
- added localiztions for notifications
- fixed possible errors in `Locales.bind()` method
- added `Locales.translate()` method to translate something
This commit is contained in:
Observer KRypt0n_ 2022-01-28 22:30:28 +02:00
parent 236113bd15
commit 7775526372
No known key found for this signature in database
GPG key ID: DC5D4EC1303465DA
13 changed files with 264 additions and 71 deletions

View file

@ -62,31 +62,26 @@ To work this launcher requires
| curl | To download archives with game, voice data, runners and so on |
| xdelta3 | To apply the patch to the game |
| cabextract | To install fonts to the wine prefix |
| notify-send | To send system notifications |
| libnotify | To send system notifications |
## Install
### apt-get
```sh
sudo apt-get install unzip tar git curl xdelta3 cabextract notify-send
sudo apt-get install unzip tar git curl xdelta3 cabextract libnotify
```
### pacman
```sh
sudo pacman -Syu unzip tar git curl xdelta3 cabextract notify-send
sudo pacman -Syu unzip tar git curl xdelta3 cabextract libnotify
```
### dnf
```sh
sudo dnf install unzip tar git curl xdelta cabextract notify-send
```
### dnf
```sh
sudo dnf install unzip tar git xdelta cabextract
sudo dnf install unzip tar git curl xdelta cabextract libnotify
```
# Additional requirements
@ -142,7 +137,9 @@ This is our current roadmap goals. You can find older ones [here](repository/pag
* <s>Use `LauncherLib.getGameVersion` function instead of the `config.json`'s `version` property</s> *(deprecated due to the new core functions)*
* <s>Fix button flickering at start when the launcher's state updates</s> *(fixed due to the new framework usage and proper state updating)*
* <s>Add downloading pause button</s> *(2.0.0 release)*
* Move launcher on [Empathize](https://github.com/empathizejs/framework)
* Make notifications translations
* Add analytics window
* Dark progress bar design
* Statistics window
* Changelog window

View file

@ -62,11 +62,6 @@ launcher:
launch: Starten
predownload: Update vorinstallieren
# Launcher update
update:
title: 'Launcher update verfügbar: {from} -> {to}'
body: Sie können das update von {repository} herunterladen
# Einstellungs Fenster
settings:
# General
@ -228,4 +223,31 @@ settings:
# Table buttons
buttons:
add: Hinzufügen
delete: Löschen
delete: Löschen
# Notifications
notifications:
# Launcher update
launcher_update_available:
title: 'Launcher update verfügbar: {from} -> {to}'
body: Sie können das update von {repository} herunterladen
# When telemetry servers are not disabled
telemetry_not_disabled:
title: An Anime Game Launcher
body: Telemetry servers are not disabled
# Before patch applying when xdelta3 package is not downloaded
xdelta3_package_required:
title: An Anime Game Launcher
body: You must download xdelta3 package to apply the patch
# If patch wasn't applied because of some error
patch_applying_error:
title: An Anime Game Launcher
body: Patch wasn't applied successfully. Please, check your log file to find a reason of it, or ask someone in our discord server
# Patch repositories are not available
patch_repos_unavailable:
title: An Anime Game Launcher
body: All the patch repositories are not available. You'll be able to run the game, but launcher can't be sure is it patched properly

View file

@ -62,11 +62,6 @@ launcher:
launch: Launch
predownload: Pre-download update
# Launcher update
update:
title: 'Launcher update available: {from} -> {to}'
body: You can download a new version of the launcher from the project's repository at {repository}
# Settings window
settings:
# General
@ -227,4 +222,31 @@ settings:
# Table buttons
buttons:
add: Add
delete: Delete
delete: Delete
# Notifications
notifications:
# Launcher update
launcher_update_available:
title: 'Launcher update available: {from} -> {to}'
body: You can download a new version of the launcher from the project's repository at {repository}
# When telemetry servers are not disabled
telemetry_not_disabled:
title: An Anime Game Launcher
body: Telemetry servers are not disabled
# Before patch applying when xdelta3 package is not downloaded
xdelta3_package_required:
title: An Anime Game Launcher
body: You must download xdelta3 package to apply the patch
# If patch wasn't applied because of some error
patch_applying_error:
title: An Anime Game Launcher
body: Patch wasn't applied successfully. Please, check your log file to find a reason of it, or ask someone in our discord server
# Patch repositories are not available
patch_repos_unavailable:
title: An Anime Game Launcher
body: All the patch repositories are not available. You'll be able to run the game, but launcher can't be sure is it patched properly

View file

@ -62,11 +62,6 @@ launcher:
launch: Jugar
predownload: Pre-descargar actualización
# Actualización del Launcher
update:
title: 'Actualización del launcher disponible: {from} -> {to}'
body: Puedes descargar una nueva versión del launcher desde el repositorio del proyecto en {repository}
# Ventana de opciones
settings:
# General
@ -226,4 +221,31 @@ settings:
# Botones de la tabla
buttons:
add: Añadir
delete: Borrar
delete: Borrar
# Notifications
notifications:
# Actualización del Launcher
launcher_update_available:
title: 'Actualización del launcher disponible: {from} -> {to}'
body: Puedes descargar una nueva versión del launcher desde el repositorio del proyecto en {repository}
# When telemetry servers are not disabled
telemetry_not_disabled:
title: An Anime Game Launcher
body: Telemetry servers are not disabled
# Before patch applying when xdelta3 package is not downloaded
xdelta3_package_required:
title: An Anime Game Launcher
body: You must download xdelta3 package to apply the patch
# If patch wasn't applied because of some error
patch_applying_error:
title: An Anime Game Launcher
body: Patch wasn't applied successfully. Please, check your log file to find a reason of it, or ask someone in our discord server
# Patch repositories are not available
patch_repos_unavailable:
title: An Anime Game Launcher
body: All the patch repositories are not available. You'll be able to run the game, but launcher can't be sure is it patched properly

View file

@ -63,11 +63,6 @@ launcher:
launch: Lancer
predownload: Pre-téléchargement de mise à jour
# Launcher update
update:
title: 'Mise à jour du Launcher disponible: {from} -> {to}'
body: Vous pouvez télécharger la nouvelle version du launcher via le dépôt ici {repository}
# Settings window
settings:
# General
@ -233,4 +228,31 @@ settings:
# Table buttons
buttons:
add: Ajouter
delete: Supprimer
delete: Supprimer
# Notifications
notifications:
# Launcher update
launcher_update_available:
title: 'Mise à jour du Launcher disponible: {from} -> {to}'
body: Vous pouvez télécharger la nouvelle version du launcher via le dépôt ici {repository}
# When telemetry servers are not disabled
telemetry_not_disabled:
title: An Anime Game Launcher
body: Telemetry servers are not disabled
# Before patch applying when xdelta3 package is not downloaded
xdelta3_package_required:
title: An Anime Game Launcher
body: You must download xdelta3 package to apply the patch
# If patch wasn't applied because of some error
patch_applying_error:
title: An Anime Game Launcher
body: Patch wasn't applied successfully. Please, check your log file to find a reason of it, or ask someone in our discord server
# Patch repositories are not available
patch_repos_unavailable:
title: An Anime Game Launcher
body: All the patch repositories are not available. You'll be able to run the game, but launcher can't be sure is it patched properly

View file

@ -62,11 +62,6 @@ launcher:
launch: Luncurkan
predownload: Pembaruan pra-unduh
# Launcher update
update:
title: 'Pembaruan peluncur tersedia: {from} -> {to}'
body: Kamu dapat mengunduh versi baru peluncur dari repositori proyek di {repository}
# Settings window
settings:
# General
@ -227,3 +222,30 @@ settings:
buttons:
add: Tambah
delete: Hapus
# Notifications
notifications:
# Launcher update
launcher_update_available:
title: 'Pembaruan peluncur tersedia: {from} -> {to}'
body: Kamu dapat mengunduh versi baru peluncur dari repositori proyek di {repository}
# When telemetry servers are not disabled
telemetry_not_disabled:
title: An Anime Game Launcher
body: Telemetry servers are not disabled
# Before patch applying when xdelta3 package is not downloaded
xdelta3_package_required:
title: An Anime Game Launcher
body: You must download xdelta3 package to apply the patch
# If patch wasn't applied because of some error
patch_applying_error:
title: An Anime Game Launcher
body: Patch wasn't applied successfully. Please, check your log file to find a reason of it, or ask someone in our discord server
# Patch repositories are not available
patch_repos_unavailable:
title: An Anime Game Launcher
body: All the patch repositories are not available. You'll be able to run the game, but launcher can't be sure is it patched properly

View file

@ -62,11 +62,6 @@ launcher:
launch: Launch
predownload: Pre-download update
# Launcher update
update:
title: 'Aggiornamento del launcher disponibile: {from} -> {to}'
body: Puoi scaricare una nuova versione del launcher dalla repository del progetto {repository}
# Settings window
settings:
# General
@ -225,4 +220,31 @@ settings:
# Table buttons
buttons:
add: Add
delete: Delete
delete: Delete
# Notifications
notifications:
# Launcher update
launcher_update_available:
title: 'Aggiornamento del launcher disponibile: {from} -> {to}'
body: Puoi scaricare una nuova versione del launcher dalla repository del progetto {repository}
# When telemetry servers are not disabled
telemetry_not_disabled:
title: An Anime Game Launcher
body: Telemetry servers are not disabled
# Before patch applying when xdelta3 package is not downloaded
xdelta3_package_required:
title: An Anime Game Launcher
body: You must download xdelta3 package to apply the patch
# If patch wasn't applied because of some error
patch_applying_error:
title: An Anime Game Launcher
body: Patch wasn't applied successfully. Please, check your log file to find a reason of it, or ask someone in our discord server
# Patch repositories are not available
patch_repos_unavailable:
title: An Anime Game Launcher
body: All the patch repositories are not available. You'll be able to run the game, but launcher can't be sure is it patched properly

View file

@ -62,11 +62,6 @@ launcher:
launch: Запустить
predownload: Предзагрузить обновление
# Обновление лаунчера
update:
title: 'Доступно обновление лаунчера: {from} -> {to}'
body: Вы можете загрузить новую версию лаунчера из репозитория проекта по ссылке {repository}
# Окно настроек
settings:
# Основное
@ -226,4 +221,31 @@ settings:
# Кнопки таблицы
buttons:
add: Добавить
delete: Удалить
delete: Удалить
# Уведомления
notifications:
# Обновление лаунчера
launcher_update_available:
title: 'Доступно обновление лаунчера: {from} -> {to}'
body: Вы можете загрузить новую версию лаунчера из репозитория проекта по ссылке {repository}
# Когда сервера телеметрии не отключены
telemetry_not_disabled:
title: An Anime Game Launcher
body: Серверы телеметрии не отключены
# Перед применением патча когда пакет xdelta3 не установлен
xdelta3_package_required:
title: An Anime Game Launcher
body: Вы обязаны установить пакет xdelta3 перед применением патча
# Если патч не был применён по какой-то причине
patch_applying_error:
title: An Anime Game Launcher
body: Патч не был применён. Пожалуйста, проверьте ваш файл журнала отладки чтобы найти причину ошибки, или спросите кого-то в нашем дискорд сервере
# Репозитории патча недоступны
patch_repos_unavailable:
title: An Anime Game Launcher
body: Все репозитории патча недоступны. Вы сможете запустить игру, однако лаунчер не может знать пропатчена ли она корректно

View file

@ -62,11 +62,6 @@ launcher:
launch: launch (◕▿◕✿)
predownload: pwe-downwoad update
# Launcher update
update:
title: 'waunchew update avaiwable: {from} -> {to}'
body: you can downwoad the new vewsion of the waunchew fwom the pwoject's wepositowy at {repository}
# Settings window
settings:
# General
@ -226,4 +221,31 @@ settings:
# Table buttons
buttons:
add: add
delete: dewete
delete: dewete
# Notifications
notifications:
# Launcher update
launcher_update_available:
title: 'waunchew update avaiwable: {from} -> {to}'
body: you can downwoad the new vewsion of the waunchew fwom the pwoject's wepositowy at {repository}
# When telemetry servers are not disabled
telemetry_not_disabled:
title: An Anime Game Launcher
body: Telemetry servers are not disabled
# Before patch applying when xdelta3 package is not downloaded
xdelta3_package_required:
title: An Anime Game Launcher
body: You must download xdelta3 package to apply the patch
# If patch wasn't applied because of some error
patch_applying_error:
title: An Anime Game Launcher
body: Patch wasn't applied successfully. Please, check your log file to find a reason of it, or ask someone in our discord server
# Patch repositories are not available
patch_repos_unavailable:
title: An Anime Game Launcher
body: All the patch repositories are not available. You'll be able to run the game, but launcher can't be sure is it patched properly

View file

@ -1,3 +1,4 @@
import { get as svelteget } from 'svelte/store';
import { dictionary, locale } from 'svelte-i18n';
import YAML from 'yaml';
@ -98,7 +99,12 @@ export default class Locales
let message = currentDictionary[currentLocale] ?? currentDictionary['en-us'];
for (const path of localeName.split('.'))
message = message[path];
{
message = message[path] ?? null;
if (message === null)
break;
}
localizer(message);
};
@ -118,6 +124,26 @@ export default class Locales
});
}
/**
* Get translation from the currently selected locale
*/
public static translate(message: string): string|object|null
{
const currentDictionary = svelteget(dictionary) as object;
let translation = currentDictionary[svelteget(locale) ?? 'en-us'] ?? currentDictionary['en-us'];
for (const path of message.split('.'))
{
translation = translation[path] ?? null;
if (translation === null)
break;
}
return translation;
}
/**
* Checks if the specified language supported
* by the game's API

View file

@ -103,10 +103,7 @@ export default class State
for (const tag of tags.reverse())
if (semver.gt(tag.tag, Launcher.version))
{
const currentDictionary = svelteget(dictionary);
const currentLocale = svelteget(locale);
const locales = (currentDictionary[currentLocale ?? 'en-us'] ?? currentDictionary['en-us'])['launcher']!['update'] as object;
const locales = Locales.translate('notifications.launcher_update_available') as object;
Notification.show({
title: locales['title'].replace('{from}', Launcher.version).replace('{to}', tag.tag),
@ -399,8 +396,7 @@ export default class State
state = 'game-launch-available';
Notification.show({
title: 'An Anime Game Launcher',
body: 'All the patch repositories are not available. You\'ll be able to run the game, but launcher can\'t be sure is it patched properly',
...(Locales.translate('notifications.patch_repos_unavailable') as { title: string, body: string }),
icon: `${constants.paths.appDir}/public/images/baal64-transparent.png`,
importance: 'critical'
});

View file

@ -3,6 +3,7 @@ import { Notification } from '../../../empathize';
import Launcher from '../../Launcher';
import Patch from '../../Patch';
import constants from '../../Constants';
import Locales from '../Locales';
export default (launcher: Launcher): Promise<void> => {
return new Promise(async (resolve) => {
@ -10,8 +11,7 @@ export default (launcher: Launcher): Promise<void> => {
if (!await Launcher.isPackageAvailable('xdelta3'))
{
Notification.show({
title: 'An Anime Game Launcher',
body: 'You must download xdelta3 package to apply the patch',
...(Locales.translate('notifications.xdelta3_package_required') as { title: string, body: string }),
icon: `${constants.paths.appDir}/public/images/baal64-transparent.png`,
importance: 'critical'
});
@ -78,8 +78,7 @@ export default (launcher: Launcher): Promise<void> => {
if (!result)
{
Notification.show({
title: 'An Anime Game Launcher',
body: 'Patch wasn\'t applied successfully. Please, check your log file to find a reason of it, or ask someone in our discord server',
...(Locales.translate('notifications.patch_applying_error') as { title: string, body: string }),
icon: `${constants.paths.appDir}/public/images/baal64-transparent.png`
});
}
@ -91,8 +90,7 @@ export default (launcher: Launcher): Promise<void> => {
}
}).catch(() => {
Notification.show({
title: 'An Anime Game Launcher',
body: 'All the patch repositories are not available. You\'ll be able to run the game, but launcher can\'t be sure is it patched properly',
...(Locales.translate('notifications.patch_repos_unavailable') as { title: string, body: string }),
icon: `${constants.paths.appDir}/public/images/baal64-transparent.png`,
importance: 'critical'
});

View file

@ -5,6 +5,7 @@ import Launcher from '../../Launcher';
import constants from '../../Constants';
import Runners from '../../core/Runners';
import Game from '../../Game';
import Locales from '../Locales';
declare const Neutralino;
@ -18,8 +19,7 @@ export default (launcher: Launcher): Promise<void> => {
if (!telemetry)
{
Notification.show({
title: 'An Anime Game Launcher',
body: 'Telemetry servers are not disabled',
...(Locales.translate('notifications.telemetry_not_disabled') as { title: string, body: string }),
icon: `${constants.paths.appDir}/public/images/baal64-transparent.png`,
importance: 'critical'
});