src/frontends/qt4/GuiApplication.cpp: fix a bug that prevents translator of languages with long names to be loaded

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@19259 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Bo Peng 2007-07-31 17:09:50 +00:00
parent 0454f345a7
commit e1076527ba

View File

@ -111,7 +111,11 @@ GuiApplication::GuiApplication(int & argc, char ** argv)
// install translation file for Qt built-in dialogs
QString language_name = QString("qt_") + QLocale::system().name();
language_name.truncate(5);
// language_name can be short (e.g. qt_zh) or long (e.g. qt_zh_CN).
// Short-named translator can be loaded from a long name, but not the
// opposite. Therefore, long name should be used without truncation.
// c.f. http://doc.trolltech.com/4.1/qtranslator.html#load
if (qt_trans_.load(language_name,
QLibraryInfo::location(QLibraryInfo::TranslationsPath)))
{