Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(545)

Issue 9810030: ash: Translate the battery status strings. (Closed)

Created:
8 years, 9 months ago by sadrul
Modified:
8 years, 9 months ago
CC:
chromium-reviews, dhollowa+watch_chromium.org, sadrul, ben+watch_chromium.org
Visibility:
Public.

Description

ash: Translate the battery status strings. Alos, do not show 'Battery: 100% 0h00m' when battery is full and plugged in. BUG=110130 TEST=none Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=128137

Patch Set 1 : . #

Unified diffs Side-by-side diffs Delta from patch set Stats (+25 lines, -5 lines) Patch
M ash/ash_strings.grd View 1 chunk +7 lines, -0 lines 0 comments Download
M ash/system/power/tray_power.cc View 2 chunks +18 lines, -5 lines 0 comments Download

Messages

Total messages: 2 (0 generated)
sadrul
8 years, 9 months ago (2012-03-22 00:33:04 UTC) #1
Ben Goodger (Google)
8 years, 9 months ago (2012-03-22 00:50:58 UTC) #2
LGTM

On Wed, Mar 21, 2012 at 5:33 PM, <sadrul@chromium.org> wrote:

> Reviewers: Ben Goodger (Google),
>
> Description:
> ash: Translate the battery status strings.
>
> Alos, do not show 'Battery: 100%  0h00m' when battery is full and plugged
> in.
>
> BUG=110130
> TEST=none
>
>
> Please review this at
http://codereview.chromium.**org/9810030/<http://codereview.chromium.org/9810...
>
> SVN Base:
svn://svn.chromium.org/chrome/**trunk/src<http://svn.chromium.org/chrome/trunk/src>
>
> Affected files:
>  M ash/ash_strings.grd
>  M ash/system/power/tray_power.cc
>
>
> Index: ash/ash_strings.grd
> diff --git a/ash/ash_strings.grd b/ash/ash_strings.grd
> index d19d19b60ca61180dadd45f2400634**19824d6940..**
> f0f6c45f8300918c7ec381006c327f**87e4d2e62a 100644
> --- a/ash/ash_strings.grd
> +++ b/ash/ash_strings.grd
> @@ -247,6 +247,13 @@ This file contains the strings for ash.
>       <message name="IDS_ASH_STATUS_TRAY_**BLUETOOTH_ADD_DEVICE"
> desc="The label used in the tray popup to add a bluetooth device.">
>         Add device...
>       </message>
> +      <message name="IDS_ASH_STATUS_TRAY_**BATTERY_FULL" desc="The label
> in the tray dialog to indicate that the battery is full.">
> +        Battery full
> +      </message>
> +      <message name="IDS_ASH_STATUS_TRAY_**BATTERY_STATUS" desc="The
> label in the tray dialog to show the status of the battery power.">
> +Battery: <ph name="percentage">$1<ex>56</**ex></ph>%
> +<ph name="hour">$2</ph>h <ph name="minute">$3</ph>m
> +      </message>
>     </messages>
>   </release>
>  </grit>
> Index: ash/system/power/tray_power.cc
> diff --git a/ash/system/power/tray_power.**cc
> b/ash/system/power/tray_power.**cc
> index 264a772434a6d068961eb38023c934**6c11ec4c5d..**
> deb009d42057816e10578fee9a4a4e**4b56f1d729 100644
> --- a/ash/system/power/tray_power.**cc
> +++ b/ash/system/power/tray_power.**cc
> @@ -9,14 +9,17 @@
>  #include "ash/system/power/power_**supply_status.h"
>  #include "ash/system/tray/system_tray_**delegate.h"
>  #include "ash/system/tray/tray_**constants.h"
> -#include "base/utf_string_conversions.**h"
> +#include "base/string_number_**conversions.h"
>  #include "base/stringprintf.h"
> +#include "base/utf_string_conversions.**h"
> +#include "grit/ash_strings.h"
>  #include "grit/ui_resources.h"
>  #include "third_party/skia/include/**core/SkBitmap.h"
>  #include "third_party/skia/include/**core/SkRect.h"
>  #include "ui/base/resource/resource_**bundle.h"
>  #include "ui/gfx/image/image.h"
>  #include "ui/gfx/size.h"
> +#include "ui/base/l10n/l10n_util.h"
>  #include "ui/views/controls/button/**button.h"
>  #include "ui/views/controls/button/**text_button.h"
>  #include "ui/views/controls/image_view.**h"
> @@ -120,10 +123,20 @@ class PowerPopupView : public views::Label {
>         supply_status_.battery_**seconds_to_empty);
>     int hour = time.InHours();
>     int min = (time - base::TimeDelta::FromHours(**hour)).InMinutes();
> -    // TODO: Translation
> -    SetText(ASCIIToUTF16(base::**StringPrintf("Battery:
> %.0lf%%\n%dh%02dm",
> -          supply_status_.battery_**percentage,
> -          hour, min)));
> +    ui::ResourceBundle& bundle = ui::ResourceBundle::**
> GetSharedInstance();
> +    if (hour && min) {
> +      SetText(l10n_util::**GetStringFUTF16(IDS_ASH_**
> STATUS_TRAY_BATTERY_STATUS,
> +          UTF8ToUTF16(base::**DoubleToString(supply_status_.**
> battery_percentage)),
> +          base::IntToString16(hour),
> +          base::IntToString16(min)));
> +    } else {
> +      if (supply_status_.line_power_on) {
> +        SetText(bundle.**GetLocalizedString(IDS_ASH_**
> STATUS_TRAY_BATTERY_FULL));
> +      } else {
> +        // Completely discharged? ... ha?
> +        SetText(string16());
> +      }
> +    }
>   }
>
>   PowerSupplyStatus supply_status_;
>
>
>

Powered by Google App Engine
This is Rietveld 408576698