-
Notifications
You must be signed in to change notification settings - Fork 702
Localization
Serge Camille edited this page Feb 22, 2021
·
2 revisions
The SimulationCraft GUI can be localized to specific languages. This is a small how-to if you want to contribute to that effort.
- SimulationCraft source code from git
- A QT installation. See HowToBuild on how to install QT for your platform.
- Open simulationcraft.pro with QT Creator
- Edit gui/gui.pro and add a new translation file to TRANSLATIONS. For example, to add a German translation we add a ´locale/sc_de.ts´ file.
- In QT Creator, run Extras -> Extern -> Linguist -> update translation (lupdate). This creates or updates a language translation file (.ts).
- If the language is new, edit qt/sc_OptionsTab.cpp and add the new language in the GUI Localization array, incrementing the index too
- For example, if you're adding a french translation:
globalsLayout_left -> addRow( tr( "GUI Localization" ), choice.gui_localization = createChoice( 5, "auto", "en", "de", "zh", "it" ) );
// Becomes:
globalsLayout_left -> addRow( tr( "GUI Localization" ), choice.gui_localization = createChoice( 6, "auto", "en", "de", "zh", "it", "fr" ) );
// Notice the 5 turning to 6, to match the new array size
- In your QT bin directory, start linguist.exe ( or similar ).
- Open the desired translation file from
<
simc-source-dir>
/locale - Add or update the translations. Save everything.
For a translation file to be used in the GUI, it needs to be exported from a .ts file to a .qm file.
This can be done again in QTCreator under Extras -> Extern -> Linguist -> release translation (lrelease )
When building SimC GUI in debug mode, you'll get debug messages in the console you are running it. You should get a line
[Localization]: Trying to load local file from: <path>/sc_<lang>.qm
Now just ensure that your exported .qm file is in the correct location and launch SimC again.
Adjust Windows build script
- Features
- Starters guide
- Frequently asked questions
- Common Issues
- Textual configuration interface
- Classes
- Graphical User Interface
- Appendixes
- Developers Corner