src/hbcore/i18n/hblocaleutil.cpp
changeset 7 923ff622b8b9
parent 6 c3690ec91ef8
child 23 e6ad4ef83b23
child 34 ed14f46c0e55
--- a/src/hbcore/i18n/hblocaleutil.cpp	Wed Jun 23 18:33:25 2010 +0300
+++ b/src/hbcore/i18n/hblocaleutil.cpp	Tue Jul 06 14:36:53 2010 +0300
@@ -187,21 +187,21 @@
 */ 
 QString HbLocaleUtil::currentLanguage()
 {
-    #if defined(Q_OS_SYMBIAN)
-        TLanguage l = User::Language();
-        
-        if(mappingList.isEmpty()) {
-            readMappings();
+#if defined(Q_OS_SYMBIAN)
+    TLanguage l = User::Language();
+    
+    if(mappingList.isEmpty()) {
+        readMappings();
+    }
+    
+    for (int i = 0; i < mappingList.count(); ++i) {
+        HbLocaleMapping mapping = mappingList.at(i);
+        if (mapping.symLangValue == l) {
+            return mapping.langName;
         }
-        
-        for (int i = 0; i < mappingList.count(); ++i) {
-            HbLocaleMapping mapping = mappingList.at(i);
-            if (mapping.symLangValue == l) {
-                return mapping.langName;
-            }
-        }
-   #endif
-   return QString("");
+    }
+#endif
+   return QString();
 }
 
 /*!
@@ -217,7 +217,6 @@
 QStringList HbLocaleUtil::supportedLanguages()
 {
 #if defined(Q_OS_SYMBIAN)   
-  
     QStringList languages; 
     CArrayFixFlat<TInt>* systemEpocLanguageCodes = 0;
     TInt error = SysLangUtil::GetInstalledLanguages( systemEpocLanguageCodes );
@@ -244,8 +243,7 @@
     delete systemEpocLanguageCodes;
     return languages;
 #else 
-    QStringList dummy; 
-    return dummy;
+    return QStringList();
 #endif
 }
 
@@ -284,7 +282,7 @@
     return translated;
 #else 
     Q_UNUSED(language); 
-    return QString("");
+    return QString();
 #endif
 }
 
@@ -405,9 +403,9 @@
     }
     
     if(mappingList.isEmpty())
-        {
+    {
         readMappings();
-        }
+    }
     int regCount = regions.count();
     for(int i = 0; i < regCount; i++)
     {
@@ -458,20 +456,20 @@
 
         QCoreApplication::installTranslator(&translator);
             
-        if(availRegions.isEmpty())
+        if(mappingList.isEmpty()) 
         {
-            readRegions();
+            readMappings();
         }
-        int cnt = availRegions.count();
+        int cnt = mappingList.count();
         for(int i = 0 ; i < cnt; i++ )
         {
-            QString reg = availRegions.at(i); 
+            HbLocaleMapping map = mappingList.at(i);
             QString regionName = QString(REGION_ID_PREFIX);
             regionName += '_';
-            regionName += reg;
+            regionName += map.regName;
             QString locRegName = hbTrId(regionName.toAscii().constData());
             if(locRegName != regionName)
-                locRegionNames.insert(reg, locRegName);
+                locRegionNames.insert(map.regName, locRegName);
         }
     }
     
@@ -553,10 +551,8 @@
             return mapping.regName;
         }
     }
+#endif    
     return QString();
-#else
-    return QString();
-#endif    
 }
 
 #if defined(Q_OS_SYMBIAN)      
@@ -614,9 +610,9 @@
     }
     
     if(mappingList.isEmpty())
-        {
+    {
         readMappings();
-        }
+    }
     int colCount = collations.count();
     for(int i = 0; i < colCount; i++)
     {
@@ -667,20 +663,20 @@
 
         QCoreApplication::installTranslator(&translator);
             
-        if(availCollations.isEmpty())
+        if(mappingList.isEmpty()) 
         {
-            readCollations();
+            readMappings();
         }
-        int cnt = availCollations.count();
+        int cnt = mappingList.count();
         for(int i = 0 ; i < cnt; i++ )
         {
-            QString col = availCollations.at(i); 
+            HbLocaleMapping map = mappingList.at(i);
             QString collationName = QString(COLLATION_ID_PREFIX);
             collationName += '_';
-            collationName += col;
+            collationName += map.collName;
             QString locColName = hbTrId(collationName.toAscii().constData());
             if(locColName != collationName)
-                locCollationNames.insert(col, locColName);
+                locCollationNames.insert(map.collName, locColName);
         }
     }
     
@@ -773,10 +769,8 @@
             return mapping.collName;
         }
     }
+#endif    
     return QString();    
-#else
-    return QString();
-#endif    
 }
 
 /*!