Skip to content

Commit

Permalink
v3.9.1 dev. progress
Browse files Browse the repository at this point in the history
Placing all programmatical references to translation keys all in one place, so it's easier to manage them all.
  • Loading branch information
TheCSDev committed Feb 26, 2024
1 parent 30314ea commit f203ca6
Show file tree
Hide file tree
Showing 33 changed files with 351 additions and 183 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import io.github.thecsdev.betterstats.BetterStats;
import io.github.thecsdev.betterstats.BetterStatsConfig;
import io.github.thecsdev.betterstats.api.client.gui.widget.ScrollBarWidget;
import io.github.thecsdev.betterstats.util.BST;
import io.github.thecsdev.tcdcommons.api.client.gui.config.TConfigPanelBuilder;
import io.github.thecsdev.tcdcommons.api.client.gui.other.TFillColorElement;
import io.github.thecsdev.tcdcommons.api.client.gui.other.TLabelElement;
Expand Down Expand Up @@ -105,43 +106,43 @@ public BetterStatsConfigScreen(@Nullable Screen parent)
{
//debug mode
config_builder.addCheckbox(
translatable("betterstats.api.client.gui.screen.betterstatsconfigscreen.debug_mode"),
BST.config_debugMode(),
BetterStatsConfig.DEBUG_MODE,
checkbox -> BetterStatsConfig.DEBUG_MODE = checkbox.getChecked());

//gui smooth scroll
config_builder.addCheckbox(
translatable("betterstats.api.client.gui.screen.betterstatsconfigscreen.gui_smooth_scroll"),
BST.config_guiSmoothScroll(),
config.guiSmoothScroll,
checkbox -> config.guiSmoothScroll = checkbox.getChecked());
config_builder.getLastAddedElement().setTooltip(Tooltip.of(translatable("betterstats.api.client.gui.screen.betterstatsconfigscreen.gui_smooth_scroll.tooltip")));
config_builder.getLastAddedElement().setTooltip(Tooltip.of(BST.config_guiSmoothScroll_tooltip()));

//gui mobs follow cursor
config_builder.addCheckbox(
translatable("betterstats.api.client.gui.screen.betterstatsconfigscreen.gui_mob_follow_cursor"),
BST.config_guiMobsFollowCursor(),
config.guiMobsFollowCursor,
checkbox -> config.guiMobsFollowCursor = checkbox.getChecked());

//trust all servers bss network
config_builder.addCheckbox(
translatable("betterstats.api.client.gui.screen.betterstatsconfigscreen.trust_all_servers_bss_net"),
BST.config_trustAllServersBssNet(),
config.trustAllServersBssNet,
checkbox -> config.trustAllServersBssNet = checkbox.getChecked());
config_builder.getLastAddedElement().setTooltip(Tooltip.of(translatable("betterstats.api.client.gui.screen.betterstatsconfigscreen.trust_all_servers_bss_net.tooltip")));
config_builder.getLastAddedElement().setTooltip(Tooltip.of(BST.config_trustAllServersBssNet_tooltip()));
}

//configs for server-sided features
config_builder.addLabelB(translatable("tcdcommons.server_side")).setTextColor(0xFFFFFF00);
{
//register commands
config_builder.addCheckbox(
translatable("betterstats.api.client.gui.screen.betterstatsconfigscreen.register_commands"),
BST.config_registerCommands(),
config.registerCommands,
checkbox -> config.registerCommands = checkbox.getChecked());

//enable stat announcement system
config_builder.addCheckbox(
translatable("betterstats.api.client.gui.screen.betterstatsconfigscreen.enable_sas"),
BST.config_enableSas(),
config.enableServerSAS,
checkbox -> config.enableServerSAS = checkbox.getChecked());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
import static io.github.thecsdev.betterstats.api.client.gui.panel.BSComponentPanel.BS_WIDGETS_TEXTURE;
import static io.github.thecsdev.tcdcommons.api.client.registry.TClientRegistries.PLAYER_BADGE_RENDERER;
import static io.github.thecsdev.tcdcommons.api.registry.TRegistries.PLAYER_BADGE;
import static io.github.thecsdev.tcdcommons.api.util.TextUtils.translatable;

import java.awt.Rectangle;

import io.github.thecsdev.betterstats.BetterStats;
import io.github.thecsdev.betterstats.api.client.badge.BSClientPlayerBadge;
import io.github.thecsdev.betterstats.api.util.stats.SUItemStat;
import io.github.thecsdev.betterstats.util.BST;
import io.github.thecsdev.tcdcommons.api.client.gui.util.UITexture;
import io.github.thecsdev.tcdcommons.api.client.render.badge.PBTextureRenderer;
import io.github.thecsdev.tcdcommons.api.registry.TRegistries;
Expand Down Expand Up @@ -38,20 +38,20 @@ public static final void register() {}
{
//create badges
final var dedication = new BSClientPlayerBadge(
translatable("betterstats.api.client.registry.bsclientplayerbadges.dedication.title"),
translatable("betterstats.api.client.registry.bsclientplayerbadges.dedication.description"));
BST.pbadge_dedication_title(),
BST.pbadge_dedication_description());
final var loyalty = new BSClientPlayerBadge(
translatable("betterstats.api.client.registry.bsclientplayerbadges.loyalty.title"),
translatable("betterstats.api.client.registry.bsclientplayerbadges.loyalty.description"));
BST.pbadge_loyalty_title(),
BST.pbadge_loyalty_description());
final var the_next_generation = new BSClientPlayerBadge(
translatable("betterstats.api.client.registry.bsclientplayerbadges.the_next_generation.title"),
translatable("betterstats.api.client.registry.bsclientplayerbadges.the_next_generation.description"));
BST.pbadge_nextgen_title(),
BST.pbadge_nextgen_description());
final var adventurous_traveler = new BSClientPlayerBadge(
translatable("betterstats.api.client.registry.bsclientplayerbadges.adventurous_traveler.title"),
translatable("betterstats.api.client.registry.bsclientplayerbadges.adventurous_traveler.description"));
BST.pbadge_advtravel_title(),
BST.pbadge_advtravel_description());
final var perennial_survivor = new BSClientPlayerBadge(
translatable("betterstats.api.client.registry.bsclientplayerbadges.perennial_survivor.title"),
translatable("betterstats.api.client.registry.bsclientplayerbadges.perennial_survivor.description"));
BST.pbadge_psurvivor_title(),
BST.pbadge_psurvivor_description());

//set badge criteria
dedication.setStatCriteria(sp -> (sp.getStatValue(Stats.CUSTOM, Stats.PLAY_TIME) > 20736000) ? 1 : 0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import io.github.thecsdev.betterstats.BetterStats;
import io.github.thecsdev.betterstats.BetterStatsConfig;
import io.github.thecsdev.betterstats.client.network.BetterStatsClientNetworkHandler;
import io.github.thecsdev.betterstats.util.BST;
import io.github.thecsdev.tcdcommons.api.client.gui.screen.TScreenWrapper;
import io.github.thecsdev.tcdcommons.api.client.gui.screen.TWidgetHudScreen;
import io.github.thecsdev.tcdcommons.api.client.gui.util.TDrawContext;
Expand All @@ -34,12 +35,11 @@
public final class BetterStatsHudScreen extends TWidgetHudScreen implements IParentScreenProvider
{
// ==================================================
private static final String P = "betterstats.client.gui.screen.hud.betterstatshudscreen";
public static final Text TEXT_TITLE = translatable(P);
public static final Text TEXT_TUTORIAL_1 = translatable(P + ".tutorial_1");
public static final Text TEXT_TUTORIAL_2 = translatable(P + ".tutorial_2");
public static final Text TEXT_TUTORIAL_3 = translatable(P + ".tutorial_3");
public static final Text TEXT_LIVE_TOGGLE = translatable(P + ".live_stats_toggle");
public static final Text TEXT_TITLE = BST.hud_title();
public static final Text TEXT_TUTORIAL_1 = BST.hud_tutorial1();
public static final Text TEXT_TUTORIAL_2 = BST.hud_tutorial2();
public static final Text TEXT_TUTORIAL_3 = BST.hud_tutorial3();
public static final Text TEXT_LIVE_TOGGLE = BST.hud_liveStatsToggle();
//
public static final Identifier HUD_SCREEN_ID = new Identifier(getModID(), "stats_hud");
// --------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package io.github.thecsdev.betterstats.client.gui.stats.panel;

import static io.github.thecsdev.betterstats.BetterStats.getModID;
import static io.github.thecsdev.tcdcommons.api.util.TextUtils.translatable;

import java.util.Objects;

Expand All @@ -16,6 +15,7 @@
import io.github.thecsdev.betterstats.api.client.util.StatFilterSettings;
import io.github.thecsdev.betterstats.api.util.io.IStatsProvider;
import io.github.thecsdev.betterstats.client.gui.stats.panel.StatFiltersPanel.StatFiltersPanelProxy;
import io.github.thecsdev.betterstats.util.BST;
import io.github.thecsdev.tcdcommons.api.client.gui.other.TLabelElement;
import io.github.thecsdev.tcdcommons.api.client.gui.panel.TPanelElement;
import io.github.thecsdev.tcdcommons.api.client.gui.widget.TScrollBarWidget;
Expand All @@ -29,7 +29,7 @@
public final class StatsTabPanel extends BSComponentPanel
{
// ==================================================
public static final Text TXT_NO_STATS_YET = translatable("betterstats.client.gui.stats.panel.statstabpanel.no_stats_yet");
public static final Text TXT_NO_STATS_YET = BST.sTab_noStatsYet();
public static final Identifier FILTER_ID_SCROLL_CACHE = new Identifier(getModID(), "stats_scroll_cache");
// --------------------------------------------------
protected final StatsTabPanelProxy proxy;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import io.github.thecsdev.betterstats.api.client.gui.util.StatsTabUtils;
import io.github.thecsdev.betterstats.api.client.registry.BSStatsTabs;
import io.github.thecsdev.betterstats.api.client.registry.StatsTab;
import io.github.thecsdev.betterstats.util.BST;
import io.github.thecsdev.tcdcommons.api.client.gui.config.TConfigPanelBuilder;
import io.github.thecsdev.tcdcommons.api.client.gui.widget.TButtonWidget;
import net.minecraft.client.gui.tooltip.Tooltip;
Expand Down Expand Up @@ -39,43 +40,43 @@ public final class BSConfigTab extends StatsTab
{
//debug mode
this.config_builder.addCheckbox(
translatable("betterstats.api.client.gui.screen.betterstatsconfigscreen.debug_mode"),
BST.config_debugMode(),
BetterStatsConfig.DEBUG_MODE,
checkbox -> BetterStatsConfig.DEBUG_MODE = checkbox.getChecked());

//gui smooth scroll
this.config_builder.addCheckbox(
translatable("betterstats.api.client.gui.screen.betterstatsconfigscreen.gui_smooth_scroll"),
BST.config_guiSmoothScroll(),
config.guiSmoothScroll,
checkbox -> config.guiSmoothScroll = checkbox.getChecked());
this.config_builder.getLastAddedElement().setTooltip(Tooltip.of(translatable("betterstats.api.client.gui.screen.betterstatsconfigscreen.gui_smooth_scroll.tooltip")));
this.config_builder.getLastAddedElement().setTooltip(Tooltip.of(BST.config_guiSmoothScroll_tooltip()));

//gui mobs follow cursor
this.config_builder.addCheckbox(
translatable("betterstats.api.client.gui.screen.betterstatsconfigscreen.gui_mob_follow_cursor"),
BST.config_guiMobsFollowCursor(),
config.guiMobsFollowCursor,
checkbox -> config.guiMobsFollowCursor = checkbox.getChecked());

//trust all servers bss network
this.config_builder.addCheckbox(
translatable("betterstats.api.client.gui.screen.betterstatsconfigscreen.trust_all_servers_bss_net"),
BST.config_trustAllServersBssNet(),
config.trustAllServersBssNet,
checkbox -> config.trustAllServersBssNet = checkbox.getChecked());
this.config_builder.getLastAddedElement().setTooltip(Tooltip.of(translatable("betterstats.api.client.gui.screen.betterstatsconfigscreen.trust_all_servers_bss_net.tooltip")));
this.config_builder.getLastAddedElement().setTooltip(Tooltip.of(BST.config_trustAllServersBssNet_tooltip()));
}

//configs for server-sided features
this.config_builder.addLabelB(translatable("tcdcommons.server_side")).setTextColor(0xFFFFFF00);
{
//register commands
this.config_builder.addCheckbox(
translatable("betterstats.api.client.gui.screen.betterstatsconfigscreen.register_commands"),
BST.config_registerCommands(),
config.registerCommands,
checkbox -> config.registerCommands = checkbox.getChecked());

//enable stat announcement system
this.config_builder.addCheckbox(
translatable("betterstats.api.client.gui.screen.betterstatsconfigscreen.enable_sas"),
BST.config_enableSas(),
config.enableServerSAS,
checkbox -> config.enableServerSAS = checkbox.getChecked());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import io.github.thecsdev.betterstats.api.util.stats.SUGeneralStat;
import io.github.thecsdev.betterstats.client.gui.screen.hud.BetterStatsHudScreen;
import io.github.thecsdev.betterstats.client.gui.screen.hud.entry.StatsHudGeneralEntry;
import io.github.thecsdev.betterstats.util.BST;
import io.github.thecsdev.tcdcommons.api.client.gui.other.TFillColorElement;
import io.github.thecsdev.tcdcommons.api.client.gui.other.TLabelElement;
import io.github.thecsdev.tcdcommons.api.client.gui.panel.TPanelElement;
Expand Down Expand Up @@ -75,7 +76,7 @@
);
final var ws2 = new CustomStatElement(
wsp.getX(), wsp.getEndY() - CustomStatElement.HEIGHT, wsp.getWidth(),
translatable("betterstats.client.gui.stats.panel.statstabpanel.seed_sha256"),
BST.sTab_hashedSeed(),
literal(Objects.toString(getBiomeAccessSeed(world.getBiomeAccess())))
);
wsp.addChild(ws1, false);
Expand All @@ -97,7 +98,7 @@

statWidget.eContextMenu.register((__, cMenu) ->
{
cMenu.addButton(translatable("betterstats.client.gui.screen.hud.betterstatshudscreen.pin_stat"), ___ ->
cMenu.addButton(BST.hud_pinStat(), ___ ->
{
final var hud = BetterStatsHudScreen.getInstance();
hud.setParentScreen(MC_CLIENT.currentScreen);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import io.github.thecsdev.betterstats.api.util.stats.SUItemStat;
import io.github.thecsdev.betterstats.client.gui.screen.hud.BetterStatsHudScreen;
import io.github.thecsdev.betterstats.client.gui.screen.hud.entry.StatsHudItemEntry;
import io.github.thecsdev.betterstats.util.BST;
import io.github.thecsdev.tcdcommons.api.client.gui.panel.TPanelElement;
import io.github.thecsdev.tcdcommons.api.util.annotations.Virtual;
import net.minecraft.text.Text;
Expand Down Expand Up @@ -96,7 +97,7 @@
{
widget.eContextMenu.register((__, cMenu) ->
{
cMenu.addButton(translatable("betterstats.client.gui.screen.hud.betterstatshudscreen.pin_stat"), ___ ->
cMenu.addButton(BST.hud_pinStat(), ___ ->
{
final var hud = BetterStatsHudScreen.getInstance();
hud.setParentScreen(MC_CLIENT.currentScreen);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import io.github.thecsdev.betterstats.api.util.stats.SUMobStat;
import io.github.thecsdev.betterstats.client.gui.screen.hud.BetterStatsHudScreen;
import io.github.thecsdev.betterstats.client.gui.screen.hud.entry.StatsHudMobEntry;
import io.github.thecsdev.betterstats.util.BST;
import io.github.thecsdev.tcdcommons.api.client.gui.panel.TPanelElement;
import io.github.thecsdev.tcdcommons.api.util.annotations.Virtual;
import net.minecraft.entity.SpawnGroup;
Expand Down Expand Up @@ -97,7 +98,7 @@
{
widget.eContextMenu.register((__, cMenu) ->
{
cMenu.addButton(translatable("betterstats.client.gui.screen.hud.betterstatshudscreen.pin_stat"), ___ ->
cMenu.addButton(BST.hud_pinStat(), ___ ->
{
final var hud = BetterStatsHudScreen.getInstance();
hud.setParentScreen(MC_CLIENT.currentScreen);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
package io.github.thecsdev.betterstats.network;

import static io.github.thecsdev.tcdcommons.api.util.TextUtils.translatable;

import java.util.WeakHashMap;

import org.jetbrains.annotations.ApiStatus.Internal;

import io.github.thecsdev.betterstats.BetterStats;
import io.github.thecsdev.betterstats.util.BST;
import io.github.thecsdev.tcdcommons.api.events.server.PlayerManagerEvent;
import io.github.thecsdev.tcdcommons.api.network.CustomPayloadNetwork;
import io.netty.buffer.Unpooled;
Expand All @@ -25,8 +24,8 @@
// ==================================================
private BetterStatsNetworkHandler() {}
// --------------------------------------------------
public static final Text TXT_TOGGLE_TOOLTIP = translatable("betterstats.network.betterstatsnetworkhandler.toggle_tooltip");
public static final Text TXT_CONSENT_WARNING = translatable("betterstats.network.betterstatsnetworkhandler.consent_warning");
public static final Text TXT_TOGGLE_TOOLTIP = BST.net_toggleTooltip();
public static final Text TXT_CONSENT_WARNING = BST.net_consentWarning();
//
public static final int NETWORK_VERSION = 2;
//
Expand Down
Loading

0 comments on commit f203ca6

Please sign in to comment.