imgtools/sisutils/src/pkglanguage.cpp
changeset 590 360bd6b35136
parent 0 044383f39525
--- a/imgtools/sisutils/src/pkglanguage.cpp	Wed Jun 16 16:51:40 2010 +0300
+++ b/imgtools/sisutils/src/pkglanguage.cpp	Wed Jun 23 16:56:47 2010 +0800
@@ -1,178 +1,178 @@
-/*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-*
-*/
-
-
-
-#include "sisutils.h"
-#include "pkglanguage.h"
-#include "pkgfileparser.h"
-
-// Language options
-static const SKeyword KLanguages [] = 
-{
-	{ L"EN", PkgLanguage::ELangEnglish },
-	{ L"FR", PkgLanguage::ELangFrench},
-	{ L"GE", PkgLanguage::ELangGerman},
-	{ L"SP", PkgLanguage::ELangSpanish},
-	{ L"IT", PkgLanguage::ELangItalian},
-	{ L"SW", PkgLanguage::ELangSwedish},
-	{ L"DA", PkgLanguage::ELangDanish},
-	{ L"NO", PkgLanguage::ELangNorwegian},
-	{ L"FI", PkgLanguage::ELangFinnish},
-	{ L"AM", PkgLanguage::ELangAmerican},
-	{ L"SF", PkgLanguage::ELangSwissFrench},
-	{ L"SG", PkgLanguage::ELangSwissGerman},
-	{ L"PO", PkgLanguage::ELangPortuguese},
-	{ L"TU", PkgLanguage::ELangTurkish},
-	{ L"IC", PkgLanguage::ELangIcelandic},
-	{ L"RU", PkgLanguage::ELangRussian},
-	{ L"HU", PkgLanguage::ELangHungarian},
-	{ L"DU", PkgLanguage::ELangDutch},
-	{ L"BL", PkgLanguage::ELangBelgianFlemish},
-	{ L"AU", PkgLanguage::ELangAustralian},
-	{ L"BF", PkgLanguage::ELangBelgianFrench},
-	{ L"AS", PkgLanguage::ELangAustrian},
-	{ L"NZ", PkgLanguage::ELangNewZealand},
-	{ L"IF", PkgLanguage::ELangInternationalFrench},
-	{ L"CS", PkgLanguage::ELangCzech},
-	{ L"SK", PkgLanguage::ELangSlovak},
-	{ L"PL", PkgLanguage::ELangPolish},
-	{ L"SL", PkgLanguage::ELangSlovenian},
-	{ L"TC", PkgLanguage::ELangTaiwanChinese},
-	{ L"HK", PkgLanguage::ELangHongKongChinese},
-	{ L"ZH", PkgLanguage::ELangPrcChinese},
-	{ L"JA", PkgLanguage::ELangJapanese},
-	{ L"TH", PkgLanguage::ELangThai},
-		  
-	{ L"AF", PkgLanguage::ELangAfrikaans },
-	{ L"SQ", PkgLanguage::ELangAlbanian },
-	{ L"AH", PkgLanguage::ELangAmharic },
-	{ L"AR", PkgLanguage::ELangArabic },
-	{ L"HY", PkgLanguage::ELangArmenian },
-	{ L"TL", PkgLanguage::ELangTagalog },
-	{ L"BE", PkgLanguage::ELangBelarussian },
-	{ L"BN", PkgLanguage::ELangBengali },
-	{ L"BG", PkgLanguage::ELangBulgarian },
-	{ L"MY", PkgLanguage::ELangBurmese },
-	{ L"CA", PkgLanguage::ELangCatalan },
-	{ L"HR", PkgLanguage::ELangCroatian },
-	{ L"CE", PkgLanguage::ELangCanadianEnglish },
-	{ L"IE", PkgLanguage::ELangInternationalEnglish },
-	{ L"SA", PkgLanguage::ELangSouthAfricanEnglish },
-	{ L"ET", PkgLanguage::ELangEstonian },
-	{ L"FA", PkgLanguage::ELangFarsi },
-	{ L"CF", PkgLanguage::ELangCanadianFrench },
-	{ L"GD", PkgLanguage::ELangScotsGaelic },
-	{ L"KA", PkgLanguage::ELangGeorgian },
-	{ L"EL", PkgLanguage::ELangGreek },
-	{ L"CG", PkgLanguage::ELangCyprusGreek },
-	{ L"GU", PkgLanguage::ELangGujarati },
-	{ L"HE", PkgLanguage::ELangHebrew },
-	{ L"HI", PkgLanguage::ELangHindi },
-	{ L"IN", PkgLanguage::ELangIndonesian },
-	{ L"GA", PkgLanguage::ELangIrish },
-	{ L"SZ", PkgLanguage::ELangSwissItalian },
-	{ L"KN", PkgLanguage::ELangKannada },
-	{ L"KK", PkgLanguage::ELangKazakh },
-	{ L"KM", PkgLanguage::ELangKhmer },
-	{ L"KO", PkgLanguage::ELangKorean },
-	{ L"LO", PkgLanguage::ELangLao },
-	{ L"LV", PkgLanguage::ELangLatvian },
-	{ L"LT", PkgLanguage::ELangLithuanian },
-	{ L"MK", PkgLanguage::ELangMacedonian },
-	{ L"MS", PkgLanguage::ELangMalay },
-	{ L"ML", PkgLanguage::ELangMalayalam },
-	{ L"MR", PkgLanguage::ELangMarathi },
-	{ L"MO", PkgLanguage::ELangMoldavian },
-	{ L"MN", PkgLanguage::ELangMongolian },
-	{ L"NN", PkgLanguage::ELangNorwegianNynorsk },
-	{ L"BP", PkgLanguage::ELangBrazilianPortuguese },
-	{ L"PA", PkgLanguage::ELangPunjabi },
-	{ L"RO", PkgLanguage::ELangRomanian },
-	{ L"SR", PkgLanguage::ELangSerbian },
-	{ L"SI", PkgLanguage::ELangSinhalese },
-	{ L"SO", PkgLanguage::ELangSomali },
-	{ L"OS", PkgLanguage::ELangInternationalSpanish },
-	{ L"LS", PkgLanguage::ELangLatinAmericanSpanish },
-	{ L"SH", PkgLanguage::ELangSwahili },
-	{ L"FS", PkgLanguage::ELangFinlandSwedish },
-	//{L"??", PkgLanguage::ELangReserved1 },
-	{ L"TA", PkgLanguage::ELangTamil },
-	{ L"TE", PkgLanguage::ELangTelugu },
-	{ L"BO", PkgLanguage::ELangTibetan },
-	{ L"TI", PkgLanguage::ELangTigrinya },
-	{ L"CT", PkgLanguage::ELangCyprusTurkish },
-	{ L"TK", PkgLanguage::ELangTurkmen },
-	{ L"UK", PkgLanguage::ELangUkrainian },
-	{ L"UR", PkgLanguage::ELangUrdu },
-	//{L"??", PkgLanguage::ELangReserved2 },
-	{ L"VI", PkgLanguage::ELangVietnamese },
-	{ L"CY", PkgLanguage::ELangWelsh },
-	{ L"ZU", PkgLanguage::ELangZulu },
-	{ L"BA", PkgLanguage::ELangBasque },
-	{ L"GL", PkgLanguage::ELangGalician },
-	//{L"??", PkgLanguage::ELangOther },
-	//{L"??", PkgLanguage::ELangNone  }
-	
-	{ NULL, PkgLanguage::ELangNone }
-	
-};
-
-#define NUMLANGUAGES (sizeof(KLanguages)/sizeof(SKeyword))
-
-/**
-GetLanguageCode: Returns the languge code for the given language
-
-@internalComponent
-@released
-
-@param aLang  - Name of the language
-*/
-unsigned long PkgLanguage::GetLanguageCode(std::wstring aLang)
-{
-	int index = NUMLANGUAGES - 1;
-
-	while(index--)
-	{
-		if(!CompareTwoString(KLanguages[index].iName, (wchar_t*)aLang.data()))
-			return KLanguages[index].iId;
-	}
-
-	return PkgLanguage::ELangNone;
-}
-
-/**
-GetLanguageName: Returns the languge name for the given language code
-
-@internalComponent
-@released
-
-@param aCode  - Language code
-*/
-std::wstring PkgLanguage::GetLanguageName(unsigned long aCode)
-{
-	int index = NUMLANGUAGES - 1;
-
-	while(index--)
-	{
-		if(KLanguages[index].iId == aCode)
-			return KLanguages[index].iName;
-	}
-
-	return NULL;
-}
-
+/*
+* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+
+
+
+#include "sisutils.h"
+#include "pkglanguage.h"
+#include "pkgfileparser.h"
+#ifndef WIN32
+#include <strings.h>
+#define stricmp strcasecmp
+#define strnicmp strncasecmp
+#endif
+// Language options
+static const SKeyword KLanguages [] = 
+{
+	{ "EN", PkgLanguage::ELangEnglish },
+	{ "FR", PkgLanguage::ELangFrench},
+	{ "GE", PkgLanguage::ELangGerman},
+	{ "SP", PkgLanguage::ELangSpanish},
+	{ "IT", PkgLanguage::ELangItalian},
+	{ "SW", PkgLanguage::ELangSwedish},
+	{ "DA", PkgLanguage::ELangDanish},
+	{ "NO", PkgLanguage::ELangNorwegian},
+	{ "FI", PkgLanguage::ELangFinnish},
+	{ "AM", PkgLanguage::ELangAmerican},
+	{ "SF", PkgLanguage::ELangSwissFrench},
+	{ "SG", PkgLanguage::ELangSwissGerman},
+	{ "PO", PkgLanguage::ELangPortuguese},
+	{ "TU", PkgLanguage::ELangTurkish},
+	{ "IC", PkgLanguage::ELangIcelandic},
+	{ "RU", PkgLanguage::ELangRussian},
+	{ "HU", PkgLanguage::ELangHungarian},
+	{ "DU", PkgLanguage::ELangDutch},
+	{ "BL", PkgLanguage::ELangBelgianFlemish},
+	{ "AU", PkgLanguage::ELangAustralian},
+	{ "BF", PkgLanguage::ELangBelgianFrench},
+	{ "AS", PkgLanguage::ELangAustrian},
+	{ "NZ", PkgLanguage::ELangNewZealand},
+	{ "IF", PkgLanguage::ELangInternationalFrench},
+	{ "CS", PkgLanguage::ELangCzech},
+	{ "SK", PkgLanguage::ELangSlovak},
+	{ "PL", PkgLanguage::ELangPolish},
+	{ "SL", PkgLanguage::ELangSlovenian},
+	{ "TC", PkgLanguage::ELangTaiwanChinese},
+	{ "HK", PkgLanguage::ELangHongKongChinese},
+	{ "ZH", PkgLanguage::ELangPrcChinese},
+	{ "JA", PkgLanguage::ELangJapanese},
+	{ "TH", PkgLanguage::ELangThai},
+		  
+	{ "AF", PkgLanguage::ELangAfrikaans },
+	{ "SQ", PkgLanguage::ELangAlbanian },
+	{ "AH", PkgLanguage::ELangAmharic },
+	{ "AR", PkgLanguage::ELangArabic },
+	{ "HY", PkgLanguage::ELangArmenian },
+	{ "TL", PkgLanguage::ELangTagalog },
+	{ "BE", PkgLanguage::ELangBelarussian },
+	{ "BN", PkgLanguage::ELangBengali },
+	{ "BG", PkgLanguage::ELangBulgarian },
+	{ "MY", PkgLanguage::ELangBurmese },
+	{ "CA", PkgLanguage::ELangCatalan },
+	{ "HR", PkgLanguage::ELangCroatian },
+	{ "CE", PkgLanguage::ELangCanadianEnglish },
+	{ "IE", PkgLanguage::ELangInternationalEnglish },
+	{ "SA", PkgLanguage::ELangSouthAfricanEnglish },
+	{ "ET", PkgLanguage::ELangEstonian },
+	{ "FA", PkgLanguage::ELangFarsi },
+	{ "CF", PkgLanguage::ELangCanadianFrench },
+	{ "GD", PkgLanguage::ELangScotsGaelic },
+	{ "KA", PkgLanguage::ELangGeorgian },
+	{ "EL", PkgLanguage::ELangGreek },
+	{ "CG", PkgLanguage::ELangCyprusGreek },
+	{ "GU", PkgLanguage::ELangGujarati },
+	{ "HE", PkgLanguage::ELangHebrew },
+	{ "HI", PkgLanguage::ELangHindi },
+	{ "IN", PkgLanguage::ELangIndonesian },
+	{ "GA", PkgLanguage::ELangIrish },
+	{ "SZ", PkgLanguage::ELangSwissItalian },
+	{ "KN", PkgLanguage::ELangKannada },
+	{ "KK", PkgLanguage::ELangKazakh },
+	{ "KM", PkgLanguage::ELangKhmer },
+	{ "KO", PkgLanguage::ELangKorean },
+	{ "LO", PkgLanguage::ELangLao },
+	{ "LV", PkgLanguage::ELangLatvian },
+	{ "LT", PkgLanguage::ELangLithuanian },
+	{ "MK", PkgLanguage::ELangMacedonian },
+	{ "MS", PkgLanguage::ELangMalay },
+	{ "ML", PkgLanguage::ELangMalayalam },
+	{ "MR", PkgLanguage::ELangMarathi },
+	{ "MO", PkgLanguage::ELangMoldavian },
+	{ "MN", PkgLanguage::ELangMongolian },
+	{ "NN", PkgLanguage::ELangNorwegianNynorsk },
+	{ "BP", PkgLanguage::ELangBrazilianPortuguese },
+	{ "PA", PkgLanguage::ELangPunjabi },
+	{ "RO", PkgLanguage::ELangRomanian },
+	{ "SR", PkgLanguage::ELangSerbian },
+	{ "SI", PkgLanguage::ELangSinhalese },
+	{ "SO", PkgLanguage::ELangSomali },
+	{ "OS", PkgLanguage::ELangInternationalSpanish },
+	{ "LS", PkgLanguage::ELangLatinAmericanSpanish },
+	{ "SH", PkgLanguage::ELangSwahili },
+	{ "FS", PkgLanguage::ELangFinlandSwedish },
+	//{"??", PkgLanguage::ELangReserved1 },
+	{ "TA", PkgLanguage::ELangTamil },
+	{ "TE", PkgLanguage::ELangTelugu },
+	{ "BO", PkgLanguage::ELangTibetan },
+	{ "TI", PkgLanguage::ELangTigrinya },
+	{ "CT", PkgLanguage::ELangCyprusTurkish },
+	{ "TK", PkgLanguage::ELangTurkmen },
+	{ "UK", PkgLanguage::ELangUkrainian },
+	{ "UR", PkgLanguage::ELangUrdu },
+	//{"??", PkgLanguage::ELangReserved2 },
+	{ "VI", PkgLanguage::ELangVietnamese },
+	{ "CY", PkgLanguage::ELangWelsh },
+	{ "ZU", PkgLanguage::ELangZulu },
+	{ "BA", PkgLanguage::ELangBasque },
+	{ "GL", PkgLanguage::ELangGalician },
+	//{"??", PkgLanguage::ELangOther },
+	//{"??", PkgLanguage::ELangNone  }
+	
+	{ NULL, PkgLanguage::ELangNone }
+	
+};
+
+#define NUMLANGUAGES (sizeof(KLanguages)/sizeof(SKeyword))
+
+/**
+GetLanguageCode: Returns the languge code for the given language
+
+@internalComponent
+@released
+
+@param aLang  - Name of the language
+*/
+TUint32 GetLanguageCode(const char* aLang) {
+	TInt index = NUMLANGUAGES - 1;
+
+	while(index--){
+		if(!stricmp(KLanguages[index].iName,aLang))
+			return KLanguages[index].iId;
+	}
+
+	return PkgLanguage::ELangNone;
+}
+
+/**
+GetLanguageName: Returns the languge name for the given language code
+
+@internalComponent
+@released
+
+@param aCode  - Language code
+*/
+const char* GetLanguageName(TUint32 aCode) {
+	
+	TInt index = NUMLANGUAGES - 1;
+	while(index--) {
+		if(KLanguages[index].iId == aCode)
+			return KLanguages[index].iName;
+	}
+
+	return NULL;
+}
+