diff options
author | rsun3 <rsun3@6f19259b-4bc3-4df7-8a09-765794883524> | 2009-04-16 08:46:28 +0000 |
---|---|---|
committer | rsun3 <rsun3@6f19259b-4bc3-4df7-8a09-765794883524> | 2009-04-16 08:46:28 +0000 |
commit | ad5a96ab2daeeac53f0c924113f23dc931f965c5 (patch) | |
tree | a11c8b0b96a6b52fda679436870e7ac3d87142d3 /EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk | |
parent | 887c077d91a648a5e206cc19790878ebf521745e (diff) | |
download | edk2-platforms-ad5a96ab2daeeac53f0c924113f23dc931f965c5.tar.xz |
Retire language conversion APIs from HII library class.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@8104 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk')
-rw-r--r-- | EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/HiiDatabase.h | 49 | ||||
-rw-r--r-- | EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/Strings.c | 216 |
2 files changed, 265 insertions, 0 deletions
diff --git a/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/HiiDatabase.h b/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/HiiDatabase.h index a1e9c1a4c6..1583745d80 100644 --- a/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/HiiDatabase.h +++ b/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/HiiDatabase.h @@ -480,6 +480,55 @@ InitSetBrowserStrings ( )
;
+/**
+ Convert language code from RFC3066 to ISO639-2.
+
+ LanguageRfc3066 contain a single RFC 3066 code such as
+ "en-US" or "fr-FR".
+
+ The LanguageRfc3066 must be a buffer large enough
+ for ISO_639_2_ENTRY_SIZE characters.
+
+ If LanguageRfc3066 is NULL, then ASSERT.
+ If LanguageIso639 is NULL, then ASSERT.
+
+ @param LanguageRfc3066 RFC3066 language code.
+ @param LanguageIso639 ISO639-2 language code.
+
+ @retval EFI_SUCCESS Language code converted.
+ @retval EFI_NOT_FOUND Language code not found.
+
+**/
+EFI_STATUS
+EFIAPI
+ConvertRfc3066LanguageToIso639Language (
+ IN CHAR8 *LanguageRfc3066,
+ OUT CHAR8 *LanguageIso639
+ )
+;
+
+/**
+ Convert language code from ISO639-2 to RFC3066 and return the converted language.
+ Caller is responsible for freeing the allocated buffer.
+
+ LanguageIso639 contain a single ISO639-2 code such as
+ "eng" or "fra".
+
+ If LanguageIso639 is NULL, then ASSERT.
+ If LanguageRfc3066 is NULL, then ASSERT.
+
+ @param LanguageIso639 ISO639-2 language code.
+
+ @return the allocated buffer or NULL, if the language is not found.
+
+**/
+CHAR8*
+EFIAPI
+ConvertIso639LanguageToRfc3066Language (
+ IN CONST CHAR8 *LanguageIso639
+ )
+;
+
#include "Utility.h"
#include "ConfigAccess.h"
diff --git a/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/Strings.c b/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/Strings.c index 05a885cc8f..caa702d5dd 100644 --- a/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/Strings.c +++ b/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/Strings.c @@ -25,6 +25,150 @@ ISO639TORFC3066MAP Iso639ToRfc3066Map [] = { {"fra", "fr-FR"},
};
+//
+// Lookup table of ISO639-2 3 character language codes to ISO 639-1 2 character language codes
+// Each entry is 5 CHAR8 values long. The first 3 CHAR8 values are the ISO 639-2 code.
+// The last 2 CHAR8 values are the ISO 639-1 code.
+//
+GLOBAL_REMOVE_IF_UNREFERENCED CONST CHAR8 Iso639ToRfc3066ConversionTable[] =
+"\
+aaraa\
+abkab\
+afraf\
+amham\
+araar\
+asmas\
+aymay\
+azeaz\
+bakba\
+belbe\
+benbn\
+bihbh\
+bisbi\
+bodbo\
+brebr\
+bulbg\
+catca\
+cescs\
+corkw\
+cosco\
+cymcy\
+danda\
+deude\
+dzodz\
+ellel\
+engen\
+epoeo\
+estet\
+euseu\
+faofo\
+fasfa\
+fijfj\
+finfi\
+frafr\
+fryfy\
+gaiga\
+gdhgd\
+glggl\
+grngn\
+gujgu\
+hauha\
+hebhe\
+hinhi\
+hrvhr\
+hunhu\
+hyehy\
+ikuiu\
+ileie\
+inaia\
+indid\
+ipkik\
+islis\
+itait\
+jawjw\
+jpnja\
+kalkl\
+kankn\
+kasks\
+katka\
+kazkk\
+khmkm\
+kinrw\
+kirky\
+korko\
+kurku\
+laolo\
+latla\
+lavlv\
+linln\
+litlt\
+ltzlb\
+malml\
+marmr\
+mkdmk\
+mlgmg\
+mltmt\
+molmo\
+monmn\
+mrimi\
+msams\
+myamy\
+nauna\
+nepne\
+nldnl\
+norno\
+ocioc\
+ormom\
+panpa\
+polpl\
+porpt\
+pusps\
+quequ\
+rohrm\
+ronro\
+runrn\
+rusru\
+sagsg\
+sansa\
+sinsi\
+slksk\
+slvsl\
+smise\
+smosm\
+snasn\
+sndsd\
+somso\
+sotst\
+spaes\
+sqisq\
+srpsr\
+sswss\
+sunsu\
+swasw\
+swesv\
+tamta\
+tattt\
+telte\
+tgktg\
+tgltl\
+thath\
+tsnts\
+tuktk\
+twitw\
+uigug\
+ukruk\
+urdur\
+uzbuz\
+vievi\
+volvo\
+wolwo\
+xhoxh\
+yidyi\
+zhaza\
+zhozh\
+zulzu\
+";
+
CHAR8 *
ConvertIso639ToRfc3066 (
CHAR8 *Iso638Lang
@@ -52,6 +196,78 @@ ConvertIso639ToRfc3066 ( }
/**
+ Convert language code from RFC3066 to ISO639-2.
+
+ @param LanguageRfc3066 RFC3066 language code.
+ @param LanguageIso639 ISO639-2 language code.
+
+ @retval EFI_SUCCESS Language code converted.
+ @retval EFI_NOT_FOUND Language code not found.
+
+**/
+EFI_STATUS
+EFIAPI
+ConvertRfc3066LanguageToIso639Language (
+ IN CHAR8 *LanguageRfc3066,
+ OUT CHAR8 *LanguageIso639
+ )
+{
+ UINTN Index;
+
+ if ((LanguageRfc3066[2] != '-') && (LanguageRfc3066[2] != 0)) {
+ CopyMem (LanguageIso639, LanguageRfc3066, 3);
+ return EFI_SUCCESS;
+ }
+
+ for (Index = 0; Iso639ToRfc3066ConversionTable[Index] != 0; Index += 5) {
+ if (CompareMem (LanguageRfc3066, &Iso639ToRfc3066ConversionTable[Index + 3], 2) == 0) {
+ CopyMem (LanguageIso639, &Iso639ToRfc3066ConversionTable[Index], 3);
+ return EFI_SUCCESS;
+ }
+ }
+
+ return EFI_NOT_FOUND;
+}
+
+
+/**
+ Convert language code from ISO639-2 to RFC3066 and return the converted language.
+ Caller is responsible for freeing the allocated buffer.
+
+ LanguageIso639 contain a single ISO639-2 code such as
+ "eng" or "fra".
+
+ If LanguageIso639 is NULL, then ASSERT.
+ If LanguageRfc3066 is NULL, then ASSERT.
+
+ @param LanguageIso639 ISO639-2 language code.
+
+ @return the allocated buffer or NULL, if the language is not found.
+
+**/
+CHAR8*
+EFIAPI
+ConvertIso639LanguageToRfc3066Language (
+ IN CONST CHAR8 *LanguageIso639
+ )
+{
+ UINTN Index;
+ CHAR8 *Rfc3066Language;
+
+ for (Index = 0; Iso639ToRfc3066ConversionTable[Index] != 0; Index += 5) {
+ if (CompareMem (LanguageIso639, &Iso639ToRfc3066ConversionTable[Index], 3) == 0) {
+ Rfc3066Language = AllocateZeroPool (3);
+ if (Rfc3066Language != NULL) {
+ Rfc3066Language = CopyMem (Rfc3066Language, &Iso639ToRfc3066ConversionTable[Index + 3], 2);
+ }
+ return Rfc3066Language;
+ }
+ }
+
+ return NULL;
+}
+
+/**
Test if all of the characters in a string have corresponding font characters.
This is a deprecated API. No Framework HII module is calling it. This function will ASSERT and
|