summaryrefslogtreecommitdiff
path: root/IntelFrameworkModulePkg/Universal/BdsDxe
diff options
context:
space:
mode:
authorrsun3 <rsun3@6f19259b-4bc3-4df7-8a09-765794883524>2009-04-16 08:46:28 +0000
committerrsun3 <rsun3@6f19259b-4bc3-4df7-8a09-765794883524>2009-04-16 08:46:28 +0000
commitad5a96ab2daeeac53f0c924113f23dc931f965c5 (patch)
treea11c8b0b96a6b52fda679436870e7ac3d87142d3 /IntelFrameworkModulePkg/Universal/BdsDxe
parent887c077d91a648a5e206cc19790878ebf521745e (diff)
downloadedk2-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 'IntelFrameworkModulePkg/Universal/BdsDxe')
-rw-r--r--IntelFrameworkModulePkg/Universal/BdsDxe/FrontPage.c1
-rw-r--r--IntelFrameworkModulePkg/Universal/BdsDxe/Language.c178
-rw-r--r--IntelFrameworkModulePkg/Universal/BdsDxe/Language.h17
3 files changed, 196 insertions, 0 deletions
diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/FrontPage.c b/IntelFrameworkModulePkg/Universal/BdsDxe/FrontPage.c
index bda75e15ca..99abf1460a 100644
--- a/IntelFrameworkModulePkg/Universal/BdsDxe/FrontPage.c
+++ b/IntelFrameworkModulePkg/Universal/BdsDxe/FrontPage.c
@@ -14,6 +14,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include "Bds.h"
#include "FrontPage.h"
+#include "Language.h"
EFI_GUID mFrontPageGuid = FRONT_PAGE_FORMSET_GUID;
diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/Language.c b/IntelFrameworkModulePkg/Universal/BdsDxe/Language.c
index fe3f0e0064..5b154e98ee 100644
--- a/IntelFrameworkModulePkg/Universal/BdsDxe/Language.c
+++ b/IntelFrameworkModulePkg/Universal/BdsDxe/Language.c
@@ -15,6 +15,150 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include "Language.h"
#include "FrontPage.h"
+//
+// 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\
+";
+
#define NARROW_GLYPH_NUMBER 8
#define WIDE_GLYPH_NUMBER 75
@@ -271,6 +415,40 @@ ExportFonts (
}
/**
+ 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;
+}
+
+/**
Determine the current language that will be used
based on language related EFI Variables.
diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/Language.h b/IntelFrameworkModulePkg/Universal/BdsDxe/Language.h
index 39dd1eccf9..91bbe9b90d 100644
--- a/IntelFrameworkModulePkg/Universal/BdsDxe/Language.h
+++ b/IntelFrameworkModulePkg/Universal/BdsDxe/Language.h
@@ -18,6 +18,23 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include "String.h"
/**
+ 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
+ );
+
+/**
Determine the current language that will be used
based on language related EFI Variables.