LogError("Wrong message format received, ignoring");
return;
}
+
auto msgString = toString(static_cast<WKStringRef>(messageBody));
LogDebug("Got message text: " << msgString);
LogDebug("loading Page : " << m_pagesList.back() <<
ssMsg >> argTheme;
ssMsg >> m_encrypted;
+ WrtDB::WidgetDAOReadOnly dao(m_widgetHandle);
+ /* This type of message is received when widget is restarting
+ * (proably in other situation too). Widget restart can be
+ * called after system language change so language tags have to
+ * be recreated here.
+ * Do NOT MOVE LanguageTags reset before m_widgetHandle initialization
+ */
+ // reset language tags (create new tags based on system locales)
+ LanguageTagsProviderSingleton::Instance().resetLanguageTags();
+ DPL::OptionalString defaultLocale = dao.getDefaultlocale();
+ LanguageTags tags = LanguageTagsProviderSingleton::Instance().getLanguageTags();
+ // check if default widget language exists in language's list
+ if (!!defaultLocale &&
+ std::find(tags.begin(), tags.end(), *defaultLocale) == tags.end())
+ {
+ if (tags.size() < 2) {
+ tags.push_front(*defaultLocale);
+ } else {
+ LanguageTags::iterator placeToInsert = tags.end();
+ --placeToInsert;
+ if (*placeToInsert != L"") { ++placeToInsert; }
+ tags.insert(placeToInsert, *defaultLocale);
+ }
+ }
+ LogDebug("Current widget locales (language tags):");
+ FOREACH(it, tags) {
+ LogDebug("Locale: " << *it);
+ }
+ LanguageTagsProviderSingleton::Instance().setLanguageTags(tags);
+ // ** Language tags setting completed **
+
if (argScale != "null" && argScale[0] == '_')
{
argScale.erase(0, 1);
m_theme = argTheme;
}
- WrtDB::WidgetDAOReadOnly dao(m_widgetHandle);
m_widgetType = dao.getWidgetType();
LogDebug("m_widgetType : " << m_widgetType.getApptypeToString() <<
"(m_widgetHandle:" << m_widgetHandle << ")");
return std::string();
}
-namespace {
-static int LanguageChanged(void *)
-{
- /* Language Tags reseting removed from this place
- * as it's done in wrt-client before widget start page reload
- * (see: languageChangedCallback() in wrt-client.cpp) */
- return 0;
-}
-
-void Initialize()
-{
- appcore_set_event_callback(
- APPCORE_EVENT_LANG_CHANGE,
- &LanguageChanged,
- NULL);
-}
-
-}
extern "C"
{
WKTypeRef)
{
DPL::Log::LogSystemSingleton::Instance().SetTag("WRT-BUNDLE");
- Initialize();
LogDebug("Bundle initialized");
static Bundle s_bundle = Bundle(bundle);
void ViewLogic::setStartPage()
{
- //TODO: actually this localization should be done in requestWillSend
- // callback, but Webkit2 denies access to local files if it detects
- // that first loaded file is not 'local' so it wan't work
- DPL::OptionalString localizedUri = ViewModule::UriSupport::localizeURI(
- DPL::FromUTF8String(m_startUrl.c_str()),
- m_model);
- m_currentUri = DPL::ToUTF8String(*localizedUri);
+ /* Start URI (as other uris) is now localized
+ * on WebProcess side */
+ m_currentUri = m_startUrl;
}
void ViewLogic::prepareEwkView(Evas_Object *wkView)