Skip to content

Commit

Permalink
Fix detecting system language #189
Browse files Browse the repository at this point in the history
  • Loading branch information
Levminer committed Mar 3, 2022
1 parent a271e46 commit f003e54
Showing 1 changed file with 25 additions and 24 deletions.
49 changes: 25 additions & 24 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ let manual_update = false
let password_buffer = null
let tray = null
let menu = null
let lang = null

/**
* Check if running in development mode
Expand Down Expand Up @@ -282,30 +283,6 @@ if (settings.settings.hardware_acceleration === false) {
app.disableHardwareAcceleration()
}

/* Set language */
let lang = en
let locale = "en"

if (settings.settings.language !== null) {
locale = settings.settings.language
} else {
locale = app.getLocale().slice(0, 2)
}

switch (locale) {
case "en":
lang = en
break

case "hu":
lang = hu
break

default:
lang = en
break
}

/**
* Show application window from tray
*/
Expand Down Expand Up @@ -403,6 +380,30 @@ const exitFromTray = () => {
const createWindows = () => {
logger.log("Started creating windows")

/* Set language */
lang = en
let locale = "en"

if (settings.settings.language !== null) {
locale = settings.settings.language
} else {
locale = app.getLocale().slice(0, 2).toLowerCase()
}

switch (locale) {
case "en":
lang = en
break

case "hu":
lang = hu
break

default:
lang = en
break
}

/**
* Window Controls Overlay
*/
Expand Down

0 comments on commit f003e54

Please sign in to comment.