-rw-r--r-- | korganizer/koprefs.cpp | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/korganizer/koprefs.cpp b/korganizer/koprefs.cpp index f3231ff..042046e 100644 --- a/korganizer/koprefs.cpp +++ b/korganizer/koprefs.cpp @@ -394,34 +394,38 @@ void KOPrefs::usrReadConfig() // qDebug("KOPrefs::usrReadConfig() fix translation "); if ( mPreferredLanguage == 1 ) { mLocaleDict = new QDict<QString>; int i = 0; QString fw ( germanwords[i] [0]); while ( !fw.isEmpty() ) { mLocaleDict->insert( fw, new QString (germanwords[i] [1] )); ++i; fw = germanwords[i] [0]; } setLocaleDict( mLocaleDict ); - } - if ( mPreferredLanguage == 3 ) { - QString fileName = MainWindow::resourcePath()+"usertranslation.txt"; + } else { + QString fileName ; + if ( mPreferredLanguage == 3 ) + fileName = MainWindow::resourcePath()+"usertranslation.txt"; + else if ( mPreferredLanguage == 2 ) + fileName = MainWindow::resourcePath()+"frenchtranslation.txt"; + else return; QFile file( fileName ); if (file.open( IO_ReadOnly ) ) { QTextStream ts( &file ); ts.setCodec( QTextCodec::codecForLocale() ); QString text = ts.read(); file.close(); - + text.replace( QRegExp("\\\\n"), "\n" ); QString line; QString we; QString wt; int br = 0; int nbr; nbr = text.find ( "},", br ); line = text.mid( br, nbr - br ); br = nbr+1; int se, ee, st, et; mLocaleDict = new QDict<QString>; QString end = "{ \"\",\"\" }"; while ( (line != end) && (br > 1) ) { @@ -433,27 +437,28 @@ void KOPrefs::usrReadConfig() we = line.mid( se, ee-se ); wt = line.mid( st, et-st ); //qDebug("*%s* *%s* ", we.latin1(), wt.latin1()); mLocaleDict->insert( we, new QString (wt) ); nbr = text.find ( "}", br ); line = text.mid( br, nbr - br ); br = nbr+1; } //qDebug("end *%s* ", end.latin1()); setLocaleDict( mLocaleDict ); } else { - qDebug("KO: Cannot find translation file usertranslation.txt"); + qDebug("KO: Cannot find translation file %s",fileName.latin1() ); } - } + +} config()->setGroup("General"); mCustomCategories = config()->readListEntry("Custom Categories"); if ( KOPrefs::instance()->mLanguageChanged ) { mLocationDefaults.clear(); mEventSummaryUser.clear(); mTodoSummaryUser.clear(); } if (mLocationDefaults.isEmpty()) { mLocationDefaults << i18n("Home") << i18n("Office") << i18n("Libary") << i18n("School") << i18n("Doctor") << i18n("Beach") << i18n("University") << i18n("Restaurant") << i18n("Bar") << i18n("Conference room") << i18n("Cinema") << i18n("Lake") << i18n("Kindergarden") << i18n("Germany") << i18n("Sweden") << i18n("Forest") << i18n("Desert") << i18n("Kitchen") ; |