Skip to content

Commit

Permalink
Use constant for "en-US"
Browse files Browse the repository at this point in the history
  • Loading branch information
tastybento committed Sep 7, 2020
1 parent 39c3b30 commit a436d99
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public class LocalesManager {
private static final String LOCALE_FOLDER = "locales";
private static final String BENTOBOX = "BentoBox";
private static final String SPACER = "*************************************************";
private static final String EN_US_TAG = "en-US";

public LocalesManager(BentoBox plugin) {
this.plugin = plugin;
Expand Down Expand Up @@ -98,8 +99,8 @@ public String get(String reference) {
return languages.get(Locale.forLanguageTag(plugin.getSettings().getDefaultLanguage())).get(reference);
}
// Get the translation from the en-US locale
if (languages.get(Locale.forLanguageTag("en-US")).contains(reference)) {
return languages.get(Locale.forLanguageTag("en-US")).get(reference);
if (languages.get(Locale.forLanguageTag(EN_US_TAG)).contains(reference)) {
return languages.get(Locale.forLanguageTag(EN_US_TAG)).get(reference);
}
return null;
}
Expand Down Expand Up @@ -135,7 +136,7 @@ public Set<String> getAvailablePrefixes(@NonNull User user) {
prefixes.addAll(languages.get(Locale.forLanguageTag(plugin.getSettings().getDefaultLanguage())).getPrefixes());

// Get the prefixes from the en-US locale
prefixes.addAll(languages.get(Locale.forLanguageTag("en-US")).getPrefixes());
prefixes.addAll(languages.get(Locale.forLanguageTag(EN_US_TAG)).getPrefixes());

return prefixes;
}
Expand Down

0 comments on commit a436d99

Please sign in to comment.