summaryrefslogtreecommitdiff
path: root/MdePkg/Library/UefiLib/UefiLib.c
diff options
context:
space:
mode:
Diffstat (limited to 'MdePkg/Library/UefiLib/UefiLib.c')
-rw-r--r--MdePkg/Library/UefiLib/UefiLib.c46
1 files changed, 46 insertions, 0 deletions
diff --git a/MdePkg/Library/UefiLib/UefiLib.c b/MdePkg/Library/UefiLib/UefiLib.c
index a58878e5d3..1acccb0522 100644
--- a/MdePkg/Library/UefiLib/UefiLib.c
+++ b/MdePkg/Library/UefiLib/UefiLib.c
@@ -1221,4 +1221,50 @@ FreeUnicodeStringTable (
return EFI_SUCCESS;
}
+/**
+ 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;
+}
+
+