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

Add translation flow to electron wrapper #412

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
1707e6a
Implement ipc channel handlers class
ZIMkaRU Sep 25, 2024
a9d05ec
Implement translation ipc channel handlers class
ZIMkaRU Sep 25, 2024
3994e1a
Initialize translate ipc channel handlers class
ZIMkaRU Sep 25, 2024
87ae4fe
Add translation ipc channel bridge to preload
ZIMkaRU Sep 25, 2024
74a248d
Change path to preload script
ZIMkaRU Sep 25, 2024
f4de92d
Add i18next and i18next-fs-backend deps
ZIMkaRU Sep 26, 2024
43dc33c
Implement fn to init i18next
ZIMkaRU Sep 26, 2024
3a0a54d
Add supported translation files
ZIMkaRU Sep 26, 2024
ce4f8ca
Init i18next module
ZIMkaRU Sep 26, 2024
6c8b99b
Add getAvailableLanguages method to window api
ZIMkaRU Sep 26, 2024
f6eba26
Add setLanguage method to window API
ZIMkaRU Sep 26, 2024
e11b392
Add getter for available languages
ZIMkaRU Sep 26, 2024
fc1a72a
Add language initialization
ZIMkaRU Sep 26, 2024
30df30c
Improve window language getter setter api
ZIMkaRU Sep 26, 2024
c3f552e
Add ability to detect default os language for first setup
ZIMkaRU Sep 27, 2024
b0ff14d
Enhance fallback languages
ZIMkaRU Sep 27, 2024
930d060
Use translation in main menu
ZIMkaRU Sep 30, 2024
899adf2
Add en main menu translation
ZIMkaRU Sep 30, 2024
595fb79
Add ru main menu translation
ZIMkaRU Sep 30, 2024
694e70f
Recreate menu in case changing translation
ZIMkaRU Sep 30, 2024
2472889
Apply prev menu item states in case recreating menu
ZIMkaRU Sep 30, 2024
b1db3ce
Enhance menu item translations
ZIMkaRU Sep 30, 2024
a68249b
Add helper to wait for port on host for 1 min
ZIMkaRU Oct 1, 2024
459c3eb
Add ability to use ui dev server with electron wrapper
ZIMkaRU Oct 1, 2024
31dd0e9
Add ability to launch ui dev server and electron using concurrently util
ZIMkaRU Oct 1, 2024
b2f2a10
Add env var to launch ui dev server
ZIMkaRU Oct 1, 2024
3b2ddb2
Fix wait-port module import
ZIMkaRU Oct 2, 2024
b28deff
Add translations folder into assembling releases
ZIMkaRU Oct 2, 2024
01ffa55
Add vi translation file
ZIMkaRU Oct 2, 2024
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 .env.example
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
REPO_OWNER=bitfinexcom
REPO_BRANCH=master

IS_BFX_API_STAGING=0
IS_DEV_ENV=0
IS_AUTO_UPDATE_DISABLED=0

SHOULD_LOCALHOST_BE_USED_FOR_LOADING_UI_IN_DEV_MODE=0

EP_GH_IGNORE_TIME=true
GH_TOKEN=

Expand Down
56 changes: 56 additions & 0 deletions build/locales/en/translations.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
{
"common": {
"title": "Report"
},
"menu": {
"macMainSubmenu": {
"servicesLabel": "Services",
"hideLabel": "Hide",
"hideOthersLabel": "Hide Others",
"unhideLabel": "Unhide",
"quitLabel": "Quit"
},
"fileSubMenu": {
"label": "File"
},
"editSubMenu": {
"label": "Edit"
},
"viewSubMenu": {
"label": "View",
"reloadLabel": "Reload",
"forceReloadLabel": "Force Reload",
"toggleDevToolsLabel": "Toggle Developer Tools",
"resetZoomLabel": "Actual Size",
"zoomInLabel": "Zoom In",
"zoomOutLabel": "Zoom Out",
"togglefullscreenLabel": "Toggle Full Screen"
},
"windowSubMenu": {
"label": "Window"
},
"toolsSubMenu": {
"label": "Tools",
"dataManagementSubMenu": {
"label": "Data Management",
"exportDbLabel": "Export DB",
"importDbLabel": "Import DB",
"restoreDbLabel": "Restore DB",
"backupDbLabel": "Backup DB",
"removeDbLabel": "Remove DB",
"clearAllDataLabel": "Clear All Data (except user creds)"
},
"changeReportsFolderLabel": "Change Reports Folder",
"changeSyncFrequencyLabel": "Change Sync Frequency"
},
"helpSubMenu": {
"label": "Help",
"openNewGitHubIssueLabel": "Open new GitHub Issue",
"checkForUpdatesLabel": "Check for Updates",
"quitAndInstallUpdatesLabel": "Quit and Install updates",
"userManualLabel": "User Manual",
"changelogLabel": "Changelog",
"aboutLabel": "About {{appName}}"
}
}
}
5 changes: 5 additions & 0 deletions build/locales/es-EM/translations.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"common": {
"title": "Reporte"
}
}
5 changes: 5 additions & 0 deletions build/locales/pt-BR/translations.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"common": {
"title": "Informes"
}
}
56 changes: 56 additions & 0 deletions build/locales/ru/translations.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
{
"common": {
"title": "Отчет"
},
"menu": {
"macMainSubmenu": {
"servicesLabel": "Услуги",
"hideLabel": "Скрыть",
"hideOthersLabel": "Скрыть Другие",
"unhideLabel": "Показать",
"quitLabel": "Выйти"
},
"fileSubMenu": {
"label": "Файл"
},
"editSubMenu": {
"label": "Редактировать"
},
"viewSubMenu": {
"label": "Вид",
"reloadLabel": "Перезагрузить",
"forceReloadLabel": "Принудительно Перезагрузить",
"toggleDevToolsLabel": "Переключить Инструменты Разработчика",
"resetZoomLabel": "Фактический Размер",
"zoomInLabel": "Увеличить",
"zoomOutLabel": "Уменьшить",
"togglefullscreenLabel": "Переключить на Полный Экран"
},
"windowSubMenu": {
"label": "Окно"
},
"toolsSubMenu": {
"label": "Инструменты",
"dataManagementSubMenu": {
"label": "Управление Данными",
"exportDbLabel": "Экспортировать БД",
"importDbLabel": "Импортировать БД",
"restoreDbLabel": "Восстановить БД",
"backupDbLabel": "Резервная копия БД",
"removeDbLabel": "Удалить БД",
"clearAllDataLabel": "Очистить Все Данные (кроме учетных данных польз.)"
},
"changeReportsFolderLabel": "Изменить Папку Отчетов",
"changeSyncFrequencyLabel": "Изменить Частоту Синхронизации"
},
"helpSubMenu": {
"label": "Помощь",
"openNewGitHubIssueLabel": "Открыть новую Проблему на GitHub",
"checkForUpdatesLabel": "Проверить наличие Обновлений",
"quitAndInstallUpdatesLabel": "Выйти и Установить обновления",
"userManualLabel": "Руководство Пользователя",
"changelogLabel": "Журнал Изменений",
"aboutLabel": "О {{appName}}"
}
}
}
5 changes: 5 additions & 0 deletions build/locales/tr/translations.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"common": {
"title": "Rapor"
}
}
5 changes: 5 additions & 0 deletions build/locales/vi/translations.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"common": {
"title": "Báo cáo"
}
}
5 changes: 5 additions & 0 deletions build/locales/zh-CN/translations.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"common": {
"title": "报告"
}
}
5 changes: 5 additions & 0 deletions build/locales/zh-TW/translations.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"common": {
"title": "報告"
}
}
1 change: 1 addition & 0 deletions electron-builder-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ module.exports = {
files: [
'**/*',
'build/icons',
'build/locales',
'build/icon.*',
'build/loader.*',
'!scripts${/*}',
Expand Down
2 changes: 2 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ try {
} catch (err) {}

const { app } = require('electron')
require('./src/i18next')
.initI18next()

const isTestEnv = process.env.NODE_ENV === 'test'

Expand Down
7 changes: 6 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
"get-port": "7.0.0",
"github-markdown-css": "5.1.0",
"grenache-grape": "git+https://github.com/bitfinexcom/grenache-grape.git",
"i18next": "23.15.1",
"i18next-fs-backend": "2.3.2",
"js-yaml": "4.1.0",
"lib-js-util-base": "git+https://github.com/bitfinexcom/lib-js-util-base.git",
"new-github-issue-url": "0.2.1",
Expand All @@ -41,6 +43,7 @@
"@wdio/mocha-framework": "8.22.0",
"@wdio/spec-reporter": "8.21.0",
"app-builder-bin": "4.2.0",
"concurrently": "9.0.1",
"cross-env": "7.0.3",
"dotenv": "16.3.1",
"electron": "27.3.5",
Expand All @@ -59,11 +62,13 @@
},
"scripts": {
"start": "cross-env NODE_ENV=development DEBUG=* electron .",
"startWithUIOnPort": "concurrently -ki -c green,blue -n UI,ELECTRON \"npm run startUI\" \"cross-env NODE_ENV=development DEBUG=* SHOULD_LOCALHOST_BE_USED_FOR_LOADING_UI_IN_DEV_MODE=1 electron .\"",
"test": "standard && npm run unit",
"unit": "cross-env NODE_ENV=test mocha './src/**/__test__/*.spec.js' --config .mocharc.json",
"setup": "./scripts/setup.sh",
"launch": "./scripts/launch.sh",
"sync-repo": "./scripts/sync-repo.sh",
"e2e": "cross-env NODE_ENV=test wdio run ./wdio.conf.js"
"e2e": "cross-env NODE_ENV=test wdio run ./wdio.conf.js",
"startUI": "cd bfx-report-ui && cross-env BROWSER=none npm start"
}
}
Loading