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
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Add language initialization
  • Loading branch information
ZIMkaRU committed Sep 26, 2024
commit fc1a72a0e3f1790429e42b1b3c98056ce317f366
13 changes: 11 additions & 2 deletions src/initialize-app.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

const { app } = require('electron')
const path = require('path')
const i18next = require('i18next')

const { REPORT_FILES_PATH_VERSION } = require('./const')

Expand Down Expand Up @@ -139,7 +140,7 @@ const _manageConfigs = (params = {}) => {
const configsKeeper = configsKeeperFactory(
{ pathToUserData },
{
language: 'en', // TODO:
language: null,
pathToUserReportFiles,
schedulerRule,
shownChangelogVer: '0.0.0',
Expand All @@ -150,6 +151,8 @@ const _manageConfigs = (params = {}) => {
configsKeeper,
{ pathToUserReportFiles }
)

return configsKeeper
}

module.exports = async () => {
Expand All @@ -169,10 +172,16 @@ module.exports = async () => {
const pathToUserData = app.getPath('userData')
const pathToUserDocuments = app.getPath('documents')

_manageConfigs({
const configsKeeper = _manageConfigs({
pathToUserData,
pathToUserDocuments
})
const savedLanguage = configsKeeper.getConfigByName('language')

if (savedLanguage) {
await i18next.changeLanguage(savedLanguage)
}

TranslationIpcChannelHandlers.create()

const secretKey = await makeOrReadSecretKey(
Expand Down