Skip to content

Commit 2689888

Browse files
committed
Comment getQuantityString()
1 parent 6551031 commit 2689888

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

WordPressUtils/src/main/java/org/wordpress/android/util/StringUtils.java

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -306,16 +306,22 @@ public static long stringToLong(String s, long defaultValue) {
306306
}
307307

308308
/**
309-
* We need this because our translation platform doesn't support plurals.
309+
* Formats the string for the given quantity, using the given arguments.
310+
* We need this because our translation platform doesn't support Android plurals.
311+
*
312+
* @param zero The desired string identifier to get when quantity is exactly 0
313+
* @param one The desired string identifier to get when quantity is exactly 1
314+
* @param other The desired string identifier to get when quantity is not (0 or 1)
315+
* @param quantity The number used to get the correct string
310316
*/
311317
public static String getQuantityString(Context context, @StringRes int zero, @StringRes int one,
312-
@StringRes int other, int count) {
313-
if (count == 0) {
318+
@StringRes int other, int quantity) {
319+
if (quantity == 0) {
314320
return context.getString(zero);
315321
}
316-
if (count == 1) {
322+
if (quantity == 1) {
317323
return context.getString(one);
318324
}
319-
return String.format(context.getString(other), count);
325+
return String.format(context.getString(other), quantity);
320326
}
321327
}

0 commit comments

Comments
 (0)