blob: 6b2a56f00f727ef68a4c3e03790d1b9dd4538078 [file]
// Copyright 2023 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/ash/input_method/editor_helpers.h"
#include <string>
#include "base/containers/fixed_flat_set.h"
#include "chrome/browser/browser_process.h"
#include "chromeos/constants/chromeos_features.h"
#include "ui/gfx/range/range.h"
namespace ash::input_method {
namespace {
constexpr auto kAllowedLanguagesForShowingL10nStrings =
base::MakeFixedFlatSet<std::string_view>({"de", "en", "en-GB", "fr", "ja"});
}
std::string GetSystemLocale() {
return g_browser_process != nullptr
? g_browser_process->GetApplicationLocale()
: "";
}
bool ShouldUseL10nStrings() {
return chromeos::features::IsOrcaUseL10nStringsEnabled() ||
(chromeos::features::IsOrcaInternationalizeEnabled() &&
kAllowedLanguagesForShowingL10nStrings.contains(GetSystemLocale()));
}
} // namespace ash::input_method