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 ) ...@@ -35,7 +35,7 @@ LanguagePreferences::LanguagePreferences( QWidget *parent )
{ {
m_ui.setupUi( this ); 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(); QStringList tss = dir.entryList();
m_ui.comboBoxLanguage->setInsertPolicy( QComboBox::InsertAlphabetically ); m_ui.comboBoxLanguage->setInsertPolicy( QComboBox::InsertAlphabetically );
...@@ -43,7 +43,7 @@ LanguagePreferences::LanguagePreferences( QWidget *parent ) ...@@ -43,7 +43,7 @@ LanguagePreferences::LanguagePreferences( QWidget *parent )
{ {
QString localeStr; QString localeStr;
int localePos = tsFileName.lastIndexOf( "vlmc_"); int localePos = tsFileName.lastIndexOf( "vlmc_");
int dotPos = tsFileName.lastIndexOf( ".ts" ); int dotPos = tsFileName.lastIndexOf( ".qm" );
if ( localePos < 0 || dotPos < 0 ) if ( localePos < 0 || dotPos < 0 )
{ {
qWarning() << "Invalid translation file:" << tsFileName; qWarning() << "Invalid translation file:" << tsFileName;
...@@ -52,6 +52,8 @@ LanguagePreferences::LanguagePreferences( QWidget *parent ) ...@@ -52,6 +52,8 @@ LanguagePreferences::LanguagePreferences( QWidget *parent )
localePos += 5; localePos += 5;
localeStr = tsFileName.mid( localePos, dotPos - localePos ); localeStr = tsFileName.mid( localePos, dotPos - localePos );
QLocale locale( localeStr ); 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() ) + " / " m_ui.comboBoxLanguage->addItem( QLocale::countryToString( locale.country() ) + " / "
+ QLocale::languageToString( locale.language() ), localeStr ); + QLocale::languageToString( locale.language() ), localeStr );
} }
......
Supports Markdown
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