translate
public static java.lang.String translate(java.lang.String key,
java.util.function.Function<java.lang.String,java.lang.String> translator,
java.lang.Object[] args,
TranslatorOptions... options)
Translate a key with the given translator and arguments.
This method is made to comply with the vanilla bedrock client.
The bedrock edition has a special way of appending data to a translation key:
If only the key is given, the client will try to translate it.
Translation keys can start with a % sign. When having multiple translation keys in a single message this is required.
Translation keys can contain the following characters: a-z, A-Z, 0-9, _, -, .
If the key ends with any other character, the client will append it to the translated string (even unescaped % signs).
To insert a % sign into the message, you have to escape it with another % sign.
All $d and $s will be removed from the translated string.
%d, %s and %[1-9] will be replaced with the given arguments.
When specifying a number, the argument of the given index will be used. The index starts at 1 and is offset by the number of %s and %d in the key.
Translation arguments can also be translated when starting with a % sign.
- Parameters:
key - The key to translate
translator - The translator function
args - The arguments to insert
options - The translator options
- Returns:
- The translated string