improve platformlangcodes/langcodes and platformlang/lang autoupdate mechanism.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@8185 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
eric_tian 2009-04-27 07:12:20 +00:00
parent 72399daee4
commit d357145fca
2 changed files with 7 additions and 22 deletions

View File

@ -156,7 +156,6 @@ FrontPageCallback (
CHAR8 *LanguageString; CHAR8 *LanguageString;
CHAR8 *LangCode; CHAR8 *LangCode;
CHAR8 *Lang; CHAR8 *Lang;
CHAR8 OldLang[ISO_639_2_ENTRY_SIZE];
UINTN Index; UINTN Index;
EFI_STATUS Status; EFI_STATUS Status;
CHAR8 *PlatformSupportedLanguages; CHAR8 *PlatformSupportedLanguages;
@ -230,23 +229,9 @@ FrontPageCallback (
AsciiStrSize (BestLanguage), AsciiStrSize (BestLanguage),
Lang Lang
); );
if (!FeaturePcdGet (PcdUefiVariableDefaultLangDeprecate)) {
//
// Set UEFI deprecated variable "Lang" for backwards compatibility
//
Status = ConvertRfc3066LanguageToIso639Language (BestLanguage, OldLang);
if (!EFI_ERROR (Status)) {
Status = gRT->SetVariable (
L"Lang",
&gEfiGlobalVariableGuid,
EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
ISO_639_2_ENTRY_SIZE,
OldLang
);
}
}
FreePool (BestLanguage); FreePool (BestLanguage);
} else {
ASSERT (FALSE);
} }
FreePool (PlatformSupportedLanguages); FreePool (PlatformSupportedLanguages);

View File

@ -504,7 +504,7 @@ InitializeLanguage (
EFI_STATUS Status; EFI_STATUS Status;
UINTN Size; UINTN Size;
CHAR8 *Lang; CHAR8 *Lang;
CHAR8 LangCode[ISO_639_2_ENTRY_SIZE]; CHAR8 LangCode[ISO_639_2_ENTRY_SIZE + 1];
CHAR8 *LangCodes; CHAR8 *LangCodes;
CHAR8 *PlatformLang; CHAR8 *PlatformLang;
CHAR8 *PlatformLangCodes; CHAR8 *PlatformLangCodes;
@ -523,7 +523,7 @@ InitializeLanguage (
L"LangCodes", L"LangCodes",
&gEfiGlobalVariableGuid, &gEfiGlobalVariableGuid,
EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS, EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
AsciiStrLen (LangCodes), AsciiStrSize (LangCodes),
LangCodes LangCodes
); );
} }
@ -547,7 +547,7 @@ InitializeLanguage (
// //
// Find current LangCode from Lang NV Variable // Find current LangCode from Lang NV Variable
// //
Size = ISO_639_2_ENTRY_SIZE; Size = ISO_639_2_ENTRY_SIZE + 1;
Status = gRT->GetVariable ( Status = gRT->GetVariable (
L"Lang", L"Lang",
&gEfiGlobalVariableGuid, &gEfiGlobalVariableGuid,
@ -576,7 +576,7 @@ InitializeLanguage (
L"Lang", L"Lang",
&gEfiGlobalVariableGuid, &gEfiGlobalVariableGuid,
EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS, EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
ISO_639_2_ENTRY_SIZE, ISO_639_2_ENTRY_SIZE + 1,
Lang Lang
); );
} }