internetradio2.0/isdsclientsrc/irlanguagemapper.cpp
changeset 0 09774dfdd46b
equal deleted inserted replaced
-1:000000000000 0:09774dfdd46b
       
     1 /*
       
     2 * Copyright (c) 2006-2007 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 "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:  ?Description
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include <btsdp.h>
       
    20 
       
    21 #include "irlanguagemapper.h"
       
    22 #include "irdebug.h"
       
    23 
       
    24 // ================= MEMBER FUNCTIONS =======================
       
    25 
       
    26 // ---------------------------------------------------------
       
    27 // IRLanguageMapper::MapLanguage
       
    28 // ---------------------------------------------------------
       
    29 
       
    30 TBufC8<KIRLanguageCodeLength> IRLanguageMapper::MapLanguage(TLanguage aLanguage)
       
    31 	{
       
    32 	IRLOG_DEBUG( "IRLanguageMapper::MapLanguage - Entering" );
       
    33 	TUint16 value=0;
       
    34 
       
    35 	switch(aLanguage)
       
    36 		{
       
    37 	case ELangEnglish:
       
    38 		value = KLanguageEnglish;
       
    39 		break;
       
    40 	case ELangFrench:
       
    41 		value = KLanguageFrench;
       
    42 		break;
       
    43 	case ELangGerman:
       
    44 		value = KLanguageGerman;
       
    45 		break;
       
    46 	case ELangSpanish:
       
    47 		value = KLanguageSpanish;
       
    48 		break;
       
    49 	case ELangItalian:
       
    50 		value = KLanguageItalian;
       
    51 		break;
       
    52 	case ELangSwedish:
       
    53 		value = KLanguageSwedish;
       
    54 		break;
       
    55 	case ELangDanish:
       
    56 		value = KLanguageDanish;
       
    57 		break;
       
    58 	case ELangNorwegian:
       
    59 		value = KLanguageNorwegian;
       
    60 		break;
       
    61 	case ELangFinnish:
       
    62 		value = KLanguageFinnish;
       
    63 		break;
       
    64 	case ELangAmerican:
       
    65 		value = KLanguageEnglish;
       
    66 		break;
       
    67 	case ELangSwissFrench:
       
    68 		value = KLanguageFrench;
       
    69 		break;
       
    70 	case ELangSwissGerman:
       
    71 		value = KLanguageGerman;
       
    72 		break;
       
    73 	case ELangPortuguese:
       
    74 		value = KLanguagePortuguese;
       
    75 		break;
       
    76 	case ELangTurkish:
       
    77 		value = KLanguageTurkish;
       
    78 		break;
       
    79 	case ELangIcelandic:
       
    80 		value = KLanguageIcelandic;
       
    81 		break;
       
    82 	case ELangRussian:
       
    83 		value = KLanguageRussian;
       
    84 		break;
       
    85 	case ELangHungarian:
       
    86 		value = KLanguageHungarian;
       
    87 		break;
       
    88 	case ELangDutch:
       
    89 		value = KLanguageDutch;
       
    90 		break;
       
    91 	case ELangBelgianFlemish:
       
    92 		value = KLanguageDutch;
       
    93 		break;
       
    94 	case ELangAustralian:
       
    95 		value = KLanguageEnglish;
       
    96 		break;
       
    97 	case ELangBelgianFrench:
       
    98 		value = KLanguageFrench;
       
    99 		break;
       
   100 	case ELangAustrian:
       
   101 		value = KLanguageGerman;
       
   102 		break;
       
   103 	case ELangNewZealand:
       
   104 		value = KLanguageEnglish;
       
   105 		break;
       
   106 	case ELangInternationalFrench:
       
   107 		value = KLanguageFrench;
       
   108 		break;
       
   109 	case ELangCzech:
       
   110 		value = KLanguageCzech;
       
   111 		break;
       
   112 	case ELangSlovak:
       
   113 		value = KLanguageSlovak;
       
   114 		break;
       
   115 	case ELangPolish:
       
   116 		value = KLanguagePolish;
       
   117 		break;
       
   118 	case ELangSlovenian:
       
   119 		value = KLanguageSlovenian;
       
   120 		break;
       
   121 	case ELangTaiwanChinese:
       
   122 		value = KLanguageChinese;
       
   123 		break;
       
   124 	case ELangHongKongChinese:
       
   125 		value = KLanguageChinese;
       
   126 		break;
       
   127 	case ELangPrcChinese:
       
   128 		value = KLanguageChinese;
       
   129 		break;
       
   130 	case ELangJapanese:
       
   131 		value = KLanguageJapanese;
       
   132 		break;
       
   133 	case ELangThai:
       
   134 		value = KLanguageThai;
       
   135 		break;
       
   136 	case ELangAfrikaans:
       
   137 		value = KLanguageAfrikaans;
       
   138 		break;
       
   139 	case ELangAlbanian:
       
   140 		value = KLanguageAlbanian;
       
   141 		break;
       
   142 	case ELangAmharic:
       
   143 		value = KLanguageAmharic;
       
   144 		break;
       
   145 	case ELangArabic:
       
   146 		value = KLanguageArabic;
       
   147 		break;
       
   148 	case ELangArmenian:
       
   149 		value = KLanguageArmenian;
       
   150 		break;
       
   151 	case ELangTagalog:
       
   152 		value = KLanguageTagalog;
       
   153 		break;
       
   154 	case ELangBelarussian:
       
   155 		value = KLanguageRussian;
       
   156 		break;
       
   157 	case ELangBengali:
       
   158 		value = KLanguageBengali;
       
   159 		break;
       
   160 	case ELangBulgarian:
       
   161 		value = KLanguageBulgarian;
       
   162 		break;
       
   163 	case ELangBurmese:
       
   164 		value = KLanguageBurmese;
       
   165 		break;
       
   166 	case ELangCatalan:
       
   167 		value = KLanguageCatalan;
       
   168 		break;
       
   169 	case ELangCroatian:
       
   170 		value = KLanguageCroatian;
       
   171 		break;
       
   172 	case ELangCanadianEnglish:
       
   173 		value = KLanguageEnglish;
       
   174 		break;
       
   175 	case ELangInternationalEnglish:
       
   176 		value = KLanguageEnglish;
       
   177 		break;
       
   178 	case ELangSouthAfricanEnglish:
       
   179 		value = KLanguageEnglish;
       
   180 		break;
       
   181 	case ELangEstonian:
       
   182 		value = KLanguageEstonian;
       
   183 		break;
       
   184 	case ELangFarsi:
       
   185 		value = KLanguagePersian;
       
   186 		break;
       
   187 	case ELangCanadianFrench:
       
   188 		value = KLanguageFrench;
       
   189 		break;
       
   190 	case ELangScotsGaelic:
       
   191 		value = KLanguageScotsGaelic;
       
   192 		break;
       
   193 	case ELangGeorgian:
       
   194 		value = KLanguageGeorgian;
       
   195 		break;
       
   196 	case ELangGreek:
       
   197 		value = KLanguageGreek;
       
   198 		break;
       
   199 	case ELangCyprusGreek:
       
   200 		value = KLanguageGreek;
       
   201 		break;
       
   202 	case ELangGujarati:
       
   203 		value = KLanguageGujarati;
       
   204 		break;
       
   205 	case ELangHebrew:
       
   206 		value = KLanguageHebrew;
       
   207 		break;
       
   208 	case ELangHindi:
       
   209 		value = KLanguageHindi;
       
   210 		break;
       
   211 	case ELangIndonesian:
       
   212 		value = KLanguageIndonesian;
       
   213 		break;
       
   214 	case ELangIrish:
       
   215 		value = KLanguageIrish;
       
   216 		break;
       
   217 	case ELangSwissItalian:
       
   218 		value = KLanguageItalian;
       
   219 		break;
       
   220 	case ELangKannada:
       
   221 		value = KLanguageKannada;
       
   222 		break;
       
   223 	case ELangKazakh:
       
   224 		value = KLanguageKazakh;
       
   225 		break;
       
   226 	case ELangKhmer:
       
   227 		value = KLanguageCambodian;
       
   228 		break;
       
   229 	case ELangKorean:
       
   230 		value = KLanguageKorean;
       
   231 		break;
       
   232 	case ELangLao:
       
   233 		value = KLanguageLaothian;
       
   234 		break;
       
   235 	case ELangLatvian:
       
   236 		value = KLanguageLatvian;
       
   237 		break;
       
   238 	case ELangLithuanian:
       
   239 		value = KLanguageLithuanian;
       
   240 		break;
       
   241 	case ELangMacedonian:
       
   242 		value = KLanguageMacedonian;
       
   243 		break;
       
   244 	case ELangMalay:
       
   245 		value = KLanguageMalay;
       
   246 		break;
       
   247 	case ELangMalayalam:
       
   248 		value = KLanguageMalayalam;
       
   249 		break;
       
   250 	case ELangMarathi:
       
   251 		value = KLanguageMarathi;
       
   252 		break;
       
   253 	case ELangMoldavian:
       
   254 		value = KLanguageMoldavian;
       
   255 		break;
       
   256 	case ELangMongolian:
       
   257 		value = KLanguageMongolian;
       
   258 		break;
       
   259 	case ELangNorwegianNynorsk:
       
   260 		value = KLanguageNorwegian;
       
   261 		break;
       
   262 	case ELangBrazilianPortuguese:
       
   263 		value = KLanguagePortuguese;
       
   264 		break;
       
   265 	case ELangPunjabi:
       
   266 		value = KLanguagePunjabi;
       
   267 		break;
       
   268 	case ELangRomanian:
       
   269 		value = KLanguageRomanian;
       
   270 		break;
       
   271 	case ELangSerbian:
       
   272 		value = KLanguageSerbian;
       
   273 		break;
       
   274 	case ELangSinhalese:
       
   275 		value = KLanguageSinhalese;
       
   276 		break;
       
   277 	case ELangSomali:
       
   278 		value = KLanguageSomali;
       
   279 		break;
       
   280 	case ELangInternationalSpanish:
       
   281 		value = KLanguageSpanish;
       
   282 		break;
       
   283 	case ELangLatinAmericanSpanish:
       
   284 		value = KLanguageSpanish;
       
   285 		break;
       
   286 	case ELangSwahili:
       
   287 		value = KLanguageSwahili;
       
   288 		break;
       
   289 	case ELangFinlandSwedish:
       
   290 		value = KLanguageSwedish;
       
   291 		break;
       
   292 	case ELangTamil:
       
   293 		value = KLanguageTamil;
       
   294 		break;
       
   295 	case ELangTelugu:
       
   296 		value = KLanguageTelugu;
       
   297 		break;
       
   298 	case ELangTibetan:
       
   299 		value = KLanguageTibetan;
       
   300 		break;
       
   301 	case ELangTigrinya:
       
   302 		value = KLanguageTigrinya;
       
   303 		break;
       
   304 	case ELangCyprusTurkish:
       
   305 		value = KLanguageTurkish;
       
   306 		break;
       
   307 	case ELangTurkmen:
       
   308 		value = KLanguageTurkmen;
       
   309 		break;
       
   310 	case ELangUkrainian:
       
   311 		value = KLanguageUkrainian;
       
   312 		break;
       
   313 	case ELangUrdu:
       
   314 		value = KLanguageUrdu;
       
   315 		break;
       
   316 	case ELangVietnamese:
       
   317 		value = KLanguageVietnamese;
       
   318 		break;
       
   319 	case ELangWelsh:
       
   320 		value = KLanguageWelsh;
       
   321 		break;
       
   322 	case ELangZulu:
       
   323 		value = KLanguageZulu;
       
   324 		break;
       
   325 	default:
       
   326 		value = KLanguageEnglish;
       
   327 		break;
       
   328 		}
       
   329 
       
   330 	/* translate the two bytes into actual 'string' */
       
   331 	TBuf8<KIRLanguageCodeLength> ret;
       
   332 	TUint char1 = (value >> 8) & 0xFFu;
       
   333 	TUint char2 = value & 0xFFu;
       
   334 	ret.Append(static_cast<TUint8>(char1));
       
   335 	ret.Append(static_cast<TUint8>(char2));
       
   336 	IRLOG_DEBUG( "IRLanguageMapper::MapLanguage - Exiting" );
       
   337 	return ret;
       
   338 	}
       
   339 
       
   340 //  End of File