Last active
July 26, 2020 21:59
-
-
Save kotx/a8e9c5937c407c013dbb1cd6f46d7659 to your computer and use it in GitHub Desktop.
Once again I have done something dumb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Environment(EnvType.CLIENT) | |
public enum TranslatableEnum { | |
ONE("enum.modid.translatable.one"); | |
TWO("enum.modid.translatable.two"); | |
private final String key; | |
TranslatableEnum(final String key) { | |
this.key = key; | |
} | |
@Override | |
public String toString() { | |
return key; | |
} | |
public Text asText() { | |
return new TranslatableText(key); | |
} | |
public String asString() { | |
return I18n.translate(key); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment