The fantastic internationalization support for text output provided by Qt makes use of translation files, which are created as the end result of a process of extracting the strings that are passed to tr() functions, translated into the desired language(s) and then generating fast compact versions (.qm files) of those translation files ready for use by the application.
The important question now is how to distribute such .qm files along with your application. And the path divides into placing separate .qm files in a location accessible at runtime by the application (usually into a subfolder 'translations' within your application's installation folder) or embedding them into a resource file (.qrc) that in turn can be embedded within the application executable file.
What I've learned so far is that no way is better than other and what I choose depends mainly on the way a particular application will be deployed and used. If it's a standalone application that will be installed by an end user himself in a desktop machine for instance, I prefer to embed the translation files as resources. The rationale here is that less files around is less chance one of them can be deleted or missing, and supporting a remote desktop PC is complicated somehow.
On the contrary, if the application will be deployed in a centralized location (i.e. running from a shared network drive) I would place separate translation files in a 'translations' subfolder, as the support here would be easier, and more frequent updates can be done with less effort.
And another question raises now: how are you distributing your Qt application's translation files? Embedded or not? Please let me know.
Wednesday, March 19, 2014
Embedded translations or not?
Labels:
.qm,
i18n,
internalization,
lrelease,
lupdate,
Qt,
Qt Linguist,
translations
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment