Commit 247a8cb6 authored by James Cook's avatar James Cook Committed by Chromium LUCI CQ

lacros: Pass locale to lacros on command line

The UX plan for UI language is to use a single shared locale for OS and
browser. See bug.

Pass the locale on the command line because Lacros needs it very early
in startup, before zygote fork.

This CL doesn't include the changes to browser WebUI settings. We'll
need to add a link-out to OS settings, similar to how Chrome OS
browser settings work today.

Bug: 1139618
Change-Id: I0202ed54d4c4a4956ecb31f04ecde670aea5595f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2600316
Commit-Queue: James Cook <jamescook@chromium.org>
Reviewed-by: default avatarErik Chen <erikchen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#838983}
parent 953e7e7d
......@@ -664,6 +664,7 @@
#include "chrome/browser/chrome_browser_main_parts_lacros.h"
#include "chrome/browser/ui/views/chrome_browser_main_extra_parts_views_lacros.h"
#include "chromeos/lacros/lacros_chrome_service_impl.h"
#include "ui/base/ui_base_switches.h"
#endif
#if BUILDFLAG(USE_MINIKIN_HYPHENATION) && !defined(OS_ANDROID)
......@@ -2453,6 +2454,12 @@ void ChromeContentBrowserClient::AppendExtraCommandLineSwitches(
command_line->CopySwitchesFrom(browser_command_line, kSwitchNames,
base::size(kSwitchNames));
#endif
#if BUILDFLAG(IS_CHROMEOS_LACROS)
// Ensure zygote loads the resource bundle for the right locale.
static const char* const kMoreSwitchNames[] = {switches::kLang};
command_line->CopySwitchesFrom(browser_command_line, kMoreSwitchNames,
base::size(kMoreSwitchNames));
#endif
} else if (process_type == switches::kGpuProcess) {
// If --ignore-gpu-blocklist is passed in, don't send in crash reports
......
......@@ -30,6 +30,7 @@
#include "base/system/sys_info.h"
#include "base/task/task_traits.h"
#include "base/task/thread_pool.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/chromeos/crosapi/ash_chrome_service_impl.h"
#include "chrome/browser/chromeos/crosapi/browser_loader.h"
#include "chrome/browser/chromeos/crosapi/browser_util.h"
......@@ -313,6 +314,10 @@ void BrowserManager::StartWithLogFile(base::ScopedFD logfd) {
std::string crash_dir =
browser_util::GetUserDataDir().Append("crash_dumps").AsUTF8Unsafe();
// Pass the locale via command line instead of via LacrosInitParams because
// the Lacros browser process needs it early in startup, before zygote fork.
std::string locale = g_browser_process->GetApplicationLocale();
// Static configuration should be enabled from Lacros rather than Ash. This
// vector should only be used for dynamic configuration.
// TODO(https://crbug.com/1145713): Remove existing static configuration.
......@@ -321,7 +326,7 @@ void BrowserManager::StartWithLogFile(base::ScopedFD logfd) {
"--user-data-dir=" + user_data_dir,
"--enable-gpu-rasterization",
"--enable-oop-rasterization",
"--lang=en-US",
"--lang=" + locale,
"--enable-crashpad",
"--enable-webgl-image-chromium",
"--breakpad-dump-location=" + crash_dir};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment