@@ -125,7 +125,7 @@ document.getElementById('launch_button').addEventListener('click', async e => {
125
125
}
126
126
} catch ( err ) {
127
127
loggerLanding . error ( 'Unhandled error in during launch process.' , err )
128
- showLaunchFailure ( 'Error During Launch' , 'See console (CTRL + Shift + i) for more details.' )
128
+ showLaunchFailure ( Lang . queryJS ( 'landing.launch.failureTitle' ) , Lang . queryJS ( 'landing.launch.failureText' ) )
129
129
}
130
130
} )
131
131
@@ -145,7 +145,7 @@ document.getElementById('avatarOverlay').onclick = async e => {
145
145
146
146
// Bind selected account
147
147
function updateSelectedAccount ( authUser ) {
148
- let username = 'No Account Selected'
148
+ let username = Lang . queryJS ( 'landing.selectedAccount.noAccountSelected' )
149
149
if ( authUser != null ) {
150
150
if ( authUser . displayName != null ) {
151
151
username = authUser . displayName
@@ -165,14 +165,14 @@ function updateSelectedServer(serv){
165
165
}
166
166
ConfigManager . setSelectedServer ( serv != null ? serv . rawServer . id : null )
167
167
ConfigManager . save ( )
168
- server_selection_button . innerHTML = '\u2022 ' + ( serv != null ? serv . rawServer . name : 'No Server Selected' )
168
+ server_selection_button . innerHTML = '• ' + ( serv != null ? serv . rawServer . name : Lang . queryJS ( 'landing.noSelection' ) )
169
169
if ( getCurrentView ( ) === VIEWS . settings ) {
170
170
animateSettingsTabRefresh ( )
171
171
}
172
172
setLaunchEnabled ( serv != null )
173
173
}
174
174
// Real text is set in uibinder.js on distributionIndexDone.
175
- server_selection_button . innerHTML = '\u2022 Loading..'
175
+ server_selection_button . innerHTML = '• ' + Lang . queryJS ( 'landing.selectedServer.loading' )
176
176
server_selection_button . onclick = async e => {
177
177
e . target . blur ( )
178
178
await toggleServerSelection ( true )
@@ -201,16 +201,14 @@ const refreshMojangStatuses = async function(){
201
201
for ( let i = 0 ; i < statuses . length ; i ++ ) {
202
202
const service = statuses [ i ]
203
203
204
+ const tooltipHTML = `<div class="mojangStatusContainer">
205
+ <span class="mojangStatusIcon" style="color: ${ MojangRestAPI . statusToHex ( service . status ) } ;">•</span>
206
+ <span class="mojangStatusName">${ service . name } </span>
207
+ </div>`
204
208
if ( service . essential ) {
205
- tooltipEssentialHTML += `<div class="mojangStatusContainer">
206
- <span class="mojangStatusIcon" style="color: ${ MojangRestAPI . statusToHex ( service . status ) } ;">•</span>
207
- <span class="mojangStatusName">${ service . name } </span>
208
- </div>`
209
+ tooltipEssentialHTML += tooltipHTML
209
210
} else {
210
- tooltipNonEssentialHTML += `<div class="mojangStatusContainer">
211
- <span class="mojangStatusIcon" style="color: ${ MojangRestAPI . statusToHex ( service . status ) } ;">•</span>
212
- <span class="mojangStatusName">${ service . name } </span>
213
- </div>`
211
+ tooltipNonEssentialHTML += tooltipHTML
214
212
}
215
213
216
214
if ( service . status === 'yellow' && status !== 'red' ) {
@@ -243,14 +241,14 @@ const refreshServerStatus = async (fade = false) => {
243
241
loggerLanding . info ( 'Refreshing Server Status' )
244
242
const serv = ( await DistroAPI . getDistribution ( ) ) . getServerById ( ConfigManager . getSelectedServer ( ) )
245
243
246
- let pLabel = 'SERVER'
247
- let pVal = 'OFFLINE'
244
+ let pLabel = Lang . queryJS ( 'landing.serverStatus.server' )
245
+ let pVal = Lang . queryJS ( 'landing.serverStatus.offline' )
248
246
249
247
try {
250
248
251
249
const servStat = await getServerStatus ( 47 , serv . hostname , serv . port )
252
250
console . log ( servStat )
253
- pLabel = 'PLAYERS'
251
+ pLabel = Lang . queryJS ( 'landing.serverStatus.players' )
254
252
pVal = servStat . players . online + '/' + servStat . players . max
255
253
256
254
} catch ( err ) {
@@ -288,7 +286,7 @@ function showLaunchFailure(title, desc){
288
286
setOverlayContent (
289
287
title ,
290
288
desc ,
291
- 'Okay'
289
+ Lang . queryJS ( 'landing.launch.okay' )
292
290
)
293
291
setOverlayHandler ( null )
294
292
toggleOverlay ( true )
@@ -304,7 +302,7 @@ function showLaunchFailure(title, desc){
304
302
*/
305
303
async function asyncSystemScan ( effectiveJavaOptions , launchAfter = true ) {
306
304
307
- setLaunchDetails ( 'Checking system info..' )
305
+ setLaunchDetails ( Lang . queryJS ( 'landing.systemScan.checking' ) )
308
306
toggleLaunchArea ( true )
309
307
setLaunchPercentage ( 0 , 100 )
310
308
@@ -317,30 +315,30 @@ async function asyncSystemScan(effectiveJavaOptions, launchAfter = true){
317
315
// If the result is null, no valid Java installation was found.
318
316
// Show this information to the user.
319
317
setOverlayContent (
320
- 'No Compatible<br>Java Installation Found' ,
321
- `In order to join WesterosCraft, you need a 64-bit installation of Java ${ effectiveJavaOptions . suggestedMajor } . Would you like us to install a copy?` ,
322
- 'Install Java' ,
323
- 'Install Manually'
318
+ Lang . queryJS ( 'landing.systemScan.noCompatibleJava' ) ,
319
+ Lang . queryJS ( 'landing.systemScan.installJavaMessage' , { 'major' : effectiveJavaOptions . suggestedMajor } ) ,
320
+ Lang . queryJS ( 'landing.systemScan.installJava' ) ,
321
+ Lang . queryJS ( 'landing.systemScan.installJavaManually' )
324
322
)
325
323
setOverlayHandler ( ( ) => {
326
- setLaunchDetails ( 'Preparing Java Download..' )
324
+ setLaunchDetails ( Lang . queryJS ( 'landing.systemScan.javaDownloadPrepare' ) )
327
325
toggleOverlay ( false )
328
326
329
327
try {
330
328
downloadJava ( effectiveJavaOptions , launchAfter )
331
329
} catch ( err ) {
332
330
loggerLanding . error ( 'Unhandled error in Java Download' , err )
333
- showLaunchFailure ( 'Error During Java Download' , 'See console (CTRL + Shift + i) for more details.' )
331
+ showLaunchFailure ( Lang . queryJS ( 'landing.systemScan.javaDownloadFailureTitle' ) , Lang . queryJS ( 'landing.systemScan.javaDownloadFailureText' ) )
334
332
}
335
333
} )
336
334
setDismissHandler ( ( ) => {
337
335
$ ( '#overlayContent' ) . fadeOut ( 250 , ( ) => {
338
336
//$('#overlayDismiss').toggle(false)
339
337
setOverlayContent (
340
- 'Java is Required<br>to Launch' ,
341
- `A valid x64 installation of Java ${ effectiveJavaOptions . suggestedMajor } is required to launch.<br><br>Please refer to our <a href="https://github.com/dscalzi/HeliosLauncher/wiki/Java-Management#manually-installing-a-valid-version-of-java">Java Management Guide</a> for instructions on how to manually install Java.` ,
342
- 'I Understand' ,
343
- 'Go Back'
338
+ Lang . queryJS ( 'landing.systemScan.javaRequired' , { 'major' : effectiveJavaOptions . suggestedMajor } ) ,
339
+ Lang . queryJS ( 'landing.systemScan.javaRequiredMessage' , { 'major' : effectiveJavaOptions . suggestedMajor } ) ,
340
+ Lang . queryJS ( 'landing.systemScan.javaRequiredDismiss' ) ,
341
+ Lang . queryJS ( 'landing.systemScan.javaRequiredCancel' )
344
342
)
345
343
setOverlayHandler ( ( ) => {
346
344
toggleLaunchArea ( false )
@@ -385,7 +383,7 @@ async function downloadJava(effectiveJavaOptions, launchAfter = true) {
385
383
effectiveJavaOptions . distribution )
386
384
387
385
if ( asset == null ) {
388
- throw new Error ( 'Failed to find OpenJDK distribution.' )
386
+ throw new Error ( Lang . queryJS ( 'landing.downloadJava.findJdkFailure' ) )
389
387
}
390
388
391
389
let received = 0
@@ -400,7 +398,7 @@ async function downloadJava(effectiveJavaOptions, launchAfter = true) {
400
398
if ( ! await validateLocalFile ( asset . path , asset . algo , asset . hash ) ) {
401
399
log . error ( `Hashes do not match, ${ asset . id } may be corrupted.` )
402
400
// Don't know how this could happen, but report it.
403
- throw new Error ( 'Downloaded JDK has bad hash, file may be corrupted.' )
401
+ throw new Error ( Lang . queryJS ( 'landing.downloadJava.javaDownloadCorruptedError' ) )
404
402
}
405
403
}
406
404
@@ -409,7 +407,7 @@ async function downloadJava(effectiveJavaOptions, launchAfter = true) {
409
407
remote . getCurrentWindow ( ) . setProgressBar ( 2 )
410
408
411
409
// Wait for extration to complete.
412
- const eLStr = 'Extracting Java'
410
+ const eLStr = Lang . queryJS ( 'landing.downloadJava.extractingJava' )
413
411
let dotStr = ''
414
412
setLaunchDetails ( eLStr )
415
413
const extractListener = setInterval ( ( ) => {
@@ -431,7 +429,7 @@ async function downloadJava(effectiveJavaOptions, launchAfter = true) {
431
429
ConfigManager . save ( )
432
430
433
431
clearInterval ( extractListener )
434
- setLaunchDetails ( 'Java Installed!' )
432
+ setLaunchDetails ( Lang . queryJS ( 'landing.downloadJava.javaInstalled' ) )
435
433
436
434
// TODO Callback hell
437
435
// Refactor the launch functions
@@ -456,7 +454,7 @@ async function dlAsync(login = true) {
456
454
457
455
const loggerLaunchSuite = LoggerUtil . getLogger ( 'LaunchSuite' )
458
456
459
- setLaunchDetails ( 'Loading server information..' )
457
+ setLaunchDetails ( Lang . queryJS ( 'landing.dlAsync.loadingServerInfo' ) )
460
458
461
459
let distro
462
460
@@ -465,7 +463,7 @@ async function dlAsync(login = true) {
465
463
onDistroRefresh ( distro )
466
464
} catch ( err ) {
467
465
loggerLaunchSuite . error ( 'Unable to refresh distribution index.' , err )
468
- showLaunchFailure ( 'Fatal Error' , 'Could not load a copy of the distribution index. See the console (CTRL + Shift + i) for more details.' )
466
+ showLaunchFailure ( Lang . queryJS ( 'landing.dlAsync.fatalError' ) , Lang . queryJS ( 'landing.dlAsync.unableToLoadDistributionIndex' ) )
469
467
return
470
468
}
471
469
@@ -478,7 +476,7 @@ async function dlAsync(login = true) {
478
476
}
479
477
}
480
478
481
- setLaunchDetails ( 'Please wait..' )
479
+ setLaunchDetails ( Lang . queryJS ( 'landing.dlAsync.pleaseWait' ) )
482
480
toggleLaunchArea ( true )
483
481
setLaunchPercentage ( 0 , 100 )
484
482
@@ -494,17 +492,17 @@ async function dlAsync(login = true) {
494
492
495
493
fullRepairModule . childProcess . on ( 'error' , ( err ) => {
496
494
loggerLaunchSuite . error ( 'Error during launch' , err )
497
- showLaunchFailure ( 'Error During Launch' , err . message || 'See console (CTRL + Shift + i) for more details.' )
495
+ showLaunchFailure ( Lang . queryJS ( 'landing.dlAsync.errorDuringLaunchTitle' ) , err . message || Lang . queryJS ( 'landing.dlAsync.errorDuringLaunchText' ) )
498
496
} )
499
497
fullRepairModule . childProcess . on ( 'close' , ( code , _signal ) => {
500
498
if ( code !== 0 ) {
501
499
loggerLaunchSuite . error ( `Full Repair Module exited with code ${ code } , assuming error.` )
502
- showLaunchFailure ( 'Error During Launch' , 'See console (CTRL + Shift + i) for more details.' )
500
+ showLaunchFailure ( Lang . queryJS ( 'landing.dlAsync.errorDuringLaunchTitle' ) , Lang . queryJS ( 'landing.dlAsync.seeConsoleForDetails' ) )
503
501
}
504
502
} )
505
503
506
504
loggerLaunchSuite . info ( 'Validating files.' )
507
- setLaunchDetails ( 'Validating file integrity..' )
505
+ setLaunchDetails ( Lang . queryJS ( 'landing.dlAsync.validatingFileIntegrity' ) )
508
506
let invalidFileCount = 0
509
507
try {
510
508
invalidFileCount = await fullRepairModule . verifyFiles ( percent => {
@@ -513,14 +511,14 @@ async function dlAsync(login = true) {
513
511
setLaunchPercentage ( 100 )
514
512
} catch ( err ) {
515
513
loggerLaunchSuite . error ( 'Error during file validation.' )
516
- showLaunchFailure ( 'Error During File Verification' , err . displayable || 'See console (CTRL + Shift + i) for more details.' )
514
+ showLaunchFailure ( Lang . queryJS ( 'landing.dlAsync.errorDuringFileVerificationTitle' ) , err . displayable || Lang . queryJS ( 'landing.dlAsync.seeConsoleForDetails' ) )
517
515
return
518
516
}
519
517
520
518
521
519
if ( invalidFileCount > 0 ) {
522
520
loggerLaunchSuite . info ( 'Downloading files.' )
523
- setLaunchDetails ( 'Downloading files..' )
521
+ setLaunchDetails ( Lang . queryJS ( 'landing.dlAsync.downloadingFiles' ) )
524
522
setLaunchPercentage ( 0 )
525
523
try {
526
524
await fullRepairModule . download ( percent => {
@@ -529,7 +527,7 @@ async function dlAsync(login = true) {
529
527
setDownloadPercentage ( 100 )
530
528
} catch ( err ) {
531
529
loggerLaunchSuite . error ( 'Error during file download.' )
532
- showLaunchFailure ( 'Error During File Download' , err . displayable || 'See console (CTRL + Shift + i) for more details.' )
530
+ showLaunchFailure ( Lang . queryJS ( 'landing.dlAsync.errorDuringFileDownloadTitle' ) , err . displayable || Lang . queryJS ( 'landing.dlAsync.seeConsoleForDetails' ) )
533
531
return
534
532
}
535
533
} else {
@@ -541,7 +539,7 @@ async function dlAsync(login = true) {
541
539
542
540
fullRepairModule . destroyReceiver ( )
543
541
544
- setLaunchDetails ( 'Preparing to launch..' )
542
+ setLaunchDetails ( Lang . queryJS ( 'landing.dlAsync.preparingToLaunch' ) )
545
543
546
544
const mojangIndexProcessor = new MojangIndexProcessor (
547
545
ConfigManager . getCommonDirectory ( ) ,
@@ -559,7 +557,7 @@ async function dlAsync(login = true) {
559
557
const authUser = ConfigManager . getSelectedAccount ( )
560
558
loggerLaunchSuite . info ( `Sending selected account (${ authUser . displayName } ) to ProcessBuilder.` )
561
559
let pb = new ProcessBuilder ( serv , versionData , forgeData , authUser , remote . app . getVersion ( ) )
562
- setLaunchDetails ( 'Launching game..' )
560
+ setLaunchDetails ( Lang . queryJS ( 'landing.dlAsync.launchingGame' ) )
563
561
564
562
// const SERVER_JOINED_REGEX = /\[.+\]: \[CHAT\] [a-zA-Z0-9_]{1,16} joined the game/
565
563
const SERVER_JOINED_REGEX = new RegExp ( `\\[.+\\]: \\[CHAT\\] ${ authUser . displayName } joined the game` )
@@ -604,7 +602,7 @@ async function dlAsync(login = true) {
604
602
data = data . trim ( )
605
603
if ( data . indexOf ( 'Could not find or load main class net.minecraft.launchwrapper.Launch' ) > - 1 ) {
606
604
loggerLaunchSuite . error ( 'Game launch failed, LaunchWrapper was not downloaded properly.' )
607
- showLaunchFailure ( 'Error During Launch' , 'The main file, LaunchWrapper, failed to download properly. As a result, the game cannot launch.<br><br>To fix this issue, temporarily turn off your antivirus software and launch the game again.<br><br>If you have time, please <a href="https://github.com/dscalzi/HeliosLauncher/issues">submit an issue</a> and let us know what antivirus software you use. We\'ll contact them and try to straighten things out.' )
605
+ showLaunchFailure ( Lang . queryJS ( 'landing.dlAsync.errorDuringLaunchTitle' ) , Lang . queryJS ( 'landing.dlAsync.launchWrapperNotDownloaded' ) )
608
606
}
609
607
}
610
608
@@ -616,7 +614,7 @@ async function dlAsync(login = true) {
616
614
proc . stdout . on ( 'data' , tempListener )
617
615
proc . stderr . on ( 'data' , gameErrorListener )
618
616
619
- setLaunchDetails ( 'Done. Enjoy the server!' )
617
+ setLaunchDetails ( Lang . queryJS ( 'landing.dlAsync.doneEnjoyServer' ) )
620
618
621
619
// Init Discord Hook
622
620
if ( distro . rawDistribution . discord != null && serv . rawServerdiscord != null ) {
@@ -633,7 +631,7 @@ async function dlAsync(login = true) {
633
631
} catch ( err ) {
634
632
635
633
loggerLaunchSuite . error ( 'Error during launch' , err )
636
- showLaunchFailure ( 'Error During Launch' , 'Please check the console (CTRL + Shift + i) for more details.' )
634
+ showLaunchFailure ( Lang . queryJS ( 'landing.dlAsync.errorDuringLaunchTitle' ) , Lang . queryJS ( 'landing.dlAsync.checkConsoleForDetails' ) )
637
635
638
636
}
639
637
}
@@ -740,7 +738,7 @@ let newsLoadingListener = null
740
738
*/
741
739
function setNewsLoading ( val ) {
742
740
if ( val ) {
743
- const nLStr = 'Checking for News'
741
+ const nLStr = Lang . queryJS ( 'landing.news.checking' )
744
742
let dotStr = '..'
745
743
nELoadSpan . innerHTML = nLStr + dotStr
746
744
newsLoadingListener = setInterval ( ( ) => {
@@ -955,7 +953,7 @@ function displayArticle(articleObject, index){
955
953
text . style . display = text . style . display === 'block' ? 'none' : 'block'
956
954
}
957
955
} )
958
- newsNavigationStatus . innerHTML = index + ' of ' + newsArr . length
956
+ newsNavigationStatus . innerHTML = Lang . query ( 'ejs.landing.newsNavigationStatus' , { currentPage : index , totalPages : newsArr . length } )
959
957
newsContent . setAttribute ( 'article' , index - 1 )
960
958
}
961
959
0 commit comments