Skip to content

Commit 9105e2a

Browse files
committed
Fix missed i18n Preview GUI
1 parent e76adb7 commit 9105e2a

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/main/java/org/maxgamer/quickshop/shop/InventoryPreview.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121

2222
import lombok.EqualsAndHashCode;
2323
import lombok.ToString;
24+
import org.apache.commons.lang.StringUtils;
25+
import org.bukkit.ChatColor;
2426
import org.bukkit.NamespacedKey;
2527
import org.bukkit.entity.HumanEntity;
2628
import org.bukkit.entity.Player;
@@ -49,7 +51,7 @@ public class InventoryPreview implements Listener {
4951
private static final NamespacedKey NAMESPACED_KEY = new NamespacedKey(QuickShop.getInstance(), "preview-item");
5052
private final ItemStack itemStack;
5153
private final QuickShop plugin = QuickShop.getInstance();
52-
private final String previewStr;
54+
private String previewStr;
5355
@Nullable
5456
private Inventory inventory;
5557

@@ -59,7 +61,7 @@ public class InventoryPreview implements Listener {
5961
* @param itemStack The item you want create.
6062
* @param plugin The plugin instance.
6163
*/
62-
public InventoryPreview(@NotNull QuickShop plugin, @NotNull ItemStack itemStack) {
64+
public InventoryPreview(@NotNull QuickShop plugin, @NotNull ItemStack itemStack, @NotNull String locale) {
6365
Util.ensureThread(false);
6466
this.itemStack = itemStack.clone();
6567
ItemMeta itemMeta;
@@ -68,8 +70,10 @@ public InventoryPreview(@NotNull QuickShop plugin, @NotNull ItemStack itemStack)
6870
} else {
6971
itemMeta = plugin.getServer().getItemFactory().getItemMeta(itemStack.getType());
7072
}
71-
//TODO Locale
72-
previewStr = "Preview Item";
73+
previewStr = plugin.text().of("quickshop-gui-preview").forLocale(locale);
74+
if (StringUtils.isEmpty(previewStr)) {
75+
previewStr = ChatColor.RED + "FIXME: Do not set quickshop-gui-preview to null or empty string.";
76+
}
7377
if (itemMeta != null) {
7478
if (itemMeta.hasLore()) {
7579
itemMeta.getLore().add(previewStr);

0 commit comments

Comments
 (0)