ncdengine/provider/client/src/ncdlocalizerutils.cpp
changeset 0 ba25891c3a9e
equal deleted inserted replaced
-1:000000000000 0:ba25891c3a9e
       
     1 /*
       
     2 * Copyright (c) 2006 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:   CNcdLocalizerUtils implementation
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include "ncdlocalizerutils.h"
       
    20 #include "catalogsdebug.h"
       
    21 #include "ncdclientlocalizer.h"
       
    22 #include "ncdstring.h"
       
    23 
       
    24 const TDesC& CNcdLocalizerUtils::LocalizedString(
       
    25     const CNcdString& aString,
       
    26     MNcdClientLocalizer* aLocalizer,
       
    27     HBufC*& aDescriptor ) 
       
    28     {
       
    29     DLTRACEIN((""));
       
    30     if ( aDescriptor ) 
       
    31         {
       
    32         return *aDescriptor;
       
    33         }
       
    34         
       
    35     if ( aString.Data() != KNullDesC || aString.Key() == KNullDesC ) 
       
    36         {
       
    37         return aString.Data();
       
    38         }
       
    39     else if ( aLocalizer )
       
    40         {
       
    41         aDescriptor = aLocalizer->LocalizeString( aString.Key() );
       
    42         if ( !aDescriptor ) 
       
    43             {
       
    44             return KNullDesC;
       
    45             }
       
    46         else 
       
    47             {            
       
    48             return *aDescriptor;
       
    49             }
       
    50         }
       
    51     else 
       
    52         {
       
    53         return KNullDesC;
       
    54         }
       
    55     }