mirror of
https://github.com/dscalzi/HeliosLauncher.git
synced 2024-12-21 11:12:13 -08:00
feat: localize discord RPC, window title, button (#314)
* feat: localize discord RPC, window title, button * fix: settings.dropinMods.okButton key
This commit is contained in:
parent
cf7fd2f411
commit
3d470d9a32
@ -5,15 +5,17 @@ const logger = LoggerUtil.getLogger('DiscordWrapper')
|
||||
|
||||
const { Client } = require('discord-rpc-patch')
|
||||
|
||||
const Lang = require('./langloader')
|
||||
|
||||
let client
|
||||
let activity
|
||||
|
||||
exports.initRPC = function(genSettings, servSettings, initialDetails = 'Waiting for Client..'){
|
||||
exports.initRPC = function(genSettings, servSettings, initialDetails = Lang.queryJS('discord.waiting')){
|
||||
client = new Client({ transport: 'ipc' })
|
||||
|
||||
activity = {
|
||||
details: initialDetails,
|
||||
state: 'Server: ' + servSettings.shortId,
|
||||
state: Lang.queryJS('discord.state', {shortId: servSettings.shortId}),
|
||||
largeImageKey: servSettings.largeImageKey,
|
||||
largeImageText: servSettings.largeImageText,
|
||||
smallImageKey: genSettings.smallImageKey,
|
||||
|
@ -563,7 +563,7 @@ async function dlAsync(login = true) {
|
||||
const onLoadComplete = () => {
|
||||
toggleLaunchArea(false)
|
||||
if(hasRPC){
|
||||
DiscordWrapper.updateDetails('Loading game..')
|
||||
DiscordWrapper.updateDetails(Lang.queryJS('landing.discord.loading'))
|
||||
proc.stdout.on('data', gameStateChange)
|
||||
}
|
||||
proc.stdout.removeListener('data', tempListener)
|
||||
@ -590,9 +590,9 @@ async function dlAsync(login = true) {
|
||||
const gameStateChange = function(data){
|
||||
data = data.trim()
|
||||
if(SERVER_JOINED_REGEX.test(data)){
|
||||
DiscordWrapper.updateDetails('Exploring the Realm!')
|
||||
DiscordWrapper.updateDetails(Lang.queryJS('landing.discord.joined'))
|
||||
} else if(GAME_JOINED_REGEX.test(data)){
|
||||
DiscordWrapper.updateDetails('Sailing to Westeros!')
|
||||
DiscordWrapper.updateDetails(Lang.queryJS('landing.discord.joining'))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -130,7 +130,7 @@ async function toggleServerSelection(toggleState){
|
||||
* @param {string} acknowledge Acknowledge button text.
|
||||
* @param {string} dismiss Dismiss button text.
|
||||
*/
|
||||
function setOverlayContent(title, description, acknowledge, dismiss = 'Dismiss'){
|
||||
function setOverlayContent(title, description, acknowledge, dismiss = Lang.queryJS('overlay.dismiss')){
|
||||
document.getElementById('overlayTitle').innerHTML = title
|
||||
document.getElementById('overlayDesc').innerHTML = description
|
||||
document.getElementById('overlayAcknowledge').innerHTML = acknowledge
|
||||
|
@ -900,7 +900,7 @@ function bindDropinModsRemoveButton(){
|
||||
setOverlayContent(
|
||||
Lang.queryJS('settings.dropinMods.deleteFailedTitle', { fullName }),
|
||||
Lang.queryJS('settings.dropinMods.deleteFailedMessage'),
|
||||
Lang.queryJS('settings.okButton')
|
||||
Lang.queryJS('settings.dropinMods.okButton')
|
||||
)
|
||||
setOverlayHandler(null)
|
||||
toggleOverlay(true)
|
||||
@ -955,7 +955,7 @@ function saveDropinModConfiguration(){
|
||||
setOverlayContent(
|
||||
Lang.queryJS('settings.dropinMods.failedToggleTitle'),
|
||||
err.message,
|
||||
Lang.queryJS('settings.okButton')
|
||||
Lang.queryJS('settings.dropinMods.okButton')
|
||||
)
|
||||
setOverlayHandler(null)
|
||||
toggleOverlay(true)
|
||||
|
@ -130,6 +130,14 @@ waitingText = "Waiting for Microsoft.."
|
||||
continueButton = "CONTINUE"
|
||||
|
||||
|
||||
[js.discord]
|
||||
waiting = "Waiting for Client.."
|
||||
state = "Server: {shortId}"
|
||||
|
||||
[js.index]
|
||||
microsoftLoginTitle = "Microsoft Login"
|
||||
microsoftLogoutTitle = "Microsoft Logout"
|
||||
|
||||
[js.login]
|
||||
login = "LOGIN"
|
||||
loggingIn = "LOGGING IN"
|
||||
@ -202,6 +210,14 @@ checkConsoleForDetails = "Please check the console (CTRL + Shift + i) for more d
|
||||
[js.landing.news]
|
||||
checking = "Checking for News"
|
||||
|
||||
[js.landing.discord]
|
||||
loading = "Loading game.."
|
||||
joining = "Sailing to Westeros!"
|
||||
joined = "Exploring the Realm!"
|
||||
|
||||
[js.overlay]
|
||||
dismiss = "Dismiss"
|
||||
|
||||
[js.settings.fileSelectors]
|
||||
executables = "Executables"
|
||||
allFiles = "All Files"
|
||||
|
4
index.js
4
index.js
@ -125,7 +125,7 @@ ipcMain.on(MSFT_OPCODE.OPEN_LOGIN, (ipcEvent, ...arguments_) => {
|
||||
msftAuthViewSuccess = arguments_[0]
|
||||
msftAuthViewOnClose = arguments_[1]
|
||||
msftAuthWindow = new BrowserWindow({
|
||||
title: 'Microsoft Login',
|
||||
title: LangLoader.queryJS('index.microsoftLoginTitle'),
|
||||
backgroundColor: '#222222',
|
||||
width: 520,
|
||||
height: 600,
|
||||
@ -178,7 +178,7 @@ ipcMain.on(MSFT_OPCODE.OPEN_LOGOUT, (ipcEvent, uuid, isLastAccount) => {
|
||||
msftLogoutSuccess = false
|
||||
msftLogoutSuccessSent = false
|
||||
msftLogoutWindow = new BrowserWindow({
|
||||
title: 'Microsoft Logout',
|
||||
title: LangLoader.queryJS('index.microsoftLogoutTitle'),
|
||||
backgroundColor: '#222222',
|
||||
width: 520,
|
||||
height: 600,
|
||||
|
Loading…
Reference in New Issue
Block a user