imgtools/sisutils/src/pkglanguage.cpp
changeset 0 044383f39525
child 590 360bd6b35136
equal deleted inserted replaced
-1:000000000000 0:044383f39525
       
     1 /*
       
     2 * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of the License "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: 
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #include "sisutils.h"
       
    21 #include "pkglanguage.h"
       
    22 #include "pkgfileparser.h"
       
    23 
       
    24 // Language options
       
    25 static const SKeyword KLanguages [] = 
       
    26 {
       
    27 	{ L"EN", PkgLanguage::ELangEnglish },
       
    28 	{ L"FR", PkgLanguage::ELangFrench},
       
    29 	{ L"GE", PkgLanguage::ELangGerman},
       
    30 	{ L"SP", PkgLanguage::ELangSpanish},
       
    31 	{ L"IT", PkgLanguage::ELangItalian},
       
    32 	{ L"SW", PkgLanguage::ELangSwedish},
       
    33 	{ L"DA", PkgLanguage::ELangDanish},
       
    34 	{ L"NO", PkgLanguage::ELangNorwegian},
       
    35 	{ L"FI", PkgLanguage::ELangFinnish},
       
    36 	{ L"AM", PkgLanguage::ELangAmerican},
       
    37 	{ L"SF", PkgLanguage::ELangSwissFrench},
       
    38 	{ L"SG", PkgLanguage::ELangSwissGerman},
       
    39 	{ L"PO", PkgLanguage::ELangPortuguese},
       
    40 	{ L"TU", PkgLanguage::ELangTurkish},
       
    41 	{ L"IC", PkgLanguage::ELangIcelandic},
       
    42 	{ L"RU", PkgLanguage::ELangRussian},
       
    43 	{ L"HU", PkgLanguage::ELangHungarian},
       
    44 	{ L"DU", PkgLanguage::ELangDutch},
       
    45 	{ L"BL", PkgLanguage::ELangBelgianFlemish},
       
    46 	{ L"AU", PkgLanguage::ELangAustralian},
       
    47 	{ L"BF", PkgLanguage::ELangBelgianFrench},
       
    48 	{ L"AS", PkgLanguage::ELangAustrian},
       
    49 	{ L"NZ", PkgLanguage::ELangNewZealand},
       
    50 	{ L"IF", PkgLanguage::ELangInternationalFrench},
       
    51 	{ L"CS", PkgLanguage::ELangCzech},
       
    52 	{ L"SK", PkgLanguage::ELangSlovak},
       
    53 	{ L"PL", PkgLanguage::ELangPolish},
       
    54 	{ L"SL", PkgLanguage::ELangSlovenian},
       
    55 	{ L"TC", PkgLanguage::ELangTaiwanChinese},
       
    56 	{ L"HK", PkgLanguage::ELangHongKongChinese},
       
    57 	{ L"ZH", PkgLanguage::ELangPrcChinese},
       
    58 	{ L"JA", PkgLanguage::ELangJapanese},
       
    59 	{ L"TH", PkgLanguage::ELangThai},
       
    60 		  
       
    61 	{ L"AF", PkgLanguage::ELangAfrikaans },
       
    62 	{ L"SQ", PkgLanguage::ELangAlbanian },
       
    63 	{ L"AH", PkgLanguage::ELangAmharic },
       
    64 	{ L"AR", PkgLanguage::ELangArabic },
       
    65 	{ L"HY", PkgLanguage::ELangArmenian },
       
    66 	{ L"TL", PkgLanguage::ELangTagalog },
       
    67 	{ L"BE", PkgLanguage::ELangBelarussian },
       
    68 	{ L"BN", PkgLanguage::ELangBengali },
       
    69 	{ L"BG", PkgLanguage::ELangBulgarian },
       
    70 	{ L"MY", PkgLanguage::ELangBurmese },
       
    71 	{ L"CA", PkgLanguage::ELangCatalan },
       
    72 	{ L"HR", PkgLanguage::ELangCroatian },
       
    73 	{ L"CE", PkgLanguage::ELangCanadianEnglish },
       
    74 	{ L"IE", PkgLanguage::ELangInternationalEnglish },
       
    75 	{ L"SA", PkgLanguage::ELangSouthAfricanEnglish },
       
    76 	{ L"ET", PkgLanguage::ELangEstonian },
       
    77 	{ L"FA", PkgLanguage::ELangFarsi },
       
    78 	{ L"CF", PkgLanguage::ELangCanadianFrench },
       
    79 	{ L"GD", PkgLanguage::ELangScotsGaelic },
       
    80 	{ L"KA", PkgLanguage::ELangGeorgian },
       
    81 	{ L"EL", PkgLanguage::ELangGreek },
       
    82 	{ L"CG", PkgLanguage::ELangCyprusGreek },
       
    83 	{ L"GU", PkgLanguage::ELangGujarati },
       
    84 	{ L"HE", PkgLanguage::ELangHebrew },
       
    85 	{ L"HI", PkgLanguage::ELangHindi },
       
    86 	{ L"IN", PkgLanguage::ELangIndonesian },
       
    87 	{ L"GA", PkgLanguage::ELangIrish },
       
    88 	{ L"SZ", PkgLanguage::ELangSwissItalian },
       
    89 	{ L"KN", PkgLanguage::ELangKannada },
       
    90 	{ L"KK", PkgLanguage::ELangKazakh },
       
    91 	{ L"KM", PkgLanguage::ELangKhmer },
       
    92 	{ L"KO", PkgLanguage::ELangKorean },
       
    93 	{ L"LO", PkgLanguage::ELangLao },
       
    94 	{ L"LV", PkgLanguage::ELangLatvian },
       
    95 	{ L"LT", PkgLanguage::ELangLithuanian },
       
    96 	{ L"MK", PkgLanguage::ELangMacedonian },
       
    97 	{ L"MS", PkgLanguage::ELangMalay },
       
    98 	{ L"ML", PkgLanguage::ELangMalayalam },
       
    99 	{ L"MR", PkgLanguage::ELangMarathi },
       
   100 	{ L"MO", PkgLanguage::ELangMoldavian },
       
   101 	{ L"MN", PkgLanguage::ELangMongolian },
       
   102 	{ L"NN", PkgLanguage::ELangNorwegianNynorsk },
       
   103 	{ L"BP", PkgLanguage::ELangBrazilianPortuguese },
       
   104 	{ L"PA", PkgLanguage::ELangPunjabi },
       
   105 	{ L"RO", PkgLanguage::ELangRomanian },
       
   106 	{ L"SR", PkgLanguage::ELangSerbian },
       
   107 	{ L"SI", PkgLanguage::ELangSinhalese },
       
   108 	{ L"SO", PkgLanguage::ELangSomali },
       
   109 	{ L"OS", PkgLanguage::ELangInternationalSpanish },
       
   110 	{ L"LS", PkgLanguage::ELangLatinAmericanSpanish },
       
   111 	{ L"SH", PkgLanguage::ELangSwahili },
       
   112 	{ L"FS", PkgLanguage::ELangFinlandSwedish },
       
   113 	//{L"??", PkgLanguage::ELangReserved1 },
       
   114 	{ L"TA", PkgLanguage::ELangTamil },
       
   115 	{ L"TE", PkgLanguage::ELangTelugu },
       
   116 	{ L"BO", PkgLanguage::ELangTibetan },
       
   117 	{ L"TI", PkgLanguage::ELangTigrinya },
       
   118 	{ L"CT", PkgLanguage::ELangCyprusTurkish },
       
   119 	{ L"TK", PkgLanguage::ELangTurkmen },
       
   120 	{ L"UK", PkgLanguage::ELangUkrainian },
       
   121 	{ L"UR", PkgLanguage::ELangUrdu },
       
   122 	//{L"??", PkgLanguage::ELangReserved2 },
       
   123 	{ L"VI", PkgLanguage::ELangVietnamese },
       
   124 	{ L"CY", PkgLanguage::ELangWelsh },
       
   125 	{ L"ZU", PkgLanguage::ELangZulu },
       
   126 	{ L"BA", PkgLanguage::ELangBasque },
       
   127 	{ L"GL", PkgLanguage::ELangGalician },
       
   128 	//{L"??", PkgLanguage::ELangOther },
       
   129 	//{L"??", PkgLanguage::ELangNone  }
       
   130 	
       
   131 	{ NULL, PkgLanguage::ELangNone }
       
   132 	
       
   133 };
       
   134 
       
   135 #define NUMLANGUAGES (sizeof(KLanguages)/sizeof(SKeyword))
       
   136 
       
   137 /**
       
   138 GetLanguageCode: Returns the languge code for the given language
       
   139 
       
   140 @internalComponent
       
   141 @released
       
   142 
       
   143 @param aLang  - Name of the language
       
   144 */
       
   145 unsigned long PkgLanguage::GetLanguageCode(std::wstring aLang)
       
   146 {
       
   147 	int index = NUMLANGUAGES - 1;
       
   148 
       
   149 	while(index--)
       
   150 	{
       
   151 		if(!CompareTwoString(KLanguages[index].iName, (wchar_t*)aLang.data()))
       
   152 			return KLanguages[index].iId;
       
   153 	}
       
   154 
       
   155 	return PkgLanguage::ELangNone;
       
   156 }
       
   157 
       
   158 /**
       
   159 GetLanguageName: Returns the languge name for the given language code
       
   160 
       
   161 @internalComponent
       
   162 @released
       
   163 
       
   164 @param aCode  - Language code
       
   165 */
       
   166 std::wstring PkgLanguage::GetLanguageName(unsigned long aCode)
       
   167 {
       
   168 	int index = NUMLANGUAGES - 1;
       
   169 
       
   170 	while(index--)
       
   171 	{
       
   172 		if(KLanguages[index].iId == aCode)
       
   173 			return KLanguages[index].iName;
       
   174 	}
       
   175 
       
   176 	return NULL;
       
   177 }
       
   178