summaryrefslogtreecommitdiff
path: root/MdeModulePkg
diff options
context:
space:
mode:
authorlgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524>2011-03-08 08:50:26 +0000
committerlgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524>2011-03-08 08:50:26 +0000
commitb0bdc7ba21b3d70a0dda3aae6fbf0f54858a88a9 (patch)
tree2ef282f22e6ec21230dfa9773100ee062c98a487 /MdeModulePkg
parent11232773acbeb117e9c2cf11d4ca65f1404c9ab0 (diff)
downloadedk2-platforms-b0bdc7ba21b3d70a0dda3aae6fbf0f54858a88a9.tar.xz
Update HiiCompareLanguage to support case that language in String package is "en" and the input language is "en-US".
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11356 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg')
-rw-r--r--MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabase.h4
-rw-r--r--MdeModulePkg/Universal/HiiDatabaseDxe/String.c22
2 files changed, 21 insertions, 5 deletions
diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabase.h b/MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabase.h
index 2b4d6bef79..d01a672189 100644
--- a/MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabase.h
+++ b/MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabase.h
@@ -1757,8 +1757,8 @@ HiiGetAltCfg (
/**
Compare whether two names of languages are identical.
- @param Language1 Name of language 1
- @param Language2 Name of language 2
+ @param Language1 Name of language 1 from StringPackage
+ @param Language2 Name of language 2 to be compared with language 1.
@retval TRUE same
@retval FALSE not same
diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/String.c b/MdeModulePkg/Universal/HiiDatabaseDxe/String.c
index 931e7b397b..d0d13f1de7 100644
--- a/MdeModulePkg/Universal/HiiDatabaseDxe/String.c
+++ b/MdeModulePkg/Universal/HiiDatabaseDxe/String.c
@@ -1954,8 +1954,8 @@ HiiGetSecondaryLanguages (
/**
Compare whether two names of languages are identical.
- @param Language1 Name of language 1
- @param Language2 Name of language 2
+ @param Language1 Name of language 1 from StringPackage
+ @param Language2 Name of language 2 to be compared with language 1.
@retval TRUE same
@retval FALSE not same
@@ -1969,6 +1969,22 @@ HiiCompareLanguage (
{
UINTN Language2Len;
+ //
+ // When languages are exactly same, they will be identical.
+ //
Language2Len = AsciiStrLen (Language2);
- return (BOOLEAN) (AsciiStrnCmp (Language1, Language2, Language2Len) == 0);
+ if (AsciiStrnCmp (Language2, Language1, Language2Len) == 0) {
+ return TRUE;
+ }
+
+ //
+ // When Language1 is the sub tag of Language2, they will also be regarded as identical.
+ // This is added to support current Shell. Shell string package uses "en" as language name.
+ // But, it may use platform language "en-US" to get string value.
+ //
+ if (AsciiStrStr (Language2, Language1) == Language2) {
+ return TRUE;
+ }
+
+ return FALSE;
}