Refine the select language logic.
Signed-off-by: Eric Dong <eric.dong@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com> Reviewed-by: Jaben Carsey <Jaben.carsey@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14629 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
/** @file
|
||||
Provides interface to advanced shell functionality for parsing both handle and protocol database.
|
||||
|
||||
Copyright (c) 2010 - 2012, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2010 - 2013, Intel Corporation. All rights reserved.<BR>
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
@ -778,18 +778,21 @@ GetGuidFromStringName(
|
||||
/**
|
||||
Get best support language for this driver.
|
||||
|
||||
First base on the current platform used language to search,Second base on the
|
||||
default language to search. The caller need to free the buffer of the best
|
||||
language.
|
||||
First base on the user input language to search, second base on the current
|
||||
platform used language to search, third get the first language from the
|
||||
support language list. The caller need to free the buffer of the best language.
|
||||
|
||||
@param[in] SupportedLanguages The support languages for this driver.
|
||||
@param[in] InputLanguage The user input language.
|
||||
@param[in] Iso639Language Whether get language for ISO639.
|
||||
|
||||
@return The best support language for this driver.
|
||||
**/
|
||||
CHAR8 *
|
||||
EFIAPI
|
||||
GetBestLanguageForDriver (
|
||||
IN CONST CHAR8 *SupportedLanguages,
|
||||
IN CONST CHAR8 *SupportedLanguages,
|
||||
IN CONST CHAR8 *InputLanguage,
|
||||
IN BOOLEAN Iso639Language
|
||||
)
|
||||
{
|
||||
@ -801,8 +804,9 @@ GetBestLanguageForDriver (
|
||||
BestLanguage = GetBestLanguage(
|
||||
SupportedLanguages,
|
||||
Iso639Language,
|
||||
(InputLanguage != NULL) ? InputLanguage : "",
|
||||
(LanguageVariable != NULL) ? LanguageVariable : "",
|
||||
Iso639Language ? "en" : "en-US",
|
||||
SupportedLanguages,
|
||||
NULL
|
||||
);
|
||||
|
||||
@ -845,12 +849,8 @@ GetStringNameFromHandle(
|
||||
NULL,
|
||||
EFI_OPEN_PROTOCOL_GET_PROTOCOL);
|
||||
if (!EFI_ERROR(Status)) {
|
||||
if (Language == NULL) {
|
||||
BestLang = GetBestLanguageForDriver (CompNameStruct->SupportedLanguages, FALSE);
|
||||
Language = BestLang;
|
||||
}
|
||||
Status = CompNameStruct->GetDriverName(CompNameStruct, (CHAR8*)Language, &RetVal);
|
||||
|
||||
BestLang = GetBestLanguageForDriver (CompNameStruct->SupportedLanguages, Language, FALSE);
|
||||
Status = CompNameStruct->GetDriverName(CompNameStruct, BestLang, &RetVal);
|
||||
if (BestLang != NULL) {
|
||||
FreePool (BestLang);
|
||||
BestLang = NULL;
|
||||
@ -867,12 +867,8 @@ GetStringNameFromHandle(
|
||||
NULL,
|
||||
EFI_OPEN_PROTOCOL_GET_PROTOCOL);
|
||||
if (!EFI_ERROR(Status)) {
|
||||
if (Language == NULL) {
|
||||
BestLang = GetBestLanguageForDriver (CompNameStruct->SupportedLanguages, FALSE);
|
||||
Language = BestLang;
|
||||
}
|
||||
Status = CompNameStruct->GetDriverName(CompNameStruct, (CHAR8*)Language, &RetVal);
|
||||
|
||||
BestLang = GetBestLanguageForDriver (CompNameStruct->SupportedLanguages, Language, FALSE);
|
||||
Status = CompNameStruct->GetDriverName(CompNameStruct, BestLang, &RetVal);
|
||||
if (BestLang != NULL) {
|
||||
FreePool (BestLang);
|
||||
}
|
||||
|
Reference in New Issue
Block a user