summaryrefslogtreecommitdiff
path: root/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c
diff options
context:
space:
mode:
Diffstat (limited to 'ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c')
-rw-r--r--ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c32
1 files changed, 14 insertions, 18 deletions
diff --git a/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c b/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c
index 0c78d0da2..515fab329 100644
--- a/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c
+++ b/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c
@@ -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);
}