[LanguageTag] Migrate l10n_util::GetLanguage callsites in Ash/ChromeOS [chromium/src : main]

0 views
Skip to first unread message

Danilo Tedeschi (Gerrit)

unread,
Aug 11, 2026, 2:36:57 PM (5 days ago) Aug 11
to Enterprise Policy Reviews, chromium...@chromium.org, (Julie)Jeongeun Kim, tbarzi...@chromium.org, shuche...@chromium.org, katie...@chromium.org, jshin...@chromium.org, nektar...@chromium.org, feature-me...@chromium.org, yuzo+...@chromium.org, browser-comp...@chromium.org, oshima...@chromium.org, abigailbk...@google.com, kyungjunle...@google.com, dtseng...@chromium.org, croissant-...@chromium.org, net-r...@chromium.org, anastas...@google.com, chromium-a...@chromium.org, chrome-intell...@chromium.org, hirokisa...@chromium.org, nona+...@chromium.org, francisjp...@google.com, josiah...@chromium.org, rrsilva+wat...@google.com, keithle...@chromium.org, tranbaod...@chromium.org, yhanad...@chromium.org, steimel+...@chromium.org, cros-setti...@google.com, chrome-intelligence-te...@google.com, extension...@chromium.org

Danilo Tedeschi has uploaded the change for review

Commit message

[LanguageTag] Migrate l10n_util::GetLanguage callsites in Ash/ChromeOS

This CL replaces usages of the legacy `l10n_util::GetLanguage` function
in Ash and ChromeOS subsystems with the type-safe
`base::i18n::GetLanguageTagFromString` API.

This is part of a larger effort to deprecate and remove
`l10n_util::GetLanguage` across the codebase.
Bug: None
Change-Id: I5dd158e232170170489d63f585b716dbef611647

Change diff


Change information

Files:
  • M ash/system/locale/locale_detailed_view.cc
  • M ash/system/locale/locale_feature_pod_controller.cc
  • M ash/system/unified/current_locale_view.cc
  • M chrome/browser/ash/accessibility/live_caption/system_live_caption_service.cc
  • M chrome/browser/ash/locale/locale_change_guard.cc
  • M chrome/browser/ash/main_parts/chrome_browser_main_parts_ash.cc
  • M chrome/browser/ash/policy/core/device_local_account_browsertest.cc
  • M chrome/browser/ui/ash/quick_answers/ui/quick_answers_util.cc
  • M chrome/browser/ui/ash/wm/coral_delegate_impl.cc
  • M chrome/browser/ui/webui/ash/login/l10n_util.cc
  • M chrome/browser/ui/webui/ash/settings/pages/a11y/select_to_speak_handler.cc
  • M chrome/browser/ui/webui/ash/settings/pages/a11y/tts_handler.cc
  • M chromeos/components/quick_answers/public/cpp/quick_answers_state.cc
  • M chromeos/components/quick_answers/understanding/intent_generator.cc
  • M chromeos/components/quick_answers/utils/language_detector.cc
  • M chromeos/components/quick_answers/utils/spell_checker.cc
  • M chromeos/components/quick_answers/utils/translation_v2_utils.cc
  • M third_party/icu
Change size: M
Delta: 18 files changed, 152 insertions(+), 50 deletions(-)
Open in Gerrit

Related details

Attention set is empty
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: newchange
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I5dd158e232170170489d63f585b716dbef611647
Gerrit-Change-Number: 8238356
Gerrit-PatchSet: 1
Gerrit-Owner: Danilo Tedeschi <da...@google.com>
Gerrit-CC: (Julie)Jeongeun Kim <je_jul...@chromium.org>
Gerrit-CC: Akihiro Ota <akihi...@chromium.org>
Gerrit-CC: Enterprise Policy Reviews <enterprise-p...@google.com>
satisfied_requirement
unsatisfied_requirement
open
diffy

James Cook (Gerrit)

unread,
Aug 11, 2026, 3:47:45 PM (5 days ago) Aug 11
to Danilo Tedeschi, Chromium LUCI CQ, Ashley Prasad, chromium...@chromium.org, Enterprise Policy Reviews, (Julie)Jeongeun Kim, abigailbk...@google.com, anastas...@google.com, browser-comp...@chromium.org, chrome-intell...@chromium.org, chrome-intelligence-te...@google.com, chromium-a...@chromium.org, croissant-...@chromium.org, cros-setti...@google.com, dtseng...@chromium.org, extension...@chromium.org, feature-me...@chromium.org, francisjp...@google.com, hirokisa...@chromium.org, josiah...@chromium.org, jshin...@chromium.org, katie...@chromium.org, keithle...@chromium.org, kyungjunle...@google.com, nektar...@chromium.org, net-r...@chromium.org, nona+...@chromium.org, oshima...@chromium.org, rrsilva+wat...@google.com, shuche...@chromium.org, steimel+...@chromium.org, tbarzi...@chromium.org, tranbaod...@chromium.org, yhanad...@chromium.org, yuzo+...@chromium.org
Attention needed from Ashley Prasad and Danilo Tedeschi

James Cook added 8 comments

File ash/system/locale/locale_detailed_view.cc
Line 26, Patchset 7 (Latest):#include "ui/base/l10n/l10n_util.h"
James Cook . unresolved

Is this include still needed?

Line 71, Patchset 7 (Latest): .value_or(base::i18n::GetKnownLanguageTag("und"))
James Cook . unresolved

It is possible to use a named constant for "und"? I had to do a bunch of searching to figure out it meant "undetermined". Also, GetKnownLanguageTag() does not have a function comment, which doesn't help.

File ash/system/locale/locale_feature_pod_controller.cc
Line 22, Patchset 7 (Latest):#include "ui/base/l10n/l10n_util.h"
James Cook . unresolved

ditto

Line 37, Patchset 7 (Latest): .value_or(base::i18n::GetKnownLanguageTag("und"))
James Cook . unresolved

ditto. Or maybe you could have a constant for the undetermined language tag and use that directly.

File ash/system/unified/current_locale_view.cc
Line 19, Patchset 7 (Latest):#include "ui/base/l10n/l10n_util.h"
James Cook . unresolved

ditto and throughout CL

File chrome/browser/ash/accessibility/live_caption/system_live_caption_service.cc
Line 93, Patchset 7 (Latest): base::i18n::GetLanguageTagFromString(target_language)
James Cook . unresolved

Pull these into local variables, this if() condition is too long.

File chromeos/components/quick_answers/understanding/intent_generator.cc
Line 111, Patchset 7 (Latest): .language_subtag() == detected_language) {
James Cook . unresolved

After seeing this code repeated many times, what do you think about adding a helper function in base::i18n to extract the language subtag? It could be called GetLanguage or GetLanguageSubtag. Doing this would probably make all these call sites more readable.

File ui/base/l10n/l10n_util.h
Line 103, Patchset 7 (Latest):COMPONENT_EXPORT(UI_BASE)
James Cook . unresolved

Please add a comment for this function. For example, is it preferred to use this method over the one above?

Open in Gerrit

Related details

Attention is currently required from:
  • Ashley Prasad
  • Danilo Tedeschi
Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Owners
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: I5dd158e232170170489d63f585b716dbef611647
    Gerrit-Change-Number: 8238356
    Gerrit-PatchSet: 7
    Gerrit-Owner: Danilo Tedeschi <da...@google.com>
    Gerrit-Reviewer: Ashley Prasad <ashl...@google.com>
    Gerrit-Reviewer: Danilo Tedeschi <da...@google.com>
    Gerrit-Reviewer: James Cook <jame...@chromium.org>
    Gerrit-CC: (Julie)Jeongeun Kim <je_jul...@chromium.org>
    Gerrit-CC: Akihiro Ota <akihi...@chromium.org>
    Gerrit-CC: Enterprise Policy Reviews <enterprise-p...@google.com>
    Gerrit-Attention: Danilo Tedeschi <da...@google.com>
    Gerrit-Attention: Ashley Prasad <ashl...@google.com>
    Gerrit-Comment-Date: Tue, 11 Aug 2026 19:47:32 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Danilo Tedeschi (Gerrit)

    unread,
    Aug 11, 2026, 8:27:58 PM (5 days ago) Aug 11
    to Chromium LUCI CQ, Ashley Prasad, James Cook, chromium...@chromium.org, Enterprise Policy Reviews, (Julie)Jeongeun Kim, abigailbk...@google.com, anastas...@google.com, browser-comp...@chromium.org, chrome-intell...@chromium.org, chrome-intelligence-te...@google.com, chromium-a...@chromium.org, croissant-...@chromium.org, cros-setti...@google.com, dtseng...@chromium.org, extension...@chromium.org, feature-me...@chromium.org, francisjp...@google.com, hirokisa...@chromium.org, josiah...@chromium.org, jshin...@chromium.org, katie...@chromium.org, keithle...@chromium.org, kyungjunle...@google.com, nektar...@chromium.org, net-r...@chromium.org, nona+...@chromium.org, oshima...@chromium.org, rrsilva+wat...@google.com, shuche...@chromium.org, steimel+...@chromium.org, tbarzi...@chromium.org, tranbaod...@chromium.org, yhanad...@chromium.org, yuzo+...@chromium.org
    Attention needed from Ashley Prasad and James Cook

    Danilo Tedeschi added 8 comments

    File ash/system/locale/locale_detailed_view.cc
    Line 26, Patchset 7:#include "ui/base/l10n/l10n_util.h"
    James Cook . resolved

    Is this include still needed?

    Danilo Tedeschi

    Done

    Line 71, Patchset 7: .value_or(base::i18n::GetKnownLanguageTag("und"))
    James Cook . resolved

    It is possible to use a named constant for "und"? I had to do a bunch of searching to figure out it meant "undetermined". Also, GetKnownLanguageTag() does not have a function comment, which doesn't help.

    Danilo Tedeschi

    stoped using "und".

    File ash/system/locale/locale_feature_pod_controller.cc
    Line 22, Patchset 7:#include "ui/base/l10n/l10n_util.h"
    James Cook . resolved

    ditto

    Danilo Tedeschi

    Done

    Line 37, Patchset 7: .value_or(base::i18n::GetKnownLanguageTag("und"))
    James Cook . resolved

    ditto. Or maybe you could have a constant for the undetermined language tag and use that directly.

    Danilo Tedeschi

    ack.

    File ash/system/unified/current_locale_view.cc
    Line 19, Patchset 7:#include "ui/base/l10n/l10n_util.h"
    James Cook . resolved

    ditto and throughout CL

    Danilo Tedeschi

    I was not able to remove it.

    File chrome/browser/ash/accessibility/live_caption/system_live_caption_service.cc
    Line 93, Patchset 7: base::i18n::GetLanguageTagFromString(target_language)
    James Cook . resolved

    Pull these into local variables, this if() condition is too long.

    Danilo Tedeschi

    Done

    File chromeos/components/quick_answers/understanding/intent_generator.cc
    Line 111, Patchset 7: .language_subtag() == detected_language) {
    James Cook . resolved

    After seeing this code repeated many times, what do you think about adding a helper function in base::i18n to extract the language subtag? It could be called GetLanguage or GetLanguageSubtag. Doing this would probably make all these call sites more readable.

    Danilo Tedeschi

    the code is long because the outer layer is not migrated to use LanguageTag yet. I prefer leaving the more complex code in as a way to force us a bubble up migration of LanguageTag that will make the code cleaner later on. However, if you prefer, I can add a temporary function that takes in a string and returns a language subtag. WDYT?

    File ui/base/l10n/l10n_util.h
    Line 103, Patchset 7:COMPONENT_EXPORT(UI_BASE)
    James Cook . resolved

    Please add a comment for this function. For example, is it preferred to use this method over the one above?

    Danilo Tedeschi

    Done

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Ashley Prasad
    • James Cook
    Submit Requirements:
      • requirement satisfiedCode-Coverage
      • requirement is not satisfiedCode-Owners
      • requirement is not satisfiedCode-Review
      • requirement is not satisfiedReview-Enforcement
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: chromium/src
      Gerrit-Branch: main
      Gerrit-Change-Id: I5dd158e232170170489d63f585b716dbef611647
      Gerrit-Change-Number: 8238356
      Gerrit-PatchSet: 25
      Gerrit-Owner: Danilo Tedeschi <da...@google.com>
      Gerrit-Reviewer: Ashley Prasad <ashl...@google.com>
      Gerrit-Reviewer: Danilo Tedeschi <da...@google.com>
      Gerrit-Reviewer: James Cook <jame...@chromium.org>
      Gerrit-CC: (Julie)Jeongeun Kim <je_jul...@chromium.org>
      Gerrit-CC: Akihiro Ota <akihi...@chromium.org>
      Gerrit-CC: Enterprise Policy Reviews <enterprise-p...@google.com>
      Gerrit-Attention: James Cook <jame...@chromium.org>
      Gerrit-Attention: Ashley Prasad <ashl...@google.com>
      Gerrit-Comment-Date: Wed, 12 Aug 2026 00:27:46 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      Comment-In-Reply-To: James Cook <jame...@chromium.org>
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      James Cook (Gerrit)

      unread,
      Aug 11, 2026, 8:50:00 PM (5 days ago) Aug 11
      to Danilo Tedeschi, Chromium LUCI CQ, Ashley Prasad, chromium...@chromium.org, Enterprise Policy Reviews, (Julie)Jeongeun Kim, abigailbk...@google.com, anastas...@google.com, browser-comp...@chromium.org, chrome-intell...@chromium.org, chrome-intelligence-te...@google.com, chromium-a...@chromium.org, croissant-...@chromium.org, cros-setti...@google.com, dtseng...@chromium.org, extension...@chromium.org, feature-me...@chromium.org, francisjp...@google.com, hirokisa...@chromium.org, josiah...@chromium.org, jshin...@chromium.org, katie...@chromium.org, keithle...@chromium.org, kyungjunle...@google.com, nektar...@chromium.org, net-r...@chromium.org, nona+...@chromium.org, oshima...@chromium.org, rrsilva+wat...@google.com, shuche...@chromium.org, steimel+...@chromium.org, tbarzi...@chromium.org, tranbaod...@chromium.org, yhanad...@chromium.org, yuzo+...@chromium.org
      Attention needed from Ashley Prasad and Danilo Tedeschi

      James Cook added 4 comments

      File ash/system/locale/locale_detailed_view.cc
      Line 71, Patchset 7: .value_or(base::i18n::GetKnownLanguageTag("und"))
      James Cook . unresolved

      It is possible to use a named constant for "und"? I had to do a bunch of searching to figure out it meant "undetermined". Also, GetKnownLanguageTag() does not have a function comment, which doesn't help.

      Danilo Tedeschi

      stoped using "und".

      James Cook

      Really? I still see it in the latest patchset.

      File ash/system/unified/current_locale_view.cc
      Line 19, Patchset 7:#include "ui/base/l10n/l10n_util.h"
      James Cook . unresolved

      ditto and throughout CL

      Danilo Tedeschi

      I was not able to remove it.

      James Cook

      Just here, or every instance in all the other files you touched?

      I'll bet at least some of them aren't needed anymore.

      File chrome/browser/ash/policy/core/device_local_account_browsertest.cc
      Line 478, Patchset 27 (Latest): .value_or(base::i18n::GetKnownLanguageTag("und"));
      James Cook . unresolved

      Like here.

      File chromeos/components/quick_answers/understanding/intent_generator.cc
      Line 111, Patchset 7: .language_subtag() == detected_language) {
      James Cook . unresolved

      After seeing this code repeated many times, what do you think about adding a helper function in base::i18n to extract the language subtag? It could be called GetLanguage or GetLanguageSubtag. Doing this would probably make all these call sites more readable.

      Danilo Tedeschi

      the code is long because the outer layer is not migrated to use LanguageTag yet. I prefer leaving the more complex code in as a way to force us a bubble up migration of LanguageTag that will make the code cleaner later on. However, if you prefer, I can add a temporary function that takes in a string and returns a language subtag. WDYT?

      James Cook

      Yes, I'd prefer a function that takes a string and returns a subtag. Thanks.

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Ashley Prasad
      • Danilo Tedeschi
      Submit Requirements:
        • requirement satisfiedCode-Coverage
        • requirement is not satisfiedCode-Owners
        • requirement is not satisfiedCode-Review
        • requirement is not satisfiedNo-Unresolved-Comments
        • requirement is not satisfiedReview-Enforcement
        Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
        Gerrit-MessageType: comment
        Gerrit-Project: chromium/src
        Gerrit-Branch: main
        Gerrit-Change-Id: I5dd158e232170170489d63f585b716dbef611647
        Gerrit-Change-Number: 8238356
        Gerrit-PatchSet: 27
        Gerrit-Owner: Danilo Tedeschi <da...@google.com>
        Gerrit-Reviewer: Ashley Prasad <ashl...@google.com>
        Gerrit-Reviewer: Danilo Tedeschi <da...@google.com>
        Gerrit-Reviewer: James Cook <jame...@chromium.org>
        Gerrit-CC: (Julie)Jeongeun Kim <je_jul...@chromium.org>
        Gerrit-CC: Akihiro Ota <akihi...@chromium.org>
        Gerrit-CC: Enterprise Policy Reviews <enterprise-p...@google.com>
        Gerrit-Attention: Danilo Tedeschi <da...@google.com>
        Gerrit-Attention: Ashley Prasad <ashl...@google.com>
        Gerrit-Comment-Date: Wed, 12 Aug 2026 00:49:49 +0000
        Gerrit-HasComments: Yes
        Gerrit-Has-Labels: No
        Comment-In-Reply-To: James Cook <jame...@chromium.org>
        Comment-In-Reply-To: Danilo Tedeschi <da...@google.com>
        satisfied_requirement
        unsatisfied_requirement
        open
        diffy

        Ashley Prasad (Gerrit)

        unread,
        Aug 12, 2026, 1:07:30 PM (4 days ago) Aug 12
        to Danilo Tedeschi, Chromium LUCI CQ, James Cook, chromium...@chromium.org, Enterprise Policy Reviews, (Julie)Jeongeun Kim, abigailbk...@google.com, anastas...@google.com, browser-comp...@chromium.org, chrome-intell...@chromium.org, chrome-intelligence-te...@google.com, chromium-a...@chromium.org, croissant-...@chromium.org, cros-setti...@google.com, dtseng...@chromium.org, extension...@chromium.org, feature-me...@chromium.org, francisjp...@google.com, hirokisa...@chromium.org, josiah...@chromium.org, jshin...@chromium.org, katie...@chromium.org, keithle...@chromium.org, kyungjunle...@google.com, nektar...@chromium.org, net-r...@chromium.org, nona+...@chromium.org, oshima...@chromium.org, rrsilva+wat...@google.com, shuche...@chromium.org, steimel+...@chromium.org, tbarzi...@chromium.org, tranbaod...@chromium.org, yhanad...@chromium.org, yuzo+...@chromium.org
        Attention needed from Danilo Tedeschi

        Ashley Prasad added 20 comments

        Commit Message
        Line 16, Patchset 30 (Latest):Bug: None
        Ashley Prasad . unresolved

        optional nit: add `Test: <tests run>`.

        File chrome/browser/ash/locale/locale_change_guard.cc
        Line 229, Patchset 30 (Latest): if (from_tag && to_tag) {
        Ashley Prasad . unresolved

        Please fix this WARNING reported by autoreview issue finding: If one of the locales is invalid (causing `from_tag` or `to_tag` to be `std::nullopt`), this will skip to `return false;` instead of evaluating differences.

        In the original code, `l10n_util::GetLanguage` would return strings for both, and if one was valid (e.g. `en`) and the other was invalid (e.g. `xyz`), they would be evaluated as different and return `true`. This could cause the notification to be silently ignored if one of the locales is malformed.

        @ashleydp - It looks like the logic here is a bit different than the original code, I think it was originally check if they did not match and returning true. Now it appears that if either are not set we're returning false. Is this intentional?

        Line 229, Patchset 30 (Latest): if (from_tag && to_tag) {
        Ashley Prasad . unresolved

        nit: can we invert this check to return early in the false condition instead of having the nested if?

        File chrome/browser/ash/main_parts/chrome_browser_main_parts_ash.cc
        Line 1130, Patchset 30 (Latest): std::string(base::i18n::GetLanguageTagFromString(
        g_browser_process->GetApplicationLocale())
        .transform(&base::i18n::LanguageTag::language_subtag)
        .value_or(std::string_view())));
        Ashley Prasad . unresolved

        qq: It looks like we're using the same general logic in several files, is this something we can put in a helper function?

        File chrome/browser/ash/policy/core/device_local_account_browsertest.cc
        Line 478, Patchset 30 (Latest): .value();
        Ashley Prasad . unresolved

        Please fix this WARNING reported by autoreview issue finding: Calling `.value()` on `std::optional` without checking if it contains a value will crash the test runner with a hard-to-read `std::bad_optional_access` exception if `GetApplicationLocale()` returns something unparseable.

        Consider checking `.has_value()` or using `CHECK` for a better error message if this is guaranteed to succeed.

        @ashleydp - optional nit: Seems unlikely to occur but it may be beneficial to have cleaner error messaging on the off chance it does.

        Line 756, Patchset 30 (Latest): EXPECT_EQ(GetLanguage(locales[0]), icu::Locale::getDefault().getLanguage());
        Ashley Prasad . unresolved

        qq: The CL description mentions removing `GetLanguage`, was this call left intentionally or am I missing a local test function this is mapped to?

        Line 1726, Patchset 30 (Latest): EXPECT_EQ(GetLanguage(kPublicSessionLocale),
        Ashley Prasad . unresolved

        Same question as line 756.

        Line 1815, Patchset 30 (Latest): EXPECT_EQ(GetLanguage(kSingleRecommendedLocale[0]),
        Ashley Prasad . unresolved

        Same question as line 756.

        Line 1938, Patchset 30 (Latest): EXPECT_EQ(GetLanguage(kPublicSessionLocale),
        Ashley Prasad . unresolved

        Same question as line 756.

        Line 2029, Patchset 30 (Latest): EXPECT_EQ(GetLanguage(kRecommendedLocales1[0]),
        Ashley Prasad . unresolved

        Same question as line 756.

        Line 2079, Patchset 30 (Latest): EXPECT_EQ(GetLanguage(kPublicSessionLocale),
        Ashley Prasad . unresolved

        Same question as line 756.

        Line 2099, Patchset 30 (Latest): EXPECT_EQ(GetLanguage(kPublicSessionLocale),
        Ashley Prasad . unresolved

        Same question as line 756.

        Line 2126, Patchset 30 (Latest): EXPECT_EQ(GetLanguage(kPublicSessionLocale),
        Ashley Prasad . unresolved

        Same question as line 756.

        File chromeos/components/quick_answers/public/cpp/quick_answers_state.h
        Line 182, Patchset 30 (Latest): base::i18n::GetKnownLanguageTag("und"));
        Ashley Prasad . unresolved

        nit: replace with named constant.

        File chromeos/components/quick_answers/public/cpp/quick_answers_state.cc
        Line 574, Patchset 30 (Latest):void QuickAnswersState::SetPreferredLanguages(
        Ashley Prasad . unresolved

        qq: is this only used in tests?

        File chromeos/components/quick_answers/understanding/intent_generator.cc
        Line 120, Patchset 30 (Latest): base::i18n::LanguageTag device_language =
        QuickAnswersState::Get()->application_locale().WithLanguageSubtagOnly();
        Ashley Prasad . unresolved

        qq: can this be simplified to `std::string_view device_language = QuickAnswersState::Get()->application_locale().language_subtag();`?

        Line 340, Patchset 30 (Latest): if (QuickAnswersState::Get()->application_locale().tag_string() == "und" ||
        Ashley Prasad . unresolved

        nit: use constant. Maybe adding constexpr for this would suffice.

        Line 360, Patchset 30 (Latest): base::i18n::LanguageTag device_language =
        QuickAnswersState::Get()->application_locale().WithLanguageSubtagOnly();
        std::optional<base::i18n::LanguageTag> detected_language =
        detected_locale
        .and_then([](const std::string& locale) {
        return base::i18n::GetLanguageTagFromString(locale);
        })
        .transform(&base::i18n::LanguageTag::WithLanguageSubtagOnly);
        Ashley Prasad . unresolved

        qq: I feel like I'm missing context here, it looks like we're taking strings making them into language tags and then making them back into strings. Is this adding some additional type checking which is why we're doing these transforms?

        Line 372, Patchset 30 (Latest): if (detected_language && device_language.tag_string() != "und" &&
        Ashley Prasad . unresolved

        nit: same as line 340

        File chromeos/components/quick_answers/utils/spell_checker.cc
        Line 118, Patchset 30 (Latest): if (app_locale.tag_string() != "und") {
        Ashley Prasad . unresolved

        nit: use a constant.

        Open in Gerrit

        Related details

        Attention is currently required from:
        • Danilo Tedeschi
        Submit Requirements:
        • requirement satisfiedCode-Coverage
        • requirement is not satisfiedCode-Owners
        • requirement is not satisfiedCode-Review
        • requirement is not satisfiedNo-Unresolved-Comments
        • requirement is not satisfiedReview-Enforcement
        Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
        Gerrit-MessageType: comment
        Gerrit-Project: chromium/src
        Gerrit-Branch: main
        Gerrit-Change-Id: I5dd158e232170170489d63f585b716dbef611647
        Gerrit-Change-Number: 8238356
        Gerrit-PatchSet: 30
        Gerrit-Owner: Danilo Tedeschi <da...@google.com>
        Gerrit-Reviewer: Ashley Prasad <ashl...@google.com>
        Gerrit-Reviewer: Danilo Tedeschi <da...@google.com>
        Gerrit-Reviewer: James Cook <jame...@chromium.org>
        Gerrit-CC: (Julie)Jeongeun Kim <je_jul...@chromium.org>
        Gerrit-CC: Akihiro Ota <akihi...@chromium.org>
        Gerrit-CC: Enterprise Policy Reviews <enterprise-p...@google.com>
        Gerrit-Attention: Danilo Tedeschi <da...@google.com>
        Gerrit-Comment-Date: Wed, 12 Aug 2026 17:07:20 +0000
        Gerrit-HasComments: Yes
        Gerrit-Has-Labels: No
        satisfied_requirement
        unsatisfied_requirement
        open
        diffy

        Danilo Tedeschi (Gerrit)

        unread,
        Aug 13, 2026, 4:52:28 PM (3 days ago) Aug 13
        to Chromium LUCI CQ, Ashley Prasad, James Cook, chromium...@chromium.org, Enterprise Policy Reviews, (Julie)Jeongeun Kim, abigailbk...@google.com, anastas...@google.com, browser-comp...@chromium.org, chrome-intell...@chromium.org, chrome-intelligence-te...@google.com, chromium-a...@chromium.org, croissant-...@chromium.org, cros-setti...@google.com, dtseng...@chromium.org, extension...@chromium.org, feature-me...@chromium.org, francisjp...@google.com, hirokisa...@chromium.org, josiah...@chromium.org, jshin...@chromium.org, katie...@chromium.org, keithle...@chromium.org, kyungjunle...@google.com, nektar...@chromium.org, net-r...@chromium.org, nona+...@chromium.org, oshima...@chromium.org, rrsilva+wat...@google.com, shuche...@chromium.org, steimel+...@chromium.org, tbarzi...@chromium.org, tranbaod...@chromium.org, yhanad...@chromium.org, yuzo+...@chromium.org
        Attention needed from Ashley Prasad and James Cook

        Danilo Tedeschi voted and added 25 comments

        Votes added by Danilo Tedeschi

        Commit-Queue+1

        25 comments

        Patchset-level comments
        File-level comment, Patchset 53 (Latest):
        Danilo Tedeschi . resolved

        sorry for the large change. I will try to split some stuff out of it.

        Commit Message
        Line 16, Patchset 30:Bug: None
        Ashley Prasad . resolved

        optional nit: add `Test: <tests run>`.

        Danilo Tedeschi

        Done

        File ash/system/locale/locale_detailed_view.cc
        Line 71, Patchset 7: .value_or(base::i18n::GetKnownLanguageTag("und"))
        James Cook . resolved

        It is possible to use a named constant for "und"? I had to do a bunch of searching to figure out it meant "undetermined". Also, GetKnownLanguageTag() does not have a function comment, which doesn't help.

        Danilo Tedeschi

        stoped using "und".

        James Cook

        Really? I still see it in the latest patchset.

        Danilo Tedeschi

        Done

        File ash/system/unified/current_locale_view.cc
        Line 19, Patchset 7:#include "ui/base/l10n/l10n_util.h"
        James Cook . resolved

        ditto and throughout CL

        Danilo Tedeschi

        I was not able to remove it.

        James Cook

        Just here, or every instance in all the other files you touched?

        I'll bet at least some of them aren't needed anymore.

        Danilo Tedeschi

        Done

        File chrome/browser/ash/locale/locale_change_guard.cc
        Line 229, Patchset 30: if (from_tag && to_tag) {
        Ashley Prasad . resolved

        nit: can we invert this check to return early in the false condition instead of having the nested if?

        Danilo Tedeschi

        Done

        Line 229, Patchset 30: if (from_tag && to_tag) {
        Ashley Prasad . resolved

        Please fix this WARNING reported by autoreview issue finding: If one of the locales is invalid (causing `from_tag` or `to_tag` to be `std::nullopt`), this will skip to `return false;` instead of evaluating differences.

        In the original code, `l10n_util::GetLanguage` would return strings for both, and if one was valid (e.g. `en`) and the other was invalid (e.g. `xyz`), they would be evaluated as different and return `true`. This could cause the notification to be silently ignored if one of the locales is malformed.

        @ashleydp - It looks like the logic here is a bit different than the original code, I think it was originally check if they did not match and returning true. Now it appears that if either are not set we're returning false. Is this intentional?

        Danilo Tedeschi

        Done

        File chrome/browser/ash/main_parts/chrome_browser_main_parts_ash.cc
        Line 1130, Patchset 30: std::string(base::i18n::GetLanguageTagFromString(

        g_browser_process->GetApplicationLocale())
        .transform(&base::i18n::LanguageTag::language_subtag)
        .value_or(std::string_view())));
        Ashley Prasad . resolved

        qq: It looks like we're using the same general logic in several files, is this something we can put in a helper function?

        Danilo Tedeschi

        Done

        File chrome/browser/ash/policy/core/device_local_account_browsertest.cc
        Line 478, Patchset 27: .value_or(base::i18n::GetKnownLanguageTag("und"));
        James Cook . resolved

        Like here.

        Danilo Tedeschi

        Done

        Line 478, Patchset 30: .value();
        Ashley Prasad . resolved

        Please fix this WARNING reported by autoreview issue finding: Calling `.value()` on `std::optional` without checking if it contains a value will crash the test runner with a hard-to-read `std::bad_optional_access` exception if `GetApplicationLocale()` returns something unparseable.

        Consider checking `.has_value()` or using `CHECK` for a better error message if this is guaranteed to succeed.

        @ashleydp - optional nit: Seems unlikely to occur but it may be beneficial to have cleaner error messaging on the off chance it does.

        Danilo Tedeschi

        Done

        Line 756, Patchset 30: EXPECT_EQ(GetLanguage(locales[0]), icu::Locale::getDefault().getLanguage());
        Ashley Prasad . resolved

        qq: The CL description mentions removing `GetLanguage`, was this call left intentionally or am I missing a local test function this is mapped to?

        Danilo Tedeschi

        Done

        Line 1726, Patchset 30: EXPECT_EQ(GetLanguage(kPublicSessionLocale),
        Ashley Prasad . resolved

        Same question as line 756.

        Danilo Tedeschi

        Done

        Line 1815, Patchset 30: EXPECT_EQ(GetLanguage(kSingleRecommendedLocale[0]),
        Ashley Prasad . resolved

        Same question as line 756.

        Danilo Tedeschi

        Done

        Line 1938, Patchset 30: EXPECT_EQ(GetLanguage(kPublicSessionLocale),
        Ashley Prasad . resolved

        Same question as line 756.

        Danilo Tedeschi

        Done

        Line 2029, Patchset 30: EXPECT_EQ(GetLanguage(kRecommendedLocales1[0]),
        Ashley Prasad . resolved

        Same question as line 756.

        Danilo Tedeschi

        Done

        Line 2079, Patchset 30: EXPECT_EQ(GetLanguage(kPublicSessionLocale),
        Ashley Prasad . resolved

        Same question as line 756.

        Danilo Tedeschi

        Done

        Line 2099, Patchset 30: EXPECT_EQ(GetLanguage(kPublicSessionLocale),
        Ashley Prasad . resolved

        Same question as line 756.

        Danilo Tedeschi

        Done

        Line 2126, Patchset 30: EXPECT_EQ(GetLanguage(kPublicSessionLocale),
        Ashley Prasad . resolved

        Same question as line 756.

        Danilo Tedeschi

        Done

        File chromeos/components/quick_answers/public/cpp/quick_answers_state.h
        Line 182, Patchset 30: base::i18n::GetKnownLanguageTag("und"));
        Ashley Prasad . resolved

        nit: replace with named constant.

        Danilo Tedeschi

        Acknowledged

        File chromeos/components/quick_answers/public/cpp/quick_answers_state.cc
        Line 574, Patchset 30:void QuickAnswersState::SetPreferredLanguages(
        Ashley Prasad . resolved

        qq: is this only used in tests?

        Danilo Tedeschi

        removed it.

        File chromeos/components/quick_answers/understanding/intent_generator.cc
        Line 111, Patchset 7: .language_subtag() == detected_language) {
        James Cook . resolved

        After seeing this code repeated many times, what do you think about adding a helper function in base::i18n to extract the language subtag? It could be called GetLanguage or GetLanguageSubtag. Doing this would probably make all these call sites more readable.

        Danilo Tedeschi

        the code is long because the outer layer is not migrated to use LanguageTag yet. I prefer leaving the more complex code in as a way to force us a bubble up migration of LanguageTag that will make the code cleaner later on. However, if you prefer, I can add a temporary function that takes in a string and returns a language subtag. WDYT?

        James Cook

        Yes, I'd prefer a function that takes a string and returns a subtag. Thanks.

        Danilo Tedeschi

        Done

        Line 120, Patchset 30: base::i18n::LanguageTag device_language =
        QuickAnswersState::Get()->application_locale().WithLanguageSubtagOnly();
        Ashley Prasad . resolved

        qq: can this be simplified to `std::string_view device_language = QuickAnswersState::Get()->application_locale().language_subtag();`?

        Danilo Tedeschi

        Done

        Line 340, Patchset 30: if (QuickAnswersState::Get()->application_locale().tag_string() == "und" ||
        Ashley Prasad . resolved

        nit: use constant. Maybe adding constexpr for this would suffice.

        Danilo Tedeschi

        Done

        Line 360, Patchset 30: base::i18n::LanguageTag device_language =

        QuickAnswersState::Get()->application_locale().WithLanguageSubtagOnly();
        std::optional<base::i18n::LanguageTag> detected_language =
        detected_locale
        .and_then([](const std::string& locale) {
        return base::i18n::GetLanguageTagFromString(locale);
        })
        .transform(&base::i18n::LanguageTag::WithLanguageSubtagOnly);
        Ashley Prasad . resolved

        qq: I feel like I'm missing context here, it looks like we're taking strings making them into language tags and then making them back into strings. Is this adding some additional type checking which is why we're doing these transforms?

        Danilo Tedeschi

        unfortunately, migrating everything to LanguageTag would be a huge change, it is easier to do it step by step. I could do a massive migration here, but I feel like it would not easy to review it.

        Line 372, Patchset 30: if (detected_language && device_language.tag_string() != "und" &&
        Ashley Prasad . resolved

        nit: same as line 340

        Danilo Tedeschi

        Done

        File chromeos/components/quick_answers/utils/spell_checker.cc
        Line 118, Patchset 30: if (app_locale.tag_string() != "und") {
        Ashley Prasad . resolved

        nit: use a constant.

        Danilo Tedeschi

        Done

        Open in Gerrit

        Related details

        Attention is currently required from:
        • Ashley Prasad
        • James Cook
        Submit Requirements:
          • requirement satisfiedCode-Coverage
          • requirement is not satisfiedCode-Owners
          • requirement is not satisfiedCode-Review
          • requirement is not satisfiedReview-Enforcement
          Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
          Gerrit-MessageType: comment
          Gerrit-Project: chromium/src
          Gerrit-Branch: main
          Gerrit-Change-Id: I5dd158e232170170489d63f585b716dbef611647
          Gerrit-Change-Number: 8238356
          Gerrit-PatchSet: 53
          Gerrit-Owner: Danilo Tedeschi <da...@google.com>
          Gerrit-Reviewer: Ashley Prasad <ashl...@google.com>
          Gerrit-Reviewer: Danilo Tedeschi <da...@google.com>
          Gerrit-Reviewer: James Cook <jame...@chromium.org>
          Gerrit-CC: (Julie)Jeongeun Kim <je_jul...@chromium.org>
          Gerrit-CC: Akihiro Ota <akihi...@chromium.org>
          Gerrit-CC: Enterprise Policy Reviews <enterprise-p...@google.com>
          Gerrit-Attention: James Cook <jame...@chromium.org>
          Gerrit-Attention: Ashley Prasad <ashl...@google.com>
          Gerrit-Comment-Date: Thu, 13 Aug 2026 20:52:13 +0000
          Gerrit-HasComments: Yes
          Gerrit-Has-Labels: Yes
          Comment-In-Reply-To: James Cook <jame...@chromium.org>
          Comment-In-Reply-To: Danilo Tedeschi <da...@google.com>
          Comment-In-Reply-To: Ashley Prasad <ashl...@google.com>
          satisfied_requirement
          unsatisfied_requirement
          open
          diffy

          James Cook (Gerrit)

          unread,
          Aug 13, 2026, 5:58:33 PM (3 days ago) Aug 13
          to Danilo Tedeschi, Chromium LUCI CQ, Ashley Prasad, chromium...@chromium.org, Enterprise Policy Reviews, (Julie)Jeongeun Kim, abigailbk...@google.com, anastas...@google.com, browser-comp...@chromium.org, chrome-intell...@chromium.org, chrome-intelligence-te...@google.com, chromium-a...@chromium.org, croissant-...@chromium.org, cros-setti...@google.com, dtseng...@chromium.org, extension...@chromium.org, feature-me...@chromium.org, francisjp...@google.com, hirokisa...@chromium.org, josiah...@chromium.org, jshin...@chromium.org, katie...@chromium.org, keithle...@chromium.org, kyungjunle...@google.com, nektar...@chromium.org, net-r...@chromium.org, nona+...@chromium.org, oshima...@chromium.org, rrsilva+wat...@google.com, shuche...@chromium.org, steimel+...@chromium.org, tbarzi...@chromium.org, tranbaod...@chromium.org, yhanad...@chromium.org, yuzo+...@chromium.org
          Attention needed from Ashley Prasad and Danilo Tedeschi

          James Cook added 1 comment

          Patchset-level comments
          File-level comment, Patchset 53:
          Danilo Tedeschi . unresolved

          sorry for the large change. I will try to split some stuff out of it.

          James Cook

          OK. I'll let you split it up first, then I'll review the pieces. Let me know when you want me to look at it.

          Open in Gerrit

          Related details

          Attention is currently required from:
          • Ashley Prasad
          • Danilo Tedeschi
          Submit Requirements:
            • requirement satisfiedCode-Coverage
            • requirement is not satisfiedCode-Owners
            • requirement is not satisfiedCode-Review
            • requirement is not satisfiedNo-Unresolved-Comments
            • requirement is not satisfiedReview-Enforcement
            Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
            Gerrit-MessageType: comment
            Gerrit-Project: chromium/src
            Gerrit-Branch: main
            Gerrit-Change-Id: I5dd158e232170170489d63f585b716dbef611647
            Gerrit-Change-Number: 8238356
            Gerrit-PatchSet: 55
            Gerrit-Owner: Danilo Tedeschi <da...@google.com>
            Gerrit-Reviewer: Ashley Prasad <ashl...@google.com>
            Gerrit-Reviewer: Danilo Tedeschi <da...@google.com>
            Gerrit-Reviewer: James Cook <jame...@chromium.org>
            Gerrit-CC: (Julie)Jeongeun Kim <je_jul...@chromium.org>
            Gerrit-CC: Akihiro Ota <akihi...@chromium.org>
            Gerrit-CC: Enterprise Policy Reviews <enterprise-p...@google.com>
            Gerrit-Attention: Danilo Tedeschi <da...@google.com>
            Gerrit-Attention: Ashley Prasad <ashl...@google.com>
            Gerrit-Comment-Date: Thu, 13 Aug 2026 21:58:19 +0000
            Gerrit-HasComments: Yes
            Gerrit-Has-Labels: No
            Comment-In-Reply-To: Danilo Tedeschi <da...@google.com>
            satisfied_requirement
            unsatisfied_requirement
            open
            diffy

            Danilo Tedeschi (Gerrit)

            unread,
            Aug 13, 2026, 7:15:03 PM (3 days ago) Aug 13
            to Chromium LUCI CQ, Ashley Prasad, James Cook, chromium...@chromium.org, Enterprise Policy Reviews, (Julie)Jeongeun Kim, abigailbk...@google.com, anastas...@google.com, browser-comp...@chromium.org, chrome-intell...@chromium.org, chrome-intelligence-te...@google.com, chromium-a...@chromium.org, croissant-...@chromium.org, cros-setti...@google.com, dtseng...@chromium.org, extension...@chromium.org, feature-me...@chromium.org, francisjp...@google.com, hirokisa...@chromium.org, josiah...@chromium.org, jshin...@chromium.org, katie...@chromium.org, keithle...@chromium.org, kyungjunle...@google.com, nektar...@chromium.org, net-r...@chromium.org, nona+...@chromium.org, oshima...@chromium.org, rrsilva+wat...@google.com, shuche...@chromium.org, steimel+...@chromium.org, tbarzi...@chromium.org, tranbaod...@chromium.org, yhanad...@chromium.org, yuzo+...@chromium.org
            Attention needed from Ashley Prasad and James Cook

            Danilo Tedeschi added 1 comment

            Patchset-level comments
            File-level comment, Patchset 53:
            Danilo Tedeschi . resolved

            sorry for the large change. I will try to split some stuff out of it.

            James Cook

            OK. I'll let you split it up first, then I'll review the pieces. Let me know when you want me to look at it.

            Danilo Tedeschi

            Done

            Open in Gerrit

            Related details

            Attention is currently required from:
            • Ashley Prasad
            • James Cook
            Submit Requirements:
              • requirement satisfiedCode-Coverage
              • requirement is not satisfiedCode-Owners
              • requirement is not satisfiedCode-Review
              • requirement is not satisfiedReview-Enforcement
              Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
              Gerrit-MessageType: comment
              Gerrit-Project: chromium/src
              Gerrit-Branch: main
              Gerrit-Change-Id: I5dd158e232170170489d63f585b716dbef611647
              Gerrit-Change-Number: 8238356
              Gerrit-PatchSet: 56
              Gerrit-Owner: Danilo Tedeschi <da...@google.com>
              Gerrit-Reviewer: Ashley Prasad <ashl...@google.com>
              Gerrit-Reviewer: Danilo Tedeschi <da...@google.com>
              Gerrit-Reviewer: James Cook <jame...@chromium.org>
              Gerrit-CC: (Julie)Jeongeun Kim <je_jul...@chromium.org>
              Gerrit-CC: Akihiro Ota <akihi...@chromium.org>
              Gerrit-CC: Enterprise Policy Reviews <enterprise-p...@google.com>
              Gerrit-Attention: James Cook <jame...@chromium.org>
              Gerrit-Attention: Ashley Prasad <ashl...@google.com>
              Gerrit-Comment-Date: Thu, 13 Aug 2026 23:14:52 +0000
              Gerrit-HasComments: Yes
              Gerrit-Has-Labels: No
              satisfied_requirement
              unsatisfied_requirement
              open
              diffy

              James Cook (Gerrit)

              unread,
              Aug 13, 2026, 7:57:09 PM (3 days ago) Aug 13
              to Danilo Tedeschi, Chromium LUCI CQ, Ashley Prasad, chromium...@chromium.org, Enterprise Policy Reviews, (Julie)Jeongeun Kim, abigailbk...@google.com, anastas...@google.com, browser-comp...@chromium.org, chrome-intell...@chromium.org, chrome-intelligence-te...@google.com, chromium-a...@chromium.org, croissant-...@chromium.org, cros-setti...@google.com, dtseng...@chromium.org, extension...@chromium.org, feature-me...@chromium.org, francisjp...@google.com, hirokisa...@chromium.org, josiah...@chromium.org, jshin...@chromium.org, katie...@chromium.org, keithle...@chromium.org, kyungjunle...@google.com, nektar...@chromium.org, net-r...@chromium.org, nona+...@chromium.org, oshima...@chromium.org, rrsilva+wat...@google.com, shuche...@chromium.org, steimel+...@chromium.org, tbarzi...@chromium.org, tranbaod...@chromium.org, yhanad...@chromium.org, yuzo+...@chromium.org
              Attention needed from Ashley Prasad and Danilo Tedeschi

              James Cook voted and added 1 comment

              Votes added by James Cook

              Code-Review+1

              1 comment

              Patchset-level comments
              File-level comment, Patchset 57 (Latest):
              James Cook . resolved

              LGTM for ash. Thanks for splitting it up, this is much more manageable.

              Open in Gerrit

              Related details

              Attention is currently required from:
              • Ashley Prasad
              • Danilo Tedeschi
              Submit Requirements:
                • requirement satisfiedCode-Coverage
                • requirement is not satisfiedCode-Owners
                • requirement satisfiedCode-Review
                • requirement satisfiedReview-Enforcement
                Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
                Gerrit-MessageType: comment
                Gerrit-Project: chromium/src
                Gerrit-Branch: main
                Gerrit-Change-Id: I5dd158e232170170489d63f585b716dbef611647
                Gerrit-Change-Number: 8238356
                Gerrit-PatchSet: 57
                Gerrit-Owner: Danilo Tedeschi <da...@google.com>
                Gerrit-Reviewer: Ashley Prasad <ashl...@google.com>
                Gerrit-Reviewer: Danilo Tedeschi <da...@google.com>
                Gerrit-Reviewer: James Cook <jame...@chromium.org>
                Gerrit-CC: (Julie)Jeongeun Kim <je_jul...@chromium.org>
                Gerrit-CC: Akihiro Ota <akihi...@chromium.org>
                Gerrit-CC: Enterprise Policy Reviews <enterprise-p...@google.com>
                Gerrit-Attention: Danilo Tedeschi <da...@google.com>
                Gerrit-Attention: Ashley Prasad <ashl...@google.com>
                Gerrit-Comment-Date: Thu, 13 Aug 2026 23:56:54 +0000
                Gerrit-HasComments: Yes
                Gerrit-Has-Labels: Yes
                satisfied_requirement
                unsatisfied_requirement
                open
                diffy

                Ashley Prasad (Gerrit)

                unread,
                Aug 14, 2026, 5:38:41 PM (2 days ago) Aug 14
                to Danilo Tedeschi, James Cook, Chromium LUCI CQ, chromium...@chromium.org, Enterprise Policy Reviews, (Julie)Jeongeun Kim, abigailbk...@google.com, anastas...@google.com, browser-comp...@chromium.org, chrome-intell...@chromium.org, chrome-intelligence-te...@google.com, chromium-a...@chromium.org, croissant-...@chromium.org, cros-setti...@google.com, dtseng...@chromium.org, extension...@chromium.org, feature-me...@chromium.org, francisjp...@google.com, hirokisa...@chromium.org, josiah...@chromium.org, jshin...@chromium.org, katie...@chromium.org, keithle...@chromium.org, kyungjunle...@google.com, nektar...@chromium.org, net-r...@chromium.org, nona+...@chromium.org, oshima...@chromium.org, rrsilva+wat...@google.com, shuche...@chromium.org, steimel+...@chromium.org, tbarzi...@chromium.org, tranbaod...@chromium.org, yhanad...@chromium.org, yuzo+...@chromium.org
                Attention needed from Danilo Tedeschi

                Ashley Prasad added 2 comments

                Patchset-level comments
                Ashley Prasad . resolved

                lgtm % AI warning

                File chrome/browser/ui/webui/ash/settings/pages/a11y/select_to_speak_handler.cc
                Line 56, Patchset 57 (Latest): language_code = base::i18n::GetLanguageSubtagUsingLanguageTag(
                Ashley Prasad . unresolved

                Please fix this WARNING reported by autoreview issue finding: In the original code, `std::replace` mutated `language_and_country_code` in-place, changing underscores to hyphens. As a result, the hyphenated version was passed to `l10n_util::GetDisplayNameForLocale` around line 64.

                By removing this explicit normalization without replacing it, `language_and_country_code` retains its underscores, meaning `l10n_util::GetDisplayNameForLocale` will now receive the raw string (potentially containing underscores if enhanced voices are used). This could lead to incorrect locale names being displayed if `GetDisplayNameForLocale` depends on hyphen separators.

                Additionally, if `base::i18n::GetLanguageSubtagUsingLanguageTag` strictly expects BCP 47 compliant tags (which use hyphens), removing this normalization might also break the subtag extraction itself.

                Was removing this explicit normalization intended? If not, it is safer to retain the hyphen replacement before extracting the subtag or keep it explicitly for downstream usages.

                @ashleydp - I took a quick look at GetDisplayNameForLocale and it does some comparison with values containing "-", so we may want to keep that replace. Is there a test covering this? If there's no test lets try to add one.

                Open in Gerrit

                Related details

                Attention is currently required from:
                • Danilo Tedeschi
                Submit Requirements:
                  • requirement satisfiedCode-Coverage
                  • requirement is not satisfiedCode-Owners
                  • requirement satisfiedCode-Review
                  • requirement is not satisfiedNo-Unresolved-Comments
                  • requirement satisfiedReview-Enforcement
                  Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
                  Gerrit-MessageType: comment
                  Gerrit-Project: chromium/src
                  Gerrit-Branch: main
                  Gerrit-Change-Id: I5dd158e232170170489d63f585b716dbef611647
                  Gerrit-Change-Number: 8238356
                  Gerrit-PatchSet: 57
                  Gerrit-Owner: Danilo Tedeschi <da...@google.com>
                  Gerrit-Reviewer: Ashley Prasad <ashl...@google.com>
                  Gerrit-Reviewer: Danilo Tedeschi <da...@google.com>
                  Gerrit-Reviewer: James Cook <jame...@chromium.org>
                  Gerrit-CC: (Julie)Jeongeun Kim <je_jul...@chromium.org>
                  Gerrit-CC: Akihiro Ota <akihi...@chromium.org>
                  Gerrit-CC: Enterprise Policy Reviews <enterprise-p...@google.com>
                  Gerrit-Attention: Danilo Tedeschi <da...@google.com>
                  Gerrit-Comment-Date: Fri, 14 Aug 2026 21:38:27 +0000
                  Gerrit-HasComments: Yes
                  Gerrit-Has-Labels: No
                  satisfied_requirement
                  unsatisfied_requirement
                  open
                  diffy

                  Danilo Tedeschi (Gerrit)

                  unread,
                  Aug 14, 2026, 5:42:17 PM (2 days ago) Aug 14
                  to James Cook, Chromium LUCI CQ, Ashley Prasad, chromium...@chromium.org, Enterprise Policy Reviews, (Julie)Jeongeun Kim, abigailbk...@google.com, anastas...@google.com, browser-comp...@chromium.org, chrome-intell...@chromium.org, chrome-intelligence-te...@google.com, chromium-a...@chromium.org, croissant-...@chromium.org, cros-setti...@google.com, dtseng...@chromium.org, extension...@chromium.org, feature-me...@chromium.org, francisjp...@google.com, hirokisa...@chromium.org, josiah...@chromium.org, jshin...@chromium.org, katie...@chromium.org, keithle...@chromium.org, kyungjunle...@google.com, nektar...@chromium.org, net-r...@chromium.org, nona+...@chromium.org, oshima...@chromium.org, rrsilva+wat...@google.com, shuche...@chromium.org, steimel+...@chromium.org, tbarzi...@chromium.org, tranbaod...@chromium.org, yhanad...@chromium.org, yuzo+...@chromium.org
                  Attention needed from Ashley Prasad

                  Danilo Tedeschi added 1 comment

                  File chrome/browser/ui/webui/ash/settings/pages/a11y/select_to_speak_handler.cc
                  Line 56, Patchset 57 (Latest): language_code = base::i18n::GetLanguageSubtagUsingLanguageTag(
                  Ashley Prasad . resolved

                  Please fix this WARNING reported by autoreview issue finding: In the original code, `std::replace` mutated `language_and_country_code` in-place, changing underscores to hyphens. As a result, the hyphenated version was passed to `l10n_util::GetDisplayNameForLocale` around line 64.

                  By removing this explicit normalization without replacing it, `language_and_country_code` retains its underscores, meaning `l10n_util::GetDisplayNameForLocale` will now receive the raw string (potentially containing underscores if enhanced voices are used). This could lead to incorrect locale names being displayed if `GetDisplayNameForLocale` depends on hyphen separators.

                  Additionally, if `base::i18n::GetLanguageSubtagUsingLanguageTag` strictly expects BCP 47 compliant tags (which use hyphens), removing this normalization might also break the subtag extraction itself.

                  Was removing this explicit normalization intended? If not, it is safer to retain the hyphen replacement before extracting the subtag or keep it explicitly for downstream usages.

                  @ashleydp - I took a quick look at GetDisplayNameForLocale and it does some comparison with values containing "-", so we may want to keep that replace. Is there a test covering this? If there's no test lets try to add one.

                  Danilo Tedeschi

                  LanguageTag supports both formats: the old POSIX/ICU style (using underscores) and the bcp47 one (the one that uses hyphens).

                  Open in Gerrit

                  Related details

                  Attention is currently required from:
                  • Ashley Prasad
                  Submit Requirements:
                    • requirement satisfiedCode-Coverage
                    • requirement is not satisfiedCode-Owners
                    • requirement satisfiedCode-Review
                    • requirement satisfiedReview-Enforcement
                    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
                    Gerrit-MessageType: comment
                    Gerrit-Project: chromium/src
                    Gerrit-Branch: main
                    Gerrit-Change-Id: I5dd158e232170170489d63f585b716dbef611647
                    Gerrit-Change-Number: 8238356
                    Gerrit-PatchSet: 57
                    Gerrit-Owner: Danilo Tedeschi <da...@google.com>
                    Gerrit-Reviewer: Ashley Prasad <ashl...@google.com>
                    Gerrit-Reviewer: Danilo Tedeschi <da...@google.com>
                    Gerrit-Reviewer: James Cook <jame...@chromium.org>
                    Gerrit-CC: (Julie)Jeongeun Kim <je_jul...@chromium.org>
                    Gerrit-CC: Akihiro Ota <akihi...@chromium.org>
                    Gerrit-CC: Enterprise Policy Reviews <enterprise-p...@google.com>
                    Gerrit-Attention: Ashley Prasad <ashl...@google.com>
                    Gerrit-Comment-Date: Fri, 14 Aug 2026 21:42:01 +0000
                    Gerrit-HasComments: Yes
                    Gerrit-Has-Labels: No
                    Comment-In-Reply-To: Ashley Prasad <ashl...@google.com>
                    satisfied_requirement
                    unsatisfied_requirement
                    open
                    diffy

                    Ashley Prasad (Gerrit)

                    unread,
                    Aug 14, 2026, 5:57:47 PM (2 days ago) Aug 14
                    to Danilo Tedeschi, James Cook, Chromium LUCI CQ, chromium...@chromium.org, Enterprise Policy Reviews, (Julie)Jeongeun Kim, abigailbk...@google.com, anastas...@google.com, browser-comp...@chromium.org, chrome-intell...@chromium.org, chrome-intelligence-te...@google.com, chromium-a...@chromium.org, croissant-...@chromium.org, cros-setti...@google.com, dtseng...@chromium.org, extension...@chromium.org, feature-me...@chromium.org, francisjp...@google.com, hirokisa...@chromium.org, josiah...@chromium.org, jshin...@chromium.org, katie...@chromium.org, keithle...@chromium.org, kyungjunle...@google.com, nektar...@chromium.org, net-r...@chromium.org, nona+...@chromium.org, oshima...@chromium.org, rrsilva+wat...@google.com, shuche...@chromium.org, steimel+...@chromium.org, tbarzi...@chromium.org, tranbaod...@chromium.org, yhanad...@chromium.org, yuzo+...@chromium.org
                    Attention needed from Danilo Tedeschi

                    Ashley Prasad voted and added 1 comment

                    Votes added by Ashley Prasad

                    Code-Review+1

                    1 comment

                    Patchset-level comments
                    File-level comment, Patchset 57 (Latest):
                    Ashley Prasad . resolved

                    lgtm

                    Open in Gerrit

                    Related details

                    Attention is currently required from:
                    • Danilo Tedeschi
                    Submit Requirements:
                    • requirement satisfiedCode-Coverage
                    • requirement satisfiedCode-Owners
                    • requirement satisfiedCode-Review
                    • requirement satisfiedReview-Enforcement
                    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
                    Gerrit-MessageType: comment
                    Gerrit-Project: chromium/src
                    Gerrit-Branch: main
                    Gerrit-Change-Id: I5dd158e232170170489d63f585b716dbef611647
                    Gerrit-Change-Number: 8238356
                    Gerrit-PatchSet: 57
                    Gerrit-Owner: Danilo Tedeschi <da...@google.com>
                    Gerrit-Reviewer: Ashley Prasad <ashl...@google.com>
                    Gerrit-Reviewer: Danilo Tedeschi <da...@google.com>
                    Gerrit-Reviewer: James Cook <jame...@chromium.org>
                    Gerrit-CC: (Julie)Jeongeun Kim <je_jul...@chromium.org>
                    Gerrit-CC: Akihiro Ota <akihi...@chromium.org>
                    Gerrit-CC: Enterprise Policy Reviews <enterprise-p...@google.com>
                    Gerrit-Attention: Danilo Tedeschi <da...@google.com>
                    Gerrit-Comment-Date: Fri, 14 Aug 2026 21:57:28 +0000
                    Gerrit-HasComments: Yes
                    Gerrit-Has-Labels: Yes
                    satisfied_requirement
                    open
                    diffy

                    Danilo Tedeschi (Gerrit)

                    unread,
                    Aug 14, 2026, 6:46:34 PM (2 days ago) Aug 14
                    to Ashley Prasad, James Cook, Chromium LUCI CQ, chromium...@chromium.org, Enterprise Policy Reviews, (Julie)Jeongeun Kim, abigailbk...@google.com, anastas...@google.com, browser-comp...@chromium.org, chrome-intell...@chromium.org, chrome-intelligence-te...@google.com, chromium-a...@chromium.org, croissant-...@chromium.org, cros-setti...@google.com, dtseng...@chromium.org, extension...@chromium.org, feature-me...@chromium.org, francisjp...@google.com, hirokisa...@chromium.org, josiah...@chromium.org, jshin...@chromium.org, katie...@chromium.org, keithle...@chromium.org, kyungjunle...@google.com, nektar...@chromium.org, net-r...@chromium.org, nona+...@chromium.org, oshima...@chromium.org, rrsilva+wat...@google.com, shuche...@chromium.org, steimel+...@chromium.org, tbarzi...@chromium.org, tranbaod...@chromium.org, yhanad...@chromium.org, yuzo+...@chromium.org

                    Danilo Tedeschi voted Commit-Queue+2

                    Commit-Queue+2
                    Open in Gerrit

                    Related details

                    Attention set is empty
                    Submit Requirements:
                    • requirement satisfiedCode-Coverage
                    • requirement satisfiedCode-Owners
                    • requirement satisfiedCode-Review
                    • requirement satisfiedReview-Enforcement
                    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
                    Gerrit-MessageType: comment
                    Gerrit-Project: chromium/src
                    Gerrit-Branch: main
                    Gerrit-Change-Id: I5dd158e232170170489d63f585b716dbef611647
                    Gerrit-Change-Number: 8238356
                    Gerrit-PatchSet: 57
                    Gerrit-Owner: Danilo Tedeschi <da...@google.com>
                    Gerrit-Reviewer: Ashley Prasad <ashl...@google.com>
                    Gerrit-Reviewer: Danilo Tedeschi <da...@google.com>
                    Gerrit-Reviewer: James Cook <jame...@chromium.org>
                    Gerrit-CC: (Julie)Jeongeun Kim <je_jul...@chromium.org>
                    Gerrit-CC: Akihiro Ota <akihi...@chromium.org>
                    Gerrit-CC: Enterprise Policy Reviews <enterprise-p...@google.com>
                    Gerrit-Comment-Date: Fri, 14 Aug 2026 22:46:21 +0000
                    Gerrit-HasComments: No
                    Gerrit-Has-Labels: Yes
                    satisfied_requirement
                    open
                    diffy

                    Chromium LUCI CQ (Gerrit)

                    unread,
                    Aug 14, 2026, 7:59:44 PM (2 days ago) Aug 14
                    to Danilo Tedeschi, Ashley Prasad, James Cook, Akihiro Ota, chromium...@chromium.org, Enterprise Policy Reviews, (Julie)Jeongeun Kim, abigailbk...@google.com, anastas...@google.com, browser-comp...@chromium.org, chrome-intell...@chromium.org, chrome-intelligence-te...@google.com, chromium-a...@chromium.org, croissant-...@chromium.org, cros-setti...@google.com, dtseng...@chromium.org, extension...@chromium.org, feature-me...@chromium.org, francisjp...@google.com, hirokisa...@chromium.org, josiah...@chromium.org, jshin...@chromium.org, katie...@chromium.org, keithle...@chromium.org, kyungjunle...@google.com, nektar...@chromium.org, net-r...@chromium.org, nona+...@chromium.org, oshima...@chromium.org, rrsilva+wat...@google.com, shuche...@chromium.org, steimel+...@chromium.org, tbarzi...@chromium.org, tranbaod...@chromium.org, yhanad...@chromium.org, yuzo+...@chromium.org

                    Chromium LUCI CQ submitted the change

                    Change information

                    Commit message:
                    [LanguageTag] Migrate l10n_util::GetLanguage callsites in Ash/ChromeOS

                    This CL replaces legacy, raw-string `l10n_util::GetLanguage` callsites
                    in Ash, ChromeOS, and Ash-specific Chrome browser components with the
                    newly introduced type-safe
                    `base::i18n::GetLanguageSubtagUsingLanguageTag` helper, preparing for
                    the removal of the deprecated raw-string function from ui/base.

                    Technical Details:
                    - Replaced raw-string language extraction with `base::i18n::GetLanguageSubtagUsingLanguageTag`
                    across Ash system locale views, pod controllers, Quick Answers utilities,
                    intent generators, spell checkers, language detectors, and device local account
                    browser tests.
                    - Included "base/i18n/legacy_language_tag_helpers.h" at each modified callsite.
                    Bug: 526738932
                    Change-Id: I5dd158e232170170489d63f585b716dbef611647
                    Reviewed-by: James Cook <jame...@chromium.org>
                    Commit-Queue: Danilo Tedeschi <da...@google.com>
                    Reviewed-by: Ashley Prasad <ashl...@google.com>
                    Cr-Commit-Position: refs/heads/main@{#1680030}
                    Files:
                    • M ash/system/locale/locale_detailed_view.cc
                    • M ash/system/locale/locale_feature_pod_controller.cc
                    • M ash/system/unified/current_locale_view.cc
                    • M chrome/browser/ash/accessibility/live_caption/system_live_caption_service.cc
                    • M chrome/browser/ash/locale/locale_change_guard.cc
                    • M chrome/browser/ash/main_parts/chrome_browser_main_parts_ash.cc
                    • M chrome/browser/ash/policy/core/device_local_account_browsertest.cc
                    • M chrome/browser/ui/ash/quick_answers/ui/quick_answers_util.cc
                    • M chrome/browser/ui/ash/wm/coral_delegate_impl.cc
                    • M chrome/browser/ui/webui/ash/login/l10n_util.cc
                    • M chrome/browser/ui/webui/ash/settings/pages/a11y/select_to_speak_handler.cc
                    • M chrome/browser/ui/webui/ash/settings/pages/a11y/tts_handler.cc
                    • M chromeos/components/quick_answers/public/cpp/quick_answers_state.cc
                    • M chromeos/components/quick_answers/understanding/intent_generator.cc
                    • M chromeos/components/quick_answers/utils/language_detector.cc
                    • M chromeos/components/quick_answers/utils/spell_checker.cc
                    • M chromeos/components/quick_answers/utils/translation_v2_utils.cc
                    Change size: M
                    Delta: 17 files changed, 83 insertions(+), 52 deletions(-)
                    Branch: refs/heads/main
                    Submit Requirements:
                    • requirement satisfiedCode-Review: +1 by James Cook, +1 by Ashley Prasad
                    Open in Gerrit
                    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
                    Gerrit-MessageType: merged
                    Gerrit-Project: chromium/src
                    Gerrit-Branch: main
                    Gerrit-Change-Id: I5dd158e232170170489d63f585b716dbef611647
                    Gerrit-Change-Number: 8238356
                    Gerrit-PatchSet: 58
                    Gerrit-Owner: Danilo Tedeschi <da...@google.com>
                    Gerrit-Reviewer: Ashley Prasad <ashl...@google.com>
                    Gerrit-Reviewer: Chromium LUCI CQ <chromiu...@luci-project-accounts.iam.gserviceaccount.com>
                    Gerrit-Reviewer: Danilo Tedeschi <da...@google.com>
                    Gerrit-Reviewer: James Cook <jame...@chromium.org>
                    Gerrit-CC: (Julie)Jeongeun Kim <je_jul...@chromium.org>
                    Gerrit-CC: Akihiro Ota <akihi...@chromium.org>
                    open
                    diffy
                    satisfied_requirement
                    Reply all
                    Reply to author
                    Forward
                    0 new messages