mirror of
https://github.com/an-anime-team/an-anime-game-launcher.git
synced 2024-12-24 10:38:14 +03:00
Multiple improvements
- added action buttons (open launcher's folder, winecfg, winetricks) - improved i18n.translate method which now can use user-provided placeholders - disabled text selection ability
This commit is contained in:
parent
90030bf1ba
commit
7f9df4f66e
19 changed files with 94 additions and 7 deletions
|
@ -129,6 +129,14 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<br><br>
|
||||
|
||||
<div id="general-action-buttons">
|
||||
<button class="button" id="launcher-folder">launcher folder</button>
|
||||
<button class="button" id="winetricks">winetricks</button>
|
||||
<button class="button" id="winecfg">winecfg</button>
|
||||
</div>
|
||||
|
||||
<br>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
"Light": "Hell",
|
||||
"Dark": "Dunkel",
|
||||
"System": "System",
|
||||
"HasNotInstalled": "{0} has not installed",
|
||||
"PreInstallationRequired": "Vorinstallation erförderlich",
|
||||
"ToggleShadersText": "Verwenden Sie die Home-Taste (POS 1), um Shader im Spiel ein/aus-zuschalten",
|
||||
"Shaders": "Shadern",
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
"Light": "Light",
|
||||
"Dark": "Dark",
|
||||
"System": "System",
|
||||
"HasNotInstalled": "{0} has not installed",
|
||||
"PreInstallationRequired": "pre-installation required",
|
||||
"ToggleShadersText": "Use Home button to toggle shaders in the game",
|
||||
"Shaders": "Shaders",
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
"Light": "Light",
|
||||
"Dark": "Dark",
|
||||
"System": "System",
|
||||
"HasNotInstalled": "{0} has not installed",
|
||||
"PreInstallationRequired": "pre-installation required",
|
||||
"ToggleShadersText": "Use Home button to toggle shaders in the game",
|
||||
"Shaders": "Shaders",
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
"Light": "Light",
|
||||
"Dark": "Dark",
|
||||
"System": "System",
|
||||
"HasNotInstalled": "{0} has not installed",
|
||||
"PreInstallationRequired": "pre-installation required",
|
||||
"ToggleShadersText": "Use Home button to toggle shaders in the game",
|
||||
"Shaders": "Shaders",
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
"Light": "Light",
|
||||
"Dark": "Dark",
|
||||
"System": "System",
|
||||
"HasNotInstalled": "{0} has not installed",
|
||||
"PreInstallationRequired": "pre-installation required",
|
||||
"ToggleShadersText": "Use Home button to toggle shaders in the game",
|
||||
"Shaders": "Shaders",
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
"Light": "Terang",
|
||||
"Dark": "Gelap",
|
||||
"System": "Sistem",
|
||||
"HasNotInstalled": "{0} has not installed",
|
||||
"PreInstallationRequired": "pra-pemasangan dibutuhkan",
|
||||
"ToggleShadersText": "Gunakan tombol Home untuk menyalakan/mematikan shader di dalam Game",
|
||||
"Shaders": "Shader",
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
"Light": "ライト",
|
||||
"Dark": "暗い",
|
||||
"System": "システム",
|
||||
"HasNotInstalled": "{0} has not installed",
|
||||
"PreInstallationRequired": "事前インストールが必要",
|
||||
"ToggleShadersText": "ホームボタンを使用してゲーム内のシェーダを切り替えます",
|
||||
"Shaders": "シェーダ",
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
"Light": "빛",
|
||||
"Dark": "어두운",
|
||||
"System": "시스템",
|
||||
"HasNotInstalled": "{0} has not installed",
|
||||
"PreInstallationRequired": "사전 설치 필요",
|
||||
"ToggleShadersText": "홈 버튼을 사용하여 게임에서 쉐이더를 전환하십시오",
|
||||
"Shaders": "쉐이더",
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
"Light": "Light",
|
||||
"Dark": "Dark",
|
||||
"System": "System",
|
||||
"HasNotInstalled": "{0} has not installed",
|
||||
"PreInstallationRequired": "pre-installation required",
|
||||
"ToggleShadersText": "Use Home button to toggle shaders in the game",
|
||||
"Shaders": "Shaders",
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
"Light": "Светлая",
|
||||
"Dark": "Тёмная",
|
||||
"System": "Системная",
|
||||
"HasNotInstalled": "{0} не установлен",
|
||||
"PreInstallationRequired": "требуется предустановка",
|
||||
"ToggleShadersText": "Используйте кнопку Home для переключения шейдеров в игре",
|
||||
"Shaders": "Шейдеры",
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
"Light": "Light",
|
||||
"Dark": "Dark",
|
||||
"System": "System",
|
||||
"HasNotInstalled": "{0} has not installed",
|
||||
"PreInstallationRequired": "pre-installation required",
|
||||
"ToggleShadersText": "Use Home button to toggle shaders in the game",
|
||||
"Shaders": "Shaders",
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
"Light": "Light",
|
||||
"Dark": "Dark",
|
||||
"System": "System",
|
||||
"HasNotInstalled": "{0} has not installed",
|
||||
"PreInstallationRequired": "pre-installation required",
|
||||
"ToggleShadersText": "Use Home button to toggle shaders in the game",
|
||||
"Shaders": "Shaders",
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
"Light": "Light",
|
||||
"Dark": "Dark",
|
||||
"System": "System",
|
||||
"HasNotInstalled": "{0} has not installed",
|
||||
"PreInstallationRequired": "pre-installation required",
|
||||
"ToggleShadersText": "Use Home button to toggle shaders in the game",
|
||||
"Shaders": "Shaders",
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
"Light": "Light",
|
||||
"Dark": "Dark",
|
||||
"System": "System",
|
||||
"HasNotInstalled": "{0} has not installed",
|
||||
"PreInstallationRequired": "pre-installation required",
|
||||
"ToggleShadersText": "Use Home button to toggle shaders in the game",
|
||||
"Shaders": "Shaders",
|
||||
|
|
|
@ -4,6 +4,8 @@ body
|
|||
margin: 0
|
||||
padding: 0
|
||||
|
||||
user-select: none
|
||||
|
||||
img.background
|
||||
position: absolute
|
||||
|
||||
|
|
|
@ -358,9 +358,12 @@
|
|||
|
||||
color: map.get($theme-map, "text")
|
||||
|
||||
&:hover
|
||||
&:hover:not([disabled])
|
||||
background-color: map.get($theme-map, "background2")
|
||||
|
||||
&[disabled]
|
||||
cursor: default
|
||||
|
||||
.button-primary
|
||||
background-color: map.get($theme-map, "background2")
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ export default class i18n
|
|||
|
||||
public static loadedLanguage: any;
|
||||
|
||||
public static translate (phrase: string): string
|
||||
public static translate (phrase: string, placeholders: string[] = []): string
|
||||
{
|
||||
if (i18n.loadedLanguage === undefined)
|
||||
this.setLang(navigator.language);
|
||||
|
@ -24,13 +24,19 @@ export default class i18n
|
|||
let translation = i18n.loadedLanguage[phrase] ?? phrase;
|
||||
let item;
|
||||
|
||||
while ((item = /\{([a-zA-Z\.]+)\}/g.exec(translation)) !== null)
|
||||
while ((item = /\{([a-zA-Z0-9\.]+)\}/g.exec(translation)) !== null)
|
||||
{
|
||||
let value: any = constants;
|
||||
if (/^-?\d+$/.test(item[1]))
|
||||
translation = translation.replace(item[0], placeholders[parseInt(item[1])]);
|
||||
|
||||
item[1].split('.').forEach(ref => value = value[ref]);
|
||||
else
|
||||
{
|
||||
let value: any = constants;
|
||||
|
||||
translation = translation.replace(item[0], value);
|
||||
item[1].split('.').forEach(ref => value = value[ref]);
|
||||
|
||||
translation = translation.replace(item[0], value);
|
||||
}
|
||||
}
|
||||
|
||||
return translation;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const { ipcRenderer } = require('electron');
|
||||
const { exec } = require('child_process');
|
||||
const { exec, spawn } = require('child_process');
|
||||
|
||||
const commandExists = require('command-exists').sync;
|
||||
|
||||
|
@ -92,6 +92,60 @@ $(() => {
|
|||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Action buttons
|
||||
*/
|
||||
|
||||
$('#general-action-buttons #launcher-folder').on('click', () => {
|
||||
spawn('xdg-open', [constants.launcherDir]);
|
||||
});
|
||||
|
||||
/**
|
||||
* winetricks button
|
||||
*/
|
||||
if (!commandExists('winetricks'))
|
||||
{
|
||||
$('#general-action-buttons #winetricks').on('click', () => {
|
||||
exec('winetricks', {
|
||||
env: {
|
||||
...process.env,
|
||||
WINEPREFIX: constants.prefixDir
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
$('#general-action-buttons #winetricks')
|
||||
.addClass('hint--top hint--small')
|
||||
.attr('data-hint', LauncherUI.i18n.translate('HasNotInstalled', ['winetricks']))
|
||||
.attr('disabled', 'disabled');
|
||||
}
|
||||
|
||||
/**
|
||||
* winecfg button
|
||||
*/
|
||||
if (!commandExists('winecfg'))
|
||||
{
|
||||
$('#general-action-buttons #winecfg').on('click', () => {
|
||||
exec('winecfg', {
|
||||
env: {
|
||||
...process.env,
|
||||
WINEPREFIX: constants.prefixDir
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
$('#general-action-buttons #winecfg')
|
||||
.addClass('hint--top hint--small')
|
||||
.attr('data-hint', LauncherUI.i18n.translate('HasNotInstalled', ['winecfg']))
|
||||
.attr('disabled', 'disabled');
|
||||
}
|
||||
|
||||
/**
|
||||
* HUD
|
||||
*/
|
||||
|
|
Loading…
Reference in a new issue