Qt is a cross-platform applications development platform from Nokia. Qt applications use two kind of resource files: user interface files and translation files. User interface files (.ui) define user interface elements such as forms and dialogs. Translations file (.ts) contains strings.
The traditional way to localize Qt application is to store all strings (even those that are already defined in .ui files) into translations file. Whenever you used to have a hard code string replace it with TR function
str = "This is my string";
Change it to
str = tr("this is my string");
Qt contains a command line tool, lupdate.exe, that scans your source code looking for lines where you have used TR function. If found it adds the string inside TR function to .ts file. To localize your application make copy of ts file for each language and translate the strings. There is one translation file for each language. They all have the same structure, same base name but a language depend file name ending. For example Sample_de.ts contains German translations, Sample_fi.ts contains Finnish, and so on. Translation file is an XML file although older Qt version do not use XML header.
Because there are several similar files it might be a bit confusing to choose what one to add to Sisulizer project. You can add any one but no more that one. When you add one file Sisulizer will import existing translations from all similar files. When you build items Sisulizer updates each file to contain new translations. Sisulizer creates a new translation file if it does not already exist.
User interface files (.ui) are created using Qt Designer. A file define one form or dialog. Qt project file can contain any number of UI files. UI files are XML files.
In traditional localization method all strings, even those from .ui files, are placed to .ts files. Developer uses lupdate.exe command line utility to scan source code and create .ts file. The you add the .ts files or Qt project file (.pro) that contains .ts file to Sisulizer. Sisulizer scans the file(s), translators translate them and Sisulizer creates localized .ts file. Finally developer use lrelease.exe command line utility to compile .ts files to binary .qm files that can be linked into application. When you compile the application next time the translated resources are included as resources inside the application and the application can choose what language to turn on when starting.
This methods has two drawbacks. The first is that when Qt tools compile the application they copy the date from .ui files to header files (.h) that are linked inside the application. Tool resource string data of .ui files but nothing else. This means that you can translate only string data from your .ui files. There is not way to localize size, position or font data of form even in many cases it is required. The second problem is that when Qt tools extracts string from .ui file and place them inside TR function the strings loose context information. The translator no longer see the form visually as developer that uses Designer. This makes translation job harder and more error prone. This is why Sisulizer has developer visual localization method for Qt that enables you to localize .ui files directory with full context and visual information.
Sisulizer introduces much easier and more extensive localization method that allows you to directly localize Designer files (.ui). You only have to use TR function and .ts file on those strings that are used in source code such as message format strings. Your user interface is in .ui files. Sisulizer scans the original .ui file and shows the items visually on Sisulizer project. In the traditional way you could only localize string of the .ui files and without context. Using Sisulizer you can localize also position, size, color and font data of your user interface. All visually.
When Sisulizer creates localized files it creates each localized .ui file in a language related sub directory. For example if you have C:\Sample\Main.ui and you build German files Sisulizer creates C:\Sample\de\Main.ui. Qt can not load localized .ui data on run time as it can load localized .ts data. Instead on compile time Qt tools read the .ui files and creates a C-header that contains the same data (dialog.ui -> ui_dialog.h). This makes all data from .ui hard coded to the compiled application. This sets a limitation for application: you have to create one application file for each language. It is not possible to create one application file that can support several language as in the traditional localization method. When you build you application replace the original .ui file with a localized .ui file. Delete the UI files header file and build the application. Qt tools create a new header file and build localized application file.
You have to make a choice. If you want to localize user interface visually and you want to localize size, position and font data as well use the Sisulizer localization method. If your application must have support for multiple language in one file use the traditional localization method.
Sisulizer contains three source types for Qt. They are:
|Qt translation file||.ts||lupdate,
| You add one or more .ts files into Sisulizer project. Sisulizer creates localized .ts files
|Qt user interface file||.ui||Qt Designer||You add one or more .ui files into Sisulizer project. Sisulizer creates localized .ui files
|Qt project file||.pro||Qt Creator,
|You add a .pro file to Sisulizer project. When scanning Sisulizer scans all the .ts and .ui files that the .pro file contains. Sisulizer creates localized .ts and .ui files.
If you have a .pro file we recommend to add it to Sisulizer project. If you do not have it you have to add each .ts and .ui files that you want to localize.