summaryrefslogtreecommitdiffstats
path: root/core/java/android/text
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2012-08-15 14:53:12 -0700
committerElliott Hughes <enh@google.com>2012-09-14 20:22:17 -0700
commitc3ff72f5bd5896ad2584e0cc0582cbd2ad8191f2 (patch)
treea3d2a2ffc6a64ea3ad2029208c830b582316d3ed /core/java/android/text
parent08153ee01e6aa67061f628bc3fed66c6400dfd1c (diff)
downloadframeworks_base-c3ff72f5bd5896ad2584e0cc0582cbd2ad8191f2.zip
frameworks_base-c3ff72f5bd5896ad2584e0cc0582cbd2ad8191f2.tar.gz
frameworks_base-c3ff72f5bd5896ad2584e0cc0582cbd2ad8191f2.tar.bz2
Use icu4c for CLDR "yesterday", "today", and "tomorrow" strings.
(cherry-pick of 47a0539ecaf7d7a15008704bd89f748aebf85d47.) Conflicts: core/res/res/values/public.xml Bug: 6811501 Change-Id: Ifb2e030a9fda85a7f664feac812b63e67780e68f
Diffstat (limited to 'core/java/android/text')
-rw-r--r--core/java/android/text/format/DateUtils.java11
1 files changed, 8 insertions, 3 deletions
diff --git a/core/java/android/text/format/DateUtils.java b/core/java/android/text/format/DateUtils.java
index 2fec5e9..0babcc5 100644
--- a/core/java/android/text/format/DateUtils.java
+++ b/core/java/android/text/format/DateUtils.java
@@ -552,14 +552,19 @@ public class DateUtils
int days = Math.abs(currentDay - startDay);
boolean past = (today > day);
+ // TODO: some locales name other days too, such as de_DE's "Vorgestern" (today - 2).
+ Locale locale = r.getConfiguration().locale;
+ if (locale == null) {
+ locale = Locale.getDefault();
+ }
if (days == 1) {
if (past) {
- return r.getString(com.android.internal.R.string.yesterday);
+ return LocaleData.get(locale).yesterday;
} else {
- return r.getString(com.android.internal.R.string.tomorrow);
+ return LocaleData.get(locale).tomorrow;
}
} else if (days == 0) {
- return r.getString(com.android.internal.R.string.today);
+ return LocaleData.get(locale).today;
}
int resId;