Skip to content

Commit

Permalink
Fix plural strings
Browse files Browse the repository at this point in the history
  • Loading branch information
HenrikJannsen committed Sep 30, 2024
1 parent 87e4a0a commit a653ff8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,8 @@ public ListItem(ReputationSource reputationSource,
dateString = DateFormatter.formatDate(blockTime);
timeString = DateFormatter.formatTime(blockTime);
age = TimeFormatter.getAgeInDays(blockTime);
sourceString = reputationSource.getDisplayString();
ageString = TimeFormatter.formatAgeInDays(blockTime);
sourceString = reputationSource.getDisplayString();
amountString = optionalAmount.map(amount -> AmountFormatter.formatAmountWithCode(Coin.fromValue(amount, "BSQ"))).orElse("-");
scoreString = String.valueOf(score);
lockTimeString = optionalLockTime.map(String::valueOf).orElse("-");
Expand Down
11 changes: 7 additions & 4 deletions i18n/src/main/java/bisq/i18n/Res.java
Original file line number Diff line number Diff line change
Expand Up @@ -93,14 +93,17 @@ public static String get(String key) {
* Additionally, a '.0' postfix handles 0 values.
*/
public static String getPluralization(String key, double number) {
String pluralKey;
if (number == 1) {
return get(key + ".1");
pluralKey = key + ".1";
} else {
if (number == 0 && has(key + ".0")) {
return get(key + ".0");
} else
return get(key + ".*", number);
pluralKey = key + ".0";
} else {
pluralKey = key + ".*";
}
}
return get(pluralKey, number);
}

public static boolean has(String key) {
Expand Down

0 comments on commit a653ff8

Please sign in to comment.