From 033c246f5cb168d26d7ec1e631e5243495944c36 Mon Sep 17 00:00:00 2001 From: Marshall Greenblatt Date: Wed, 3 Jan 2024 14:00:39 -0500 Subject: [PATCH] chrome: mac: Support locale configuration (fixes #3623) --- patch/patch.cfg | 5 +++ patch/patches/mac_chrome_locale_3623.patch | 40 ++++++++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 patch/patches/mac_chrome_locale_3623.patch diff --git a/patch/patch.cfg b/patch/patch.cfg index ddffe864a..bd93fafd5 100644 --- a/patch/patch.cfg +++ b/patch/patch.cfg @@ -711,5 +711,10 @@ patches = [ # Fix mojom_ts_generator.py error with Python 3.11. # https://bugs.chromium.org/p/chromium/issues/detail?id=1422178 'name': 'mojo_generator_1422178' + }, + { + # chrome: mac: Support locale configuration. + # https://github.com/chromiumembedded/cef/issues/3623 + 'name': 'mac_chrome_locale_3623' } ] diff --git a/patch/patches/mac_chrome_locale_3623.patch b/patch/patches/mac_chrome_locale_3623.patch new file mode 100644 index 000000000..bf80d7315 --- /dev/null +++ b/patch/patches/mac_chrome_locale_3623.patch @@ -0,0 +1,40 @@ +diff --git chrome/browser/chrome_resource_bundle_helper.cc chrome/browser/chrome_resource_bundle_helper.cc +index 0cfc966050b60..8268a8b1f4fcb 100644 +--- chrome/browser/chrome_resource_bundle_helper.cc ++++ chrome/browser/chrome_resource_bundle_helper.cc +@@ -82,16 +82,8 @@ std::string InitResourceBundleAndDetermineLocale(PrefService* local_state, + .empty()); + #endif + +- std::string preferred_locale; +-#if BUILDFLAG(IS_MAC) +- // TODO(markusheintz): Read preference pref::kApplicationLocale in order +- // to enforce the application locale. +- // Tests always get en-US. +- preferred_locale = is_running_tests ? "en-US" : std::string(); +-#else +- preferred_locale = ++ std::string preferred_locale = + local_state->GetString(language::prefs::kApplicationLocale); +-#endif + + #if BUILDFLAG(IS_CHROMEOS_ASH) + ui::ResourceBundle::SetLottieParsingFunctions( +diff --git components/language/core/browser/locale_util.cc components/language/core/browser/locale_util.cc +index aa43742055b04..e84f21ab963cc 100644 +--- components/language/core/browser/locale_util.cc ++++ components/language/core/browser/locale_util.cc +@@ -17,11 +17,11 @@ std::string GetApplicationLocale(PrefService* local_state) { + // LoadLocaleResources(), which is how the global locale is set. + // TODO(asvitkine): We should try to refactor things so that the logic is not + // duplicated in multiple files. +-#if !BUILDFLAG(IS_APPLE) ++ + // The pref isn't always registered in unit tests. + if (local_state->HasPrefPath(prefs::kApplicationLocale)) + preferred_locale = local_state->GetString(prefs::kApplicationLocale); +-#endif ++ + // Note: The call below is necessary even if |preferred_locale| is empty, as + // it will get the locale that should be used potentially from other sources, + // depending on the platform (e.g. the OS locale on Mac).