summaryrefslogtreecommitdiffstats
path: root/src/core/web_engine_library_info.cpp
diff options
context:
space:
mode:
authorPeter Varga <pvarga@inf.u-szeged.hu>2016-05-24 17:08:09 +0200
committerPeter Varga <pvarga@inf.u-szeged.hu>2016-07-13 21:12:03 +0000
commit89319455c36d48fe46a8501edd3c174c1de291fb (patch)
tree8ba7c33284a0b973090eb5de322ef466a859fbcf /src/core/web_engine_library_info.cpp
parent9bb9076c50048913075f11692f784ebb959d63cf (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/web_engine_library_info.cpp')
-rw-r--r--src/core/web_engine_library_info.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/core/web_engine_library_info.cpp b/src/core/web_engine_library_info.cpp
index 2de3d39ff..a81a26d16 100644
--- a/src/core/web_engine_library_info.cpp
+++ b/src/core/web_engine_library_info.cpp
@@ -332,8 +332,16 @@ base::string16 WebEngineLibraryInfo::getApplicationName()
std::string WebEngineLibraryInfo::getApplicationLocale()
{
base::CommandLine *parsedCommandLine = base::CommandLine::ForCurrentProcess();
- if (!parsedCommandLine->HasSwitch(switches::kLang))
- return QLocale().bcp47Name().toStdString();
+ if (!parsedCommandLine->HasSwitch(switches::kLang)) {
+ const QString &locale = QLocale().bcp47Name();
+
+ // QLocale::bcp47Name returns "en" for American English locale. Chromium requires the "US" suffix
+ // to clarify the dialect and ignores the shorter version.
+ if (locale == "en")
+ return "en-US";
+
+ return locale.toStdString();
+ }
return parsedCommandLine->GetSwitchValueASCII(switches::kLang);
}