diff --git a/electron-builder.yml b/electron-builder.yml index 6efeab57..f09aa3ee 100644 --- a/electron-builder.yml +++ b/electron-builder.yml @@ -27,6 +27,8 @@ files: - "config/" - "scripts/" - "build/" + - "lib/*.js" + - "locales/*.json" # Mac OS configuration mac: diff --git a/electron.js b/electron.js index df85e7d8..ec24c46c 100644 --- a/electron.js +++ b/electron.js @@ -1,15 +1,19 @@ -const { app, BrowserWindow, ipcMain, Menu, Notification, Tray, nativeImage, dialog } = require('electron'); -const { autoUpdater } = require('electron-updater'); -const server = require('./server.js'); -const log = require('electron-log'); -const path = require('path'); +const { app, BrowserWindow, ipcMain, Menu, Notification, Tray, nativeImage, dialog, webContents } = require('electron') +const { autoUpdater } = require('electron-updater') +const server = require('./server.js') +const log = require('electron-log') +const path = require('path') +const i18n = require("./lib/i18n.js") app.commandLine.appendSwitch('js-flags', '--max-old-space-size=512') -process.env['APP_PATH'] = app.getAppPath(); +process.env['APP_PATH'] = app.getAppPath() -autoUpdater.logger = log; -log.info('App starting...'); +autoUpdater.autoDownload = false +autoUpdater.autoInstallOnAppQuit = false +autoUpdater.logger = log +autoUpdater.logger.transports.file.level = 'info' +log.info('App starting...') const editMenu = Menu.buildFromTemplate([ { @@ -17,7 +21,7 @@ const editMenu = Menu.buildFromTemplate([ submenu: [{ label: "Quit", click() { - app.quit(); + app.quit() } }] }, @@ -33,20 +37,17 @@ const editMenu = Menu.buildFromTemplate([ {label: "Select All", accelerator: "CommandOrControl+A", selector: "selectAll:"} ] } -]); +]) -Menu.setApplicationMenu(editMenu); +Menu.setApplicationMenu(editMenu) let myWindow = null; -// TODO: Move the Tray function into another file (maybe Tray.js) -_- -// const tray = new Tray(nativeImage.createEmpty()); - -const APP_ICON = path.join(__dirname, 'img', 'icons'); +const APP_ICON = path.join(__dirname, 'img', 'icons') const iconPath = () => { - return APP_ICON + (process.platform === 'win32' ? '/ico/256x256.ico' : '/png/256x256.png'); -}; + return APP_ICON + (process.platform === 'win32' ? '/ico/256x256.ico' : '/png/256x256.png') +} function createWindow() { myWindow = new BrowserWindow({ @@ -79,8 +80,6 @@ function createWindow() { }) } - - const createTray = () => { let myTray = new Tray(__dirname + '/img/icons/png/tray/tray.png') const contextMenu = Menu.buildFromTemplate([ @@ -92,14 +91,14 @@ const createTray = () => { type: 'separator', }, { - label: 'Show Qortal UI', + label: i18n.__("electron_translate_1"), click: function () { myWindow.maximize() myWindow.show() }, }, { - label: 'Quit', + label: i18n.__("electron_translate_2"), click() { myTray.destroy() app.quit() @@ -112,7 +111,7 @@ const createTray = () => { myTray.on("double-click", () => myWindow.maximize() , myWindow.show()) } -const isLock = app.requestSingleInstanceLock(); +const isLock = app.requestSingleInstanceLock() if (!isLock) { app.quit() @@ -128,12 +127,12 @@ if (!isLock) { createWindow(); createTray(); if (process.platform === 'win32') { - app.setAppUserModelId("org.qortal.QortalUI"); + app.setAppUserModelId("org.qortal.QortalUI") } - autoUpdater.checkForUpdatesAndNotify(); + autoUpdater.checkForUpdatesAndNotify() setInterval(() => { - autoUpdater.checkForUpdatesAndNotify(); - }, 1000 * 60 * 15) + autoUpdater.checkForUpdatesAndNotify() + }, 1000 * 60 * 720) }) app.on('window-all-closed', function () { if (process.platform !== 'darwin') { @@ -142,27 +141,44 @@ if (!isLock) { }) app.on('activate', function () { if (myWindow === null) { - createWindow(); - createTray(); + createWindow() + createTray() } }) ipcMain.on('app_version', (event) => { log.info(app.getVersion()); - mainWindow.webContents.send('app_version', { version: app.getVersion() }); - }); - autoUpdater.on('update-available', () => { - const n = new Notification({ - title: 'Update Available!', - body: 'It will be downloaded ⌛️ in the background!' + mainWindow.webContents.send('app_version', { version: app.getVersion() }) + }) + autoUpdater.on('update-available', (event) => { + const downloadOpts = { + type: 'info', + buttons: ['YES', 'NO'], + title: i18n.__("electron_translate_3"), + detail: i18n.__("electron_translate_4") + } + dialog.showMessageBox(downloadOpts).then((returnValue) => { + if (returnValue.response === 0) { + autoUpdater.downloadUpdate() + const dl = new Notification({ + title: i18n.__("electron_translate_11"), + body: i18n.__("electron_translate_12") + }) + dl.show() + } else { + return + } }) - n.show(); + }) + autoUpdater.on('download-progress', (progressObj) => { + myWindow.webContents.send('downloadProgress', progressObj) }) autoUpdater.on('update-downloaded', (event) => { const dialogOpts = { type: 'info', - buttons: ['Restart now', 'Install after close Qortal UI'], - title: 'Update available', - detail: 'A new Qortal UI version has been downloaded. Click RESTART NOW to apply update, or INSTALL AFTER CLOSE QORTAL UI to install after you quit the UI.' + buttons: [i18n.__("electron_translate_5"), i18n.__("electron_translate_6")], + title: i18n.__("electron_translate_7"), + message: i18n.__("electron_translate_8"), + detail: i18n.__("electron_translate_9") } dialog.showMessageBox(dialogOpts).then((returnValue) => { if (returnValue.response === 0) { @@ -174,9 +190,9 @@ if (!isLock) { }) autoUpdater.on('error', (err) => { const n = new Notification({ - title: 'Error while Updating...', + title: i18n.__("electron_translate_10"), body: err }) - n.show(); + n.show() }) } diff --git a/lib/i18n.js b/lib/i18n.js new file mode 100644 index 00000000..c788ac75 --- /dev/null +++ b/lib/i18n.js @@ -0,0 +1,165 @@ +const osLocale = require("os-locale"); +const fs = require("fs"); +const path = require("path"); + +let cache = { + defaultLocale: "en", + availableLocales: [], + canonicalLocales: [], + locales: [] +}; + +let i18n = {}; + +i18n.__ = function(name) { + i18n.getLocale(); + + let string = i18n.getLocaleData(cache.locale)[name] || i18n.getLocaleData(cache.defaultLocale)[name]; + if (!string) { + let underscoreIndex = cache.locale.indexOf("_"); + if (underscoreIndex !== -1) { + let localeBaseCode = cache.locale.substring(0, underscoreIndex); + if (i18n.localeExists(localeBaseCode)) { + string = i18n.getLocaleData(localeBaseCode)[name]; + } + } + } + + if (string) { + if (arguments.length === 1) { + return string; + } else { + for (let i = 0, l = arguments.length - 1; i < l; i++) { + string = string.replace("$" + i, arguments[1 + i]); + } + return string; + } + } else { + console.warn(`String "${name}" does not exist.`) + } +}; + +i18n.localeExists = function(locale) { + return i18n.getAvailableLocales().indexOf(locale) !== -1; +}; + +i18n.getLocaleData = function(locale) { + if (!cache.locales[locale]) { + cache.locales[locale] = i18n.readLocaleFile(locale); + } + return cache.locales[locale]; +}; + +i18n.readLocaleFile = function(locale) { + let localeData = JSON.parse(fs.readFileSync( + path.join(__dirname, "..", "locales", locale + ".json"), + { encoding: "utf8" } + )); + if (localeData.__redirect__) { + let redirectedLocaleData = JSON.parse(fs.readFileSync( + path.join(__dirname, "..", "locales", localeData.__redirect__ + ".json"), + { encoding: "utf8" } + )); + redirectedLocaleData.__is_redirected__ = true; + redirectedLocaleData.__canonical__ = localeData.__redirect__; + return redirectedLocaleData; + } else { + return localeData; + } +}; + +i18n.doDOMReplacement = function() { + let elems0 = document.getElementsByClassName("i18n"); + for (let i = 0, l = elems0.length; i < l; i++) { + elems0[i].innerHTML = i18n.__(elems0[i].dataset.i18nName); + } + + let elems1 = document.getElementsByClassName("i18n-attr"); + for (let i = 0, l = elems1.length; i < l; i++) { + let mappings = elems1[i].dataset.i18nMap.split(";"); + for (let j = 0, m = mappings.length; j < m; j++) { + let keyVal = mappings[j].split(":"); + elems1[i].setAttribute(keyVal[0], i18n.__(keyVal[1])); + } + } +}; + +i18n.setLocale = function(locale) { + if (i18n.localeExists(locale)) { + cache.locale = locale; + return true; + } + return false; +}; + +i18n.getLocale = function() { + if (!cache.locale) { + let systemLocale = osLocale.sync(); + let availableLocales = i18n.getAvailableLocales(); + if (availableLocales.indexOf(systemLocale) !== -1) { + cache.locale = systemLocale; + } else if (availableLocales.indexOf(systemLocale.split("_")[0]) !== -1) { + cache.locale = systemLocale.split("_")[0]; + } else { + var looseLocaleMatch; + for (let i = 0, l = availableLocales.length; i < l; i++) { + if (availableLocales[i].split("_")[0] === systemLocale.split("_")[0]) { + looseLocaleMatch = availableLocales[i]; + break; + } + } + if (looseLocaleMatch) { + cache.locale = looseLocaleMatch; + } else { + cache.locale = cache.defaultLocale; + } + } + } + return cache.locale; +}; + +i18n.getCanonicalLocale = function() { + i18n.getLocale(); + + if (!cache.locales[cache.locale]) { + cache.locales[cache.locale] = i18n.readLocaleFile(cache.locale); + } + if (cache.locales[cache.locale].__canonical__) { + return cache.locales[cache.locale].__canonical__; + } else { + return cache.locale; + } +}; + +i18n.getAvailableLocales = function(canonicalOnly) { + if (!cache.availableLocales.length) { + let filenames = fs.readdirSync(path.join(__dirname, "..", "locales")); + for (let i = 0, l = filenames.length; i < l; i++) { + cache.availableLocales.push(filenames[i].split(".")[0]); + } + } + if (canonicalOnly) { + return i18n.getCanonicalLocales(); + } else { + return cache.availableLocales; + } +}; + +i18n.getCanonicalLocales = function() { + i18n.getAvailableLocales(); + + if (!cache.canonicalLocales.length) { + for (let i = 0, l = cache.availableLocales.length; i < l; i++) { + if (!i18n.readLocaleFile(cache.availableLocales[i]).hasOwnProperty("__is_redirected__")) { + cache.canonicalLocales.push(cache.availableLocales[i]); + } + } + } + return cache.canonicalLocales; +}; + +i18n.getDefaultLocale = function() { + return cache.defaultLocale; +}; + +module.exports = i18n; diff --git a/locales/bg.json b/locales/bg.json new file mode 100644 index 00000000..2b9de1c2 --- /dev/null +++ b/locales/bg.json @@ -0,0 +1,16 @@ +{ + "__locale_name__": "Български", + + "electron_translate_1": "Показване на Qortal UI", + "electron_translate_2": "Изход", + "electron_translate_3": "Налична е актуализация", + "electron_translate_4": "Налична е нова версия на Qortal UI. Искате ли да я изтеглите?", + "electron_translate_5": "ИНСТАЛИРАНЕ СЕГА", + "electron_translate_6": "МОЖЕ БИ ПО-КЪСНО", + "electron_translate_7": "Актуализацията е готова за инсталиране", + "electron_translate_8": "Беше изтеглена нова версия на Qortal UI.", + "electron_translate_9": "Щракнете върху ИНСТАЛИРАНЕ СЕГА, за да приложите актуализация, МОЖЕ БИ ПО-КЪСНО, за да не актуализирате потребителския интерфейс.", + "electron_translate_10": "Грешка при актуализиране...", + "electron_translate_11": "ИЗТЕГЛЕТЕ АКТУАЛИЗАЦИЯТА", + "electron_translate_12": "Ще бъде изтеглено ⌛️ във фонов режим!" +} \ No newline at end of file diff --git a/locales/de.json b/locales/de.json new file mode 100644 index 00000000..590401f2 --- /dev/null +++ b/locales/de.json @@ -0,0 +1,16 @@ +{ + "__locale_name__": "Deutsch, Deutschland", + + "electron_translate_1": "Qortal-UI anzeigen", + "electron_translate_2": "Beenden", + "electron_translate_3": "Update verfügbar", + "electron_translate_4": "Eine neue Version der Qortal-Benutzeroberfläche ist verfügbar. Möchten Sie sie herunterladen?", + "electron_translate_5": "JETZT INSTALLIEREN", + "electron_translate_6": "VIELLEICHT SPÄTER", + "electron_translate_7": "Update zur Installation bereit", + "electron_translate_8": "Eine neue Qortal-UI-Version wurde heruntergeladen.", + "electron_translate_9": "Klicken Sie auf JETZT INSTALLIEREN, um das Update anzuwenden, VIELLEICHT SPÄTER, um die Benutzeroberfläche nicht zu aktualisieren.", + "electron_translate_10": "Fehler beim Aktualisieren...", + "electron_translate_11": "UPDATE HERUNTERLADEN", + "electron_translate_12": "Das Update wird im Hintergrund heruntergeladen ⌛️!" +} \ No newline at end of file diff --git a/locales/en.json b/locales/en.json new file mode 100644 index 00000000..a10a2de0 --- /dev/null +++ b/locales/en.json @@ -0,0 +1,16 @@ +{ + "__locale_name__": "English", + + "electron_translate_1": "Show Qortal UI", + "electron_translate_2": "Quit", + "electron_translate_3": "Update available", + "electron_translate_4": "A new Qortal UI version is available. You want to download it ?", + "electron_translate_5": "INSTALL NOW", + "electron_translate_6": "MAYBE LATER", + "electron_translate_7": "Update ready to install", + "electron_translate_8": "A new Qortal UI version has been downloaded.", + "electron_translate_9": "Click INSTALL NOW to apply update, MAYBE LATER to not update the UI.", + "electron_translate_10": "Error while Updating...", + "electron_translate_11": "DOWNLOAD UPDATE", + "electron_translate_12": "It will be downloaded ⌛️ in the background!" +} \ No newline at end of file diff --git a/locales/es.json b/locales/es.json new file mode 100644 index 00000000..552305c9 --- /dev/null +++ b/locales/es.json @@ -0,0 +1,16 @@ +{ + "__locale_name__": "español", + + "electron_translate_1": "Mostrar interfaz de usuario de Qortal", + "electron_translate_2": "Salir", + "electron_translate_3": "Actualización disponible", + "electron_translate_4": "Hay una nueva versión de Qortal UI disponible. ¿Quieres descargarla?", + "electron_translate_5": "INSTALAR AHORA", + "electron_translate_6": "QUIZÁS MÁS TARDE", + "electron_translate_7": "Actualización lista para instalar", + "electron_translate_8": "Se ha descargado una nueva versión de la interfaz de usuario de Qortal.", + "electron_translate_9": "Haz clic en INSTALAR AHORA para aplicar la actualización, QUIZÁS MÁS TARDE para no actualizar la interfaz de usuario"., + "electron_translate_10": "Error al actualizar...", + "electron_translate_11": "DESCARGAR ACTUALIZACIÓN", + "electron_translate_12": "¡Se descargará ⌛️ en segundo plano!" +} \ No newline at end of file diff --git a/locales/fr.json b/locales/fr.json new file mode 100644 index 00000000..624cbdee --- /dev/null +++ b/locales/fr.json @@ -0,0 +1,16 @@ +{ + "__locale_name__": "Français", + + "electron_translate_1": "Afficher l'interface utilisateur de Qortal", + "electron_translate_2": "Quitter", + "electron_translate_3": "Mise à jour disponible", + "electron_translate_4": "Une nouvelle version de l'UI Qortal est disponible. Vous voulez la télécharger ?", + "electron_translate_5": "INSTALLER MAINTENANT", + "electron_translate_6": "PEUT-ÊTRE PLUS TARD", + "electron_translate_7": "Mise à jour prête à installer", + "electron_translate_8": "Une nouvelle version de l'interface utilisateur de Qortal a été téléchargée.", + "electron_translate_9": "Cliquez sur INSTALLER MAINTENANT pour appliquer la mise à jour, PEUT-ÊTRE PLUS TARD pour ne pas mettre à jour l'interface utilisateur.", + "electron_translate_10": "Erreur lors de la mise à jour...", + "electron_translate_11": "TÉLÉCHARGER LA MISE À JOUR", + "electron_translate_12": "Il sera téléchargé ⌛️ en arrière-plan !" +} \ No newline at end of file diff --git a/locales/it.json b/locales/it.json new file mode 100644 index 00000000..bd851cd6 --- /dev/null +++ b/locales/it.json @@ -0,0 +1,16 @@ +{ + "__locale_name__": "Italiano", + + "electron_translate_1": "Mostra UI Qortal", + "electron_translate_2": "Esci", + "electron_translate_3": "Aggiornamento disponibile", + "electron_translate_4": "È disponibile una nuova versione dell'interfaccia utente di Qortal. Vuoi scaricarla?", + "electron_translate_5": "INSTALLA ORA", + "electron_translate_6": "FORSE PIÙ TARDI", + "electron_translate_7": "Aggiornamento pronto per l'installazione", + "electron_translate_8": "È stata scaricata una nuova versione dell'interfaccia utente di Qortal.", + "electron_translate_9": "Fai clic su INSTALLA ORA per applicare l'aggiornamento, FORSE DOPO per non aggiornare l'interfaccia utente.", + "electron_translate_10": "Errore durante l'aggiornamento...", + "electron_translate_11": "SCARICA AGGIORNAMENTO", + "electron_translate_12": "Verrà scaricato ⌛️ in background!" +} \ No newline at end of file diff --git a/locales/ko.json b/locales/ko.json new file mode 100644 index 00000000..65f679d4 --- /dev/null +++ b/locales/ko.json @@ -0,0 +1,16 @@ +{ + "__locale_name__": "한국어", + + "electron_translate_1": "Qortal UI 표시", + "electron_translate_2": "종료", + "electron_translate_3": "업데이트 가능", + "electron_translate_4": "새로운 Qortal UI 버전을 사용할 수 있습니다. 다운로드하시겠습니까?", + "electron_translate_5": "지금 설치", + "electron_translate_6": "나중에 가능", + "electron_translate_7": "업데이트 설치 준비 완료", + "electron_translate_8": "새로운 Qortal UI 버전이 다운로드되었습니다.", + "electron_translate_9": "업데이트를 적용하려면 지금 설치를 클릭하고 UI를 업데이트하지 않으려면 나중에 할 수도 있습니다.", + "electron_translate_10": "업데이트 중 오류...", + "electron_translate_11": "업데이트 다운로드", + "electron_translate_12": "백그라운드에서 ⌛️ 다운로드됩니다!" +} \ No newline at end of file diff --git a/locales/nl.json b/locales/nl.json new file mode 100644 index 00000000..73756911 --- /dev/null +++ b/locales/nl.json @@ -0,0 +1,16 @@ +{ + "__locale_name__": "Nederlands", + + "electron_translate_1": "Toon Qortal UI", + "electron_translate_2": "Stoppen", + "electron_translate_3": "Update beschikbaar", + "electron_translate_4": "Er is een nieuwe Qortal UI-versie beschikbaar. Wil je deze downloaden?", + "electron_translate_5": "NU INSTALLEREN", + "electron_translate_6": "MISSCHIEN LATER", + "electron_translate_7": "Update klaar om te installeren", + "electron_translate_8": "Er is een nieuwe Qortal UI-versie gedownload.", + "electron_translate_9": "Klik op NU INSTALLEREN om de update toe te passen, MISSCHIEN LATER om de gebruikersinterface niet bij te werken.", + "electron_translate_10": "Fout tijdens updaten...", + "electron_translate_11": "UPDATE DOWNLOADEN", + "electron_translate_12": "Het wordt ⌛️ op de achtergrond gedownload!" +} \ No newline at end of file diff --git a/locales/pt.json b/locales/pt.json new file mode 100644 index 00000000..516e26cd --- /dev/null +++ b/locales/pt.json @@ -0,0 +1,16 @@ +{ + "__locale_name__": "Português", + + "electron_translate_1": "Mostrar Qortal UI", + "electron_translate_2": "Sair", + "electron_translate_3": "Atualização disponível", + "electron_translate_4": "Uma nova versão Qortal UI está disponível. Deseja baixá-la?", + "electron_translate_5": "INSTALE AGORA", + "electron_translate_6": "TALVEZ MAIS TARDE", + "electron_translate_7": "Atualização pronta para instalar", + "electron_translate_8": "Uma nova versão Qortal UI foi baixada.", + "electron_translate_9": "Clique em INSTALAR AGORA para aplicar a atualização, TALVEZ MAIS TARDE para não atualizar a UI.", + "electron_translate_10": "Erro ao atualizar...", + "electron_translate_11": "BAIXAR ATUALIZAÇÃO", + "electron_translate_12": "Será baixado ⌛️ em segundo plano!" +} \ No newline at end of file diff --git a/locales/pt_BR.json b/locales/pt_BR.json new file mode 100644 index 00000000..6e272b8d --- /dev/null +++ b/locales/pt_BR.json @@ -0,0 +1,16 @@ +{ + "__locale_name__": "Português Brasileiro", + + "electron_translate_1": "Mostrar Qortal UI", + "electron_translate_2": "Sair", + "electron_translate_3": "Atualização disponível", + "electron_translate_4": "Uma nova versão Qortal UI está disponível. Deseja baixá-la?", + "electron_translate_5": "INSTALE AGORA", + "electron_translate_6": "TALVEZ MAIS TARDE", + "electron_translate_7": "Atualização pronta para instalar", + "electron_translate_8": "Uma nova versão Qortal UI foi baixada.", + "electron_translate_9": "Clique em INSTALAR AGORA para aplicar a atualização, TALVEZ MAIS TARDE para não atualizar a UI.", + "electron_translate_10": "Erro ao atualizar...", + "electron_translate_11": "BAIXAR ATUALIZAÇÃO", + "electron_translate_12": "Será baixado ⌛️ em segundo plano!" +} \ No newline at end of file diff --git a/locales/ru_RU.json b/locales/ru_RU.json new file mode 100644 index 00000000..c0f6ff7c --- /dev/null +++ b/locales/ru_RU.json @@ -0,0 +1,16 @@ +{ + "__locale_name__": "Русский, Россия", + + "electron_translate_1": "Показать пользовательский интерфейс Qortal", + "electron_translate_2": "Выйти", + "electron_translate_3": "Доступно обновление", + "electron_translate_4": "Доступна новая версия пользовательского интерфейса Qortal. Хотите скачать ее?", + "electron_translate_5": "УСТАНОВИТЬ СЕЙЧАС", + "electron_translate_6": "МОЖЕТ БЫТЬ ПОЗЖЕ", + "electron_translate_7": "Обновление готово к установке", + "electron_translate_8": "Загружена новая версия пользовательского интерфейса Qortal.", + "electron_translate_9": "Нажмите УСТАНОВИТЬ СЕЙЧАС, чтобы применить обновление, МОЖЕТ БЫТЬ ПОЗЖЕ, чтобы не обновлять пользовательский интерфейс.", + "electron_translate_10": "Ошибка при обновлении...", + "electron_translate_11": "СКАЧАТЬ ОБНОВЛЕНИЕ", + "electron_translate_12": "Он будет загружен ⌛️ в фоновом режиме!" +} \ No newline at end of file diff --git a/locales/tr.json b/locales/tr.json new file mode 100644 index 00000000..11491409 --- /dev/null +++ b/locales/tr.json @@ -0,0 +1,16 @@ +{ + "__locale_name__": "Türkçe", + + "electron_translate_1": "Qortal Kullanıcı Arayüzünü Göster", + "electron_translate_2": "Çık", + "electron_translate_3": "Güncelleme mevcut", + "electron_translate_4": "Yeni bir Qortal UI sürümü mevcut. İndirmek istiyor musunuz?", + "electron_translate_5": "ŞİMDİ YÜKLE", + "electron_translate_6": "BELKİ SONRA", + "electron_translate_7": "Güncelleme yüklenmeye hazır", + "electron_translate_8": "Yeni bir Qortal UI sürümü indirildi.", + "electron_translate_9": "Güncellemeyi uygulamak için ŞİMDİ YÜKLE'ye tıklayın, kullanıcı arayüzünü güncellememek için MAYBE SONRA tıklayın.", + "electron_translate_10": "Güncelleme Sırasında Hata...", + "electron_translate_11": "GÜNCELLEMEYİ İNDİRİN", + "electron_translate_12": "Arka planda ⌛️ indirilecek!" +} \ No newline at end of file diff --git a/locales/uk.json b/locales/uk.json new file mode 100644 index 00000000..1e52aca0 --- /dev/null +++ b/locales/uk.json @@ -0,0 +1,16 @@ +{ + "__locale_name__": "Українська, Україна", + + "electron_translate_1": "Show Qortal UI", + "electron_translate_2": "Quit", + "electron_translate_3": "Update available", + "electron_translate_4": "A new Qortal UI version is available. You want to download it ?", + "electron_translate_5": "INSTALL NOW", + "electron_translate_6": "MAYBE LATER", + "electron_translate_7": "Update ready to install", + "electron_translate_8": "A new Qortal UI version has been downloaded.", + "electron_translate_9": "Click INSTALL NOW to apply update, MAYBE LATER to not update the UI.", + "electron_translate_10": "Error while Updating...", + "electron_translate_11": "DOWNLOAD UPDATE", + "electron_translate_12": "It will be downloaded ⌛️ in the background!" +} \ No newline at end of file diff --git a/locales/zh_CN.json b/locales/zh_CN.json new file mode 100644 index 00000000..7fe1625d --- /dev/null +++ b/locales/zh_CN.json @@ -0,0 +1,16 @@ +{ + "__locale_name__": "中文 (简体)", + + "electron_translate_1": "显示 Qortal 用户界面", + "electron_translate_2": "退出", + "electron_translate_3": "更新可用", + "electron_translate_4": "一个新的 Qortal UI 版本可用。你想下载它吗?", + "electron_translate_5": "立即安装", + "electron_translate_6": "稍后再说", + "electron_translate_7": "更新准备安装", + "electron_translate_8": "已下载新的 Qortal UI 版本。", + "electron_translate_9": "点击现在安装应用更新,可能稍后不更新用户界面。", + "electron_translate_10": "更新时出错...", + "electron_translate_11": "下载更新", + "electron_translate_12": "它将在后台下载 ⌛️!" +} \ No newline at end of file diff --git a/locales/zh_HK.json b/locales/zh_HK.json new file mode 100644 index 00000000..8d4e15bf --- /dev/null +++ b/locales/zh_HK.json @@ -0,0 +1,3 @@ +{ + "__redirect__": "zh_TW" +} \ No newline at end of file diff --git a/locales/zh_TW.json b/locales/zh_TW.json new file mode 100644 index 00000000..07182899 --- /dev/null +++ b/locales/zh_TW.json @@ -0,0 +1,16 @@ +{ + "__locale_name__": "中文 (繁體)", + + "electron_translate_1": "顯示 Qortal 用戶界面", + "electron_translate_2": "退出", + "electron_translate_3": "更新可用", + "electron_translate_4": "一個新的 Qortal UI 版本可用。你想下載它嗎?", + "electron_translate_5": "立即安裝", + "electron_translate_6": "稍後再說", + "electron_translate_7": "更新準備安裝", + "electron_translate_8": "已下載新的 Qortal UI 版本。", + "electron_translate_9": "點擊現在安裝應用更新,可能稍後不更新用戶界面。", + "electron_translate_10": "更新時出錯...", + "electron_translate_11": "下載更新", + "electron_translate_12": "它將在後台下載 ⌛️!" +} \ No newline at end of file diff --git a/qortal-ui-core/src/tradebot/trade-bot-routes.js b/qortal-ui-core/src/tradebot/trade-bot-routes.js index aecb989f..d15156ec 100644 --- a/qortal-ui-core/src/tradebot/trade-bot-routes.js +++ b/qortal-ui-core/src/tradebot/trade-bot-routes.js @@ -1,6 +1,8 @@ import { store } from '../store.js' import * as api from 'qortal-ui-crypto' import snackbar from '../functional-components/snackbar.js' +import copyTextMenu from '../functional-components/copy-text-menu.js'; +import framePasteMenu from '../functional-components/frame-paste-menu.js'; const createTransaction = api.createTransaction const processTransaction = api.processTransaction @@ -23,6 +25,27 @@ export const routes = { return api.request(url, req.data) }, + openCopyTextMenu: async (req) => { + const textMenuObject = { + selectedText: req.data.selectedText, + eventObject: req.data.eventObject, + isFrame: req.data.isFrame, + }; + copyTextMenu.open(textMenuObject); + }, + + closeCopyTextMenu: async (req) => { + copyTextMenu.close(); + }, + + openFramePasteMenu: async (req) => { + framePasteMenu.open(req.data); + }, + + closeFramePasteMenu: async (req) => { + framePasteMenu.close(); + }, + transaction: async (req) => { let response try {