From 540a0af54fb2c18cb046286a323b9aa7b8a68e28 Mon Sep 17 00:00:00 2001 From: calderwoodra Date: Wed, 12 Jul 2017 15:47:40 -0700 Subject: 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 --- .../android/dialer/calllogutils/CallEntryFormatter.java | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'java/com/android/dialer/calllogutils') 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) { -- cgit v1.2.3