Today we will discuss a rather interesting option for adding translation to a Qt/C++ application. Namely, adding translations for texts from external sources when you display texts from databases, an external API, or just some other files.
Such a situation can arise in the following case, for example, analysts in your project form sets of data and texts in some external database or text files, but there is no possibility of multilingualism for some reason. And therefore, you do not have the option to select the language as an additional parameter when requesting this data. Or, for example, the final data is downloaded from an external resource and stored in a SQLite database, of course, without additional translations. But at the same time, you are developing a multilingual application and you need to somehow generate translation files for these texts, so that the translation team can translate them, and you can connect them in the application.
But in Qt it is possible to solve this problem as well. In such situations, you can also generate source code files in the same way, for example, generate them when importing data during application development, and then generate translation files with the extension
, which are used in QtLinguist to translate the application to Qt, and then generate binary
translation files that will be included in the application.
Let's see how it works and what needs to be done for this.