Commit e2078bd6 authored by Hugo Beauzee-Luyssen's avatar Hugo Beauzee-Luyssen
Browse files

Only load translation that has been build.

parent 8aebc6fb
......@@ -35,7 +35,7 @@ LanguagePreferences::LanguagePreferences( QWidget *parent )
{
m_ui.setupUi( this );
QDir dir( "ts/", "*.ts", QDir::Name | QDir::IgnoreCase, QDir::Files );
QDir dir( "ts/", "*.qm", QDir::Name | QDir::IgnoreCase, QDir::Files );
QStringList tss = dir.entryList();
m_ui.comboBoxLanguage->setInsertPolicy( QComboBox::InsertAlphabetically );
......@@ -43,7 +43,7 @@ LanguagePreferences::LanguagePreferences( QWidget *parent )
{
QString localeStr;
int localePos = tsFileName.lastIndexOf( "vlmc_");
int dotPos = tsFileName.lastIndexOf( ".ts" );
int dotPos = tsFileName.lastIndexOf( ".qm" );
if ( localePos < 0 || dotPos < 0 )
{
qWarning() << "Invalid translation file:" << tsFileName;
......@@ -52,6 +52,8 @@ LanguagePreferences::LanguagePreferences( QWidget *parent )
localePos += 5;
localeStr = tsFileName.mid( localePos, dotPos - localePos );
QLocale locale( localeStr );
qDebug() << "Adding new language:" << QLocale::countryToString( locale.country() ) << '/' <<
QLocale::languageToString( locale.language() ) << "with locale" << localeStr;
m_ui.comboBoxLanguage->addItem( QLocale::countryToString( locale.country() ) + " / "
+ QLocale::languageToString( locale.language() ), localeStr );
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment