}
}
+// terminate candidate process when language changed
+// icu related data (CultureInfo, etc) should be recreated.
+static void langChangedCB(keynode_t *key, void* data)
+{
+ _INFO("terminiate candidate process to update language.");
+ exit(0);
+}
+
+static void setLang()
+{
+ char* lang = vconf_get_str(VCONFKEY_LANGSET);
+ if (!lang) {
+ _ERR("Fail to get language from vconf");
+ return;
+ }
+
+ // In order to operate ICU (used for globalization) normally, the following
+ // environment variables must be set before using ICU API.
+ // When running Applicaiton, the following environment variables are set by AppFW.
+ // But when preloading the dll in the candidate process, the following environment variables are not set
+ // As a result, CultureInfo is incorrectly generated and malfunctions.
+ // For example, uloc_getDefault() returns en_US_POSIX, CultureInfo is set to invariant mode.
+ setenv("LANG", const_cast<char *>(lang), 1);
+ setenv("LC_MESSAGES", const_cast<char *>(lang), 1);
+ setenv("LC_ALL", const_cast<char *>(lang), 1);
+
+ free(lang);
+}
+
void CoreRuntime::preloadTypes()
{
const static std::string initDllPath = concatPath(__FRAMEWORK_DIR, "Tizen.Init.dll");
// Intiailize ecore first (signal handlers, etc.) before runtime init.
ecore_init();
+ // set language environment to support ICU
+ setLang();
+
char *env = nullptr;
env = getenv("CORECLR_ENABLE_PROFILING");
if (env != nullptr && !strcmp(env, "1")) {
if (!standalone) {
pluginPreload();
+
+ // terminate candidate process if language is changed.
+ // CurrentCulture created for preloaded dlls should be updated.
+ vconf_notify_key_changed(VCONFKEY_LANGSET, langChangedCB, NULL);
}
// Set environment for System.Environment.SpecialFolder
free(localDataPath);
}
+ vconf_ignore_key_changed(VCONFKEY_LANGSET, langChangedCB);
+
pluginBeforeExecute();
_INFO("execute assembly : %s", path);