Roll back changes to apply GetBestLanguage() in HiiDataBase. Exact language match should be used in HiiDatabase.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@8384 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
rsun3
2009-05-26 03:48:50 +00:00
parent b0a5e682d6
commit f324bf4dbe
4 changed files with 109 additions and 79 deletions

View File

@@ -307,7 +307,6 @@ HiiThunkGetString (
Private = HII_THUNK_PRIVATE_DATA_FROM_THIS(This);
Iso639AsciiLanguage = NULL;
Rfc4646AsciiLanguage = NULL;
if (LanguageString != NULL) {
@@ -322,6 +321,7 @@ HiiThunkGetString (
// in Iso639. So map it to the Language Identifier defined in RFC4646.
//
Rfc4646AsciiLanguage = ConvertLanguagesIso639ToRfc4646 (Iso639AsciiLanguage);
FreePool (Iso639AsciiLanguage);
//
// If Rfc4646AsciiLanguage is NULL, more language mapping must be added to
@@ -337,67 +337,56 @@ HiiThunkGetString (
goto Done;
}
if (Rfc4646AsciiLanguage == NULL) {
//
// Get the languages that the package specified by HiiHandle supports
//
SupportedLanguages = HiiGetSupportedLanguages (UefiHiiHandle);
if (SupportedLanguages == NULL) {
goto Error2;
}
//
// Get the current platform language setting
//
PlatformLanguage = GetEfiGlobalVariable (L"PlatformLang");
if (PlatformLanguage == NULL) {
goto Error1;
}
//
// Get the best matching language from SupportedLanguages
//
BestLanguage = GetBestLanguage (
SupportedLanguages,
FALSE, // RFC 4646 mode
PlatformLanguage, // Next highest priority
SupportedLanguages, // Lowest priority
NULL
);
if (BestLanguage == NULL) {
FreePool (PlatformLanguage);
Error1:
FreePool (SupportedLanguages);
Error2:
Status = EFI_INVALID_PARAMETER;
goto Done;
}
Status = mHiiStringProtocol->GetString (
mHiiStringProtocol,
BestLanguage,
UefiHiiHandle,
Token,
StringBuffer,
BufferLengthTemp,
NULL
);
FreePool (BestLanguage);
} else {
Status = mHiiStringProtocol->GetString (
mHiiStringProtocol,
Rfc4646AsciiLanguage,
UefiHiiHandle,
Token,
StringBuffer,
BufferLengthTemp,
NULL
);
//
// Get the languages that the package specified by HiiHandle supports
//
SupportedLanguages = HiiGetSupportedLanguages (UefiHiiHandle);
if (SupportedLanguages == NULL) {
goto Error2;
}
//
// Get the current platform language setting
//
PlatformLanguage = GetEfiGlobalVariable (L"PlatformLang");
if (PlatformLanguage == NULL) {
goto Error1;
}
//
// Get the best matching language from SupportedLanguages
//
BestLanguage = GetBestLanguage (
SupportedLanguages,
FALSE, // RFC 4646 mode
(Rfc4646AsciiLanguage != NULL) ? Rfc4646AsciiLanguage : "",
PlatformLanguage, // Next highest priority
SupportedLanguages, // Lowest priority
NULL
);
if (BestLanguage == NULL) {
FreePool (PlatformLanguage);
Error1:
FreePool (SupportedLanguages);
Error2:
Status = EFI_INVALID_PARAMETER;
goto Done;
}
Status = mHiiStringProtocol->GetString (
mHiiStringProtocol,
BestLanguage,
UefiHiiHandle,
Token,
StringBuffer,
BufferLengthTemp,
NULL
);
FreePool (BestLanguage);
Done:
if (Iso639AsciiLanguage != NULL) {
FreePool (Iso639AsciiLanguage);
if (Rfc4646AsciiLanguage != NULL) {
FreePool (Rfc4646AsciiLanguage);
}
return Status;