Skip to content

Commit

Permalink
Export page backend localization
Browse files Browse the repository at this point in the history
  • Loading branch information
Levminer committed Jan 27, 2022
1 parent d1a08fb commit 15b835d
Showing 1 changed file with 18 additions and 10 deletions.
28 changes: 18 additions & 10 deletions app/export/src/js/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const { aes, convert, time } = require("@levminer/lib")
const { aes, convert, time, localization } = require("@levminer/lib")
const logger = require("@levminer/lib/logger/renderer")
const { app, dialog } = require("@electron/remote")
const { ipcRenderer: ipc } = require("electron")
Expand All @@ -18,6 +18,13 @@ window.onerror = (error) => {
*/
logger.getWindow("export")

/**
* Localization
*/
localization.localize("export")

const lang = localization.getLang()

/**
* Check if running in development
*/
Expand Down Expand Up @@ -119,8 +126,8 @@ const go = (data) => {
const saveFile = () => {
dialog
.showSaveDialog({
title: "Save as Text file",
filters: [{ name: "Text file", extensions: ["txt"] }],
title: lang.import_dialog.save_file,
filters: [{ name: lang.export_dialog.text_file, extensions: ["txt"] }],
defaultPath: "~/authme_export.txt",
})
.then((result) => {
Expand Down Expand Up @@ -148,8 +155,8 @@ const saveFile = () => {
const newSaveFile = () => {
dialog
.showSaveDialog({
title: "Save as Authme file",
filters: [{ name: "Authme file", extensions: ["authme"] }],
title: lang.import_dialog.save_file,
filters: [{ name: lang.application_dialog.authme_file, extensions: ["authme"] }],
defaultPath: "~/export.authme",
})
.then((result) => {
Expand Down Expand Up @@ -189,8 +196,8 @@ const newSaveFile = () => {
const saveQrCodes = () => {
dialog
.showSaveDialog({
title: "Save as HTML file",
filters: [{ name: "HTML file", extensions: ["html"] }],
title: lang.import_dialog.save_file,
filters: [{ name: lang.export_dialog.html_file, extensions: ["html"] }],
defaultPath: "~/authme_export.html",
})
.then((result) => {
Expand Down Expand Up @@ -229,13 +236,14 @@ const hide = () => {
* No saved codes found
*/
const error = () => {
fs.readFile(path.join(folder_path, "codes", "codes.authme"), "utf-8", (err, content) => {
fs.readFile(path.join(folder_path, "codes", "codes.authme"), "utf-8", (err) => {
if (err) {
dialog.showMessageBox({
title: "Authme",
buttons: ["Close"],
buttons: [lang.button.close],
noLink: true,
type: "error",
message: "No save file found. \n\nGo back to the main page and save your codes!",
message: lang.export_dialog.no_save_found,
})
}
})
Expand Down

0 comments on commit 15b835d

Please sign in to comment.