From 2d81bfb9832ec5612e18501ea04227acc1e2b221 Mon Sep 17 00:00:00 2001 From: qwang12 Date: Thu, 22 May 2008 00:59:42 +0000 Subject: Add in ConvertIso639LanguageToRfc3066Language API. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@5268 6f19259b-4bc3-4df7-8a09-765794883524 --- MdePkg/Library/HiiLib/HiiString.c | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) (limited to 'MdePkg/Library/HiiLib') diff --git a/MdePkg/Library/HiiLib/HiiString.c b/MdePkg/Library/HiiLib/HiiString.c index b28a955d81..2df4b47c38 100644 --- a/MdePkg/Library/HiiLib/HiiString.c +++ b/MdePkg/Library/HiiLib/HiiString.c @@ -415,6 +415,44 @@ ConvertRfc3066LanguageToIso639Language ( } +/** + Convert language code from ISO639-2 to RFC3066. + + LanguageIso639 contain a single ISO639-2 code such as + "eng" or "fra". + + The LanguageRfc3066 must be a buffer large enough + for RFC_3066_ENTRY_SIZE characters. + + If LanguageIso639 is NULL, then ASSERT. + If LanguageRfc3066 is NULL, then ASSERT. + + @param LanguageIso639 ISO639-2 language code. + @param LanguageRfc3066 RFC3066 language code. + + @retval EFI_SUCCESS Language code converted. + @retval EFI_NOT_FOUND Language code not found. + +**/ +EFI_STATUS +EFIAPI +ConvertIso639LanguageToRfc3066Language ( + IN CONST CHAR8 *LanguageIso639, + OUT CHAR8 *LanguageRfc3066 + ) +{ + UINTN Index; + + for (Index = 0; Iso639ToRfc3066ConversionTable[Index] != 0; Index += 5) { + if (CompareMem (LanguageIso639, &Iso639ToRfc3066ConversionTable[Index], 3) == 0) { + CopyMem (LanguageRfc3066, &Iso639ToRfc3066ConversionTable[Index + 3], 2); + return EFI_SUCCESS; + } + } + + return EFI_NOT_FOUND; +} + /** Convert language code list from RFC3066 to ISO639-2, e.g. "en-US;fr-FR" will be converted to "engfra". -- cgit v1.2.3