Here is a piece of Java code:
private void setMatchesFound(int found) {
String template = mBrowserActivity.getResources().
getQuantityString(R.plurals.matches_found, found, found);
mMatches.setText(template);
}
and the corresponding XML resource:
<!-- Displayed on the Find dialog to display the number of matches
found in the current page. -->
<plurals name="matches_found">
<!-- Case of no matches -->
<item quantity="zero">No matches</item>
<!-- Case of one match -->
<item quantity="one">1 match</item>
<!-- Case of "few" (two) matches -->
<item quantity="few"><xliff:g id="number" example="2">d</xliff:g> matches</item>
<!-- Case of several matches -->
<item quantity="other"><xliff:g id="number" example="137">%d</xliff:g> matches</item>
</plurals>
It works just fine, showing something like "12 matches" in a "Find text on page" dialog. The code was added by this git commit (oh year, with a "very descriptive" log message).
Now, there is a git commit that changes the above Java code, here's the relevant diff:
- getQuantityString(R.plurals.matches_found, found, found);
+ getQuantityString(R.plurals.matches_found, mNumberOfMatches,
+ mWebView.findIndex() + 1, mNumberOfMatches);
As you can see, the aim is to print something like "Match 3 of 5". The problem is that XML code is not changed, so it shows something like "Matches: 3" instead of what it should. Bad and broken UI. Android 2.3.3.
The good thing is it is open source so anyone (incl. me) can fix it. I an not an expert in the field but I'll try.