summaryrefslogtreecommitdiff
path: root/java/com/android/dialer/calllogutils
diff options
context:
space:
mode:
authorcalderwoodra <calderwoodra@google.com>2017-07-12 15:47:40 -0700
committerEric Erfanian <erfanian@google.com>2017-07-24 18:46:58 +0000
commit540a0af54fb2c18cb046286a323b9aa7b8a68e28 (patch)
tree6a16b36b9bf0740b16770c9423e6062ef18f19b6 /java/com/android/dialer/calllogutils
parentaf2a1a2e5f7dcedb4595fb56e65ace002bcd740c (diff)
Fixes the Hebrew translation for calls <60s in length.
The Hebrew translation had an extra single quotation causing an UnboundQuotationException. This change fixes that temporarily by looking for that specific translation and adjusting it. This change should be reverted once the translation is corrected. Test: release build in hebrew results in no crash, manual test PiperOrigin-RevId: 161730025 Change-Id: Ifb171e3e795e91a93096493ec770ae339a6ed12f
Diffstat (limited to 'java/com/android/dialer/calllogutils')
-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) {