diff options
author | avi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-06-22 20:40:22 +0000 |
---|---|---|
committer | avi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-06-22 20:40:22 +0000 |
commit | 7a3b263af6356885628add7a8843a40dbee5b8ab (patch) | |
tree | eff6140c44d29b6904b90366df65161364ea555f /base/string_util.h | |
parent | efaba4815ff6786082583393ad06f8c22ef11fa0 (diff) | |
download | chromium_src-7a3b263af6356885628add7a8843a40dbee5b8ab.zip chromium_src-7a3b263af6356885628add7a8843a40dbee5b8ab.tar.gz chromium_src-7a3b263af6356885628add7a8843a40dbee5b8ab.tar.bz2 |
Localize strings, speeds.
BUG=86527
TEST=run in non-English. For European languages, during a download the decimal separators should be commas (e.g. "0,0 MB"). (The speeds are in strings files and might take a little time to run through the translation machinery.)
Review URL: http://codereview.chromium.org/7189076
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@90092 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/string_util.h')
-rw-r--r-- | base/string_util.h | 30 |
1 files changed, 5 insertions, 25 deletions
diff --git a/base/string_util.h b/base/string_util.h index 0cb439c..f731c34 100644 --- a/base/string_util.h +++ b/base/string_util.h @@ -407,31 +407,11 @@ inline bool IsWhitespace(wchar_t c) { return wcschr(kWhitespaceWide, c) != NULL; } -enum DataUnits { - DATA_UNITS_BYTE = 0, - DATA_UNITS_KIBIBYTE, - DATA_UNITS_MEBIBYTE, - DATA_UNITS_GIBIBYTE, -}; - -// Return the unit type that is appropriate for displaying the amount of bytes -// passed in. -BASE_API DataUnits GetByteDisplayUnits(int64 bytes); - -// Return a byte string in human-readable format, displayed in units appropriate -// specified by 'units', with an optional unit suffix. -// Ex: FormatBytes(512, DATA_UNITS_KIBIBYTE, true) => "0.5 KB" -// Ex: FormatBytes(10*1024, DATA_UNITS_MEBIBYTE, false) => "0.1" -BASE_API string16 FormatBytes(int64 bytes, DataUnits units, bool show_units); - -// As above, but with "/s" units. -// Ex: FormatSpeed(512, DATA_UNITS_KIBIBYTE, true) => "0.5 KB/s" -// Ex: FormatSpeed(10*1024, DATA_UNITS_MEBIBYTE, false) => "0.1" -BASE_API string16 FormatSpeed(int64 bytes, DataUnits units, bool show_units); - -// Return a number formated with separators in the user's locale way. -// Ex: FormatNumber(1234567) => 1,234,567 -BASE_API string16 FormatNumber(int64 number); +// Return a byte string in human-readable format with a unit suffix. Not +// appropriate for use in any UI; use of FormatBytes and friends in ui/base is +// highly recommended instead. TODO(avi): Figure out how to get callers to use +// FormatBytes instead; remove this. +BASE_API string16 FormatBytesUnlocalized(int64 bytes); // Starting at |start_offset| (usually 0), replace the first instance of // |find_this| with |replace_with|. |