Changeset 14396 for trunk/qt/app.cc
- Timestamp:
- Dec 22, 2014, 1:08:19 AM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/qt/app.cc
r14394 r14396 81 81 MODEL_REFRESH_INTERVAL_MSEC = 3000 82 82 }; 83 84 bool 85 loadTranslation (QTranslator& translator, const QString& name, const QString& localeName, 86 const QStringList& searchDirectories) 87 { 88 const QString filename = name + QLatin1Char ('_') + localeName; 89 foreach (const QString& directory, searchDirectories) 90 { 91 if (translator.load (filename, directory)) 92 return true; 93 } 94 95 return false; 96 } 83 97 } 84 98 … … 96 110 setApplicationName (MY_CONFIG_NAME); 97 111 112 const QString localeName = QLocale ().name (); 113 98 114 // install the qt translator 99 qtTranslator.load ("qt_" + QLocale::system ().name (), QLibraryInfo::location (QLibraryInfo::TranslationsPath)); 100 installTranslator (&qtTranslator); 115 if (loadTranslation (qtTranslator, QLatin1String ("qt"), localeName, QStringList () 116 << QLibraryInfo::location (QLibraryInfo::TranslationsPath) 117 #ifdef TRANSLATIONS_DIR 118 << TRANSLATIONS_DIR 119 #endif 120 << (applicationDirPath () + "/translations") 121 )) 122 installTranslator (&qtTranslator); 101 123 102 124 // install the transmission translator 103 appTranslator.load (QString (MY_CONFIG_NAME) + "_" + QLocale::system ().name (), QCoreApplication::applicationDirPath () + "/translations"); 104 installTranslator (&appTranslator); 125 if (loadTranslation (appTranslator, MY_CONFIG_NAME, localeName, QStringList () 126 #ifdef TRANSLATIONS_DIR 127 << TRANSLATIONS_DIR 128 #endif 129 << (applicationDirPath () + "/translations") 130 )) 131 installTranslator (&appTranslator); 105 132 106 133 Formatter::initUnits ();
Note: See TracChangeset
for help on using the changeset viewer.