summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/HiiDatabase.h49
-rw-r--r--EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/Strings.c216
-rw-r--r--EdkCompatibilityPkg/Compatibility/Uc2OnUcThunk/Uc2OnUcThunk.c182
-rw-r--r--EdkCompatibilityPkg/Compatibility/Uc2OnUcThunk/Uc2OnUcThunk.inf1
-rw-r--r--EdkCompatibilityPkg/Compatibility/UcOnUc2Thunk/UcOnUc2Thunk.c178
-rw-r--r--EdkCompatibilityPkg/Compatibility/UcOnUc2Thunk/UcOnUc2Thunk.inf1
-rw-r--r--IntelFrameworkModulePkg/Universal/BdsDxe/FrontPage.c1
-rw-r--r--IntelFrameworkModulePkg/Universal/BdsDxe/Language.c178
-rw-r--r--IntelFrameworkModulePkg/Universal/BdsDxe/Language.h17
-rw-r--r--MdeModulePkg/Include/Library/HiiLib.h67
-rw-r--r--MdeModulePkg/Library/UefiHiiLib/HiiString.c273
11 files changed, 823 insertions, 340 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
diff --git a/EdkCompatibilityPkg/Compatibility/Uc2OnUcThunk/Uc2OnUcThunk.c b/EdkCompatibilityPkg/Compatibility/Uc2OnUcThunk/Uc2OnUcThunk.c
index 4ab74bad83..33c8510b8d 100644
--- a/EdkCompatibilityPkg/Compatibility/Uc2OnUcThunk/Uc2OnUcThunk.c
+++ b/EdkCompatibilityPkg/Compatibility/Uc2OnUcThunk/Uc2OnUcThunk.c
@@ -30,6 +30,7 @@ Module Name:
#include <Library/UefiLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Library/HiiLib.h>
+#include <Library/BaseMemoryLib.h>
///
@@ -37,6 +38,187 @@ Module Name:
///
#define ISO_639_2_ENTRY_SIZE 3
+//
+// 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\
+";
+
+/**
+ 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;
+}
+
/**
Performs a case-insensitive comparison of two Null-terminated Unicode
strings.
diff --git a/EdkCompatibilityPkg/Compatibility/Uc2OnUcThunk/Uc2OnUcThunk.inf b/EdkCompatibilityPkg/Compatibility/Uc2OnUcThunk/Uc2OnUcThunk.inf
index 5e0266919d..be9db2887c 100644
--- a/EdkCompatibilityPkg/Compatibility/Uc2OnUcThunk/Uc2OnUcThunk.inf
+++ b/EdkCompatibilityPkg/Compatibility/Uc2OnUcThunk/Uc2OnUcThunk.inf
@@ -53,6 +53,7 @@
UefiLib
MemoryAllocationLib
HiiLib
+ BaseMemoryLib
[Protocols]
gEfiUnicodeCollation2ProtocolGuid
diff --git a/EdkCompatibilityPkg/Compatibility/UcOnUc2Thunk/UcOnUc2Thunk.c b/EdkCompatibilityPkg/Compatibility/UcOnUc2Thunk/UcOnUc2Thunk.c
index 8fbffce05f..76fec60269 100644
--- a/EdkCompatibilityPkg/Compatibility/UcOnUc2Thunk/UcOnUc2Thunk.c
+++ b/EdkCompatibilityPkg/Compatibility/UcOnUc2Thunk/UcOnUc2Thunk.c
@@ -30,6 +30,7 @@ Module Name:
#include <Library/UefiLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Library/HiiLib.h>
+#include <Library/BaseMemoryLib.h>
///
@@ -37,6 +38,183 @@ Module Name:
///
#define ISO_639_2_ENTRY_SIZE 3
+//
+// 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\
+";
+
+/**
+ 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;
+}
/**
Performs a case-insensitive comparison of two Null-terminated Unicode
diff --git a/EdkCompatibilityPkg/Compatibility/UcOnUc2Thunk/UcOnUc2Thunk.inf b/EdkCompatibilityPkg/Compatibility/UcOnUc2Thunk/UcOnUc2Thunk.inf
index ffe2d3f29c..600a0e6d84 100644
--- a/EdkCompatibilityPkg/Compatibility/UcOnUc2Thunk/UcOnUc2Thunk.inf
+++ b/EdkCompatibilityPkg/Compatibility/UcOnUc2Thunk/UcOnUc2Thunk.inf
@@ -53,6 +53,7 @@
UefiLib
MemoryAllocationLib
HiiLib
+ BaseMemoryLib
[Protocols]
gEfiUnicodeCollation2ProtocolGuid
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.
diff --git a/MdeModulePkg/Include/Library/HiiLib.h b/MdeModulePkg/Include/Library/HiiLib.h
index 80278b2f5a..17420b483d 100644
--- a/MdeModulePkg/Include/Library/HiiLib.h
+++ b/MdeModulePkg/Include/Library/HiiLib.h
@@ -269,73 +269,6 @@ HiiGetSupportedLanguages (
;
/**
- 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
- )
-;
-
-/**
- Convert language code list from RFC3066 to ISO639-2, e.g. "en-US;fr-FR" will
- be converted to "engfra".
-
- If SupportedLanguages is NULL, then ASSERT.
-
- @param SupportedLanguages The RFC3066 language list.
-
- @return The ISO639-2 language list.
-
-**/
-CHAR8 *
-EFIAPI
-Rfc3066ToIso639 (
- CHAR8 *SupportedLanguages
- )
-;
-
-/**
Allocates and returns a Null-terminated Unicode <ConfigHdr> string using routing
information that includes a GUID, an optional Unicode string name, and a device
path. The string returned is allocated with AllocatePool(). The caller is
diff --git a/MdeModulePkg/Library/UefiHiiLib/HiiString.c b/MdeModulePkg/Library/UefiHiiLib/HiiString.c
index 2c317e5de3..f6569754b2 100644
--- a/MdeModulePkg/Library/UefiHiiLib/HiiString.c
+++ b/MdeModulePkg/Library/UefiHiiLib/HiiString.c
@@ -15,153 +15,6 @@
#include "InternalHiiLib.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\
-";
-
-
-
/**
This function create a new string in String Package or updates an existing
string in a String Package. If StringId is 0, then a new string is added to
@@ -497,129 +350,3 @@ Error:
return String;
}
-/**
- 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;
-}
-
-/**
- Convert language code list from RFC3066 to ISO639-2, e.g. "en-US;fr-FR" will
- be converted to "engfra".
-
- @param SupportedLanguages The RFC3066 language list.
-
- @return The ISO639-2 language list.
-
-**/
-CHAR8 *
-EFIAPI
-Rfc3066ToIso639 (
- CHAR8 *SupportedLanguages
- )
-{
- CHAR8 *Languages;
- CHAR8 *ReturnValue;
- CHAR8 *LangCodes;
- CHAR8 *LangRfc3066;
- CHAR8 LangIso639[ISO_639_2_ENTRY_SIZE];
- UINTN LanguageSize;
- EFI_STATUS Status;
-
- LanguageSize = AsciiStrSize (SupportedLanguages);
- ReturnValue = AllocateZeroPool (LanguageSize);
- if (ReturnValue == NULL) {
- return ReturnValue;
- }
-
- //
- // Allocate working buffer to contain substring in SupportedLanguages;
- //
- LangRfc3066 = AllocatePool (LanguageSize);
- if (LangRfc3066 == NULL) {
- FreePool (ReturnValue);
- return NULL;
- }
- Languages = ReturnValue;
- LangCodes = SupportedLanguages;
- while (*LangCodes != 0) {
- HiiLibGetNextLanguage (&LangCodes, LangRfc3066);
-
- Status = ConvertRfc3066LanguageToIso639Language (LangRfc3066, LangIso639);
- if (!EFI_ERROR (Status)) {
- CopyMem (Languages, LangIso639, 3);
- Languages = Languages + 3;
- }
- }
-
- FreePool (LangRfc3066);
- return ReturnValue;
-}
-
-