@@ -68,7 +68,7 @@ int main( int argc, char ** argv )
68
68
gdalShares << QCoreApplication::applicationDirPath ().append ( " /share/gdal" )
69
69
<< appResources.append ( " /share/gdal" )
70
70
<< appResources.append ( " /gdal" );
71
- Q_FOREACH ( const QString& gdalShare, gdalShares )
71
+ Q_FOREACH ( const QString& gdalShare, gdalShares )
72
72
{
73
73
if ( QFile::exists ( gdalShare ) )
74
74
{
@@ -79,6 +79,39 @@ int main( int argc, char ** argv )
79
79
}
80
80
#endif
81
81
82
+ QString i18nPath = QgsApplication::i18nPath ();
83
+ bool myLocaleOverrideFlag = settings.value ( " locale/overrideFlag" , false ).toBool ();
84
+ QString myUserLocale = settings.value ( " locale/userLocale" , " " ).toString ();
85
+ QString myTranslationCode = !myLocaleOverrideFlag || myUserLocale.isEmpty () ? QLocale::system ().name () : myUserLocale;
86
+
87
+ QTranslator qgistor ( 0 );
88
+ QTranslator qttor ( 0 );
89
+ if ( myTranslationCode != " C" )
90
+ {
91
+ if ( qgistor.load ( QString ( " qgis_" ) + myTranslationCode, i18nPath ) )
92
+ {
93
+ a.installTranslator ( &qgistor );
94
+ }
95
+ else
96
+ {
97
+ qWarning ( " loading of qgis translation failed [%s]" , QString ( " %1/qgis_%2" ).arg ( i18nPath ).arg ( myTranslationCode ).toLocal8Bit ().constData () );
98
+ }
99
+
100
+ /* Translation file for Qt.
101
+ * The strings from the QMenuBar context section are used by Qt/Mac to shift
102
+ * the About, Preferences and Quit items to the Mac Application menu.
103
+ * These items must be translated identically in both qt_ and qgis_ files.
104
+ */
105
+ if ( qttor.load ( QString ( " qt_" ) + myTranslationCode, QLibraryInfo::location ( QLibraryInfo::TranslationsPath ) ) )
106
+ {
107
+ a.installTranslator ( &qttor );
108
+ }
109
+ else
110
+ {
111
+ qWarning ( " loading of qt translation failed [%s]" , QString ( " %1/qt_%2" ).arg ( QLibraryInfo::location ( QLibraryInfo::TranslationsPath ) ).arg ( myTranslationCode ).toLocal8Bit ().constData () );
112
+ }
113
+ }
114
+
82
115
QgsBrowser w;
83
116
84
117
a.connect ( &a, SIGNAL ( aboutToQuit () ), &w, SLOT ( saveWindowState () ) );
0 commit comments