这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@ZIMkaRU
Copy link
Member

@ZIMkaRU ZIMkaRU commented Oct 2, 2024

This PR adds translation flow to the electronjs wrapper


The approach is following:

window.bfxReportElectronApi.setLanguage('en') // return either false (if not set) or `i18next.resolvedLanguage` eg 'en'
window.bfxReportElectronApi.getLanguage() // return eg 'en'
window.bfxReportElectronApi.getAvailableLanguages() // return eg ['en', 'ru', 'es']
  • if language is changed via UI, the provided API persists value into storage on the electronjs process side
  • and the next time the language value returns from that storage

Basic changes:

  • store translations in one common folder
  • separate translations by language in JSON files using namespaces
  • use i18next lib and the official i18next-fs-backend plugin to provide the ability to load translations
  • provide correct i18next initialization in the main entry point
  • add translation ipc channel bridge to window preload script to have window.bfxReportElectronApi on UI side
  • add translations into the main menu of the app
  • provide ability to use the UI dev server with the electronjs wrapper in dev mode to be able to develop the corresponding UI part of this feature. For this purpose adds concurrently dep https://www.npmjs.com/package/concurrently to the dev section. Provides corresponding cmd:
npm run startWithUIOnPort

Here in parallel launch the UI dev server and the electron wrapper that waits for localhost:3000 for 1min to be initialized

Copy link
Contributor

@ezewer ezewer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good to me!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants