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