Add translation lines

This commit is contained in:
Maroxy 2021-10-23 01:53:41 +02:00
parent fe91ba3a94
commit 5d57296467
3 changed files with 12 additions and 5 deletions

View file

@ -1,4 +1,5 @@
import $ from 'cash-dom';
const i18n = new(require('./i18n'));
type LauncherState =
'patch-unavailable' |
@ -47,7 +48,7 @@ export class LauncherUI
break;
case 'patch-applying':
$('#launch').text('Applying patch');
$('#launch').text(i18n.translate('ApplyPatch'));
$('#launch').attr('disabled', 'disabled');
break;
@ -58,7 +59,7 @@ export class LauncherUI
break;
case 'game-installation-available':
$('#launch').text('Install');
$('#launch').text(i18n.translate('Install'));
break;
@ -71,7 +72,7 @@ export class LauncherUI
.removeClass('hint--medium')
.removeClass('hint--large');
$('#launch').text('Launch');
$('#launch').text(i18n.translate('Launch'));
break;
}

View file

@ -2,6 +2,7 @@ const path = require('path');
const fs = require('fs');
const { exec } = require('child_process');
const { ipcRenderer } = require('electron');
const i18n = new(require('./i18n'));
import $ from 'cash-dom';
@ -246,14 +247,14 @@ $(() => {
console.log(`%c> Applying patch...`, 'font-size: 16px');
// patch-applying state changes only button text
$('#downloaded').text('Applying patch...');
$('#downloaded').text(i18n.translate('ApplyPatch'));
Genshinlib.patchGame(data.game.latest.version, () => {
LauncherUI.setState('game-launch-available');
ipcRenderer.send('notification', {
title: document.title,
content: 'Game was successfully installed'
content: i18n.translate('GameDownloaded')
});
}, (data) => console.log(data.toString()));
}

View file

@ -1,10 +1,15 @@
const fs = require('fs');
const path = require('path');
const i18n = new(require('./i18n'));
import $ from 'cash-dom';
import { Genshinlib } from './Genshinlib';
$(() => {
$("*[i18id]").each(function (i, el) {
el.innerText = i18n.translate(el.getAttribute('i18id')?.toString());
});
$('.menu-item').on('click', (e) => {
$('.settings')[0]!.scrollTop = $(`#${e.target.getAttribute('anchor')}`).offset()!.top - $('.settings').offset()!.top - 16;