Skip to content

Commit 065e948

Browse files
committed
Added methods for singular and plural locale mappings
Introduced `displayNamesSingular()` and `displayNamesPlural()` methods in `Currency.Builder`. These provide unmodifiable mappings of singular and plural display names for various locales, improving extensibility and localization support.
1 parent b30e45a commit 065e948

File tree

1 file changed

+20
-1
lines changed
  • src/main/java/net/thenextlvl/service/api/economy/currency

1 file changed

+20
-1
lines changed

src/main/java/net/thenextlvl/service/api/economy/currency/Currency.java

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,11 @@
55
import net.kyori.adventure.text.Component;
66
import org.jetbrains.annotations.ApiStatus;
77
import org.jetbrains.annotations.Contract;
8+
import org.jetbrains.annotations.Unmodifiable;
89
import org.jspecify.annotations.NullMarked;
910

1011
import java.util.Locale;
12+
import java.util.Map;
1113
import java.util.Optional;
1214
import java.util.OptionalInt;
1315

@@ -46,7 +48,6 @@ default Component getDisplayNameSingular(Audience audience) {
4648
*/
4749
Component getDisplayNameSingular(Locale locale);
4850

49-
5051
/**
5152
* Retrieves the plural display name component of the currency based on the audience's locale.
5253
* <p>
@@ -109,6 +110,15 @@ default Component format(Number amount, Audience audience) {
109110
* singular and plural display names, currency symbol, and fractional digits.
110111
*/
111112
interface Builder {
113+
/**
114+
* Retrieves a map containing the singular display names of the currency for various locales.
115+
*
116+
* @return an unmodifiable map of {@code Locale} and {@code Component} objects
117+
* representing the singular display names of the currency.
118+
*/
119+
@Unmodifiable
120+
Map<Locale, Component> displayNamesSingular();
121+
112122
/**
113123
* Sets the singular display name of the currency for a specific locale.
114124
*
@@ -128,6 +138,15 @@ interface Builder {
128138
@Contract(value = "_ -> new")
129139
Optional<Component> displayNameSingular(Locale locale);
130140

141+
/**
142+
* Retrieves a map containing the plural display names of the currency for various locales.
143+
*
144+
* @return an unmodifiable map of {@code Locale} and {@code Component} objects
145+
* representing the plural display names of the currency.
146+
*/
147+
@Unmodifiable
148+
Map<Locale, Component> displayNamesPlural();
149+
131150
/**
132151
* Sets the plural display name of the currency for a specific locale.
133152
*

0 commit comments

Comments
 (0)