varenius / salsa

Code developed for the 2.3m radio telescopes SALSA in Onsala, Sweden
MIT License
16 stars 6 forks source link

UI translation #44

Closed varenius closed 3 years ago

varenius commented 3 years ago

Should offer UI translation. Initially Swedish and English. Could be done by generating ts files from ui file?

varenius commented 3 years ago

Seems to actually work now, for Swedish!

Steps (commands on linux in parenthesis):

  1. Create UI in QtDesigner (designer) --> SALSA_UI.ui
  2. Generate ts file (pylupdate5 SALSA_UI.ui -ts sv.ts)
  3. Use QtLinguist to translate the ts file (linguist).
  4. Convert .ts to .qm (lrelease sv.ts)

Then read the qm file in the code (see 4474187fc48632774a7de9a2902bd005ed6b8cd1).

varenius commented 3 years ago

Some links I found useful for language translation: https://stackoverflow.com/questions/53349623/how-to-change-languagestranslations-dynamically-on-pyqt5 https://www.pythonstudio.us/pyqt-programming/internationalization.html

varenius commented 3 years ago

Initial version of Swedish and English now works. Marking as closed (but useful to have the Steps above to refer to for future updates of the translation files).