mirror of
https://github.com/dscalzi/HeliosLauncher.git
synced 2024-12-22 03:32:12 -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 { Client } = require('discord-rpc-patch')
|
||||||
|
|
||||||
|
const Lang = require('./langloader')
|
||||||
|
|
||||||
let client
|
let client
|
||||||
let activity
|
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' })
|
client = new Client({ transport: 'ipc' })
|
||||||
|
|
||||||
activity = {
|
activity = {
|
||||||
details: initialDetails,
|
details: initialDetails,
|
||||||
state: 'Server: ' + servSettings.shortId,
|
state: Lang.queryJS('discord.state', {shortId: servSettings.shortId}),
|
||||||
largeImageKey: servSettings.largeImageKey,
|
largeImageKey: servSettings.largeImageKey,
|
||||||
largeImageText: servSettings.largeImageText,
|
largeImageText: servSettings.largeImageText,
|
||||||
smallImageKey: genSettings.smallImageKey,
|
smallImageKey: genSettings.smallImageKey,
|
||||||
|
@ -563,7 +563,7 @@ async function dlAsync(login = true) {
|
|||||||
const onLoadComplete = () => {
|
const onLoadComplete = () => {
|
||||||
toggleLaunchArea(false)
|
toggleLaunchArea(false)
|
||||||
if(hasRPC){
|
if(hasRPC){
|
||||||
DiscordWrapper.updateDetails('Loading game..')
|
DiscordWrapper.updateDetails(Lang.queryJS('landing.discord.loading'))
|
||||||
proc.stdout.on('data', gameStateChange)
|
proc.stdout.on('data', gameStateChange)
|
||||||
}
|
}
|
||||||
proc.stdout.removeListener('data', tempListener)
|
proc.stdout.removeListener('data', tempListener)
|
||||||
@ -590,9 +590,9 @@ async function dlAsync(login = true) {
|
|||||||
const gameStateChange = function(data){
|
const gameStateChange = function(data){
|
||||||
data = data.trim()
|
data = data.trim()
|
||||||
if(SERVER_JOINED_REGEX.test(data)){
|
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)){
|
} 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} acknowledge Acknowledge button text.
|
||||||
* @param {string} dismiss Dismiss 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('overlayTitle').innerHTML = title
|
||||||
document.getElementById('overlayDesc').innerHTML = description
|
document.getElementById('overlayDesc').innerHTML = description
|
||||||
document.getElementById('overlayAcknowledge').innerHTML = acknowledge
|
document.getElementById('overlayAcknowledge').innerHTML = acknowledge
|
||||||
|
@ -900,7 +900,7 @@ function bindDropinModsRemoveButton(){
|
|||||||
setOverlayContent(
|
setOverlayContent(
|
||||||
Lang.queryJS('settings.dropinMods.deleteFailedTitle', { fullName }),
|
Lang.queryJS('settings.dropinMods.deleteFailedTitle', { fullName }),
|
||||||
Lang.queryJS('settings.dropinMods.deleteFailedMessage'),
|
Lang.queryJS('settings.dropinMods.deleteFailedMessage'),
|
||||||
Lang.queryJS('settings.okButton')
|
Lang.queryJS('settings.dropinMods.okButton')
|
||||||
)
|
)
|
||||||
setOverlayHandler(null)
|
setOverlayHandler(null)
|
||||||
toggleOverlay(true)
|
toggleOverlay(true)
|
||||||
@ -955,7 +955,7 @@ function saveDropinModConfiguration(){
|
|||||||
setOverlayContent(
|
setOverlayContent(
|
||||||
Lang.queryJS('settings.dropinMods.failedToggleTitle'),
|
Lang.queryJS('settings.dropinMods.failedToggleTitle'),
|
||||||
err.message,
|
err.message,
|
||||||
Lang.queryJS('settings.okButton')
|
Lang.queryJS('settings.dropinMods.okButton')
|
||||||
)
|
)
|
||||||
setOverlayHandler(null)
|
setOverlayHandler(null)
|
||||||
toggleOverlay(true)
|
toggleOverlay(true)
|
||||||
|
@ -130,6 +130,14 @@ waitingText = "Waiting for Microsoft.."
|
|||||||
continueButton = "CONTINUE"
|
continueButton = "CONTINUE"
|
||||||
|
|
||||||
|
|
||||||
|
[js.discord]
|
||||||
|
waiting = "Waiting for Client.."
|
||||||
|
state = "Server: {shortId}"
|
||||||
|
|
||||||
|
[js.index]
|
||||||
|
microsoftLoginTitle = "Microsoft Login"
|
||||||
|
microsoftLogoutTitle = "Microsoft Logout"
|
||||||
|
|
||||||
[js.login]
|
[js.login]
|
||||||
login = "LOGIN"
|
login = "LOGIN"
|
||||||
loggingIn = "LOGGING IN"
|
loggingIn = "LOGGING IN"
|
||||||
@ -202,6 +210,14 @@ checkConsoleForDetails = "Please check the console (CTRL + Shift + i) for more d
|
|||||||
[js.landing.news]
|
[js.landing.news]
|
||||||
checking = "Checking for 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]
|
[js.settings.fileSelectors]
|
||||||
executables = "Executables"
|
executables = "Executables"
|
||||||
allFiles = "All Files"
|
allFiles = "All Files"
|
||||||
|
4
index.js
4
index.js
@ -125,7 +125,7 @@ ipcMain.on(MSFT_OPCODE.OPEN_LOGIN, (ipcEvent, ...arguments_) => {
|
|||||||
msftAuthViewSuccess = arguments_[0]
|
msftAuthViewSuccess = arguments_[0]
|
||||||
msftAuthViewOnClose = arguments_[1]
|
msftAuthViewOnClose = arguments_[1]
|
||||||
msftAuthWindow = new BrowserWindow({
|
msftAuthWindow = new BrowserWindow({
|
||||||
title: 'Microsoft Login',
|
title: LangLoader.queryJS('index.microsoftLoginTitle'),
|
||||||
backgroundColor: '#222222',
|
backgroundColor: '#222222',
|
||||||
width: 520,
|
width: 520,
|
||||||
height: 600,
|
height: 600,
|
||||||
@ -178,7 +178,7 @@ ipcMain.on(MSFT_OPCODE.OPEN_LOGOUT, (ipcEvent, uuid, isLastAccount) => {
|
|||||||
msftLogoutSuccess = false
|
msftLogoutSuccess = false
|
||||||
msftLogoutSuccessSent = false
|
msftLogoutSuccessSent = false
|
||||||
msftLogoutWindow = new BrowserWindow({
|
msftLogoutWindow = new BrowserWindow({
|
||||||
title: 'Microsoft Logout',
|
title: LangLoader.queryJS('index.microsoftLogoutTitle'),
|
||||||
backgroundColor: '#222222',
|
backgroundColor: '#222222',
|
||||||
width: 520,
|
width: 520,
|
||||||
height: 600,
|
height: 600,
|
||||||
|
Loading…
Reference in New Issue
Block a user