Added locale authors names in the Language Selection panel

This commit is contained in:
Florian CUNY 2019-05-11 20:41:28 +02:00
parent ba7c118266
commit eb05f1fca5
3 changed files with 29 additions and 8 deletions

View File

@ -1,15 +1,17 @@
package world.bentobox.bentobox.panels;
import java.util.Locale;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.inventory.ItemStack;
import world.bentobox.bentobox.BentoBox;
import world.bentobox.bentobox.api.localization.BentoBoxLocale;
import world.bentobox.bentobox.api.localization.TextVariables;
import world.bentobox.bentobox.api.panels.builders.PanelBuilder;
import world.bentobox.bentobox.api.panels.builders.PanelItemBuilder;
import world.bentobox.bentobox.api.user.User;
import world.bentobox.bentobox.managers.LocalesManager;
import java.util.Locale;
/**
* @author Poslovitch
@ -26,10 +28,14 @@ public class LanguagePanel {
PanelBuilder panelBuilder = new PanelBuilder()
.name(user.getTranslation("language.panel-title"));
for (Locale locale : BentoBox.getInstance().getLocalesManager().getAvailableLocales(true)) {
LocalesManager localesManager = BentoBox.getInstance().getLocalesManager();
for (Locale locale : localesManager.getAvailableLocales(true)) {
PanelItemBuilder localeIcon = new PanelItemBuilder();
ItemStack localeBanner = BentoBox.getInstance().getLocalesManager().getLanguages().get(locale).getBanner();
BentoBoxLocale language = localesManager.getLanguages().get(locale);
ItemStack localeBanner = language.getBanner();
if (localeBanner != null) {
localeIcon.icon(localeBanner);
} else {
@ -45,7 +51,14 @@ public class LanguagePanel {
});
if (user.getLocale().toLanguageTag().equals(locale.toLanguageTag())) {
localeIcon.description(user.getTranslation("language.selected"));
localeIcon.description(user.getTranslation("language.description.selected"), "");
} else {
localeIcon.description(user.getTranslation("language.description.click-to-select"), "");
}
localeIcon.description(user.getTranslation("language.description.authors"));
for (String author : language.getAuthors()) {
localeIcon.description(user.getTranslation("language.description.author", TextVariables.NAME, author));
}
panelBuilder.item(localeIcon.build());

View File

@ -984,7 +984,11 @@ protection:
language:
panel-title: "Select your language"
selected: "&aCurrently selected."
description:
selected: "&aCurrently selected."
click-to-select: "&eClick &ato select."
authors: "&aAuthors:"
author: "&3- &b[name]"
edited: "&aChanged your language to &e[lang]&a."
management:

View File

@ -243,7 +243,11 @@ protection:
language:
panel-title: "Choisissez votre langue"
selected: "&aActuellement sélectionné."
description:
selected: "&aActuellement sélectionné."
click-to-select: "&eCliquez &apour sélectionner."
authors: "&aAuteurs :"
author: "&3- &b[name]"
edited: "&aLangue modifiée en &e[lang]&a."
management: