summaryrefslogtreecommitdiff
path: root/java/com/android/dialer/calllogutils/CallEntryFormatter.java
diff options
context:
space:
mode:
Diffstat (limited to 'java/com/android/dialer/calllogutils/CallEntryFormatter.java')
-rw-r--r--java/com/android/dialer/calllogutils/CallEntryFormatter.java15
1 files changed, 13 insertions, 2 deletions
diff --git a/java/com/android/dialer/calllogutils/CallEntryFormatter.java b/java/com/android/dialer/calllogutils/CallEntryFormatter.java
index 6aa93af52..8288ea9ed 100644
--- a/java/com/android/dialer/calllogutils/CallEntryFormatter.java
+++ b/java/com/android/dialer/calllogutils/CallEntryFormatter.java
@@ -95,9 +95,20 @@ public class CallEntryFormatter {
// example output: "1s"
formatPattern =
context.getString(R.string.call_duration_short_format_pattern, "s", secondsString);
+
+ // Temporary work around for a broken Hebrew(iw) translation.
+ if (formatPattern.endsWith("\'\'")) {
+ formatPattern = formatPattern.substring(0, formatPattern.length() - 1);
+ }
+ }
+
+ // If new translation issues arise, we should catch them here to prevent crashes.
+ try {
+ return new SimpleDateFormat(formatPattern)
+ .format(new Date(TimeUnit.SECONDS.toMillis(elapsedSeconds)));
+ } catch (Exception e) {
+ return "";
}
- SimpleDateFormat format = new SimpleDateFormat(formatPattern);
- return format.format(new Date(TimeUnit.SECONDS.toMillis(elapsedSeconds)));
}
private static CharSequence formatDurationA11y(Context context, long elapsedSeconds) {