This section describes how to call functions of BaflUtils to get an equivalent language list and a nearest equivalent language.
This tutorial assumes that you have an understanding of the following topics:
Equivalent Language Reference explains the equivalent language table, including the equivalent language list and its priority.
About Application Resources describes the purpose of resource files.
How to Localize Resources describes language-neutral and language-dependent resource files.
BaflUtils provides the following two static functions to get the equivalent language list and a nearest equivalent language:
GetEquivalentLanguageList(TLanguage aLang, TLanguagePath& aEquivalents)
For a given language (TLanguage), it returns an array (TLanguagePath) which contains the equivalent languages. If no equivalent language is found, ELangNone is returned.
NearestLanguageFileV2(const RFs& aFs,TFileName& aName, TLanguage& aLanguage)
A TLanguage value is used at the end of a resource file name to identify a resource file for a language. For example, filename.r01 and filename.r02 are the English and French versions of the filename.rsc resource file.
An application calls BaflUtils::NearestLanguageFileV2() to determine which localized resource file is the closest to the current system language. The function searches the following drives in the given sequence for the available resource files, which have the same file name (without extension) as aName. Once the resource files are searched on a drive, the function stops searching on the next drive.
The custom resource drive if it is set using the HAL::ECustomResourceDrive attribute or the legacy HAL::ESystemDrive attribute.
The optional drive if it is specified in the aName parameter.
Z: drive if the optional drive is not set in the aName parameter.
The current system language is then taken as a given language. All the available resource file names are prioritized according to the equivalent language list. The resource file name with the highest priority is returned.