diff options
author | qhuang8 <qhuang8@6f19259b-4bc3-4df7-8a09-765794883524> | 2008-11-27 07:43:56 +0000 |
---|---|---|
committer | qhuang8 <qhuang8@6f19259b-4bc3-4df7-8a09-765794883524> | 2008-11-27 07:43:56 +0000 |
commit | 11e9250309ea59ae7aad20c4af176c6dc39a741e (patch) | |
tree | 498321db0e3e50a561c0db54159bed8899dd03ef /MdeModulePkg/Library | |
parent | aad6137d5cdd23e8f7678918d3ab2e2a99f216eb (diff) | |
download | edk2-platforms-11e9250309ea59ae7aad20c4af176c6dc39a741e.tar.xz |
Add GetCurrentLanguage() to HiiLib in MdeModulePkg
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@6758 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg/Library')
-rw-r--r-- | MdeModulePkg/Library/UefiHiiLib/HiiLanguage.c | 47 | ||||
-rw-r--r-- | MdeModulePkg/Library/UefiHiiLib/InternalHiiLib.h | 4 | ||||
-rw-r--r-- | MdeModulePkg/Library/UefiHiiLib/UefiHiiLib.inf | 8 |
3 files changed, 59 insertions, 0 deletions
diff --git a/MdeModulePkg/Library/UefiHiiLib/HiiLanguage.c b/MdeModulePkg/Library/UefiHiiLib/HiiLanguage.c index 147e5a3942..58817c1baf 100644 --- a/MdeModulePkg/Library/UefiHiiLib/HiiLanguage.c +++ b/MdeModulePkg/Library/UefiHiiLib/HiiLanguage.c @@ -204,3 +204,50 @@ HiiLibGetSupportedSecondaryLanguages ( }
+/**
+ Determine what is the current language setting. The space reserved for Lang
+ must be at least RFC_3066_ENTRY_SIZE bytes;
+
+ If Lang is NULL, then ASSERT.
+
+ @param Lang Pointer of system language. Lang will always be filled with
+ a valid RFC 3066 language string. If "PlatformLang" is not
+ set in the system, the default language specifed by PcdUefiVariableDefaultPlatformLang
+ is returned.
+
+ @return EFI_SUCCESS If the EFI Variable with "PlatformLang" is set and return in Lang.
+ @return EFI_NOT_FOUND If the EFI Variable with "PlatformLang" is not set, but a valid default language is return in Lang.
+
+**/
+EFI_STATUS
+EFIAPI
+GetCurrentLanguage (
+ OUT CHAR8 *Lang
+ )
+{
+ EFI_STATUS Status;
+ UINTN Size;
+
+ ASSERT (Lang != NULL);
+
+ //
+ // Get current language setting
+ //
+ Size = RFC_3066_ENTRY_SIZE;
+ Status = gRT->GetVariable (
+ L"PlatformLang",
+ &gEfiGlobalVariableGuid,
+ NULL,
+ &Size,
+ Lang
+ );
+
+ if (EFI_ERROR (Status)) {
+ AsciiStrCpy (Lang, (CHAR8 *) PcdGetPtr (PcdUefiVariableDefaultPlatformLang));
+ }
+
+ return Status;
+}
+
+
+
diff --git a/MdeModulePkg/Library/UefiHiiLib/InternalHiiLib.h b/MdeModulePkg/Library/UefiHiiLib/InternalHiiLib.h index 18d168ec70..28c738fb06 100644 --- a/MdeModulePkg/Library/UefiHiiLib/InternalHiiLib.h +++ b/MdeModulePkg/Library/UefiHiiLib/InternalHiiLib.h @@ -21,6 +21,8 @@ #include <Protocol/HiiString.h>
#include <Protocol/DevicePath.h>
+#include <Guid/GlobalVariable.h>
+
#include <Library/BaseLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/HiiLib.h>
@@ -29,6 +31,8 @@ #include <Library/UefiBootServicesTableLib.h>
#include <Library/DevicePathLib.h>
#include <Library/UefiLib.h>
+#include <Library/PcdLib.h>
+#include <Library/UefiRuntimeServicesTableLib.h>
#define HII_LIB_DEFAULT_STRING_SIZE 0x200
diff --git a/MdeModulePkg/Library/UefiHiiLib/UefiHiiLib.inf b/MdeModulePkg/Library/UefiHiiLib/UefiHiiLib.inf index f355d02f1b..08dc64a704 100644 --- a/MdeModulePkg/Library/UefiHiiLib/UefiHiiLib.inf +++ b/MdeModulePkg/Library/UefiHiiLib/UefiHiiLib.inf @@ -48,12 +48,20 @@ UefiBootServicesTableLib
DevicePathLib
UefiLib
+ PcdLib
+ UefiRuntimeServicesTableLib
[Protocols]
gEfiHiiDatabaseProtocolGuid # ALWAYS_CONSUMED
gEfiHiiStringProtocolGuid # ALWAYS_CONSUMED
gEfiDevicePathProtocolGuid
+[Pcd]
+ gEfiMdePkgTokenSpaceGuid.PcdUefiVariableDefaultPlatformLang
+
+[Guids]
+ gEfiGlobalVariableGuid
+
[Depex]
gEfiHiiDatabaseProtocolGuid AND
gEfiHiiStringProtocolGuid
|