From 7351dd113f26580f3bcc7500746f3a26aecc4260 Mon Sep 17 00:00:00 2001 From: Eric Fischer Date: Fri, 12 Jun 2009 16:06:37 -0700 Subject: [PATCH] Use locale-appropriate formatting to display application sizes like "252KB". In particular allow the French and Polish translators to put a space between the number and the unit. --- core/java/android/text/format/Formatter.java | 10 ++++++++-- core/res/res/values-fr/strings.xml | 1 + core/res/res/values/strings.xml | 5 +++++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/core/java/android/text/format/Formatter.java b/core/java/android/text/format/Formatter.java index 1b30aa0a218c3..367b26ce45d39 100644 --- a/core/java/android/text/format/Formatter.java +++ b/core/java/android/text/format/Formatter.java @@ -59,9 +59,15 @@ public final class Formatter { result = result / 1024; } if (result < 100) { - return String.format("%.2f%s", result, context.getText(suffix).toString()); + String value = String.format("%.2f", result); + return context.getResources(). + getString(com.android.internal.R.string.fileSizeSuffix, + value, context.getString(suffix)); } - return String.format("%.0f%s", result, context.getText(suffix).toString()); + String value = String.format("%.0f", result); + return context.getResources(). + getString(com.android.internal.R.string.fileSizeSuffix, + value, context.getString(suffix)); } /** diff --git a/core/res/res/values-fr/strings.xml b/core/res/res/values-fr/strings.xml index e85b14cf98da9..0011c45cc0b68 100644 --- a/core/res/res/values-fr/strings.xml +++ b/core/res/res/values-fr/strings.xml @@ -21,6 +21,7 @@ "Go" "To" "Po" + %1$s %2$s "<sans titre>" "…" "(Aucun numéro de téléphone)" diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml index 79dc1baa72411..6f5b29adf5dd7 100644 --- a/core/res/res/values/strings.xml +++ b/core/res/res/values/strings.xml @@ -30,6 +30,11 @@ TB PB + + %1$s%2$s