Fixed: getDefaultLocale func. 90/73290/1
authorDenis Dolzhenko <d.dolzhenko@samsung.com>
Tue, 7 Jun 2016 10:43:26 +0000 (13:43 +0300)
committerDenis Dolzhenko <d.dolzhenko@samsung.com>
Tue, 7 Jun 2016 10:43:26 +0000 (13:43 +0300)
Change-Id: I9e12b463b03a031f48c2cd98bad18b3bce219d42
Signed-off-by: Denis Dolzhenko <d.dolzhenko@samsung.com>
src/Common/Utils/src/TimeUtils.cpp

index a12a94e..6a77db8 100644 (file)
@@ -125,18 +125,24 @@ int TimeUtils::getTimeFormat()
 
 const std::string &TimeUtils::getDefaultLocale()
 {
-    const char *locale = nullptr;
     static std::string res;
 
-    i18n_ulocale_set_default(getenv("LC_TIME"));
-    i18n_ulocale_get_default(&locale);
+    char *str = nullptr;
+    system_settings_get_value_string(SYSTEM_SETTINGS_KEY_LOCALE_LANGUAGE, &str);
 
-    if(locale)
+    if(str)
     {
-        res = locale;
-        size_t i = res.find(".UTF8");
+        i18n_ulocale_set_default(str);
+        res = str;
+        size_t i = res.find(".");
         if(i != std::string::npos)
             res = res.substr(i);
+
+        free(str);
+    }
+    else
+    {
+        res.clear();
     }
     return res;
 }