[Applications.Common] Fix getting default locale (#4965)
authorhjhun <36876573+hjhun@users.noreply.github.com>
Fri, 3 Feb 2023 08:24:49 +0000 (17:24 +0900)
committerGitHub <noreply@github.com>
Fri, 3 Feb 2023 08:24:49 +0000 (17:24 +0900)
Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
src/Tizen.Applications.Common/Interop/Interop.Libc.cs
src/Tizen.Applications.Common/Tizen.Applications/CoreApplication.cs

index 55d23c9600b9fa4442dcbfa2c318f211c4bef6ee..81aacdd73c9e545c55bb6a845d51bed53e94aa49 100644 (file)
@@ -26,6 +26,9 @@ internal static partial class Interop
         [DllImport(Libraries.Libc, EntryPoint = "free", CallingConvention = CallingConvention.Cdecl)]
         internal static extern int Free(IntPtr ptr);
 
+        [DllImport(Libraries.Libc, EntryPoint = "getenv")]
+        internal static extern IntPtr GetEnvironmentVariable(string name);
+
         [NativeStruct("struct timespec", Include = "time.h")]
         [StructLayout(LayoutKind.Sequential)]
         internal struct TimeStamp
index 0e83f374bc70fcdcd9e2f9ef1b4c8734580245f8..c9725ae148704901928cf876c35c01cdc1c1b064 100644 (file)
@@ -595,12 +595,7 @@ namespace Tizen.Applications
 
         internal static string GetDefaultLocale()
         {
-            IntPtr stringPtr = IntPtr.Zero;
-            if (Interop.BaseUtilsi18n.GetDefault(out stringPtr) != 0)
-            {
-                return string.Empty;
-            }
-
+            IntPtr stringPtr = Interop.Libc.GetEnvironmentVariable("LANG");
             if (stringPtr == IntPtr.Zero)
             {
                 return string.Empty;