[Battery Usage] Make the timestamp slot info text format localizable.

(1) Some languages could localize the hephen to "~" or "to".
(2) Both 12hr format and 24hr format will have spaces around the hyphen.

Bug: 267185303
Bug: 266839251
Bug: 267349989
Bug: 267572852
Bug: 267595534
Test: manual
Change-Id: I62ff37d9ab20292621ee29ee3080cea7f8fd0fdb
This commit is contained in:
Zaiyue Xue
2023-02-08 14:19:25 +08:00
parent cb099dfc5e
commit d4aa8d764d
2 changed files with 8 additions and 3 deletions

View File

@@ -440,7 +440,8 @@ public class BatteryChartPreferenceController extends AbstractPreferenceControll
return selectedHourText;
}
return String.format("%s %s", selectedDayText, selectedHourText);
return mContext.getString(
R.string.battery_usage_day_and_hour, selectedDayText, selectedHourText);
}
private String getAccessibilityAnnounceMessage() {
@@ -666,8 +667,8 @@ public class BatteryChartPreferenceController extends AbstractPreferenceControll
}
return index == timestamps.size() - 1
? generateText(timestamps, index)
: String.format("%s%s%s", generateText(timestamps, index),
mIs24HourFormat ? "-" : " - ", generateText(timestamps, index + 1));
: mContext.getString(R.string.battery_usage_timestamps_hyphen,
generateText(timestamps, index), generateText(timestamps, index + 1));
}
public HourlyChartLabelTextGenerator setLatestTimestamp(Long latestTimestamp) {