/* Initialize Lang or PlatformLang variable, if Lang or PlatformLang variable is not found, or it has been set to an unsupported value(not one of platform supported language codes), set the default language code to it. */
VOID InitializeLangVariable(IN CHAR16 *LangName, IN CHAR8 *SupportedLang, IN CHAR8 *DefaultLang, IN BOOLEAN Iso639Language)
/* Initialize Lang or PlatformLang variable, if Lang or PlatformLang variable is not found, or it has been set to an unsupported value(not one of platform supported language codes), set the default language code to it. */
VOID InitializeLangVariable(IN CHAR16 *LangName, IN CHAR8 *SupportedLang, IN CHAR8 *DefaultLang, IN BOOLEAN Iso639Language)
{
  CHAR8  *Lang;
  GetEfiGlobalVariable2 (LangName, (VOID **)&Lang, NULL);
  if ((Lang == NULL) || !IsLangInSupportedLangCodes (SupportedLang, Lang, Iso639Language)) {
    ASSERT (IsLangInSupportedLangCodes (SupportedLang, DefaultLang, Iso639Language));
    BdsDxeSetVariableAndReportStatusCodeOnError (
      LangName,
      &gEfiGlobalVariableGuid,
      EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
      AsciiStrSize (DefaultLang),
      DefaultLang
      );
  }
  if (Lang != NULL) {
    FreePool (Lang);
  }
}