Fix formats and internationalization of the string "0.6 seconds" in sk language

Root cause: The OTHER quantity does not require special treatment of the given quantity
Next: Using few quantity for the language requires special treatment of "small" numbers (as with  numbers ending 2, 3, or 4)

Bug: 154085511
Test: Change language to Slovensko to check the UI
Change-Id: I9143d9504cf8f9c5ccf17160e0dc0943fa10d31d
This commit is contained in:
menghanli
2020-04-23 11:02:12 +08:00
parent 1f91111c3a
commit 8a27603600
3 changed files with 7 additions and 4 deletions

View File

@@ -5186,7 +5186,8 @@
<!-- Summary for autoclick seekbar settings preference when user selected custom item. [CHAR LIMIT=35] -->
<plurals name="accessibilty_autoclick_delay_unit_second">
<item quantity="one"><xliff:g id="click_delay_label" example="1">%1$s</xliff:g> second</item>
<item quantity="other"><xliff:g id="click_delay_label" example="0.6">%1$s</xliff:g> seconds</item>
<item quantity="few"><xliff:g id="click_delay_label" example="0.6">%1$s</xliff:g> seconds</item>
<item quantity="other"><xliff:g id="click_delay_label">%1$s</xliff:g> seconds</item>
</plurals>
<!-- Summary for vibration settings preference when notification vibration and haptic feedback intensity are set. [CHAR LIMIT=50] -->

View File

@@ -204,7 +204,7 @@ public class ToggleAutoclickCustomSeekbarController extends BasePreferenceContro
}
private CharSequence delayTimeToString(int delayMillis) {
final int quantity = (delayMillis == 1000) ? Quantity.ONE : Quantity.OTHER;
final int quantity = (delayMillis == 1000) ? Quantity.ONE : Quantity.FEW;
final float delaySecond = (float) delayMillis / 1000;
// Only show integer when delay time is 1.
final String decimalFormat = (delaySecond == 1) ? "%.0f" : "%.1f";

View File

@@ -53,11 +53,13 @@ public class ToggleAutoclickPreferenceFragment extends DashboardFragment
@Retention(SOURCE)
@IntDef({
Quantity.OTHER,
Quantity.ONE
Quantity.ONE,
Quantity.FEW
})
@interface Quantity {
int OTHER = 0;
int ONE = 1;
int FEW = 3;
}
/**
@@ -79,7 +81,7 @@ public class ToggleAutoclickPreferenceFragment extends DashboardFragment
*/
static CharSequence getAutoclickPreferenceSummary(Resources resources, int delayMillis) {
final int summaryIndex = getAutoclickPreferenceSummaryIndex(delayMillis);
final int quantity = (delayMillis == 1000) ? Quantity.ONE : Quantity.OTHER;
final int quantity = (delayMillis == 1000) ? Quantity.ONE : Quantity.FEW;
final float delaySecond = (float) delayMillis / 1000;
// Only show integer when delay time is 1.
final String decimalFormat = (delaySecond == 1) ? "%.0f" : "%.1f";