Getting
a Nearest Equivalent Language
In this example, the system language is ELangCanadianEnglish and
there is no exact match of the resource file on the system. The application
calls BaflUtils::NearestLanguageFileV2() to get the closest
match. There are three available resource files:
c:\FileMenu.rsc is
the language-neutral resource file.
c:\FileMenu.r01 is
for ELangEnglish.
c:\FileMenu.r10 is
for ELangAmerican.
In the application, define a string with the neutral-language resource
file name.
_LIT(KRscFilename, "C:\\FileMenu.rsc");
Create a session with the File Server to search the file system for
available resource files.
RFs fileServerSession;
CleanupClosePushL(fileServerSession);
User::LeaveIfError(fileServerSession.Connect());
Construct a buffer to save a resource file name. The buffer takes
the neutral-language resource file name as a input parameter to
BaflUtils::NearestLanguageFileV2().
It will be updated with a new value after the call.
TBuf<256> filename;
filename.Copy(KRscFilename);
Define a
TLanguage as a return parameter for the
nearest equivalent language.
TLanguage lang=ELangNone;
Get the nearest language.
BaflUtils::NearestLanguageFileV2(fileServerSession, filename, lang);
...
Close the session with the File Server.
CleanupStack::PopAndDestroy (&fileServerSession);
The filename parameter is updated as "c:\\FileMenu.r10" which
is the closest resource file for ELangCanadianEnglish. The lang parameter
is returned as ELangAmerican (value 10) which is the nearest
equivalent language.
Copyright ©2010 Nokia Corporation and/or its subsidiary(-ies).
All rights
reserved. Unless otherwise stated, these materials are provided under the terms of the Eclipse Public License
v1.0.