diff options
author | Allan Sandfeld Jensen <allan.jensen@digia.com> | 2015-01-12 16:39:52 +0100 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@theqtcompany.com> | 2015-01-13 11:37:47 +0100 |
commit | aeb2abb6145158491e8ebe9d573df76e73c3ab13 (patch) | |
tree | c4d4573dde0b875391d8cfbeb02ea3ea219fdc03 /src | |
parent | bc79678dfb91648d1d31b15732f31739abe5df55 (diff) |
Make Chromium use the same locale as Qt
Tell Chromium to use the locale Qt has determined as the default locale.
Change-Id: I16986d84afcc0b496a22441b4a92fc09a5c89121
Reviewed-by: Andras Becsi <andras.becsi@theqtcompany.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/core/content_browser_client_qt.cpp | 6 | ||||
-rw-r--r-- | src/core/content_browser_client_qt.h | 2 | ||||
-rw-r--r-- | src/core/content_main_delegate_qt.cpp | 4 |
3 files changed, 11 insertions, 1 deletions
diff --git a/src/core/content_browser_client_qt.cpp b/src/core/content_browser_client_qt.cpp index c1dc696bd..1f29e4bec 100644 --- a/src/core/content_browser_client_qt.cpp +++ b/src/core/content_browser_client_qt.cpp @@ -69,6 +69,7 @@ #include "access_token_store_qt.h" #include <QGuiApplication> +#include <QLocale> #include <QOpenGLContext> #include <qpa/qplatformnativeinterface.h> @@ -402,3 +403,8 @@ content::LocationProvider *ContentBrowserClientQt::OverrideSystemLocationProvide return 0; // Leave it up to Chromium to figure something out. #endif } + +std::string ContentBrowserClientQt::GetApplicationLocale() +{ + return QLocale().name().toStdString(); +} diff --git a/src/core/content_browser_client_qt.h b/src/core/content_browser_client_qt.h index 2a758c6d7..cc66f6a3b 100644 --- a/src/core/content_browser_client_qt.h +++ b/src/core/content_browser_client_qt.h @@ -101,6 +101,8 @@ public: virtual blink::WebNotificationPresenter::Permission CheckDesktopNotificationPermission(const GURL& source_origin, content::ResourceContext* context, int render_process_id) Q_DECL_OVERRIDE; + virtual std::string GetApplicationLocale() Q_DECL_OVERRIDE; + void enableInspector(bool enable, content::BrowserContext *browser_context); private: diff --git a/src/core/content_main_delegate_qt.cpp b/src/core/content_main_delegate_qt.cpp index e41888976..44dc0b8bd 100644 --- a/src/core/content_main_delegate_qt.cpp +++ b/src/core/content_main_delegate_qt.cpp @@ -52,6 +52,8 @@ #include "renderer/content_renderer_client_qt.h" #include "web_engine_library_info.h" +#include <QLocale> + static base::StringPiece PlatformResourceProvider(int key) { if (key == IDR_DIR_HEADER_HTML) { base::StringPiece html_data = ui::ResourceBundle::GetSharedInstance().GetRawDataResource(IDR_DIR_HEADER_HTML); @@ -63,7 +65,7 @@ static base::StringPiece PlatformResourceProvider(int key) { void ContentMainDelegateQt::PreSandboxStartup() { net::NetModule::SetResourceProvider(PlatformResourceProvider); - ui::ResourceBundle::InitSharedInstanceWithLocale(l10n_util::GetApplicationLocale(std::string("en-US")), 0); + ui::ResourceBundle::InitSharedInstanceWithLocale(QLocale().name().toStdString(), 0); // Suppress info, warning and error messages per default. int logLevel = logging::LOG_FATAL; |