diff options
author | Peter Varga <pvarga@inf.u-szeged.hu> | 2016-05-24 17:08:09 +0200 |
---|---|---|
committer | Peter Varga <pvarga@inf.u-szeged.hu> | 2016-07-13 21:12:03 +0000 |
commit | 89319455c36d48fe46a8501edd3c174c1de291fb (patch) | |
tree | 8ba7c33284a0b973090eb5de322ef466a859fbcf /src/core/content_main_delegate_qt.cpp | |
parent | 9bb9076c50048913075f11692f784ebb959d63cf (diff) |
Fix changing locale of ResourceBundle on Linux
The ResourceBundle is not re-initialized for new Renderer Processes
because it is initialized only once in Zygote Process. This means runtime
locale changes do not affect new Renderer Processes. Zygote Process is
supported on Linux only thus other platforms don't need this fix.
With this change the locale of the ResourceBundle is reloaded when
new Renderer Process is started. For accessing the pak file of the locale
in the sandboxed environment the file descriptor is passed via the Chromium's
GlobalDescriptor solution.
Task-number: QTBUG-53000
Change-Id: I57e84078db9d0795d16d930aa1b3e93a6e86ec39
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'src/core/content_main_delegate_qt.cpp')
-rw-r--r-- | src/core/content_main_delegate_qt.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/core/content_main_delegate_qt.cpp b/src/core/content_main_delegate_qt.cpp index a9c49ff2e..379c42468 100644 --- a/src/core/content_main_delegate_qt.cpp +++ b/src/core/content_main_delegate_qt.cpp @@ -59,7 +59,9 @@ #include "base/cpu.h" #endif -#include <QLocale> +#if defined(OS_LINUX) +#include "ui/base/ui_base_switches.h" +#endif namespace QtWebEngineCore { @@ -135,6 +137,15 @@ content::ContentBrowserClient *ContentMainDelegateQt::CreateContentBrowserClient content::ContentRendererClient *ContentMainDelegateQt::CreateContentRendererClient() { +#if defined(OS_LINUX) + base::CommandLine *parsedCommandLine = base::CommandLine::ForCurrentProcess(); + + if (parsedCommandLine->HasSwitch(switches::kLang)) { + const std::string &locale = parsedCommandLine->GetSwitchValueASCII(switches::kLang); + ui::ResourceBundle::GetSharedInstance().ReloadLocaleResources(locale); + } +#endif + return new ContentRendererClientQt; } |