Be more explicit in quantity

Translators still keep triggering the linter with errors such as the
following:
Error: The quantity 'one' matches more than one specific number in this locale (1, 21, 31, 41, 51, 61, 71, 81, 101, 1001, …), but the message did not include a formatting argument (such as %d). This is usually an internationalization error. See full issue explanation for more. [ImpliedQuantity]
This commit is contained in:
Sylvia van Os
2021-08-01 12:50:56 +02:00
parent 068660fe3f
commit aa515b1192
2 changed files with 4 additions and 4 deletions

View File

@@ -125,7 +125,7 @@ public class MainActivity extends AppCompatActivity implements LoyaltyCardCursor
builder.setTitle(R.string.deleteTitle);
builder.setMessage(R.string.deleteConfirmation);
} else {
builder.setTitle(getResources().getQuantityString(R.plurals.deleteCardsTitle, mAdapter.getSelectedItemCount()));
builder.setTitle(getResources().getQuantityString(R.plurals.deleteCardsTitle, mAdapter.getSelectedItemCount(), mAdapter.getSelectedItemCount()));
builder.setMessage(getResources().getQuantityString(R.plurals.deleteCardsConfirmation, mAdapter.getSelectedItemCount(), mAdapter.getSelectedItemCount()));
}

View File

@@ -34,10 +34,10 @@
For example, in Russian, Android's plural quantity "one" actually refers to "any number ending on 1 but not ending in 11".
So while in English the extra non-plural form seems unnecessary duplication, it is necessary to give translators enough flexibility.
In Catima, we use the plain string when meaning exactly 1, and otherwise use the plural forms -->
<string name="deleteTitle">Delete Card</string>
<string name="deleteTitle">Delete card</string>
<plurals name="deleteCardsTitle">
<item quantity="one">Delete Card</item>
<item quantity="other">Delete Cards</item>
<item quantity="one">Delete <xliff:g>%d</xliff:g> card</item>
<item quantity="other">Delete <xliff:g>%d</xliff:g> cards</item>
</plurals>
<string name="deleteConfirmation">Delete this card permanently?</string>
<plurals name="deleteCardsConfirmation">