summaryrefslogtreecommitdiff
path: root/MdePkg/Library/HiiLib
diff options
context:
space:
mode:
authorqwang12 <qwang12@6f19259b-4bc3-4df7-8a09-765794883524>2008-05-22 00:59:42 +0000
committerqwang12 <qwang12@6f19259b-4bc3-4df7-8a09-765794883524>2008-05-22 00:59:42 +0000
commit2d81bfb9832ec5612e18501ea04227acc1e2b221 (patch)
treeebaa065c86f6398ffbdaf97e8b19bf8e21cf68ca /MdePkg/Library/HiiLib
parent6fd5fbe3ec4ac0852b276f37127603c198df57af (diff)
downloadedk2-platforms-2d81bfb9832ec5612e18501ea04227acc1e2b221.tar.xz
Add in ConvertIso639LanguageToRfc3066Language API.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@5268 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdePkg/Library/HiiLib')
-rw-r--r--MdePkg/Library/HiiLib/HiiString.c38
1 files changed, 38 insertions, 0 deletions
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
@@ -416,6 +416,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".