Using plurals to define for min length of string
When a number of min length of a string is singular, the definition of <plurals> can show a localization with a correct grammar for singular. Bug: http://b/78537276 Test: Manual Change-Id: Ic5d94078f1c80a81a37ff7c11d5d5e106a764bed
This commit is contained in:
committed by
Prochin Wang
parent
0e8e89f576
commit
ae8fdff1af
@@ -1371,19 +1371,29 @@
|
||||
<string name="lock_failed_attempts_now_wiping_dialog_dismiss">Dismiss</string>
|
||||
|
||||
<!-- Hint shown in dialog screen when password is too short -->
|
||||
<string name="lockpassword_password_too_short">Must be at least <xliff:g id="count" example="3">%d</xliff:g> characters</string>
|
||||
<plurals name="lockpassword_password_too_short">
|
||||
<item quantity="one">Must contain at least <xliff:g id="count" example="1">%d</xliff:g> character</item>
|
||||
<item quantity="other">Must be at least <xliff:g id="count" example="3">%d</xliff:g> characters</item>
|
||||
</plurals>
|
||||
<!-- Hint shown in dialog screen when PIN is too short -->
|
||||
<string name="lockpassword_pin_too_short">PIN must be at least <xliff:g id="count" example="3">%d</xliff:g> digits</string>
|
||||
<plurals name="lockpassword_pin_too_short">
|
||||
<item quantity="one">PIN must contain at least <xliff:g id="count" example="1">%d</xliff:g> digit</item>
|
||||
<item quantity="other">PIN must be at least <xliff:g id="count" example="3">%d</xliff:g> digits</item>
|
||||
</plurals>
|
||||
|
||||
<!-- Hint shown after minimum password criteria is met -->
|
||||
<string name="lockpassword_continue_label">Continue</string>
|
||||
|
||||
<!-- Error shown in popup when password is too long -->
|
||||
<string name="lockpassword_password_too_long">Must be fewer than
|
||||
<xliff:g id="number" example="17">%d</xliff:g> characters</string>
|
||||
<plurals name="lockpassword_password_too_long">
|
||||
<item quantity="one">Must be fewer than <xliff:g id="number" example="1">%d</xliff:g> character</item>
|
||||
<item quantity="other">Must be fewer than <xliff:g id="number" example="17">%d</xliff:g> characters</item>
|
||||
</plurals>
|
||||
<!-- Error shown in popup when PIN is too long -->
|
||||
<string name="lockpassword_pin_too_long">Must be fewer than
|
||||
<xliff:g id="number" example="17">%d</xliff:g> digits</string>
|
||||
<plurals name="lockpassword_pin_too_long">
|
||||
<item quantity="one">Must be fewer than <xliff:g id="number" example="1">%d</xliff:g> digit</item>
|
||||
<item quantity="other">Must be fewer than <xliff:g id="number" example="17">%d</xliff:g> digits</item>
|
||||
</plurals>
|
||||
|
||||
<!-- Error shown when in PIN mode and user enters a non-digit -->
|
||||
<string name="lockpassword_pin_contains_non_digits">Must contain only digits 0-9</string>
|
||||
|
@@ -843,14 +843,20 @@ public class ChooseLockPassword extends SettingsActivity {
|
||||
mPasswordMinNonLetter));
|
||||
}
|
||||
if ((errorCode & TOO_SHORT) > 0) {
|
||||
messages.add(getString(mIsAlphaMode ?
|
||||
R.string.lockpassword_password_too_short
|
||||
: R.string.lockpassword_pin_too_short, mPasswordMinLength));
|
||||
messages.add(getResources().getQuantityString(
|
||||
mIsAlphaMode
|
||||
? R.plurals.lockpassword_password_too_short
|
||||
: R.plurals.lockpassword_pin_too_short,
|
||||
mPasswordMinLength,
|
||||
mPasswordMinLength));
|
||||
}
|
||||
if ((errorCode & TOO_LONG) > 0) {
|
||||
messages.add(getString(mIsAlphaMode ?
|
||||
R.string.lockpassword_password_too_long
|
||||
: R.string.lockpassword_pin_too_long, mPasswordMaxLength + 1));
|
||||
messages.add(getResources().getQuantityString(
|
||||
mIsAlphaMode
|
||||
? R.plurals.lockpassword_password_too_long
|
||||
: R.plurals.lockpassword_pin_too_long,
|
||||
mPasswordMaxLength + 1,
|
||||
mPasswordMaxLength + 1));
|
||||
}
|
||||
if ((errorCode & CONTAIN_SEQUENTIAL_DIGITS) > 0) {
|
||||
messages.add(getString(R.string.lockpassword_pin_no_sequential_digits));
|
||||
|
Reference in New Issue
Block a user