Skip to content

Commit

Permalink
Localize dialogs
Browse files Browse the repository at this point in the history
  • Loading branch information
Levminer committed Jan 29, 2022
1 parent 5477ac0 commit afaaba0
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 19 deletions.
6 changes: 5 additions & 1 deletion languages/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,14 @@ module.exports = {
},

"dialog": {
"error": "Error occurred while running Authme!",
"error": "Error occurred while running Authme.",
"integrity": "Failed to check the integrity of the files. \n\nYou or someone messed with the settings file, shutting down for security reasons!",
"support": "Authme is a free, open source software. \n\nIf you like the app, please consider supporting!",
"feedback": "Thank you for providing feedback! \n\nPlease report issues on GitHub or by Email.",
"docs": "You can view the Authme Docs in the browser. \n\nClick open to view it in your browser.",
"license": "This software is licensed under GPL-3.0 \n\nCopyright © 2020 Lőrik Levente",
"no_update_available": "No update available: \n\nYou are running the latest version! \n\nYou are currently running:",
"update_error": "Error during auto update. \n\nTry to restart Authme and check your network connection.",
},

"button": {
Expand All @@ -55,6 +57,8 @@ module.exports = {
"copy": "Copy",
"copied": "Copied",
"help": "Help",
"exit": "Exit",
"report": "Report"
},

"text": {
Expand Down
38 changes: 20 additions & 18 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const os = require("os")
*/
process.on("uncaughtException", (error) => {
logger.error("Error on load", error.stack)
dialog.showErrorBox("Authme", `Authme crashed, exiting now. \n\nPlease open a GitHub Issue with a screenshot of this error. \n\n${error.stack}`)
dialog.showErrorBox("Authme", `Authme crashed while starting. \n\nPlease open a GitHub Issue with a screenshot of this error (https://github.com/Levminer/authme). \n\n${error.stack}`)

shell.openExternal("https://github.com/Levminer/authme/issues")

Expand Down Expand Up @@ -821,7 +821,9 @@ const createWindows = () => {
}
})
.catch((error) => {
logger.error("Error during looking for auto update", error.stack)
logger.error("Error getting response from API (Auto update)", error.stack)

autoUpdater.checkForUpdates()
})
}

Expand All @@ -845,7 +847,7 @@ const createWindows = () => {
defaultId: 0,
cancelId: 1,
type: "info",
message: `No update available: \n\nYou are running the latest version! \n\nYou are currently running: Authme ${authme_version}`,
message: `${lang.dialog.no_update_available} ${authme_version}`,
})

manual_update = false
Expand All @@ -867,7 +869,7 @@ const createWindows = () => {
defaultId: 0,
cancelId: 1,
type: "error",
message: `Error during auto update. \n\nTry to restart Authme and check your network connection! \n\n${error.stack}`,
message: `${lang.dialog.update_error} \n\n${error.stack}`,
})
})

Expand Down Expand Up @@ -932,15 +934,15 @@ const createWindows = () => {
}

if (settings.statistics.rate === true || settings.statistics.feedback === true) {
if (opens % 150 === 0) {
if (opens % 50 === 0) {
openInfo()
}
} else if (settings.statistics.rate === true && settings.statistics.feedback === true) {
if (opens % 1000 === 0) {
if (opens % 100 === 0) {
openInfo()
}
} else {
if (opens % 50 === 0) {
if (opens % 15 === 0) {
openInfo()
}
}
Expand All @@ -959,12 +961,12 @@ app.whenReady()
dialog
.showMessageBox({
title: "Authme",
buttons: ["Report", lang.button.close, "Exit"],
buttons: [lang.button.report, lang.button.close, lang.button.exit],
defaultId: 0,
cancelId: 1,
noLink: true,
type: "error",
message: `Error occurred while starting Authme! \n\n${error.stack}`,
message: `${lang.dialog.error} \n\n${error.stack}`,
})
.then((result) => {
if (result.response === 0) {
Expand Down Expand Up @@ -1069,12 +1071,12 @@ app.whenReady()
dialog
.showMessageBox({
title: "Authme",
buttons: ["Report", lang.button.close, "Exit"],
buttons: [lang.button.report, lang.button.close, lang.button.exit],
defaultId: 0,
cancelId: 1,
noLink: true,
type: "error",
message: `Error occurred while starting Authme! \n\n${error.stack}`,
message: `${lang.dialog.error} \n\n${error.stack}`,
})
.then((result) => {
if (result.response === 0) {
Expand Down Expand Up @@ -1388,12 +1390,12 @@ ipc.on("abort", () => {
dialog
.showMessageBox({
title: "Authme",
buttons: ["Help", lang.button.close],
buttons: [lang.button.help, lang.button.close],
type: "error",
defaultId: 0,
cancelId: 1,
noLink: true,
message: "Failed to check the integrity of the files. \n\nYou or someone messed with the settings file, shutting down for security reasons!",
message: lang.dialog.integrity,
})
.then((result) => {
if (result.response === 0) {
Expand Down Expand Up @@ -1464,7 +1466,7 @@ ipc.on("support", () => {
* Open Microsoft Store link
*/
ipc.on("rateAuthme", () => {
shell.openExternal("ms-windows-store://pdp/?productid=XP9M33RJSVD6JR")
shell.openExternal("ms-windows-store://review/?ProductId=XP9M33RJSVD6JR")

settings.statistics.rated = true

Expand Down Expand Up @@ -1635,7 +1637,7 @@ const support = () => {
cancelId: 1,
noLink: true,
type: "info",
message: "Authme is a free, open source software. \n\nIf you like the app, please consider supporting!",
message: lang.dialog.support,
})
.then((result) => {
if (result.response === 0) {
Expand All @@ -1656,7 +1658,7 @@ const feedback = () => {
cancelId: 2,
noLink: true,
type: "info",
message: "Thank you for providing feedback! \n\nPlease report issues on GitHub or by Email.",
message: lang.dialog.feedback,
})
.then((result) => {
if (result.response === 0) {
Expand Down Expand Up @@ -1961,7 +1963,7 @@ const createMenu = () => {
cancelId: 1,
noLink: true,
type: "info",
message: "You can view the Authme Docs in the browser. \n\nClick open to view it in your browser!",
message: lang.dialog.docs,
})
.then((result) => {
if (result.response === 0) {
Expand Down Expand Up @@ -2007,7 +2009,7 @@ const createMenu = () => {
cancelId: 1,
noLink: true,
type: "info",
message: "This software is licensed under GPL-3.0 \n\nCopyright © 2020 Lőrik Levente",
message: lang.dialog.license,
})
.then((result) => {
if (result.response === 0) {
Expand Down

0 comments on commit afaaba0

Please sign in to comment.