|
1 /* |
|
2 * Copyright (c) 2007-2008 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: Localisation utility for UI visible strings |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 // CLASS HEADER |
|
23 #include "shwresourceutility.h" |
|
24 |
|
25 // EXTERNAL INCLUDES |
|
26 #include <StringLoader.h> |
|
27 #include <AknUtils.h> |
|
28 #include <bautils.h> // for BaflUtils |
|
29 #include <data_caging_path_literals.hrh> // for KDC_APP_RESOURCE_DIR |
|
30 |
|
31 // INTERNAL INCLUDES |
|
32 #include <glxresourceutilities.h> // for CGlxResourceUtilities |
|
33 #include <glxlog.h> |
|
34 #include <glxtracer.h> |
|
35 |
|
36 _LIT(KShwSlideshowEngineResource, "shwslideshowengine.rsc"); |
|
37 |
|
38 // ----------------------------------------------------------------------------- |
|
39 // LocalisedNameL |
|
40 // ----------------------------------------------------------------------------- |
|
41 HBufC* ShwResourceUtility::LocalisedNameL(TInt aResourceId) |
|
42 { |
|
43 TRACER(" ShwResourceUtility::LocalisedNameL"); |
|
44 GLX_LOG_INFO( "ShwResourceUtility::LocalisedNameL" ); |
|
45 // Load the engine's resource |
|
46 TFileName resourceFile( KDC_APP_RESOURCE_DIR ); |
|
47 // append resource file name |
|
48 resourceFile.Append( KShwSlideshowEngineResource ); |
|
49 // add the application path |
|
50 CGlxResourceUtilities::GetResourceFilenameL( resourceFile ); |
|
51 // add the resource to CCoeEnv |
|
52 TInt id = CCoeEnv::Static()->AddResourceFileL( resourceFile ); |
|
53 // read the string and return it |
|
54 HBufC* tmp = CCoeEnv::Static()->AllocReadResourceL( aResourceId ); |
|
55 // remove the resource as its not needed anymore |
|
56 CCoeEnv::Static()->DeleteResourceFile( id ); |
|
57 // return the string and ownership |
|
58 return tmp; |
|
59 } |