Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Translate pop-ups for accepting or rejecting updates and selecting folders #414

Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions assets/locales/de/dialog.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"Select folder for storage": "Ordner für Speicher auswählen",
"Select a folder for storing node data": "Ordner für die Speicherung von Knotendaten auswählen"
}
10 changes: 10 additions & 0 deletions assets/locales/de/updater.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"Updates for NiceNode available": "Updates für NiceNode verfügbar",
"Downloading NiceNode update...": "NiceNode Update wird heruntergeladen...",
"Do you want update NiceNode now? NiceNode will restart after downloading the update. Update to version": "Möchten Sie NiceNode jetzt aktualisieren? NiceNode wird nach dem Herunterladen des Updates neu gestartet. Aktualisieren auf Version.",
"Yes": "Ja",
"No": "Nein",
"No update available": "Kein Update verfügbar",
"Sorry, there was an error updating NiceNode": "Entschuldigung, beim Aktualisieren von NiceNode ist ein Fehler aufgetreten",
"Unable to install the new version of NiceNode. You can try downloading the new version manually at https://www.nicenode.xyz/#download": "Die Installation der neuen Version von NiceNode ist nicht möglich. Sie können versuchen, die neue Version manuell herunterzuladen unter https://www.nicenode.xyz/#download"
}
4 changes: 4 additions & 0 deletions assets/locales/en/dialog.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"Select folder for storage": "Select folder for storage",
"Select a folder for storing node data": "Select a folder for storing node data"
}
10 changes: 10 additions & 0 deletions assets/locales/en/updater.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"Updates for NiceNode available": "Updates for NiceNode available",
"Downloading NiceNode update...": "Downloading NiceNode update...",
"Do you want update NiceNode now? NiceNode will restart after downloading the update. Update to version": "Do you want to update NiceNode now? NiceNode will restart after downloading the update. Update to version",
"Yes": "Yes",
"No": "No",
"No update available": "No update available",
"Sorry, there was an error updating NiceNode": "Sorry, there was an error updating NiceNode",
"Unable to install the new version of NiceNode. You can try downloading the new version manually at https://www.nicenode.xyz/#download": "Unable to install the new version of NiceNode. You can try downloading the new version manually at https://www.nicenode.xyz/#download"
}
4 changes: 4 additions & 0 deletions assets/locales/es/dialog.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"Select folder for storage": "Seleccionar carpeta para almacenamiento",
"Select a folder for storing node data": "Seleccionar una carpeta para almacenar los datos del nodo"
}
10 changes: 10 additions & 0 deletions assets/locales/es/updater.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"Updates for NiceNode available": "Actualizaciones disponibles para NiceNode",
"Downloading NiceNode update...": "Descargando la actualización de NiceNode...",
"Do you want update NiceNode now? NiceNode will restart after downloading the update. Update to version": "¿Desea actualizar NiceNode ahora? NiceNode se reiniciará después de descargar la actualización. Actualizar a la versión",
"Yes": "Sí",
"No": "No",
"No update available": "No hay actualizaciones disponibles",
"Sorry, there was an error updating NiceNode": "Lo siento, se produjo un error al actualizar NiceNode",
"Unable to install the new version of NiceNode. You can try downloading the new version manually at https://www.nicenode.xyz/#download": "No se puede instalar la nueva versión de NiceNode. Puede intentar descargar la nueva versión manualmente en https://www.nicenode.xyz/#download"
}
4 changes: 4 additions & 0 deletions assets/locales/fr/dialog.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"Select folder for storage": "Sélectionner un dossier de stockage",
"Select a folder for storing node data": "Sélectionner un dossier pour stocker les données du nœud"
}
10 changes: 10 additions & 0 deletions assets/locales/fr/updater.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"Updates for NiceNode available": "Mises à jour disponibles pour NiceNode",
"Downloading NiceNode update...": "Téléchargement de la mise à jour de NiceNode...",
"Do you want update NiceNode now? NiceNode will restart after downloading the update. Update to version": "Voulez-vous mettre à jour NiceNode maintenant ? NiceNode redémarrera après le téléchargement de la mise à jour. Mettre à jour vers la version",
"Yes": "Oui",
"No": "Non",
"No update available": "Aucune mise à jour disponible",
"Sorry, there was an error updating NiceNode": "Désolé, une erreur s'est produite lors de la mise à jour de NiceNode",
"Unable to install the new version of NiceNode. You can try downloading the new version manually at https://www.nicenode.xyz/#download": "Impossible d'installer la nouvelle version de NiceNode. Vous pouvez essayer de télécharger la nouvelle version manuellement sur https://www.nicenode.xyz/#download"
}
4 changes: 4 additions & 0 deletions assets/locales/ja/dialog.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"Select folder for storage": "ストレージ用のフォルダを選択",
"Select a folder for storing node data": "ノードデータを保存するためのフォルダを選択"
}
10 changes: 10 additions & 0 deletions assets/locales/ja/updater.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"Updates for NiceNode available": "NiceNodeのアップデートが利用可能です",
"Downloading NiceNode update...": "NiceNodeのアップデートをダウンロード中...",
"Do you want update NiceNode now? NiceNode will restart after downloading the update. Update to version": "NiceNodeを今すぐアップデートしますか?アップデートのダウンロード後にNiceNodeが再起動します。バージョンにアップデート",
"Yes": "はい",
"No": "いいえ",
"No update available": "アップデートはありません",
"Sorry, there was an error updating NiceNode": "申し訳ありませんが、NiceNodeのアップデート中にエラーが発生しました",
"Unable to install the new version of NiceNode. You can try downloading the new version manually at https://www.nicenode.xyz/#download": "NiceNodeの新しいバージョンをインストールできません。新しいバージョンを https://www.nicenode.xyz/#download から手動でダウンロードして試すことができます"
}
4 changes: 4 additions & 0 deletions assets/locales/ru/dialog.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"Select folder for storage": "Выберите папку для хранения",
"Select a folder for storing node data": "Выберите папку для хранения данных узла"
}
10 changes: 10 additions & 0 deletions assets/locales/ru/updater.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"Updates for NiceNode available": "Доступны обновления для NiceNode",
"Downloading NiceNode update...": "Загрузка обновления NiceNode...",
"Do you want update NiceNode now? NiceNode will restart after downloading the update. Update to version": "Вы хотите обновить NiceNode сейчас? NiceNode перезапустится после загрузки обновления. Обновить до версии",
"Yes": "Да",
"No": "Нет",
"No update available": "Обновление не доступно",
"Sorry, there was an error updating NiceNode": "Извините, произошла ошибка при обновлении NiceNode",
"Unable to install the new version of NiceNode. You can try downloading the new version manually at https://www.nicenode.xyz/#download": "Невозможно установить новую версию NiceNode. Вы можете попробовать скачать новую версию вручную по адресу https://www.nicenode.xyz/#download"
}
4 changes: 4 additions & 0 deletions assets/locales/vi/dialog.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"Select folder for storage": "Chọn thư mục để lưu trữ",
"Select a folder for storing node data": "Chọn một thư mục để lưu trữ dữ liệu của nút"
}
10 changes: 10 additions & 0 deletions assets/locales/vi/updater.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"Updates for NiceNode available": "Có cập nhật cho NiceNode",
"Downloading NiceNode update...": "Đang tải về cập nhật cho NiceNode...",
"Do you want update NiceNode now? NiceNode will restart after downloading the update. Update to version": "Bạn có muốn cập nhật NiceNode ngay bây giờ không? NiceNode sẽ khởi động lại sau khi tải xong cập nhật. Cập nhật lên phiên bản",
"Yes": "Có",
"No": "Không",
"No update available": "Không có cập nhật",
"Sorry, there was an error updating NiceNode": "Xin lỗi, đã xảy ra lỗi khi cập nhật NiceNode",
"Unable to install the new version of NiceNode. You can try downloading the new version manually at https://www.nicenode.xyz/#download": "Không thể cài đặt phiên bản mới của NiceNode. Bạn có thể thử tải phiên bản mới bằng cách thủ công tại https://www.nicenode.xyz/#download"
}
4 changes: 4 additions & 0 deletions assets/locales/zh/dialog.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"Select folder for storage": "选择用于存储的文件夹",
"Select a folder for storing node data": "选择一个用于存储节点数据的文件夹"
}
10 changes: 10 additions & 0 deletions assets/locales/zh/updater.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"Updates for NiceNode available": "NiceNode 有更新",
"Downloading NiceNode update...": "正在下载 NiceNode 更新...",
"Do you want update NiceNode now? NiceNode will restart after downloading the update. Update to version": "您现在要更新 NiceNode 吗?NiceNode 将在下载更新后重新启动。更新到版本",
"Yes": "是",
"No": "否",
"No update available": "没有可用更新",
"Sorry, there was an error updating NiceNode": "抱歉,更新 NiceNode 时出现错误",
"Unable to install the new version of NiceNode. You can try downloading the new version manually at https://www.nicenode.xyz/#download": "无法安装 NiceNode 的新版本。您可以尝试手动下载新版本,网址为 https://www.nicenode.xyz/#download"
}
7 changes: 5 additions & 2 deletions src/main/dialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ import logger from './logger';
// eslint-disable-next-line import/no-cycle
import { getMainWindow } from './main';
import { getNode, updateNode } from './state/nodes';
import { i18nMain } from './i18nMain';

const t = (str: string) => i18nMain.t(str, { ns: 'dialog' });

export const updateNodeDataDir = async (node: Node, newDataDir: string) => {
node.runtime.dataDir = newDataDir;
Expand Down Expand Up @@ -40,7 +43,7 @@ export const openDialogForNodeDataDir = async (nodeId: NodeId) => {
defaultPath = getNodesDirPath();
}
const result = await dialog.showOpenDialog(mainWindow, {
title: `Select folder for ${node.spec.displayName} storage`,
title: t(`Select folder for ${node.spec.displayName} storage`),
defaultPath,
properties: ['openDirectory'],
});
Expand Down Expand Up @@ -69,7 +72,7 @@ export const openDialogForStorageLocation = async (): Promise<
}
const defaultPath = getNodesDirPath();
const result = await dialog.showOpenDialog(mainWindow, {
title: `Select a folder for storing node data`,
title: t('Select a folder for storing node data'),
defaultPath,
properties: ['openDirectory'],
});
Expand Down
32 changes: 32 additions & 0 deletions src/main/i18nMain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,34 +7,50 @@ import { getMenuBuilder } from './main';
import enTranslations from '../../assets/locales/en/translation.json';
import enNotifications from '../../assets/locales/en/notifications.json';
import enWindowMenu from '../../assets/locales/en/windowMenu.json';
import enUpdater from '../../assets/locales/en/updater.json';
import enDialog from '../../assets/locales/en/dialog.json';

import esTranslations from '../../assets/locales/es/translation.json';
import esNotifications from '../../assets/locales/es/notifications.json';
import esWindowMenu from '../../assets/locales/es/windowMenu.json';
import esUpdater from '../../assets/locales/es/updater.json';
import esDialog from '../../assets/locales/es/dialog.json';

import zhTranslations from '../../assets/locales/zh/translation.json';
import zhNotifications from '../../assets/locales/zh/notifications.json';
import zhWindowMenu from '../../assets/locales/zh/windowMenu.json';
import zhUpdater from '../../assets/locales/zh/updater.json';
import zhDialog from '../../assets/locales/zh/dialog.json';

import frTranslations from '../../assets/locales/fr/translation.json';
import frNotifications from '../../assets/locales/fr/notifications.json';
import frWindowMenu from '../../assets/locales/fr/windowMenu.json';
import frUpdater from '../../assets/locales/fr/updater.json';
import frDialog from '../../assets/locales/fr/dialog.json';

import jaTranslations from '../../assets/locales/ja/translation.json';
import jaNotifications from '../../assets/locales/ja/notifications.json';
import jaWindowMenu from '../../assets/locales/ja/windowMenu.json';
import jaUpdater from '../../assets/locales/ja/updater.json';
import jaDialog from '../../assets/locales/ja/dialog.json';

import deTranslations from '../../assets/locales/de/translation.json';
import deNotifications from '../../assets/locales/de/notifications.json';
import deWindowMenu from '../../assets/locales/de/windowMenu.json';
import deUpdater from '../../assets/locales/de/updater.json';
import deDialog from '../../assets/locales/de/dialog.json';

import ruTranslations from '../../assets/locales/ru/translation.json';
import ruNotifications from '../../assets/locales/ru/notifications.json';
import ruWindowMenu from '../../assets/locales/ru/windowMenu.json';
import ruUpdater from '../../assets/locales/ru/updater.json';
import ruDialog from '../../assets/locales/ru/dialog.json';

import viTranslations from '../../assets/locales/vi/translation.json';
import viNotifications from '../../assets/locales/vi/notifications.json';
import viWindowMenu from '../../assets/locales/vi/windowMenu.json';
import viUpdater from '../../assets/locales/vi/updater.json';
import viDialog from '../../assets/locales/vi/dialog.json';

// Default app language is english
const ENGLISH_LANGUAGE_CODE = 'en';
Expand All @@ -49,41 +65,57 @@ i18n.use(I18nextCLILanguageDetector).init({
translation: enTranslations,
notifications: enNotifications,
windowMenu: enWindowMenu,
updater: enUpdater,
dialog: enDialog,
},
es: {
translation: esTranslations,
notifications: esNotifications,
windowMenu: esWindowMenu,
updater: esUpdater,
dialog: esDialog,
},
zh: {
translation: zhTranslations,
notifications: zhNotifications,
windowMenu: zhWindowMenu,
updater: zhUpdater,
dialog: zhDialog,
},
fr: {
translation: frTranslations,
notifications: frNotifications,
windowMenu: frWindowMenu,
updater: frUpdater,
dialog: frDialog,
},
ja: {
translation: jaTranslations,
notifications: jaNotifications,
windowMenu: jaWindowMenu,
updater: jaUpdater,
dialog: jaDialog,
},
de: {
translation: deTranslations,
notifications: deNotifications,
windowMenu: deWindowMenu,
updater: deUpdater,
dialog: deDialog,
},
ru: {
translation: ruTranslations,
notifications: ruNotifications,
windowMenu: ruWindowMenu,
updater: ruUpdater,
dialog: ruDialog,
},
vi: {
translation: viTranslations,
notifications: viNotifications,
windowMenu: viWindowMenu,
updater: viUpdater,
dialog: viDialog,
},

// ... other languages ...
Expand Down
29 changes: 18 additions & 11 deletions src/main/updater.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@ import sleep from 'await-sleep';

import logger, { autoUpdateLogger } from './logger';
import { reportEvent } from './events';
import { i18nMain } from './i18nMain';

let notifyUserIfNoUpdateAvailable: boolean;

const t = (str: string) => i18nMain.t(str, { ns: 'updater' });

const intiUpdateHandlers = (browserWindow: BrowserWindow) => {
autoUpdater.on('error', (error) => {
logger.error('autoUpdater:::::::::error', error);
Expand All @@ -16,7 +19,7 @@ const intiUpdateHandlers = (browserWindow: BrowserWindow) => {
logger.info('autoUpdater:::::::::checking-for-update');
});
autoUpdater.on('download-progress', (info) => {
logger.info(`autoUpdater:::::::::download-progress: `, info);
logger.info('autoUpdater:::::::::download-progress: ', info);
});
autoUpdater.on('update-available', async (info: UpdateInfo) => {
logger.info('autoUpdater:::::::::update-available: ', info);
Expand All @@ -25,9 +28,11 @@ const intiUpdateHandlers = (browserWindow: BrowserWindow) => {
dialog
.showMessageBox(browserWindow, {
type: 'info',
title: 'Updates for NiceNode available',
message: `Do you want update NiceNode now? NiceNode will restart after downloading the update. Update to version ${info.version}.`,
buttons: ['Yes', 'No'],
title: t('Updates for NiceNode available'),
message: `${t(
'Do you want update NiceNode now? NiceNode will restart after downloading the update. Update to version',
)} ${info.version}.`,
buttons: [t('Yes'), t('No')],
})
.then(async (buttonIndex) => {
// eslint-disable-next-line promise/always-return
Expand All @@ -37,15 +42,15 @@ const intiUpdateHandlers = (browserWindow: BrowserWindow) => {
autoUpdater.downloadUpdate();
dialog.showMessageBox(browserWindow, {
type: 'info',
title: 'Updates for NiceNode available',
message: `Downloading NiceNode update...`,
title: t('Updates for NiceNode available'),
message: t('Downloading NiceNode update...'),
});
} else {
console.log('update checkbox not checked');
}
})
.catch((err) => {
console.error('error in update available diaglog: ', err);
console.error('error in update available dialog: ', err);
});
});

Expand All @@ -54,8 +59,8 @@ const intiUpdateHandlers = (browserWindow: BrowserWindow) => {
if (notifyUserIfNoUpdateAvailable) {
dialog.showMessageBox(browserWindow, {
type: 'info',
title: 'No update available',
message: `No update available`,
title: t('No update available'),
Gathin23 marked this conversation as resolved.
Show resolved Hide resolved
message: t('No update available'),
});
notifyUserIfNoUpdateAvailable = false;
}
Expand All @@ -71,8 +76,10 @@ const intiUpdateHandlers = (browserWindow: BrowserWindow) => {
logger.error('Error in: autoUpdater.quitAndInstall()');
logger.error(err);
dialog.showErrorBox(
'Sorry, there was an error updating NiceNode',
'Unable to install the new version of NiceNode. You can try downloading the new version manually at https://www.nicenode.xyz/#download',
t('Sorry, there was an error updating NiceNode'),
t(
'Unable to install the new version of NiceNode. You can try downloading the new version manually at https://www.nicenode.xyz/#download',
),
);
// todo: send error details
reportEvent('ErrorUpdatingNiceNode');
Expand Down