Commit 8a0fa25f authored by Yuwei Huang's avatar Yuwei Huang Committed by Commit Bot

[remoting][notification] Fix locale issue on Android

l10n_util::GetApplicationLocale() returns empty string on Android since
we don't pack any .pak file into our apk, which makes the notification
client always fallback to en-US. This CL fixes this by calling
base::android::GetDefaultLocaleString() on Android to get back the
default locale.

Bug: 1001291
Change-Id: I0d8499d00dcd8a1343109377b3bee6f708c43e59
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1864362
Auto-Submit: Yuwei Huang <yuweih@chromium.org>
Commit-Queue: Jamie Walch <jamiewalch@chromium.org>
Reviewed-by: default avatarJamie Walch <jamiewalch@chromium.org>
Cr-Commit-Position: refs/heads/master@{#706665}
parent 8e895245
...@@ -19,6 +19,10 @@ ...@@ -19,6 +19,10 @@
#include "remoting/client/notification/version_range.h" #include "remoting/client/notification/version_range.h"
#include "ui/base/l10n/l10n_util.h" #include "ui/base/l10n/l10n_util.h"
#if defined(OS_ANDROID)
#include "base/android/locale_utils.h"
#endif
namespace remoting { namespace remoting {
namespace { namespace {
...@@ -190,8 +194,16 @@ NotificationClient::NotificationClient( ...@@ -190,8 +194,16 @@ NotificationClient::NotificationClient(
std::make_unique<GstaticJsonFetcher>(network_task_runner), std::make_unique<GstaticJsonFetcher>(network_task_runner),
kCurrentPlatform, kCurrentPlatform,
kCurrentVersion, kCurrentVersion,
#if defined(OS_ANDROID)
// GetApplicationLocale() returns empty string on Android since we
// don't pack any .pak file into the apk, so we need to get the locale
// string directly.
base::android::GetDefaultLocaleString(),
#else
l10n_util::GetApplicationLocale(""), l10n_util::GetApplicationLocale(""),
kShouldIgnoreDevMessages) {} #endif
kShouldIgnoreDevMessages) {
}
NotificationClient::~NotificationClient() = default; NotificationClient::~NotificationClient() = default;
......
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