Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Localitzation of transtation files and name of locales.
I'm developing an application with some translations files. These translation files could be installed automatically by .pro file. However in the application, to load a translation file, QTranstalor needs the directory where the translation files are located. From the application point of view, at runtime how can It to now where the translations files are located? Perhaps a variable from qmake should be passed to the application?
The name of the translation files should include the name of the locale. In Qt5.3, the name of translations only includes the name of the language but not the country (qt_ca.qm), however when I define a locale for a language, the name of the locale is 'language_COUNTRY' (qt_ca_ES.qm). Which is the right format of the translation file name?
Thanks and Best Regards,
Did you check QCoreApplication::applicationDirPath(..) or applicationFilePath(..) etc ?
Yes, but these function member only return the path to the executable file and it is not what I'm looking for.
I'm looking for something like QLibraryInfo::location(QLibraryInfo::TranslationsPath) but referred to the application.
Where are you placing translation files ? You can put your application translation files in your application directory path while installing your app. This way you can load from your path only.
By default, they are installed in /usr/local/shared/application/translations, but if I change set PREFIX=/usr in qmake, it could be /usr/shared/application/translations.
Anyway, I don't expect install the translations files in $$PREFIX/bin.