Skip to content

Commit

Permalink
[remoting][notification] Fix locale issue on Android
Browse files Browse the repository at this point in the history
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: Jamie Walch <jamiewalch@chromium.org>
Cr-Commit-Position: refs/heads/master@{#706665}
  • Loading branch information
ywh233 authored and Commit Bot committed Oct 16, 2019
1 parent 8e89524 commit 8a0fa25
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion remoting/client/notification/notification_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@
#include "remoting/client/notification/version_range.h"
#include "ui/base/l10n/l10n_util.h"

#if defined(OS_ANDROID)
#include "base/android/locale_utils.h"
#endif

namespace remoting {

namespace {
Expand Down Expand Up @@ -190,8 +194,16 @@ NotificationClient::NotificationClient(
std::make_unique<GstaticJsonFetcher>(network_task_runner),
kCurrentPlatform,
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(""),
kShouldIgnoreDevMessages) {}
#endif
kShouldIgnoreDevMessages) {
}

NotificationClient::~NotificationClient() = default;

Expand Down

0 comments on commit 8a0fa25

Please sign in to comment.