os/ossrv/genericopenlibs/openenvcore/libc/src/localeinfo.cpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 /*
     2 * Copyright (c) 2006-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 "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:  Contains the source for all locale related functionalities
    15  *     
    16  *
    17 */
    18 
    19 
    20 #include <stdlib.h>
    21 #include <f32file.h>
    22 #include "localeinfo.h"
    23 #include "sysif.h"
    24 #include <e32std_private.h>
    25 #include <e32ldr_private.h>
    26 
    27 typedef void (*TLibFn)(TLocale*);
    28 
    29 #if (defined(__SYMBIAN32__) && (defined(__WINSCW__) || defined(__WINS__)))
    30 #include "libc_wsd_defs.h"
    31 #include "localetlsinfo.h"
    32 #else
    33 
    34 #ifdef SYMBIAN_DISTINCT_LOCALE_MODEL
    35 #define NEW_LANG_VARIANT_DLL_NAME 30
    36 #endif
    37 
    38 #endif
    39 #define LC_TIME_MEMORY 1024
    40 #define LC_MONETARY_MEMORY 50
    41 #define LC_NUMERIC_MEMORY 20
    42 #define MONTHS	12
    43 #define WEEKDAYS 7
    44 #define DECIMAL_THOUSAND_DATE_TIME_SEPARATOR 2
    45 #define EURO_CURRENCY 4
    46 #define LOCALE_LENGTH 50
    47 #define CHARACTER_SET_NAME 32
    48 #define TIME_FORMAT_LENGTH 32
    49 #define NON_UNICODE_TEXT_BUFFER_LENGTH 256
    50 #define LANG_VARIANT_DLL_NAME 10
    51 
    52 #define MONTH_STR	"%m"
    53 #define DAY_STR		"%d"
    54 #define YEAR_STR 	"%Y"
    55 #define TWELVE_HOUR_STR 	"%I"
    56 #define TWENTY_FOUR_HOUR_STR	"%H"
    57 #define MINUTE_STR	"%M"
    58 #define SECOND_STR	"%S"
    59 #define AMPM_SPACE	" %p"
    60 #define AMPM_NO_SPACE	"%p"
    61 
    62 
    63 #ifdef SYMBIAN_DISTINCT_LOCALE_MODEL
    64 
    65 
    66 _LIT(KLanDllName, "elocl_lan.");
    67 _LIT(KRegDllName, "elocl_reg.");
    68 _LIT(KColDllName, "elocl_col.");
    69 
    70 #endif
    71 
    72 _LIT(KDllName, "elocl");
    73 
    74 
    75 #ifndef SYMBIAN_OE_ENHANCED_LOCALE_SUPPORT
    76 _LIT(KEuro, "\x20AC");
    77 #endif
    78 
    79 _LIT8(KAMPMSpace12hr, "B");
    80 _LIT8(KAMPMSpace, "A");
    81 _LIT8(KAMPMNoSpace12hr, "*B");
    82 _LIT8(KAMPMNoSpace, "*A");
    83 
    84 #ifndef EMULATOR
    85 
    86 CLocale* CLocale::iNewLocale = NULL;
    87 lc_monetary_T* CLocale::iMonetary_locale = NULL;
    88 lc_numeric_T* CLocale::iNumeric_locale =NULL;
    89 lc_time_T* CLocale::iTime_locale = NULL;
    90 
    91 TText8*  numericLocale =  NULL;
    92 TText8* monetaryLocale = NULL;
    93 TText8* timeLocale =  NULL;
    94 
    95 static TBuf<LANG_VARIANT_DLL_NAME> DllName;
    96 
    97 #ifdef SYMBIAN_DISTINCT_LOCALE_MODEL
    98 static TBuf<NEW_LANG_VARIANT_DLL_NAME> ColDllName;
    99 #endif
   100 
   101 #else //EMULATOR
   102 
   103 #define iNewLocale ((GetGlobals()->localeptr)->GET_WSD_VAR_NAME(iNewLocale,s))
   104 #define iMonetary_locale ((GetGlobals()->localeptr)->GET_WSD_VAR_NAME(iMonetary_locale,s))
   105 #define iNumeric_locale ((GetGlobals()->localeptr)->GET_WSD_VAR_NAME(iNumeric_locale,s))
   106 #define iTime_locale ((GetGlobals()->localeptr)->GET_WSD_VAR_NAME(iTime_locale,s))
   107 
   108 #define numericLocale ((GetGlobals()->localeptr)->GET_WSD_VAR_NAME(numericLocale,s))
   109 #define monetaryLocale ((GetGlobals()->localeptr)->GET_WSD_VAR_NAME(monetaryLocale,s))
   110 #define timeLocale ((GetGlobals()->localeptr)->GET_WSD_VAR_NAME(timeLocale,s))
   111 
   112 #define DllName ((GetGlobals()->localeptr)->GET_WSD_VAR_NAME(DllName,s))
   113 
   114 #ifdef SYMBIAN_DISTINCT_LOCALE_MODEL
   115 
   116 #define ColDllName ((GetGlobals()->localeptr)->GET_WSD_VAR_NAME(ColDllName,s))
   117 #endif
   118 
   119 #endif //EMULATOR
   120 
   121 CLocale::CLocale()
   122 	{
   123 	iMonetary_locale = NULL;
   124 	iNumeric_locale = NULL;
   125 	iTime_locale = NULL;
   126 
   127 	numericLocale =  NULL;
   128     monetaryLocale = NULL;
   129 	timeLocale =  NULL;
   130 #ifdef SYMBIAN_DISTINCT_LOCALE_MODEL    
   131      iOldDllPresent = 0;
   132 #endif
   133 	}
   134 	
   135 
   136 
   137 CLocale* CLocale::New()
   138 	{
   139 	CLocale* self = new CLocale();
   140 	if(self)
   141 		{
   142 		TInt ret=KErrNone;
   143 		TRAPD(result,ret = self->ConstructL());
   144 		if(KErrNone != (result | ret))
   145 			{
   146 			delete self;
   147 			self = NULL;
   148 			}
   149 		}
   150 	return self;
   151 	}
   152 	
   153 TInt CLocale::ConstructL()
   154 	{
   155 	iMonetary_locale = new  lc_monetary_T;
   156 	if(!iMonetary_locale)
   157 		{
   158 		return KErrNoMemory;
   159 		}
   160 	iNumeric_locale = new lc_numeric_T;
   161 	if(!iNumeric_locale)
   162 		{
   163 		return KErrNoMemory;
   164 		}
   165 	iTime_locale = new (ELeave) lc_time_T;
   166 	if(!iTime_locale)
   167 		{
   168 		return KErrNoMemory;
   169 		}
   170 	
   171 	for(TInt i =0 ; i < MONTHS; i++)
   172 		{
   173 		iTime_locale->mon[i] = NULL;
   174 		iTime_locale->month[i] = NULL;
   175 		iTime_locale->alt_month[i] = NULL;	
   176 		}
   177 	
   178 
   179 	for(TInt i =0 ; i < WEEKDAYS; i++)
   180 		{
   181 		iTime_locale->wday[i] = NULL;
   182 		iTime_locale->weekday[i] = NULL;	
   183 		}
   184 
   185 	iTime_locale->X_fmt = NULL;
   186 	iTime_locale->x_fmt = NULL;
   187 	iTime_locale->c_fmt = NULL;
   188 	iTime_locale->am = NULL;
   189 	iTime_locale->pm = NULL;
   190 	iTime_locale->date_fmt = NULL;
   191 	iTime_locale->md_order = NULL;
   192 	iTime_locale->ampm_fmt = NULL;
   193 	
   194 	iMonetary_locale->int_curr_symbol = NULL;
   195 	iMonetary_locale->currency_symbol  = NULL;
   196 	iMonetary_locale->mon_decimal_point = NULL;
   197 	iMonetary_locale->mon_thousands_sep = NULL;
   198 	iMonetary_locale->mon_grouping = NULL;
   199 	iMonetary_locale->positive_sign = NULL;
   200 	iMonetary_locale->negative_sign = NULL;
   201 	iMonetary_locale->int_frac_digits = iMonetary_locale->frac_digits = NULL;
   202 	iMonetary_locale->p_cs_precedes = iMonetary_locale->int_p_cs_precedes = NULL;
   203 	iMonetary_locale->p_sep_by_space = iMonetary_locale->int_p_sep_by_space = NULL;
   204 	iMonetary_locale->n_cs_precedes = iMonetary_locale->int_n_cs_precedes = NULL;
   205 	iMonetary_locale->n_sep_by_space = iMonetary_locale->int_n_sep_by_space = NULL;
   206 	iMonetary_locale->p_sign_posn = iMonetary_locale->int_p_sign_posn = NULL;
   207 	iMonetary_locale->n_sign_posn = iMonetary_locale->int_n_sign_posn = NULL;
   208 
   209 	iNumeric_locale->decimal_point = NULL;
   210 	iNumeric_locale->thousands_sep = NULL;
   211 	iNumeric_locale->grouping = NULL;
   212 	
   213 	return KErrNone;
   214 	}
   215 
   216 CLocale* CLocale::GetInstance()
   217 	{
   218 	// Switch to the backend heap
   219 	RHeap* oldheap = User::SwitchHeap(Backend()->Heap());
   220 	
   221 	if(NULL == iNewLocale)	
   222 		{
   223 		iNewLocale = New();
   224 		}
   225 		
   226 	if(numericLocale == NULL )
   227 		{
   228 		numericLocale =  new TText8 [LC_NUMERIC_MEMORY];	
   229 		}
   230 	
   231 	if(monetaryLocale == NULL)
   232 		{
   233 		monetaryLocale = new TText8[LC_MONETARY_MEMORY];
   234 		}
   235 	
   236 	if(timeLocale == NULL)
   237 		{
   238 		timeLocale =  new TText8[LC_TIME_MEMORY];
   239 		}
   240 	
   241 
   242 				
   243 	//Set back the default user heap
   244 	User::SwitchHeap(oldheap);
   245 	return iNewLocale;	
   246 	}
   247 
   248 	
   249 void CLocale::DeleteInstance()
   250 	{
   251 	// Switch to the backend heap so that deletes happen from there
   252 	RHeap* oldheap = User::SwitchHeap(Backend()->Heap());
   253 
   254 	delete [] timeLocale;
   255 	timeLocale =NULL;
   256 
   257 	delete []  numericLocale;
   258 	numericLocale = NULL;
   259 
   260 	delete [] monetaryLocale;
   261 	monetaryLocale = NULL;
   262 
   263 	delete  iMonetary_locale;
   264 	iMonetary_locale = NULL;
   265 
   266 	delete iNumeric_locale;
   267 	iNumeric_locale = NULL;
   268 
   269 	delete iTime_locale;
   270 	iTime_locale = NULL;
   271 	
   272 	delete iNewLocale;
   273 	iNewLocale = NULL;
   274 	
   275 
   276 	
   277 	//Set back to the default user heap
   278 	User::SwitchHeap(oldheap);
   279 	}
   280 		
   281 
   282 TText* CLocale::SetLocale(TDesC& aLocale)	
   283 	{
   284 		//Check whether locale is supported
   285 	
   286 		TText* retVal = NULL;
   287 		TInt r;
   288 #ifdef SYMBIAN_DISTINCT_LOCALE_MODEL 
   289 		
   290 		// load the new locale dll if not present check for the old dll
   291 		r = LoadNewLocaleDll( aLocale );
   292         if ( r  ==  KErrNone ) 
   293         {
   294             retVal = (TText*) aLocale.Ptr();
   295             iOldDllPresent = 0;
   296             return retVal;
   297         }
   298 #endif
   299 
   300     if(!LoadLocale(aLocale))
   301     {
   302         return NULL;
   303     }
   304     RLoader loader;
   305     r = loader.Connect();
   306     if(KErrNone == r)
   307         {
   308             //Load the language variant DLL 
   309             TInt size = KNumLocaleExports * sizeof(TLibraryFunction);
   310             TPtr8 functionListBuf((TUint8*) iData, size, size);
   311             r = loader.SendReceive(ELoadLocale, TIpcArgs(0, (const TDesC*)&DllName, &functionListBuf) );
   312             if(KErrNone == r)
   313             {
   314                 ((TLibFn)iData[FnLocaleData])(&iLocale);
   315                 retVal = (TText*) aLocale.Ptr();
   316 #ifdef SYMBIAN_DISTINCT_LOCALE_MODEL 
   317                 iOldDllPresent = 1;
   318 #endif
   319             }
   320             loader.Close();
   321         }
   322     return retVal;
   323 }
   324 
   325 #ifdef SYMBIAN_OE_ENHANCED_LOCALE_SUPPORT
   326 
   327 #ifdef SYMBIAN_DISTINCT_LOCALE_MODEL
   328 TInt  CLocale::GetSystemLocale(TDesC& aLanDllName,TDesC& aRegDllName)
   329     {
   330         RLoader loader;
   331         TInt retVal = -1;
   332         TInt r = loader.Connect();
   333         if(KErrNone == r)
   334             {
   335             TInt size = KNumLocaleExports * sizeof(TLibraryFunction);
   336             TPtr8 functionListBuf1((TUint8*) iDataLanguage, size, size);
   337             r = loader.SendReceive(ELoadLocale, TIpcArgs(0, (const TDesC*)&aLanDllName, &functionListBuf1) );
   338             if(KErrNone != r)
   339                 return retVal;
   340             TPtr8 functionListBuf2((TUint8*) iDataRegion, size, size);
   341             r = loader.SendReceive(ELoadLocale, TIpcArgs(0, (const TDesC*)&aRegDllName, &functionListBuf2) );
   342             ((TLibFn)iDataRegion[FnLocaleDataV2])(&iLocale);
   343             if(KErrNone != r)
   344                 return retVal;
   345             retVal = 0;
   346             loader.Close();
   347             }
   348         return retVal;
   349     
   350     }
   351 #endif
   352 //Load the system dll settings
   353 TInt CLocale::GetSystemLocale(TDesC& aDllName)	
   354 	{
   355 		RLoader loader;
   356 		TInt retVal = -1;
   357 		TInt r = loader.Connect();
   358 		if(KErrNone == r)
   359 			{
   360 			//Load the language variant DLL 
   361 			TInt size = KNumLocaleExports * sizeof(TLibraryFunction);
   362           	TPtr8 functionListBuf((TUint8*) iData, size, size);
   363           	r = loader.SendReceive(ELoadLocale, TIpcArgs(0, (const TDesC*)&aDllName, &functionListBuf) );
   364 			if(KErrNone == r)
   365 				{
   366             	((TLibFn)iData[FnLocaleData])(&iLocale);
   367             	retVal = 0;
   368 				}
   369 			loader.Close();
   370 			}
   371 		return retVal;
   372 	}
   373 
   374 #endif
   375 
   376 
   377 TInt CLocale::MonetaryLoadLocaleL(const char* localeName)
   378 {
   379     #ifdef SYMBIAN_OE_ENHANCED_LOCALE_SUPPORT
   380         TInt charsetID=-1;
   381         if(localeName)
   382         {
   383             charsetID = GetCharcaterSetIDL(localeName);
   384             if(charsetID == -1)
   385             {
   386                 return -1;
   387             }
   388         }
   389     #else
   390         TInt charsetID = GetCharcaterSetIDL(localeName);
   391         if(charsetID == -1)
   392         {
   393             return -1;
   394         }
   395     #endif
   396     #ifdef SYMBIAN_OE_ENHANCED_LOCALE_SUPPORT
   397 	    else
   398         {
   399         //update the iLocale with the system locale settings
   400             iLocale.Refresh();	
   401         }
   402     #endif
   403     #ifndef SYMBIAN_OE_ENHANCED_LOCALE_SUPPORT
   404         //Retreive monetary information from language variant DLL
   405         Mem::Copy(&iLocaleSettings.iCurrencySymbol[0], (const TAny*) iData[FnCurrencySymbol](), sizeof(TText) * (KMaxCurrencySymbol+1));	
   406     #endif
   407         TLocalePos aCurrencySymbolPosition = iLocale.CurrencySymbolPosition();
   408         TLocale::TNegativeCurrencyFormat aNegativeCurrencyFormat = iLocale.NegativeCurrencyFormat();
   409         TBool aCurrencySpaceBetween = iLocale.CurrencySpaceBetween();
   410         TBool aNegativeCurrencySymbolOpposite = iLocale.NegativeCurrencySymbolOpposite();
   411         TBool aNegativeLoseSpace = iLocale.NegativeLoseSpace();
   412         TBool aCurrencyTriadsAllowed = iLocale.CurrencyTriadsAllowed();
   413         
   414         TInt currencyDecimalPlaces = iLocale.CurrencyDecimalPlaces();
   415         iThousandsSeparator= iLocale.ThousandsSeparator();
   416         iDecimalSeparator = iLocale.DecimalSeparator();
   417             
   418         TText8* temp = monetaryLocale;
   419         
   420         //Set the decimal separator
   421         const TText* dec_point = (const TText*) &iDecimalSeparator;
   422         if(dec_point)
   423         {
   424             const TPtrC dec(dec_point);
   425             TBuf8<DECIMAL_THOUSAND_DATE_TIME_SEPARATOR> decimal;
   426             decimal.Copy(dec);
   427             strncpy((char*) monetaryLocale, (char*) decimal.Ptr(), decimal.Length());
   428             monetaryLocale[decimal.Length()] = '\0';
   429             iMonetary_locale->mon_decimal_point = (const char*) monetaryLocale;
   430             monetaryLocale += decimal.Length() + 1;
   431         }
   432         
   433         //Set thousand separator
   434         const TText* thous_sep = (const TText*) &iThousandsSeparator;
   435         if(thous_sep)
   436         {
   437             const TPtrC thousand(thous_sep);
   438             TBuf8<DECIMAL_THOUSAND_DATE_TIME_SEPARATOR> thousand_sep;
   439             thousand_sep.Copy(thousand);
   440             strncpy((char*) monetaryLocale, (char*) thousand_sep.Ptr(), thousand_sep.Length());
   441             monetaryLocale[thousand_sep.Length()] = '\0';
   442             iMonetary_locale->mon_thousands_sep = (const char*) monetaryLocale;
   443             monetaryLocale += thousand_sep.Length() + 1;
   444         }
   445     #ifdef SYMBIAN_OE_ENHANCED_LOCALE_SUPPORT
   446         TBuf<KMaxCurrencySymbol> CurrencySymbol;
   447         if(localeName)
   448         {
   449 #ifdef  SYMBIAN_DISTINCT_LOCALE_MODEL
   450         if( iOldDllPresent ) // old style dll is loaded
   451             {
   452                 Mem::Copy(&iLocaleSettings.iCurrencySymbol[0], (const TAny*) iData[FnCurrencySymbol](), sizeof(TText) * (KMaxCurrencySymbol+1));
   453             }
   454         else
   455             {
   456                 Mem::Copy(&iLocaleSettings.iCurrencySymbol[0], (const TAny*) iDataRegion[FnCurrencySymbolV2](), sizeof(TText) * (KMaxCurrencySymbol+1));
   457             }
   458 #else
   459         Mem::Copy(&iLocaleSettings.iCurrencySymbol[0], (const TAny*) iData[FnCurrencySymbol](), sizeof(TText) * (KMaxCurrencySymbol+1));
   460 #endif
   461         //Set Currency information
   462         const TText16* cur = iLocaleSettings.iCurrencySymbol;
   463         const TPtrC currency(cur);
   464         CurrencySymbol.Copy(currency);
   465         }
   466         else
   467         {
   468         TCurrencySymbol cur;
   469         const TPtrC currency(cur);
   470         CurrencySymbol.Copy(currency);
   471         }
   472         strncpy((char*) monetaryLocale, (char*) CurrencySymbol.Ptr(), CurrencySymbol.Length());
   473         monetaryLocale[CurrencySymbol.Length()] = '\0';
   474             iMonetary_locale->currency_symbol = (const char*) monetaryLocale;
   475             monetaryLocale += strlen((char*) monetaryLocale) + 1;
   476     #else	
   477         //Set Currency information
   478         const TText16* currency = iLocaleSettings.iCurrencySymbol;
   479         if(currency)
   480         {
   481             TBuf<EURO_CURRENCY> euroSymbol(currency);
   482             char* temp = strchr(localeName, '.');
   483             temp = temp + 1;
   484             
   485             if(!euroSymbol.Compare(KEuro) && !strcmp(temp, "ISO-8859-1"))
   486             {
   487                 strcpy((char*) monetaryLocale,"\x80");
   488                 monetaryLocale[1] = '\0';					
   489             }
   490             else
   491             {
   492                 ConvertToMultiByteL((TText8*)monetaryLocale, currency, charsetID);	
   493             }
   494             iMonetary_locale->currency_symbol = (const char*) monetaryLocale;
   495             monetaryLocale += strlen((char*) monetaryLocale) + 1;
   496         }
   497     #endif
   498         
   499         //Set grouping information
   500         strcpy((char*) monetaryLocale,(aCurrencyTriadsAllowed? "\003":""));
   501         monetaryLocale[strlen((char*) monetaryLocale)] = '\0';
   502         iMonetary_locale->mon_grouping = (const char*) monetaryLocale;
   503         monetaryLocale += strlen((char*) monetaryLocale) + 1;
   504         
   505         //Set currency decimal places
   506         iMonetary_locale->int_frac_digits =	iMonetary_locale->frac_digits = (const char*) monetaryLocale;
   507         *monetaryLocale++ = currencyDecimalPlaces;
   508         *monetaryLocale++ = '\0';
   509             
   510         //Set the currency symbol position for a monetary quantity with non-negative value 
   511         iMonetary_locale->p_cs_precedes = (const char*) monetaryLocale;
   512         iMonetary_locale->int_p_cs_precedes = iMonetary_locale->p_cs_precedes;
   513         *monetaryLocale++ = (ELocaleBefore == aCurrencySymbolPosition)?1:0;
   514         *monetaryLocale++ = '\0';
   515         
   516         //Set the currency symbol position for a monetary quantity with negative value		
   517         iMonetary_locale->n_cs_precedes = (const char*) monetaryLocale;
   518         iMonetary_locale->int_n_cs_precedes = iMonetary_locale->n_cs_precedes;
   519         *monetaryLocale++ = aNegativeCurrencySymbolOpposite?0:1;
   520         *monetaryLocale++ ='\0';
   521         
   522         //Set the currency symbol separated by space or not for a monetary quantity with non-negative value
   523         iMonetary_locale->p_sep_by_space = (const char*) monetaryLocale;
   524         iMonetary_locale->int_p_sep_by_space = iMonetary_locale->p_sep_by_space;
   525         *monetaryLocale++ = aCurrencySpaceBetween?1:0;	
   526         *monetaryLocale++ ='\0';
   527         
   528         //Set the currency symbol separated by space or not for a monetary quantity with negative value
   529         iMonetary_locale->n_sep_by_space = (const char*) monetaryLocale;
   530         iMonetary_locale->int_n_sep_by_space = iMonetary_locale->n_sep_by_space;
   531         *monetaryLocale++ = aNegativeLoseSpace?1:0;
   532         *monetaryLocale++ = '\0';
   533         
   534         //Set the positioning of the negative and positive for a monetary quantity 
   535         if(TLocale::ELeadingMinusSign == aNegativeCurrencyFormat)				
   536         {
   537             iMonetary_locale->n_sign_posn = (const char*) monetaryLocale;
   538             *monetaryLocale++ = 1;
   539             *monetaryLocale++ = '\0';
   540         }
   541         if(TLocale::EInBrackets == aNegativeCurrencyFormat)
   542         {
   543             iMonetary_locale->n_sign_posn = (const char*) monetaryLocale;
   544             *monetaryLocale++ = 0;
   545             *monetaryLocale++ = '\0';
   546         }
   547         
   548         if(TLocale::ETrailingMinusSign == aNegativeCurrencyFormat)
   549         {
   550             iMonetary_locale->n_sign_posn = (const char*) monetaryLocale;
   551             *monetaryLocale++ = 2;
   552             *monetaryLocale++ = '\0';
   553         }
   554         
   555         if(TLocale::EInterveningMinusSign == aNegativeCurrencyFormat)
   556         {
   557             iMonetary_locale->n_sign_posn = (const char*) monetaryLocale;
   558             *monetaryLocale++ = 3;
   559             *monetaryLocale++ = '\0';
   560         }
   561         
   562         iMonetary_locale->int_n_sign_posn = iMonetary_locale->n_sign_posn;
   563         iMonetary_locale->p_sign_posn = 	iMonetary_locale->int_p_sign_posn = 	iMonetary_locale->n_sign_posn;
   564         //Set the positive sign and negative sign for monetary quantity
   565         iMonetary_locale->positive_sign = iMonetary_locale->negative_sign = "";
   566         //Set the internationla currency symbol
   567         iMonetary_locale->int_curr_symbol = "";
   568         monetaryLocale = temp;
   569         return 0;
   570         
   571 	
   572 }
   573 /* Forward declaration of ReadALine */
   574 inline TInt ReadALine(RFile& aFile, TInt& aPos, TDes8& aDesc);
   575 extern void GetInstallationDataDir(TFileName& aPath);
   576 #ifdef SYMBIAN_DISTINCT_LOCALE_MODEL
   577 
   578 TInt CLocale::ParseNewLocaleFile( TDesC& aLocale )
   579 {
   580 // open and parse the file
   581     TPtrC src(aLocale);
   582     TBuf8<LOCALE_LENGTH> locale_name;
   583     locale_name.Copy(src);
   584     char locale[LOCALE_LENGTH];
   585     strncpy(locale, (char*) locale_name.Ptr(), locale_name.Length());
   586     locale[locale_name.Length()] = '\0';
   587     
   588     if (NULL == strchr(locale, '.'))
   589         {
   590         return 0;
   591         }
   592     RFile newfile;
   593 #ifndef __EPOC32__
   594     _LIT(localeFileNew,"\\resource\\openc\\locales_new.txt" );
   595 #else
   596     TFileName localeFileNew;
   597     GetInstallationDataDir(localeFileNew);
   598     localeFileNew.Append(_L("locales_new.txt" ));
   599 #endif
   600            
   601     int retValNew = newfile.Open(Backend()->FileSession(), localeFileNew, EFileRead);
   602     if( KErrNone != retValNew )
   603     {
   604         return 0;
   605     }
   606     int pos = 0;
   607     TBuf8<LOCALE_LENGTH> localeInfoNew;
   608     retValNew = ReadALine(newfile, pos, localeInfoNew);
   609     char* buffer = (char*) localeInfoNew.Ptr();
   610     int  i = 0;
   611     int  flag = 0;
   612     while( retValNew > 0)
   613     {
   614         char str1[LOCALE_LENGTH];
   615         while(buffer[i] != '=')
   616         {
   617             str1[i] = buffer[i];
   618             i++;
   619         }
   620         str1[i] = '\0';
   621         if(!strcmp(str1,locale))
   622         {
   623             flag = 1;
   624             break;
   625         }
   626         i = 0;
   627         retValNew = ReadALine(newfile, pos, localeInfoNew);
   628         buffer = (char*) localeInfoNew.Ptr();
   629     }
   630     if(flag)
   631     {
   632         
   633         iLanDllName.Copy(KLanDllName);
   634         iRegDllName.Copy(KRegDllName);
   635         ColDllName.Copy(KColDllName);
   636         i++;
   637         int len = localeInfoNew.Length();
   638         TBuf<50> localeids;
   639         while(i < len )
   640         {
   641         localeids.Append(buffer[i]);  
   642         i++;
   643         }
   644         TLex lex( localeids );
   645         TChar ch;
   646         TInt k = 0;
   647         TBuf<10> token[3];
   648         while((ch = lex.Get()) != 0 )
   649         {
   650         while (ch != ',' && ch != 0 && ch != '\t' && ch != '\n' && ch != '\r') 
   651            {
   652            lex.Inc();
   653            ch = lex.Peek();
   654            }
   655         token[k].Copy(lex.MarkedToken());
   656         k++;
   657         lex.Inc();
   658         lex.Mark();
   659         }
   660         iLanDllName.Append(token[0]);
   661         iRegDllName.Append(token[1]);
   662         ColDllName.Append(token[2]);
   663         newfile.Close();
   664         return 1;
   665        
   666      }
   667     newfile.Close();
   668     return 0;
   669 }
   670 
   671 TInt CLocale::LoadNewLocaleDll( TDesC& aLocale  )
   672     {
   673     
   674     if(!ParseNewLocaleFile( aLocale ))
   675         {
   676             return -1;
   677         }
   678     RLoader loader;
   679     TInt r = loader.Connect();
   680     if( KErrNone != r)
   681        return -1;
   682     TInt size = KNumLocaleExports * sizeof(TLibraryFunction);
   683     TPtr8 functionListBuf((TUint8*) iDataRegion, size, size );
   684     r = loader.SendReceive(ELoadLocale, TIpcArgs(0, (const TDesC*)&iRegDllName, &functionListBuf) );
   685     if( KErrNone != r)
   686        return -1;
   687     ((TLibFn)iDataRegion[FnLocaleDataV2])(&iLocale);
   688     // language dll loading
   689     TPtr8 functionListBuf_lan((TUint8*) iDataLanguage, size, size);
   690     r = loader.SendReceive(ELoadLocale, TIpcArgs(0, (const TDesC*)&iLanDllName, &functionListBuf_lan) );
   691     if( KErrNone != r)
   692        return -1;
   693    
   694     return r;
   695     
   696     }
   697 
   698 #endif
   699 
   700 
   701 
   702 #ifdef SYMBIAN_OE_ENHANCED_LOCALE_SUPPORT
   703 TInt CLocale::NumericLoadLocale(const char* localeName)
   704 #else
   705 TInt CLocale::NumericLoadLocale(const char* /*localeName*/)
   706 #endif
   707 {
   708     #ifdef SYMBIAN_OE_ENHANCED_LOCALE_SUPPORT
   709         if(!localeName)
   710         {
   711             //update the iLocale with the system settings
   712             iLocale.Refresh();
   713             
   714         }
   715     #endif
   716         //Retrive numeric information from language variant DLL
   717         TBool aCurrencyTriadsAllowed = iLocale.CurrencyTriadsAllowed();
   718         iThousandsSeparator= iLocale.ThousandsSeparator();
   719         iDecimalSeparator = iLocale.DecimalSeparator();
   720         
   721         TText8* temp = numericLocale;
   722         //Set the decimal separator
   723         const TText* dec_point = (const TText*) &iDecimalSeparator;
   724         if(dec_point)
   725         {
   726             const TPtrC dec(dec_point);
   727             TBuf8<DECIMAL_THOUSAND_DATE_TIME_SEPARATOR> decimal;
   728             decimal.Copy(dec);
   729             strncpy((char*) numericLocale, (char*) decimal.Ptr(), decimal.Length());
   730             numericLocale[decimal.Length()] ='\0';
   731             iNumeric_locale->decimal_point = (const char*) numericLocale;
   732             numericLocale += decimal.Length() + 1;
   733         }
   734         
   735         //Set thousand separator
   736         const TText* thous_sep = (const TText*) &iThousandsSeparator;
   737         if(thous_sep)
   738         {
   739             const TPtrC thousand(thous_sep);
   740             TBuf8<DECIMAL_THOUSAND_DATE_TIME_SEPARATOR> thousand_sep;
   741             thousand_sep.Copy(thousand);
   742             strncpy((char*) numericLocale, (char*) thousand_sep.Ptr(), thousand_sep.Length());
   743             numericLocale[thousand_sep.Length()] = '\0';
   744             iNumeric_locale->thousands_sep = (const char*) numericLocale;
   745             numericLocale += thousand_sep.Length() + 1;
   746         }
   747         
   748         //Set grouping information
   749         strcpy((char*) numericLocale,(aCurrencyTriadsAllowed? "\003":""));
   750         numericLocale[strlen((char*) numericLocale)] = '\0';
   751         iNumeric_locale->grouping = (const char*) numericLocale;
   752         numericLocale += strlen((char*) numericLocale) + 1;
   753                 
   754         numericLocale = temp;
   755         return 0;
   756 	
   757 }
   758 
   759 #ifdef SYMBIAN_DISTINCT_LOCALE_MODEL
   760 
   761 
   762 TInt CLocale::TimeLoadNewLocaleL( const char* localeName )
   763 {
   764     TInt charsetID = -1;
   765     if( localeName )
   766     {
   767         charsetID = GetCharcaterSetIDL(localeName);
   768         if(charsetID == -1)
   769         {
   770             return -1;
   771         }
   772     }
   773     else
   774     {
   775     //update the iLocale with the system locale settings
   776         iLocale.Refresh();
   777     }
   778     TText8* startAddress =  timeLocale;
   779     //Set month and abbreviated month name information
   780     for(TInt aMonth = 0 ; aMonth < MONTHS; aMonth++)
   781     {
   782 
   783         const TText16* month = ((reinterpret_cast<TText*const*>((const TText*) iDataLanguage[FnMonthTableV2]()))[aMonth]);
   784         if(month)
   785         {
   786 #ifdef SYMBIAN_OE_ENHANCED_LOCALE_SUPPORT
   787             if(!localeName)
   788             {
   789                 ConvertToMultiByteCustom((TUint8*)timeLocale,  month);  
   790             }
   791             else    
   792             {
   793 #endif
   794             ConvertToMultiByteL((TUint8*)timeLocale,  month, charsetID);
   795 #ifdef SYMBIAN_OE_ENHANCED_LOCALE_SUPPORT
   796             }
   797 #endif
   798             iTime_locale->month[aMonth] = (const char*)  timeLocale;
   799             iTime_locale->alt_month[aMonth] = (const char*)  timeLocale;
   800             timeLocale += strlen((char*) timeLocale) + 1;
   801         }
   802         const TText16* abbMonth = ((reinterpret_cast<TText*const*>((const TText*) iDataLanguage[FnMonthAbbTableV2]()))[aMonth]);
   803         if(abbMonth)
   804         {
   805 #ifdef SYMBIAN_OE_ENHANCED_LOCALE_SUPPORT
   806             if(!localeName)
   807             {
   808                 ConvertToMultiByteCustom((TUint8*)timeLocale,  abbMonth);   
   809             }
   810             else    
   811             {
   812 #endif
   813             ConvertToMultiByteL((TUint8*)timeLocale, abbMonth, charsetID);
   814 #ifdef SYMBIAN_OE_ENHANCED_LOCALE_SUPPORT
   815             }
   816 #endif
   817             iTime_locale->mon[aMonth] = (const char*)  timeLocale;
   818             timeLocale += strlen((char*) timeLocale) + 1;               
   819         }
   820                     
   821     }
   822     
   823     //Set day and abbreviated day name information
   824     const TText16* day = ((reinterpret_cast<TText*const*>((const TText*) iDataLanguage[FnDayTableV2]()))[6]);
   825     if(day)
   826     {
   827 #ifdef SYMBIAN_OE_ENHANCED_LOCALE_SUPPORT
   828         if(!localeName)
   829         {
   830             ConvertToMultiByteCustom((TUint8*)timeLocale,  day);    
   831         }
   832         else    
   833         {
   834 #endif
   835         ConvertToMultiByteL((TUint8*)timeLocale, day, charsetID);
   836 #ifdef SYMBIAN_OE_ENHANCED_LOCALE_SUPPORT
   837         }
   838 #endif
   839         iTime_locale->weekday[0] = (const char*)  timeLocale;
   840         timeLocale += strlen((char*) timeLocale) + 1;               
   841     }
   842     const TText16* abbDay = ((reinterpret_cast<TText*const*>((const TText*) iDataLanguage[FnDayAbbTableV2]()))[6]);
   843     if(abbDay)
   844     {
   845 #ifdef SYMBIAN_OE_ENHANCED_LOCALE_SUPPORT
   846         if(!localeName)
   847         {
   848             ConvertToMultiByteCustom((TUint8*)timeLocale,  abbDay); 
   849         }
   850         else
   851         {
   852 #endif
   853         ConvertToMultiByteL((TUint8*)timeLocale,  abbDay, charsetID);
   854 #ifdef SYMBIAN_OE_ENHANCED_LOCALE_SUPPORT
   855         }
   856 #endif
   857         iTime_locale->wday[0] = (const char*)  timeLocale;              
   858         timeLocale += strlen((char*) timeLocale) + 1;
   859     }
   860     
   861     for(TInt aDay = 0 ; aDay < WEEKDAYS - 1; aDay++)
   862     {
   863         const TText16* day = ((reinterpret_cast<TText*const*>((const TText*) iDataLanguage[FnDayTableV2]()))[aDay]);
   864         if(day)
   865         {
   866 #ifdef SYMBIAN_OE_ENHANCED_LOCALE_SUPPORT
   867             if(!localeName)
   868             {
   869                 ConvertToMultiByteCustom((TUint8*)timeLocale,  day);    
   870             }
   871             else    
   872             {
   873 #endif
   874             ConvertToMultiByteL((TUint8*)timeLocale, day, charsetID);
   875 #ifdef SYMBIAN_OE_ENHANCED_LOCALE_SUPPORT
   876             }
   877 #endif
   878             iTime_locale->weekday[aDay + 1] = (const char*)  timeLocale;
   879             timeLocale += strlen((char*) timeLocale) + 1;               
   880         }
   881         const TText16* abbDay = ((reinterpret_cast<TText*const*>((const TText*) iDataLanguage[FnDayAbbTableV2]()))[aDay]);
   882         if(abbDay)
   883         {
   884 #ifdef SYMBIAN_OE_ENHANCED_LOCALE_SUPPORT
   885             if(!localeName)
   886             {
   887                 ConvertToMultiByteCustom((TUint8*)timeLocale,  abbDay); 
   888             }
   889             else    
   890             {
   891 #endif
   892             ConvertToMultiByteL((TUint8*)timeLocale,  abbDay, charsetID);
   893 #ifdef SYMBIAN_OE_ENHANCED_LOCALE_SUPPORT
   894             }  
   895 #endif
   896             iTime_locale->wday[aDay + 1] = (const char*)  timeLocale;               
   897             timeLocale += strlen((char*) timeLocale) + 1;
   898         }
   899                     
   900     }
   901     const TText16* am = ((reinterpret_cast<TText*const*>((const TText*) iDataLanguage[FnAmPmTableV2]()))[0]);
   902     if(am)
   903     {
   904 #ifdef SYMBIAN_OE_ENHANCED_LOCALE_SUPPORT
   905         if(!localeName)
   906         {
   907             ConvertToMultiByteCustom((TUint8*)timeLocale,  am); 
   908         }
   909         else    
   910         {
   911 #endif
   912         ConvertToMultiByteL((TUint8*)timeLocale, am, charsetID);
   913 #ifdef SYMBIAN_OE_ENHANCED_LOCALE_SUPPORT
   914         } 
   915 #endif
   916         iTime_locale->am = (const char*)  timeLocale;                   
   917         timeLocale += strlen((char*) timeLocale) + 1;
   918     }
   919     const TText16* pm = ((reinterpret_cast<TText*const*>((const TText*) iDataLanguage[FnAmPmTableV2]()))[1]);
   920     if(pm)
   921     {
   922 #ifdef SYMBIAN_OE_ENHANCED_LOCALE_SUPPORT
   923         if(!localeName)
   924         {
   925             ConvertToMultiByteCustom((TUint8*)timeLocale,  pm); 
   926         }
   927         else    
   928         {
   929 #endif
   930         ConvertToMultiByteL((TUint8*)timeLocale, pm, charsetID);
   931 #ifdef SYMBIAN_OE_ENHANCED_LOCALE_SUPPORT
   932         }  
   933 #endif
   934         iTime_locale->pm = (const char*)  timeLocale;                   
   935         timeLocale += strlen((char*) timeLocale) + 1;
   936     }
   937             
   938     Mem::Copy(&iLocaleTimeDateFormat.iTimeFormatSpec[0], (const TAny*) iDataRegion[FnTimeFormatSpecV2](), sizeof(TText) * (KMaxTimeFormatSpec+1));
   939     TText* timeForm = iLocaleTimeDateFormat.iTimeFormatSpec;
   940     
   941     //Set time format(T_FMT) and am/pm time format(T_FMT_AMPM) string
   942     if(timeForm)
   943     {
   944         const TPtrC time(timeForm);
   945         TBuf8<TIME_FORMAT_LENGTH> timeFormat;
   946         timeFormat.Copy(time);
   947         
   948         TChar timeSeparator = iLocale.TimeSeparator(1);
   949         TBuf8<DECIMAL_THOUSAND_DATE_TIME_SEPARATOR> timeSeparator1;
   950         timeSeparator1.Append(timeSeparator);
   951         
   952         timeSeparator = iLocale.TimeSeparator(2);
   953         TBuf8<DECIMAL_THOUSAND_DATE_TIME_SEPARATOR> timeSeparator2;
   954         timeSeparator2.Append(timeSeparator);
   955         
   956         TTimeFormat time12hror24hr = iLocale.TimeFormat();
   957         
   958         if(KErrNotFound != timeFormat.Locate('J'))
   959         {
   960             //Check for time format(12/24 hour format)
   961             if(time12hror24hr == ETime12)
   962             {
   963                 strcpy((char*) timeLocale,TWELVE_HOUR_STR);
   964             }
   965             else
   966             {
   967                 strcpy((char*) timeLocale,TWENTY_FOUR_HOUR_STR);
   968             }
   969         }
   970         
   971         else if(KErrNotFound != timeFormat.Locate('I'))
   972         {
   973             strcpy((char*) timeLocale,TWELVE_HOUR_STR);
   974         }   
   975         
   976         else if(KErrNotFound != timeFormat.Locate('H'))
   977         {
   978             strcpy((char*) timeLocale,TWENTY_FOUR_HOUR_STR);
   979         }   
   980     
   981         strncat((char*) timeLocale, (char*) timeSeparator1.Ptr(), timeSeparator1.Length());
   982         strcat((char*) timeLocale, MINUTE_STR);
   983         strncat((char*) timeLocale, (char*) timeSeparator2.Ptr(), timeSeparator2.Length());
   984         strcat((char*) timeLocale, SECOND_STR);
   985         
   986         if(time12hror24hr == ETime12)
   987         {
   988 
   989             if((KErrNotFound != timeFormat.Find(KAMPMSpace12hr)) || (KErrNotFound != timeFormat.Find(KAMPMSpace)) )
   990             {
   991                 if((KErrNotFound != timeFormat.Find(KAMPMNoSpace12hr)) || (KErrNotFound != timeFormat.Find(KAMPMNoSpace)))
   992                 {
   993                     strcat((char*) timeLocale, AMPM_NO_SPACE);
   994                 }
   995                 else
   996                 {
   997                     strcat((char*) timeLocale, AMPM_SPACE);
   998                 }
   999             }   
  1000         }
  1001                     
  1002         iTime_locale->ampm_fmt =  (const char*)  timeLocale;
  1003         iTime_locale->X_fmt = iTime_locale->ampm_fmt;
  1004         timeLocale += strlen((char*) timeLocale) + 1;
  1005     }
  1006     
  1007     TDateFormat aDateFormat = iLocale.DateFormat();
  1008     //Set date fromat string(D_FMT) 
  1009     TChar dateSeparator = iLocale.DateSeparator(1);
  1010     TBuf8<DECIMAL_THOUSAND_DATE_TIME_SEPARATOR> dateSeparator1;
  1011     dateSeparator1.Append(dateSeparator);
  1012     
  1013     TBuf8<DECIMAL_THOUSAND_DATE_TIME_SEPARATOR> dateSeparator2;
  1014     dateSeparator = iLocale.DateSeparator(2);
  1015     dateSeparator2.Append(dateSeparator);
  1016 
  1017     //Americal date formt(mm/dd/YYYY)
  1018     if(EDateAmerican == aDateFormat)
  1019     {
  1020         strcpy((char*) timeLocale, MONTH_STR);
  1021         strncat((char*) timeLocale, (char*) dateSeparator1.Ptr(), dateSeparator1.Length());
  1022         strcat((char*) timeLocale, DAY_STR);
  1023         strncat((char*) timeLocale, (char*) dateSeparator2.Ptr(), dateSeparator2.Length());
  1024         strcat((char*) timeLocale, YEAR_STR);
  1025         iTime_locale->x_fmt = (const char*)  timeLocale;
  1026     }
  1027     
  1028     //European date format(dd/mm/YYYY)
  1029     if(EDateEuropean == aDateFormat)
  1030     {
  1031         strcpy((char*) timeLocale, DAY_STR);
  1032         strncat((char*) timeLocale, (char*) dateSeparator1.Ptr(), dateSeparator1.Length());
  1033         strcat((char*) timeLocale, MONTH_STR);
  1034         strncat((char*) timeLocale, (char*) dateSeparator2.Ptr(), dateSeparator2.Length());
  1035         strcat((char*) timeLocale, YEAR_STR);
  1036         iTime_locale->x_fmt = (const char*)  timeLocale;
  1037     }
  1038     
  1039     //Japanese date format(YYYY/mm/dd)
  1040     if(EDateJapanese == aDateFormat)
  1041     {
  1042         strcpy((char*) timeLocale, YEAR_STR);
  1043         strncat((char*) timeLocale, (char*) dateSeparator1.Ptr(), dateSeparator1.Length());
  1044         strcat((char*) timeLocale, MONTH_STR);
  1045         strncat((char*) timeLocale, (char*) dateSeparator2.Ptr(), dateSeparator2.Length());
  1046         strcat((char*) timeLocale, DAY_STR);
  1047         iTime_locale->x_fmt = (const char*)  timeLocale;
  1048     }
  1049     
  1050     iTime_locale->md_order = iTime_locale->c_fmt = iTime_locale->date_fmt = (const char*) L"";
  1051             ;
  1052     timeLocale = startAddress;
  1053 
  1054 
  1055 
  1056 return 0;
  1057 }
  1058 #endif
  1059 TInt CLocale::TimeLoadLocaleL(const char* localeName)
  1060 {
  1061 #ifdef SYMBIAN_DISTINCT_LOCALE_MODEL
  1062 
  1063     if( ! iOldDllPresent)
  1064         {
  1065            TInt ret = TimeLoadNewLocaleL( localeName ); // option 2 to load language and region dll both
  1066            if( ret == -1 )
  1067                return -1;
  1068            return ret;
  1069         }
  1070 #endif
  1071     TText8* startAddress =  timeLocale;
  1072     #ifdef SYMBIAN_OE_ENHANCED_LOCALE_SUPPORT
  1073             TInt charsetID = -1;
  1074             if(localeName)
  1075             {
  1076                 charsetID = GetCharcaterSetIDL(localeName);
  1077                 if(charsetID == -1)
  1078                     {
  1079                         return -1;
  1080                     }
  1081             }
  1082     #else
  1083             TInt charsetID = GetCharcaterSetIDL(localeName);
  1084             if(charsetID == -1)
  1085             {
  1086                 return -1;
  1087             }
  1088     #endif
  1089 		
  1090 
  1091     #ifdef SYMBIAN_OE_ENHANCED_LOCALE_SUPPORT
  1092             else
  1093             {
  1094                 iLocale.Refresh();
  1095             }
  1096     #endif
  1097             //Set month and abbreviated month name information
  1098             for(TInt aMonth = 0 ; aMonth < MONTHS; aMonth++)
  1099             {
  1100    
  1101                 const TText16* month = ((reinterpret_cast<TText*const*>((const TText*) iData[FnMonthTable]()))[aMonth]);
  1102                 if(month)
  1103                 {
  1104     #ifdef SYMBIAN_OE_ENHANCED_LOCALE_SUPPORT
  1105                     if(!localeName)
  1106                     {
  1107                         ConvertToMultiByteCustom((TUint8*)timeLocale,  month);	
  1108                     }
  1109                     else	
  1110                     {
  1111     #endif
  1112                     ConvertToMultiByteL((TUint8*)timeLocale,  month, charsetID);
  1113     #ifdef SYMBIAN_OE_ENHANCED_LOCALE_SUPPORT
  1114                     }
  1115     #endif
  1116                     iTime_locale->month[aMonth] = (const char*)  timeLocale;
  1117                     iTime_locale->alt_month[aMonth] = (const char*)  timeLocale;
  1118                     timeLocale += strlen((char*) timeLocale) + 1;
  1119                 }
  1120     
  1121                 const TText16* abbMonth = ((reinterpret_cast<TText*const*>((const TText*) iData[FnMonthAbbTable]()))[aMonth]);
  1122                 if(abbMonth)
  1123                 {
  1124     #ifdef SYMBIAN_OE_ENHANCED_LOCALE_SUPPORT
  1125                     if(!localeName)
  1126                     {
  1127                         ConvertToMultiByteCustom((TUint8*)timeLocale,  abbMonth);	
  1128                     }
  1129                     else	
  1130                     {
  1131     #endif
  1132                     ConvertToMultiByteL((TUint8*)timeLocale, abbMonth, charsetID);	
  1133     #ifdef SYMBIAN_OE_ENHANCED_LOCALE_SUPPORT
  1134                     }
  1135     #endif
  1136                     iTime_locale->mon[aMonth] = (const char*)  timeLocale;
  1137                     timeLocale += strlen((char*) timeLocale) + 1;				
  1138                 }
  1139                             
  1140             }
  1141             
  1142             //Set day and abbreviated day name information
  1143     
  1144             const TText16* day = ((reinterpret_cast<TText*const*>((const TText*) iData[FnDayTable]()))[6]);
  1145             if(day)
  1146             {
  1147     #ifdef SYMBIAN_OE_ENHANCED_LOCALE_SUPPORT
  1148                 if(!localeName)
  1149                 {
  1150                     ConvertToMultiByteCustom((TUint8*)timeLocale,  day);	
  1151                 }
  1152                 else	
  1153                 {
  1154     #endif
  1155                 ConvertToMultiByteL((TUint8*)timeLocale, day, charsetID);
  1156     #ifdef SYMBIAN_OE_ENHANCED_LOCALE_SUPPORT
  1157                 }
  1158     #endif
  1159                 iTime_locale->weekday[0] = (const char*)  timeLocale;
  1160                 timeLocale += strlen((char*) timeLocale) + 1;				
  1161             }
  1162             
  1163     
  1164             const TText16* abbDay = ((reinterpret_cast<TText*const*>((const TText*) iData[FnDayAbbTable]()))[6]);
  1165             if(abbDay)
  1166             {
  1167     #ifdef SYMBIAN_OE_ENHANCED_LOCALE_SUPPORT
  1168                 if(!localeName)
  1169                 {
  1170                     ConvertToMultiByteCustom((TUint8*)timeLocale,  abbDay);	
  1171                 }
  1172                 else
  1173                 {
  1174     #endif
  1175                 
  1176                 ConvertToMultiByteL((TUint8*)timeLocale,  abbDay, charsetID);
  1177     #ifdef SYMBIAN_OE_ENHANCED_LOCALE_SUPPORT
  1178                 }
  1179     #endif
  1180                 iTime_locale->wday[0] = (const char*)  timeLocale;				
  1181                 timeLocale += strlen((char*) timeLocale) + 1;
  1182             }
  1183             
  1184             for(TInt aDay = 0 ; aDay < WEEKDAYS - 1; aDay++)
  1185             {
  1186     
  1187                 const TText16* day = ((reinterpret_cast<TText*const*>((const TText*) iData[FnDayTable]()))[aDay]);
  1188                 if(day)
  1189                 {
  1190     #ifdef SYMBIAN_OE_ENHANCED_LOCALE_SUPPORT
  1191                     if(!localeName)
  1192                     {
  1193                         ConvertToMultiByteCustom((TUint8*)timeLocale,  day);	
  1194                     }
  1195                     else	
  1196                     {
  1197     #endif
  1198                     ConvertToMultiByteL((TUint8*)timeLocale, day, charsetID);
  1199     #ifdef SYMBIAN_OE_ENHANCED_LOCALE_SUPPORT
  1200                     }
  1201     #endif
  1202                     iTime_locale->weekday[aDay + 1] = (const char*)  timeLocale;
  1203                     timeLocale += strlen((char*) timeLocale) + 1;				
  1204                 }
  1205                 
  1206     
  1207                 const TText16* abbDay = ((reinterpret_cast<TText*const*>((const TText*) iData[FnDayAbbTable]()))[aDay]);
  1208                 if(abbDay)
  1209                 {
  1210     #ifdef SYMBIAN_OE_ENHANCED_LOCALE_SUPPORT
  1211                     if(!localeName)
  1212                     {
  1213                         ConvertToMultiByteCustom((TUint8*)timeLocale,  abbDay);	
  1214                     }
  1215                     else	
  1216                     {
  1217     #endif
  1218                     ConvertToMultiByteL((TUint8*)timeLocale,  abbDay, charsetID);
  1219     #ifdef SYMBIAN_OE_ENHANCED_LOCALE_SUPPORT
  1220                     }  
  1221     #endif
  1222                     iTime_locale->wday[aDay + 1] = (const char*)  timeLocale;				
  1223                     timeLocale += strlen((char*) timeLocale) + 1;
  1224                 }
  1225                             
  1226             }
  1227             
  1228             //Set AM string
  1229     
  1230             const TText16* am = ((reinterpret_cast<TText*const*>((const TText*) iData[FnAmPmTable]()))[0]);
  1231             if(am)
  1232             {
  1233     #ifdef SYMBIAN_OE_ENHANCED_LOCALE_SUPPORT
  1234                 if(!localeName)
  1235                 {
  1236                     ConvertToMultiByteCustom((TUint8*)timeLocale,  am);	
  1237                 }
  1238                 else	
  1239                 {
  1240     #endif
  1241                 ConvertToMultiByteL((TUint8*)timeLocale, am, charsetID);
  1242     #ifdef SYMBIAN_OE_ENHANCED_LOCALE_SUPPORT
  1243                 }  
  1244     #endif
  1245                 iTime_locale->am = (const char*)  timeLocale;					
  1246                 timeLocale += strlen((char*) timeLocale) + 1;
  1247             }
  1248             
  1249             //Set PM string
  1250     
  1251             const TText16* pm = ((reinterpret_cast<TText*const*>((const TText*) iData[FnAmPmTable]()))[1]);
  1252             if(pm)
  1253             {
  1254     #ifdef SYMBIAN_OE_ENHANCED_LOCALE_SUPPORT
  1255                 if(!localeName)
  1256                 {
  1257                     ConvertToMultiByteCustom((TUint8*)timeLocale,  pm);	
  1258                 }
  1259                 else	
  1260                 {
  1261     #endif
  1262                 ConvertToMultiByteL((TUint8*)timeLocale, pm, charsetID);
  1263     #ifdef SYMBIAN_OE_ENHANCED_LOCALE_SUPPORT
  1264                 }  
  1265     #endif
  1266                 iTime_locale->pm = (const char*)  timeLocale;					
  1267                 timeLocale += strlen((char*) timeLocale) + 1;
  1268             }
  1269                     
  1270     
  1271             Mem::Copy(&iLocaleTimeDateFormat.iTimeFormatSpec[0], (const TAny*) iData[FnTimeFormatSpec](), sizeof(TText) * (KMaxTimeFormatSpec+1));
  1272             TText* timeForm = iLocaleTimeDateFormat.iTimeFormatSpec;
  1273             
  1274             //Set time format(T_FMT) and am/pm time format(T_FMT_AMPM) string
  1275             if(timeForm)
  1276             {
  1277                 const TPtrC time(timeForm);
  1278                 TBuf8<TIME_FORMAT_LENGTH> timeFormat;
  1279                 timeFormat.Copy(time);
  1280                 
  1281                 TChar timeSeparator = iLocale.TimeSeparator(1);
  1282                 TBuf8<DECIMAL_THOUSAND_DATE_TIME_SEPARATOR> timeSeparator1;
  1283                 timeSeparator1.Append(timeSeparator);
  1284                 
  1285                 timeSeparator = iLocale.TimeSeparator(2);
  1286                 TBuf8<DECIMAL_THOUSAND_DATE_TIME_SEPARATOR> timeSeparator2;
  1287                 timeSeparator2.Append(timeSeparator);
  1288                 
  1289                 TTimeFormat time12hror24hr = iLocale.TimeFormat();
  1290                 
  1291                 if(KErrNotFound != timeFormat.Locate('J'))
  1292                 {
  1293                     //Check for time format(12/24 hour format)
  1294                     if(time12hror24hr == ETime12)
  1295                     {
  1296                         strcpy((char*) timeLocale,TWELVE_HOUR_STR);
  1297                     }
  1298                     else
  1299                     {
  1300                         strcpy((char*) timeLocale,TWENTY_FOUR_HOUR_STR);
  1301                     }
  1302                 }
  1303                 
  1304                 else if(KErrNotFound != timeFormat.Locate('I'))
  1305                 {
  1306                     strcpy((char*) timeLocale,TWELVE_HOUR_STR);
  1307                 }	
  1308                 
  1309                 else if(KErrNotFound != timeFormat.Locate('H'))
  1310                 {
  1311                     strcpy((char*) timeLocale,TWENTY_FOUR_HOUR_STR);
  1312                 }	
  1313             
  1314                 strncat((char*) timeLocale, (char*) timeSeparator1.Ptr(), timeSeparator1.Length());
  1315                 strcat((char*) timeLocale, MINUTE_STR);
  1316                 strncat((char*) timeLocale, (char*) timeSeparator2.Ptr(), timeSeparator2.Length());
  1317                 strcat((char*) timeLocale, SECOND_STR);
  1318                 
  1319                 if(time12hror24hr == ETime12)
  1320                 {
  1321     
  1322                     if((KErrNotFound != timeFormat.Find(KAMPMSpace12hr)) || (KErrNotFound != timeFormat.Find(KAMPMSpace)) )
  1323                     {
  1324                         if((KErrNotFound != timeFormat.Find(KAMPMNoSpace12hr)) || (KErrNotFound != timeFormat.Find(KAMPMNoSpace)))
  1325                         {
  1326                             strcat((char*) timeLocale, AMPM_NO_SPACE);
  1327                         }
  1328                         else
  1329                         {
  1330                             strcat((char*) timeLocale, AMPM_SPACE);
  1331                         }
  1332                     }	
  1333                 }
  1334                             
  1335                 iTime_locale->ampm_fmt =  (const char*)  timeLocale;
  1336                 iTime_locale->X_fmt = iTime_locale->ampm_fmt;
  1337                 timeLocale += strlen((char*) timeLocale) + 1;
  1338             }
  1339             
  1340             TDateFormat aDateFormat = iLocale.DateFormat();
  1341             //Set date fromat string(D_FMT)	
  1342             TChar dateSeparator = iLocale.DateSeparator(1);
  1343             TBuf8<DECIMAL_THOUSAND_DATE_TIME_SEPARATOR> dateSeparator1;
  1344             dateSeparator1.Append(dateSeparator);
  1345             
  1346             TBuf8<DECIMAL_THOUSAND_DATE_TIME_SEPARATOR> dateSeparator2;
  1347             dateSeparator = iLocale.DateSeparator(2);
  1348             dateSeparator2.Append(dateSeparator);
  1349     
  1350             //Americal date formt(mm/dd/YYYY)
  1351             if(EDateAmerican == aDateFormat)
  1352             {
  1353                 strcpy((char*) timeLocale, MONTH_STR);
  1354                 strncat((char*) timeLocale, (char*) dateSeparator1.Ptr(), dateSeparator1.Length());
  1355                 strcat((char*) timeLocale, DAY_STR);
  1356                 strncat((char*) timeLocale, (char*) dateSeparator2.Ptr(), dateSeparator2.Length());
  1357                 strcat((char*) timeLocale, YEAR_STR);
  1358                 iTime_locale->x_fmt = (const char*)  timeLocale;
  1359             }
  1360             
  1361             //European date format(dd/mm/YYYY)
  1362             if(EDateEuropean == aDateFormat)
  1363             {
  1364                 strcpy((char*) timeLocale, DAY_STR);
  1365                 strncat((char*) timeLocale, (char*) dateSeparator1.Ptr(), dateSeparator1.Length());
  1366                 strcat((char*) timeLocale, MONTH_STR);
  1367                 strncat((char*) timeLocale, (char*) dateSeparator2.Ptr(), dateSeparator2.Length());
  1368                 strcat((char*) timeLocale, YEAR_STR);
  1369                 iTime_locale->x_fmt = (const char*)  timeLocale;
  1370             }
  1371             
  1372             //Japanese date format(YYYY/mm/dd)
  1373             if(EDateJapanese == aDateFormat)
  1374             {
  1375                 strcpy((char*) timeLocale, YEAR_STR);
  1376                 strncat((char*) timeLocale, (char*) dateSeparator1.Ptr(), dateSeparator1.Length());
  1377                 strcat((char*) timeLocale, MONTH_STR);
  1378                 strncat((char*) timeLocale, (char*) dateSeparator2.Ptr(), dateSeparator2.Length());
  1379                 strcat((char*) timeLocale, DAY_STR);
  1380                 iTime_locale->x_fmt = (const char*)  timeLocale;
  1381             }
  1382             
  1383             iTime_locale->md_order = iTime_locale->c_fmt = iTime_locale->date_fmt = (const char*) L"";
  1384                     ;
  1385             timeLocale = startAddress;
  1386             return 0;	
  1387 		
  1388 }
  1389 
  1390 struct lc_numeric_T* CLocale::GetCurrentNumericLocale(void)
  1391 {
  1392 
  1393 	if(NULL != iNumeric_locale)
  1394 	{
  1395 		return iNumeric_locale;	
  1396 	}
  1397 	return NULL;
  1398 	
  1399 }
  1400 
  1401 struct lc_monetary_T* CLocale::GetCurrentMonetaryLocale(void)
  1402 {
  1403 	if(NULL != iMonetary_locale)
  1404 	{
  1405 		return iMonetary_locale;	
  1406 	}
  1407 	return NULL;
  1408 }
  1409 
  1410 struct lc_time_T* CLocale::GetCurrentTimeLocale(void)
  1411 {
  1412 	if(NULL != iTime_locale)
  1413 	{
  1414 		return iTime_locale;
  1415 	}
  1416 	
  1417 	return NULL;
  1418 }
  1419 
  1420 
  1421 TInt CLocale::LoadLocale(TDesC& aLocale)
  1422 {
  1423     TPtrC src(aLocale);
  1424     TBuf8<LOCALE_LENGTH> locale_name;
  1425     locale_name.Copy(src);
  1426     char locale[LOCALE_LENGTH];
  1427     strncpy(locale, (char*) locale_name.Ptr(), locale_name.Length());
  1428     locale[locale_name.Length()] = '\0';
  1429     
  1430     if (NULL == strchr(locale, '.'))
  1431         {
  1432         return 0;
  1433         }
  1434 
  1435     // Open the file locale mapping(mapping of POSIX locale string to language variant DLL number) file
  1436     RFile file;
  1437     
  1438 #ifndef __EPOC32__
  1439     _LIT(localeFile, "\\resource\\openc\\locales.txt");
  1440 #else
  1441     TFileName localeFile;
  1442     GetInstallationDataDir(localeFile);
  1443     localeFile.Append(_L("locales.txt"));
  1444 #endif //__EPOC32__
  1445     
  1446     int retVal = file.Open(Backend()->FileSession(), localeFile, EFileRead);
  1447     if(KErrNone != retVal)
  1448         {
  1449         return 0;
  1450         }
  1451     
  1452     int pos = 0;
  1453     TBuf8<LOCALE_LENGTH> localeInfo;
  1454     retVal = ReadALine(file, pos, localeInfo);
  1455     char* buffer = (char*) localeInfo.Ptr();
  1456         
  1457     //Check whether locale is supported or not
  1458     int i = 0;
  1459     int flag = 0;
  1460     while( retVal > 0)
  1461     {
  1462         char str[LOCALE_LENGTH];
  1463         while(buffer[i] != '=')
  1464         {
  1465             str[i] = buffer[i];
  1466             i++;
  1467         }
  1468         str[i] = '\0';
  1469         if(!strcmp(str,locale))
  1470         {
  1471             flag = 1;
  1472             break;
  1473         }
  1474         i = 0;
  1475         retVal = ReadALine(file, pos, localeInfo);
  1476         buffer = (char*) localeInfo.Ptr();
  1477     }
  1478     if(flag)
  1479     {
  1480         DllName.Copy(KDllName);
  1481         DllName.Append('.');
  1482         i++;
  1483         int len = localeInfo.Length();
  1484         while(i < len)
  1485             {
  1486             DllName.Append(buffer[i]);  
  1487             i++;
  1488             }
  1489         file.Close();
  1490         return 1;   
  1491             }
  1492         
  1493         file.Close();
  1494         return 0;
  1495 
  1496 }
  1497 
  1498 
  1499 TInt CLocale::ConvertToMultiByteL(TUint8* aNarrowCharString, const TText16* aWideCharString, TInt  aCharsetUID)
  1500 {
  1501 	//Create a handle to a file server session and connect to the file server. 
  1502 	//Push it on to cleanup stack
  1503 	RFs fileSession;
  1504 	User::LeaveIfError(fileSession.Connect());
  1505 	CleanupClosePushL(fileSession);
  1506 	
  1507 	//Allocate and constructs a CCnvCharacterSetConverter object
  1508 	CCnvCharacterSetConverter* conv = CCnvCharacterSetConverter::NewLC();
  1509 
  1510 	//Search the character set array  containing all of the character sets for which conversion is available
  1511 	CCnvCharacterSetConverter::TAvailability  avail = conv->PrepareToConvertToOrFromL(aCharsetUID, fileSession);
  1512 	if(CCnvCharacterSetConverter::ENotAvailable == avail)
  1513 		{
  1514 			CleanupStack::PopAndDestroy(2);
  1515 			*aNarrowCharString = '\0';
  1516 			return -1;	
  1517 		}
  1518 		
  1519 	const TPtrC16 unicodeText(aWideCharString);
  1520 	TBuf8<NON_UNICODE_TEXT_BUFFER_LENGTH> nativeText;
  1521 	
  1522 	TInt retVal = KErrNone;
  1523 	TInt aNumberOfUnconvertibleCharacters = 0;
  1524 	TInt aIndexOfFirstByteOfFirstUnconvertibleCharacter = 0;
  1525 	
  1526 	//Convert text encoded in the Unicode character set (UCS-2) into other character sets
  1527 	retVal = conv->ConvertFromUnicode(nativeText,unicodeText, aNumberOfUnconvertibleCharacters, aIndexOfFirstByteOfFirstUnconvertibleCharacter);
  1528 	TInt returnCode = 0;
  1529 	//Check for illegal characters in the input
  1530 	if(retVal == CCnvCharacterSetConverter::EErrorIllFormedInput)
  1531 	{
  1532 		*aNarrowCharString = '\0';
  1533 		returnCode = -1;
  1534 	}
  1535 	
  1536 	//Check for incomplete characters in the input, set the errno accordingly
  1537 	else if(aNumberOfUnconvertibleCharacters)
  1538 	{
  1539 		*aNarrowCharString = '\0';
  1540 		returnCode = -1;
  1541 	}
  1542 	else
  1543 	{
  1544 	strncpy((char*) aNarrowCharString, (char*) nativeText.Ptr(), nativeText.Length());
  1545 	aNarrowCharString[nativeText.Length()] = '\0';
  1546 	returnCode = 0;
  1547 	}
  1548 	CleanupStack::PopAndDestroy(2); // conv, fileSession
  1549 	return returnCode;
  1550 	
  1551 }
  1552 
  1553 TInt CLocale::GetCharcaterSetIDL(const char* aLocaleName)
  1554 {
  1555 	//extract the charcate set name  from locale string
  1556 	char* temp = strchr(aLocaleName, '.');
  1557 	char locale[LOCALE_LENGTH];
  1558 	if(NULL == temp)
  1559 	{
  1560 		return -1;
  1561 	}
  1562 	temp++;
  1563 	int  j= 0;
  1564 	while((*temp != '@') && *temp != '\0')
  1565 	{
  1566 		locale[j++]	 = *temp++;
  1567 	}
  1568 	locale[j++] = '\0';
  1569 	
  1570 	//Create a handle to a file server session and connect to the file server. 
  1571 	//Push it on to cleanup stack
  1572 	RFs fileSession;
  1573 	User::LeaveIfError(fileSession.Connect());
  1574 	CleanupClosePushL(fileSession);
  1575 	
  1576 	TInt characterSetUID = 0;
  1577 	
  1578 	//Allocate and constructs a CCnvCharacterSetConverter object
  1579 	CCnvCharacterSetConverter* conv = CCnvCharacterSetConverter::NewLC() ;
  1580 		
  1581 	//Create an array identifying all the character sets for which conversion is available
  1582 	CArrayFix<CCnvCharacterSetConverter::SCharacterSet> *charSet = CCnvCharacterSetConverter::CreateArrayOfCharacterSetsAvailableL(fileSession);
  1583 	CleanupStack::PushL( charSet );
  1584 	
  1585 	TInt i = 0;
  1586 	//Get the number of character sets for which conversion is available
  1587 	TInt count = charSet->Count();
  1588 	while(i < count)
  1589 	{
  1590 		CCnvCharacterSetConverter::SCharacterSet characterSet = charSet->At(i);	
  1591 		i++;
  1592 		//Get the UID of character set for which conversion is available
  1593 		TUint charSetUID = characterSet.Identifier();
  1594 				
  1595 		const TBufC<CHARACTER_SET_NAME> charSetName = characterSet.NameIsFileName()?TParsePtrC(characterSet.Name()).Name():characterSet.Name();								
  1596 		TBuf8<CHARACTER_SET_NAME> aCharSetname;
  1597 		aCharSetname.Copy(charSetName);
  1598 	
  1599 		//Assign the character set UID
  1600 		if(!aCharSetname.Compare(TPtrC8((const TText8*) locale)))
  1601 		{
  1602 			characterSetUID = charSetUID;
  1603 			break;
  1604 		}
  1605 					
  1606 		HBufC8*  stdInterName = conv->ConvertCharacterSetIdentifierToStandardNameL(charSetUID, fileSession);					
  1607 		if(NULL != stdInterName)
  1608 		{
  1609 			if(!stdInterName->Compare(TPtrC8((const TText8*) locale)))
  1610 			{
  1611 				characterSetUID = charSetUID;
  1612 				delete stdInterName;
  1613 				stdInterName = NULL;		
  1614 				break;
  1615 			}
  1616 			delete stdInterName;
  1617 			stdInterName = NULL;			
  1618 		}
  1619 	}
  1620 	
  1621 	if(!characterSetUID)
  1622 	{
  1623 		characterSetUID =  -1;
  1624 	}
  1625 		
  1626 	CleanupStack::PopAndDestroy(3); //charSet, conv, fileSession
  1627 	return characterSetUID;
  1628 }
  1629 
  1630 /* ReadALine : Reads one line at a time from specified file */
  1631 inline TInt ReadALine(RFile& aFile, TInt& aPos, TDes8& aDesc)
  1632 	{
  1633 	TInt ret = aFile.Read(aPos, aDesc);
  1634 	TChar delimOne = '\r';
  1635 	TChar delimTwo = '\n';
  1636 	
  1637 	TInt len = aDesc.Length();
  1638 	if(!ret && len)
  1639 		{
  1640 		//Always assumes that each line will end with "\r\n" except the last line
  1641 		TInt pos = aDesc.Locate(delimOne);
  1642 		pos = aDesc.Locate(delimTwo);
  1643 			
  1644 		if(KErrNotFound != pos)
  1645 			{
  1646 			aPos = aPos + pos + 1;
  1647 			len = pos - 1;
  1648 			aDesc.SetLength(len);
  1649 			}
  1650 		else
  1651 			{
  1652 			aPos = aPos + len;
  1653 			}
  1654 		}
  1655 	return len;
  1656 	}
  1657 #ifdef SYMBIAN_OE_ENHANCED_LOCALE_SUPPORT
  1658 
  1659 void CLocale::ConvertToMultiByteCustom(TUint8* aNarrowCharString, const TText16* aWideCharString)
  1660 	{
  1661 	const TPtrC unicodeText(aWideCharString);
  1662 	TBuf8<NON_UNICODE_TEXT_BUFFER_LENGTH> nativeText;
  1663     nativeText.Copy(unicodeText);
  1664     strncpy((char*) aNarrowCharString, (char*) nativeText.Ptr(), nativeText.Length());
  1665     aNarrowCharString[nativeText.Length()] = '\0';
  1666 	}
  1667 
  1668 TInt CLocale::SyncLocale(TLocaleAspect aspect)
  1669 	{   
  1670 #ifdef SYMBIAN_DISTINCT_LOCALE_MODEL
  1671 	TBuf<NON_UNICODE_TEXT_BUFFER_LENGTH> reg_dllname;
  1672 #endif
  1673 	TBuf<NON_UNICODE_TEXT_BUFFER_LENGTH> Kdname;
  1674 	TExtendedLocale locale;
  1675     locale.LoadSystemSettings();
  1676     locale.GetLocaleDllName(aspect,Kdname);
  1677 #ifdef SYMBIAN_DISTINCT_LOCALE_MODEL
  1678     // check if the new  dlls is present then load it or go for old dll
  1679     if( Kdname.FindC(_L("elocl.")) == KErrNotFound ) 
  1680         {
  1681         iOldDllPresent = 0;
  1682         locale.GetLocaleDllName(ELocaleTimeDateSettings,reg_dllname);
  1683         return (GetSystemLocale(Kdname,reg_dllname ));
  1684         }
  1685     else
  1686         iOldDllPresent = 1;
  1687 #endif
  1688     return (GetSystemLocale(Kdname));
  1689 	}
  1690 
  1691 const TText* CLocale::GetLocaleName(void)
  1692 	{
  1693 	TPtrC dllname(DllName);
  1694 	return dllname.Ptr();
  1695 	}
  1696 
  1697 
  1698 #ifdef SYMBIAN_DISTINCT_LOCALE_MODEL
  1699     
  1700 const TText* CLocale::GetCollateLocaleName(void)
  1701     {
  1702         TPtrC dllname(ColDllName);
  1703         return dllname.Ptr(); 
  1704      }
  1705 #endif
  1706 
  1707 
  1708 #endif // SYMBIAN_OE_ENHANCED_LOCALE_SUPPORT
  1709 
  1710 
  1711 
  1712