Skip to content
This repository has been archived by the owner on Sep 15, 2024. It is now read-only.

Commit

Permalink
add translation support
Browse files Browse the repository at this point in the history
  • Loading branch information
MicrocontrollersDev committed Aug 3, 2024
1 parent ecf8f0c commit 1877227
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,62 +36,62 @@ public class NametagTweaksConfig {

public static Screen configScreen(Screen parent) {
return YetAnotherConfigLib.create(CONFIG, ((defaults, config, builder) -> builder
.title(Text.literal("Nametag Tweaks"))
.title(Text.translatable("nametag-tweaks.nametag-tweaks"))
.category(ConfigCategory.createBuilder()
.name(Text.literal("Nametag Tweaks"))
.option(Option.createBuilder(boolean.class)
.name(Text.literal("Remove Nametags"))
.description(OptionDescription.of(Text.of("Removes all nametags.")))
.name(Text.translatable("nametag-tweaks.nametag-tweaks"))
.option(Option.<Boolean>createBuilder()
.name(Text.translatable("nametag-tweaks.remove-nametags"))
.description(OptionDescription.of(Text.translatable("nametag-tweaks.remove-nametags.description")))
.binding(defaults.removeNametags, () -> config.removeNametags, newVal -> config.removeNametags = newVal)
.controller(TickBoxControllerBuilder::create)
.build())
.option(Option.createBuilder(boolean.class)
.name(Text.literal("Show Own Nametag"))
.description(OptionDescription.of(Text.of("Show your own nametag when in third person perspective.")))
.option(Option.<Boolean>createBuilder()
.name(Text.translatable("nametag-tweaks.show-own-nametag"))
.description(OptionDescription.of(Text.translatable("nametag-tweaks.show-own-nametag.description")))
.binding(defaults.showOwnNametags, () -> config.showOwnNametags, newVal -> config.showOwnNametags = newVal)
.controller(TickBoxControllerBuilder::create)
.build())
.option(Option.createBuilder(boolean.class)
.name(Text.literal("Hide Entity Nametags in F1 Mode"))
.description(OptionDescription.of(Text.of("Hide non-player and non-armor stand nametags in F1 mode when the HUD is hidden.")))
.option(Option.<Boolean>createBuilder()
.name(Text.translatable("nametag-tweaks.hide-entity-nametags-in-f1-mode"))
.description(OptionDescription.of(Text.translatable("nametag-tweaks.hide-entity-nametags-in-f1-mode.description")))
.binding(defaults.hideEntityNametagsInHiddenHud, () -> config.hideEntityNametagsInHiddenHud, newVal -> config.hideEntityNametagsInHiddenHud = newVal)
.controller(TickBoxControllerBuilder::create)
.build())
.option(Option.createBuilder(boolean.class)
.name(Text.literal("Hide Player Nametags in F1 Mode"))
.description(OptionDescription.of(Text.of("Hide player nametags in F1 mode when the HUD is hidden.")))
.option(Option.<Boolean>createBuilder()
.name(Text.translatable("nametag-tweaks.hide-player-nametags-in-f1-mode"))
.description(OptionDescription.of(Text.translatable("nametag-tweaks.hide-player-nametags-in-f1-mode.description")))
.binding(defaults.hidePlayerNametagsInHiddenHud, () -> config.hidePlayerNametagsInHiddenHud, newVal -> config.hidePlayerNametagsInHiddenHud = newVal)
.controller(TickBoxControllerBuilder::create)
.build())
.option(Option.createBuilder(boolean.class)
.name(Text.literal("Hide Armor Stand Nametags in F1 Mode"))
.description(OptionDescription.of(Text.of("Hide armor stand nametags in F1 mode when the HUD is hidden.")))
.option(Option.<Boolean>createBuilder()
.name(Text.translatable("nametag-tweaks.hide-armor-stand-nametags-in-f1-mode"))
.description(OptionDescription.of(Text.translatable("nametag-tweaks.hide-armor-stand-nametags-in-f1-mode.description")))
.binding(defaults.hideArmorStandNametagsInHiddenHud, () -> config.hideArmorStandNametagsInHiddenHud, newVal -> config.hideArmorStandNametagsInHiddenHud = newVal)
.controller(TickBoxControllerBuilder::create)
.build())
.option(Option.createBuilder(int.class)
.name(Text.literal("Nametag Height Offset"))
.description(OptionDescription.of(Text.of("Change the height offset of nametags.")))
.option(Option.<Integer>createBuilder()
.name(Text.translatable("nametag-tweaks.nametag-height-offset"))
.description(OptionDescription.of(Text.translatable("nametag-tweaks.nametag-height-offset.description")))
.binding(0, () -> config.nametagOffset, newVal -> config.nametagOffset = newVal)
.controller(opt -> IntegerSliderControllerBuilder.create(opt)
.range(-10, 10)
.step(1))
.build())
.option(Option.<Color>createBuilder()
.name(Text.literal("Nametag Background Color"))
.description(OptionDescription.of(Text.of("Allows setting a custom color for the background of nametags.")))
.name(Text.translatable("nametag-tweaks.nametag-background-color"))
.description(OptionDescription.of(Text.translatable("nametag-tweaks.nametag-background-color.description")))
.binding(defaults.nametagColor, () -> config.nametagColor, value -> config.nametagColor = value)
.customController(opt -> new ColorController(opt, true))
.build())
.option(Option.createBuilder(boolean.class)
.name(Text.literal("Nametag Text Shadow"))
.description(OptionDescription.of(Text.of("Adds text shadow to nametags.")))
.option(Option.<Boolean>createBuilder()
.name(Text.translatable("nametag-tweaks.nametag-text-shadow"))
.description(OptionDescription.of(Text.translatable("nametag-tweaks.nametag-text-shadow.description")))
.binding(defaults.nametagTextShadow, () -> config.nametagTextShadow, newVal -> config.nametagTextShadow = newVal)
.controller(TickBoxControllerBuilder::create)
.build())
.option(Option.createBuilder(float.class)
.name(Text.literal("Nametag Scale"))
.description(OptionDescription.of(Text.of("Allow scaling for Minecraft nametags.")))
.option(Option.<Float>createBuilder()
.name(Text.translatable("nametag-tweaks.nametag-scale"))
.description(OptionDescription.of(Text.translatable("nametag-tweaks.nametag-scale.description")))
.binding(1F, () -> config.nametagScale, newVal -> config.nametagScale = newVal)
.controller(opt -> FloatSliderControllerBuilder.create(opt)
.range(0.1F, 1F)
Expand Down
21 changes: 21 additions & 0 deletions src/main/resources/assets/nametagtweaks/lang/en_us.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"nametag-tweaks.nametag-tweaks": "Nametag Tweaks",
"nametag-tweaks.remove-nametags": "Remove Nametags",
"nametag-tweaks.remove-nametags.description": "Removes all nametags.",
"nametag-tweaks.show-own-nametag": "Show Own Nametag",
"nametag-tweaks.show-own-nametag.description": "Show your own nametag when in third person perspective.",
"nametag-tweaks.hide-entity-nametags-in-f1-mode": "Hide Entity Nametags in F1 Mode",
"nametag-tweaks.hide-entity-nametags-in-f1-mode.description": "Hide non-player and non-armor stand nametags in F1 mode when the HUD is hidden.",
"nametag-tweaks.hide-player-nametags-in-f1-mode": "Hide Player Nametags in F1 Mode",
"nametag-tweaks.hide-player-nametags-in-f1-mode.description": "Hide player nametags in F1 mode when the HUD is hidden.",
"nametag-tweaks.hide-armor-stand-nametags-in-f1-mode": "Hide Armor Stand Nametags in F1 Mode",
"nametag-tweaks.hide-armor-stand-nametags-in-f1-mode.description": "Hide armor stand nametags in F1 mode when the HUD is hidden.",
"nametag-tweaks.nametag-height-offset": "Nametag Height Offset",
"nametag-tweaks.nametag-height-offset.description": "Change the height offset of nametags.",
"nametag-tweaks.nametag-background-color": "Nametag Background Color",
"nametag-tweaks.nametag-background-color.description": "Allows setting a custom color for the background of nametags.",
"nametag-tweaks.nametag-text-shadow": "Nametag Text Shadow",
"nametag-tweaks.nametag-text-shadow.description": "Adds text shadow to nametags.",
"nametag-tweaks.nametag-scale": "Nametag Scale",
"nametag-tweaks.nametag-scale.description": "Allow scaling for Minecraft nametags."
}

0 comments on commit 1877227

Please sign in to comment.