Skip to content

Instantly share code, notes, and snippets.

@kotx
Last active July 26, 2020 21:59
Show Gist options
  • Save kotx/a8e9c5937c407c013dbb1cd6f46d7659 to your computer and use it in GitHub Desktop.
Save kotx/a8e9c5937c407c013dbb1cd6f46d7659 to your computer and use it in GitHub Desktop.
Once again I have done something dumb
@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