Text and Localization
Minecraft is a game with fully localized text in languages all over the world. To achieve this, Minecraft employs a system where internal translation keys are assigned values on a per-language basis. Minecraft will generate translation keys for custom entities, items, and blocks, and it is up to us to assign them a localized name in our resource pack.
Language files typically go within the resource pack in the "texts" folder as files with the
.lang file extension. These files can be placed in the behavior pack, but the only translatable text it can change is the pack manifest's name and description.
Minecraft supports 29 languages currently, as described in § Vanilla Languages.
The format for a language file is rather straightforward. Translations are supplied as key-value pairs separated by an equals sign (
=), the key being a translation key and the value being a string. Values cannot contain newline characters.
wiki.example_translation.line_1=The first line! wiki.example_translation.line_2=Some more information following the first line.
Comments may be added with two pound signs (
##), either as line comments or in-line comments. All text after the pound signs are a comment until the next line.
Trailing spaces are not trimmed for in-line comments. If you want to indent a comment, use the Tab character.
## Translator note: I thought this would be funny to put here. item.flint_and_steel.name=Flint and Steve ##[sic]
A translation can contain substitutions in place of text. Substitutions can either be ordered (
%2, etc.) or not ordered (
%s). Vanilla translations have their values filled in by the game, while players can manually set the substitutions' values with commands that use the raw JSON text format, like with
commands.op.success=Opped: %s immersive_reader.book_page_header=Page %1 of %2
Localization can be done just about anywhere text can be used, including (but not limited to):
- Pack name and description
- Entity, item, or block names
- Pages in a book
- Lines on a sign
- Text in dialogue
Some text cannot be translated however, such as for an item renamed in an anvil.
It is good practice create a copy of your language file for each major language your pack supports. For example, to support full English one should create both an
en_US.lang and an
en_GB.lang file, to cover English in both the United States and Great Britain countries, respectively.
When editing language files one must also add a
languages.json file in the
texts folder containing an array with each of the languages you plan to change. This lets Minecraft know that it should apply localization for these languages.
[ "en_US", "en_GB", "fr_FR" ]
With a global resource pack, custom languages may be introduced through the
language_names.json files. Once the pack is applied globally the language can be changed in the "Language" tab of the in-game settings.
For the following examples, lets assume that we have 2 fully functional language files, one named
xx_XX.lang, and another named
[ "xx_XX", "yy_YY" ]
language_names.json is an array as well, but this time to define the names to display for the languages.
[ [ "xx_XX", "New Language (Custom Language #1)" ], [ "yy_YY", "Wiki-Speak (Custom Language #2)" ] ]
Whenever using a custom language, make sure to unequip the language before you disable the Resource Pack which it is stored in, or else Minecraft will crash.
The following is a table of the 29 languages Minecraft supports by default.