#include <libxml/parserInternals.h>
#include <system_info.h>
+#include <runtime_info.h>
+#include <unicode/locid.h>
#include <FAppPkgPackageAppInfo.h>
#include <FBaseSysLog.h>
#include <FAppPkg_PackageInfoImpl.h>
#include <FAppPkg_PackageParser.h>
#include <FBase_StringConverter.h>
-#include <FSys_SettingInfoImpl.h>
using namespace Tizen::App;
using namespace Tizen::Base;
namespace Tizen { namespace App { namespace Package
{
+struct charDeleter
+{
+ void operator()(char* pValue)
+ {
+ if(pValue != null)
+ {
+ free(pValue);
+ pValue = null;
+ }
+ }
+};
+
_PackageXmlAttribute::_PackageXmlAttribute(void)
:__pName(null)
,__pValue(null)
SysTryReturn(NID_APP, pNameList, false, E_SYSTEM, "pNameList is null.");
String locale;
- result r = _SettingInfoImpl::GetValue(L"http://tizen.org/setting/locale.language", locale);
+ result r = GetLocale(locale);
SysTryReturn(NID_APP, !IsFailed(r), false, E_SYSTEM, "GetValue(http://tizen.org/setting/locale.language) failed.");
locale.Replace(L"_", L"-");
return res;
}
+result
+_PackageParser::GetLocale(String& value)
+{
+ int errorCode = 0;
+ result r = E_SUCCESS;
+ char* pTemp = null;
+ std::unique_ptr<char, charDeleter> pLocale(null);
+
+ errorCode = runtime_info_get_value_string(RUNTIME_INFO_KEY_LANGUAGE, &pTemp);
+ SysTryReturnResult(NID_APP, (errorCode == RUNTIME_INFO_ERROR_NONE) && (pTemp != null), E_SYSTEM, "runtime_info_get_value_string() failed.");
+
+ pLocale.reset(pTemp);
+ icu::Locale icuLocale(pLocale.get());
+ String localeString(icuLocale.getISO3Language());
+ String languageScriptTmp(icuLocale.getScript());
+
+ if (!languageScriptTmp.IsEmpty())
+ {
+ String languageScript;
+ languageScriptTmp.ToLowerCase(languageScript);
+ localeString.Append(L"-");
+ localeString.Append(languageScript);
+ }
+ localeString.Append("_");
+ localeString.Append(icuLocale.getCountry());
+
+ value = localeString;
+
+ return r;
+}
+
} } } // Tizen::App::Package