/* 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. */
CHAR8* EFIAPI GetBestLanguageForDriver(IN CONST CHAR8 *SupportedLanguages, IN CONST CHAR8 *InputLanguage, IN BOOLEAN Iso639Language)
/* 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. */
CHAR8* EFIAPI GetBestLanguageForDriver(IN CONST CHAR8 *SupportedLanguages, IN CONST CHAR8 *InputLanguage, IN BOOLEAN Iso639Language)
{
  CHAR8  *LanguageVariable;
  CHAR8  *BestLanguage;
  GetVariable2 (Iso639Language ? L"Lang" : L"PlatformLang", &gEfiGlobalVariableGuid, (VOID **)&LanguageVariable, NULL);
  BestLanguage = GetBestLanguage (
                   SupportedLanguages,
                   Iso639Language,
                   (InputLanguage != NULL) ? InputLanguage : "",
                   (LanguageVariable != NULL) ? LanguageVariable : "",
                   SupportedLanguages,
                   NULL
                   );
  if (LanguageVariable != NULL) {
    FreePool (LanguageVariable);
  }
  return BestLanguage;
}