summaryrefslogtreecommitdiff
path: root/library
Unidiff
Diffstat (limited to 'library') (more/less context) (ignore whitespace changes)
-rw-r--r--library/global.cpp55
-rw-r--r--library/qpeapplication.cpp40
2 files changed, 60 insertions, 35 deletions
diff --git a/library/global.cpp b/library/global.cpp
index fd7579a..dd15eb7 100644
--- a/library/global.cpp
+++ b/library/global.cpp
@@ -19,2 +19,3 @@
19**********************************************************************/ 19**********************************************************************/
20#define QTOPIA_INTERNAL_LANGLIST
20#include <qpe/qpedebug.h> 21#include <qpe/qpedebug.h>
@@ -172,8 +173,14 @@ const QDawg& Global::fixedDawg()
172 QString dawgfilename = dictDir() + "/dawg"; 173 QString dawgfilename = dictDir() + "/dawg";
173 QString lang = getenv( "LANG" ); 174 QString words_lang;
174 QString dawgfilename_lang = dawgfilename + "." + lang; 175 QStringList langs = Global::languageList();
175 QString words_lang = dictDir() + "/words." + lang; 176 for (QStringList::ConstIterator it = langs.begin(); it!=langs.end(); ++it) {
176 if ( QFile::exists(dawgfilename_lang) || 177 QString lang = *it;
177 QFile::exists(words_lang) ) 178 words_lang = dictDir() + "/words." + lang;
178 dawgfilename = dawgfilename_lang; 179 QString dawgfilename_lang = dawgfilename + "." + lang;
180 if ( QFile::exists(dawgfilename_lang) ||
181 QFile::exists(words_lang) ) {
182 dawgfilename = dawgfilename_lang;
183 break;
184 }
185 }
179 QFile dawgfile(dawgfilename); 186 QFile dawgfile(dawgfilename);
@@ -641,2 +648,38 @@ void Global::findDocuments(DocLnkSet* folder, const QString &mimefilter)
641 648
649QStringList Global::languageList()
650{
651 QString lang = getenv("LANG");
652 QStringList langs;
653 langs.append(lang);
654 int i = lang.find(".");
655 if ( i > 0 )
656 lang = lang.left( i );
657 i = lang.find( "_" );
658 if ( i > 0 )
659 langs.append(lang.left(i));
660 return langs;
661}
662
663QStringList Global::helpPath()
664{
665 QStringList path;
666 QStringList langs = Global::languageList();
667 for (QStringList::ConstIterator it = langs.fromLast(); it!=langs.end(); --it) {
668 QString lang = *it;
669 if ( !lang.isEmpty() )
670 path += QPEApplication::qpeDir() + "/help/" + lang + "/html";
671 }
672 path += QPEApplication::qpeDir() + "/pics";
673 path += QPEApplication::qpeDir() + "/help/en/html";
674 path += QPEApplication::qpeDir() + "/docs";
675 QString dir = QDir::current().canonicalPath();
676 if ( dir == "/" )
677 dir += "/docs";
678 else {
679 path += dir + "/../pics";
680 dir += "/../docs";
681 path += dir;
682 }
683 return path;
684}
642 685
diff --git a/library/qpeapplication.cpp b/library/qpeapplication.cpp
index 70ffec1..4dbfbd8 100644
--- a/library/qpeapplication.cpp
+++ b/library/qpeapplication.cpp
@@ -21,2 +21,3 @@
21**********************************************************************/ 21**********************************************************************/
22#define QTOPIA_INTERNAL_LANGLIST
22#include <stdlib.h> 23#include <stdlib.h>
@@ -139,18 +140,3 @@ public:
139 { 140 {
140 QStringList path; 141 setFilePath( Global::helpPath() );
141 QString lang = getenv("LANG");
142 if ( !lang.isEmpty() )
143 path += QPEApplication::qpeDir() + "/help/" + lang + "/html";
144 path += QPEApplication::qpeDir() + "/pics";
145 path += QPEApplication::qpeDir() + "/help/en/html";
146 path += QPEApplication::qpeDir() + "/docs";
147 QString dir = QDir::current().canonicalPath();
148 if ( dir == "/" )
149 dir += "/docs";
150 else {
151 path += dir + "/../pics";
152 dir += "/../docs";
153 path += dir;
154 }
155 setFilePath( path );
156 setExtensionType("html","text/html;charset=UTF-8"); 142 setExtensionType("html","text/html;charset=UTF-8");
@@ -539,15 +525,11 @@ QPEApplication::QPEApplication( int& argc, char **argv, Type t )
539#ifndef QT_NO_TRANSLATION 525#ifndef QT_NO_TRANSLATION
540 char *l = getenv( "LANG" ); 526 QStringList langs = Global::languageList();
541 QString lang; 527 for (QStringList::ConstIterator it = langs.begin(); it!=langs.end(); ++it) {
542 if ( l ) { 528 QString lang = *it;
543 lang = l;
544 529
545 /* 530 QTranslator * trans;
546 Config config("qpe"); 531 QString tfn;
547 config.setGroup( "Appearance" );
548 lang = config.readEntry( "Language", lang );
549 */
550 532
551 QTranslator * trans = new QTranslator(this); 533 trans = new QTranslator(this);
552 QString tfn = qpeDir()+"/i18n/"+lang+"/"+d->appName+".qm"; 534 tfn = qpeDir()+"/i18n/"+lang+"/libqpe.qm";
553 if ( trans->load( tfn )) 535 if ( trans->load( tfn ))
@@ -558,3 +540,3 @@ QPEApplication::QPEApplication( int& argc, char **argv, Type t )
558 trans = new QTranslator(this); 540 trans = new QTranslator(this);
559 tfn = qpeDir()+"/i18n/"+lang+"/libqpe.qm"; 541 tfn = qpeDir()+"/i18n/"+lang+"/"+d->appName+".qm";
560 if ( trans->load( tfn )) 542 if ( trans->load( tfn ))
@@ -564,3 +546,3 @@ QPEApplication::QPEApplication( int& argc, char **argv, Type t )
564 546
565 //###language/font hack; should look it up somewhere 547 //###language/font hack; should look it up somewhere
566 if ( lang == "ja" || lang == "zh_CN" || lang == "zh_TW" || lang == "ko" ) { 548 if ( lang == "ja" || lang == "zh_CN" || lang == "zh_TW" || lang == "ko" ) {