Index: ash/system/chromeos/power/power_status_view.cc |
diff --git a/ash/system/chromeos/power/power_status_view.cc b/ash/system/chromeos/power/power_status_view.cc |
index 56881a9eba70fc1ef76cec2ebc25a9c0d7a56002..f88d9db864ea5769e50de3ee91c83d8e88e42de1 100644 |
--- a/ash/system/chromeos/power/power_status_view.cc |
+++ b/ash/system/chromeos/power/power_status_view.cc |
@@ -10,7 +10,7 @@ |
#include "ash/system/chromeos/power/tray_power.h" |
#include "ash/system/tray/fixed_sized_image_view.h" |
#include "ash/system/tray/tray_constants.h" |
-#include "base/strings/string_number_conversions.h" |
+#include "base/i18n/number_formatting.h" |
#include "base/strings/utf_string_conversions.h" |
#include "grit/ash_strings.h" |
#include "ui/base/l10n/l10n_util.h" |
@@ -92,7 +92,7 @@ void PowerStatusView::UpdateText() { |
} else { |
battery_percentage = l10n_util::GetStringFUTF16( |
IDS_ASH_STATUS_TRAY_BATTERY_PERCENT_ONLY, |
- base::IntToString16(status.GetRoundedBatteryPercent())); |
+ base::FormatNumber(status.GetRoundedBatteryPercent())); |
jungshik at Google
2016/05/10 08:50:44
To be 100% i18n-safe, you should use MessageFormat
jungshik at Google
2016/05/10 09:28:17
Oops. The 1st argument should be |base::ASCIIToUTF
Greg Levin
2016/05/10 23:33:43
Done.
|
if (status.IsUsbChargerConnected()) { |
battery_time_status = rb.GetLocalizedString( |
IDS_ASH_STATUS_TRAY_BATTERY_CHARGING_UNRELIABLE); |
@@ -106,16 +106,14 @@ void PowerStatusView::UpdateText() { |
!status.IsBatteryDischargingOnLinePower()) { |
int hour = 0, min = 0; |
PowerStatus::SplitTimeIntoHoursAndMinutes(time, &hour, &min); |
- base::string16 minute = min < 10 ? |
- base::ASCIIToUTF16("0") + base::IntToString16(min) : |
- base::IntToString16(min); |
- battery_time_status = |
- l10n_util::GetStringFUTF16( |
- status.IsBatteryCharging() ? |
- IDS_ASH_STATUS_TRAY_BATTERY_TIME_UNTIL_FULL_SHORT : |
- IDS_ASH_STATUS_TRAY_BATTERY_TIME_LEFT_SHORT, |
- base::IntToString16(hour), |
- minute); |
+ base::string16 minute = |
+ min < 10 ? base::FormatNumber(0) + base::FormatNumber(min) |
+ : base::FormatNumber(min); |
Daniel Erat
2016/05/03 19:17:33
i'm also curious about the i18n-ness of this zero-
stevenjb
2016/05/03 19:49:09
It seems like if we are going to switch this to Fo
jungshik at Google
2016/05/10 08:50:44
There are two ways to handle this better depending
Greg Levin
2016/05/10 23:33:43
I went with the second option. Two points, though
Greg Levin
2016/05/11 19:43:02
EDIT: I updated it to use the new TimeDurationForm
|
+ battery_time_status = l10n_util::GetStringFUTF16( |
+ status.IsBatteryCharging() |
+ ? IDS_ASH_STATUS_TRAY_BATTERY_TIME_UNTIL_FULL_SHORT |
+ : IDS_ASH_STATUS_TRAY_BATTERY_TIME_LEFT_SHORT, |
+ base::FormatNumber(hour), minute); |
} |
} |
battery_percentage = battery_time_status.empty() ? |