Skip to main content

Rules: Text and localization

scripts/gen-rules.mjs builds this page from rules/*.json. Do not edit it by hand; edit the JSON and run npm run gen-rules. The rule bullets on topic pages (- **[ID]**) are filled from the same source.

Explanations and examples are on the topic page Text and localization.

IDRuleLevelEvidence environmentSource
TXT-01A label is localized by default. It looks up the text as a translation key first and prints it as is if there is none. For text that must be printed as a literal (user input, chat, titles, etc.), give "localize": false. When vanilla uses localize it almost always uses false (31 to 1).measured, vanillaunknownBC-facts, VN, BW-doc
TXT-02Main label properties: text (literal, #binding, $variable), color, font_type, font_size, font_scale_factor, text_alignment (left, center, right), shadow, enable_profanity_filter, localize.vanilla-VN hud_screen.json:2287-2310, Appendix B
TXT-03The font_type values are default, smooth, rune, unicode and MinecraftTen. Vanilla mainly uses smooth (193) and MinecraftTen (21). Using an internal font name such as MinecraftSeven draws nothing with no error.measured, vanillaunknownBC 6.6-6, BC-S7, VN
TXT-04#font_type is an engine-reserved property, so it is validated the moment it is used. A wrong alias is logged line by line in NonAssertErrorLog and blocks marketplace submission.code (source)-BC 6.6-7
TXT-05font_size has four values, small, normal, large and extra_large, with scales 0.5, 1, 2 and 4 in that order. On Windows 1.26.65.1 "Ab" drew as small 6x5, normal 12x10, large 24x20 and extra_large 48x40, and on 2026-11-24 a "Hg" label gave the same label boxes with glyphs growing in the same ratio. In the code the text size of a draw request is this table value x font_scale_factor, and drawing scales the transform matrix by this size x the font scale, so the table value multiplies the glyph size directly. medium is not a size value and draws as normal. The engine's font_size table has no medium and reads an unknown value as normal. So the medium that vanilla uses 4 times is the same as normal.measured, code (binary), vanillaWindows 1.26.65.1VN, Appendix B, 2026-11-20 Windows 1.26.65.1 measurement and decompilation, 2026-11-24 Windows 1.26.65.1 measurement and decompilation
TXT-06A label cannot draw a numeric binding as is. Join it to a string and bind it to text: ('n=' + #raw). Only integers join, and in string + float the float part is empty and only the string is left (('D ' + float) gives 'D ', EXP-22). On Windows 1.26.65.1 too, a number or boolean alone in #text showed nothing, 'R' + an integer showed the digits, and 'R' + a float left only R (measurement record).measuredWindows 1.26.65.1BC-facts, BC 6.6-5, BW-type
TXT-07An empty label, or a default size label containing only §r, still has a height of one line. It does not collapse to 0, so to remove a row, hide it with #visible.measuredunknownBC-S10
TXT-08§ color codes are kept in bound text too. Vanilla _global_variables.json defines the 16 colors §0 to §f as $0_color_format … $f_color_format, so you can write "color": "$f_color_format". Counting the colors of §g to §w, there are 29 color code variables, and the color of §w is $party_blue_color (TXT-24).measured, vanilla, working packunknownBC-S7, VN _global_variables.json:247, AP 4.9
TXT-09Send only a number and let the RP do the translation. Attach a key prefix to a piece cut out of the data string and put it in a localize: true label: ('myui.toast.' + #category). The script sends only fixed-width numbers (padded with 0). AP, which supports 28 languages, works this way.working pack-AP 4.5, BA chapter 6
TXT-10lang value rules: if the value is empty (key=), the key itself is printed. If a language file lacks the key, the en_US value is printed. If the value is only §r, nothing is drawn and the width is also 0. Spaces around a value are kept. But if the whole value is a single space, the parser erases it and it becomes an undefined key. If you need a single space, wrap it as §r §r.measuredunknownBC-S10, BC-facts
TXT-11Properties of server form entry strings: the § color codes are kept, starting with a digit is no problem, even 200 characters work, a bare translation key string is not translated by the engine, and a RawMessage ({ rawtext: [...] }) is translated into the player's language by the client and put into the binding. So a sentence made of several translation keys can also be sent as one entry.measuredunknownBC-S7, BC 4.1-(4)
TXT-12To write text on a surface that cannot handle text directly (a chest slot), convert the number to a lang key and the lang key to a character. Make the slot stack count n into the key ('core.ui.c.' + #count) and put core.ui.c.<n>=<character> in .lang. A count of 1 leaves #inventory_stack_count empty, so set it to a space character.measured, code (source)unknownBC 4.3-(3), BC-facts
TXT-13'%.Ns' is in bytes, so cutting a Hangul field in the middle breaks the character (EXP-09). Fixed-width fields that contain Hangul are padded by the encoder with UTF-8 bytes. The color code § is 2 bytes and most emoji are 4 bytes (EXP-24). On Windows 1.26.65.1 § was cut as 2 bytes, Hangul as 3 and emoji as 4, and a cut in the middle of a character also dropped the character concatenated right after it (measurement record).measured, code (source)Windows 1.26.65.1BA 3.1, BW-intro
TXT-14When hardcoding a lang key, such as for an empty-screen message, a typo in the key name shows up only as the key itself printed on the screen (_r4ui:ancements.empty in AP v4.2). Compare the lang file and the key list mechanically.working pack, inferred-AP chapter 5
TXT-15A string put into vanilla common.hover_text through #hover_text of property_bag is not localized. If translation is needed, make the tooltip label yourself.unverified-BW-btn
TXT-16Label helper properties: line_padding (line spacing, vanilla 14), backup_font_type (4), hide_hyphen (3), locked_color and locked_alpha (when the parent is enabled: false, 4 and 17), notify_on_ellipses (when an ellipsis appears or disappears, #using_ellipses of the specified control changes, 4).vanilla-BW-doc Text table, VN
TXT-17If the text of a localized label has %, each %token (letters, digits, -, ., _) is translated separately, and a token that does not exist is left as literal text. So the % in text like "50%" disappears. To show %, use localize: false.code (source)-CN
TXT-22A hover box drawn directly next to a cell was clipped by the scroll window. If you put vanilla common.hover_text (hover_text_renderer) as a child of the button's hover state and put the button text in #hover_text, it appears next to the pointer without being clipped. With $hover_text_max_width at 0, lines break only at \n in the text, and at 150 Hangul broke at about five characters.measuredWindows 1.26.52DF
TXT-23When a scoreboard line label went through translation, % disappeared (TXT-17 confirmed in game). localize: false.measuredWindows 1.26.52DF
TXT-24The actual colors of § color codes are built from 29 variables in ui/_global_variables.json: $0_color_format to $f_color_format, $coin_color (§g), $material_quartz_color, iron, netherite, redstone, copper, gold, emerald, diamond, lapis, amethyst and resin (§h to §v), and $party_blue_color (§w). So to use the §w color in a label color, use $party_blue_color. If a pack changes these variables, the § colors appear to change too, but this was not checked in game. The mapping between variables and codes was judged from the order and vanilla comments.code (binary), inferredunknownNB-11, VN _global_variables.json:238-312
TXT-25The engine builds a slot's #inventory_stack_count as text in advance: count 0 (empty slot) and 1 are empty text, 2 to 99 are the number, and 100 or more is 99+. So this value cannot tell count 1 from an empty slot; check emptiness separately with another binding such as #item_id_aux (TXT-12, EXP-17). This was read from the Windows 1.26.63 client and not measured separately in game.code (binary)Windows 1.26.63, Android 1.26.52.3NB
TXT-26font_scale_factor multiplies the font_size scale. A label with font_scale_factor: 2 drew at twice the normal size.measured, code (binary)Windows 1.26.65.12026-11-20 Windows 1.26.65.1 measurement and decompilation
TXT-27line_padding is added to every line. A normal label holding "a\nb" was 20 high without line_padding and 28 high with line_padding: 4.measured, code (binary)Windows 1.26.65.12026-11-20 Windows 1.26.65.1 measurement and decompilation
TXT-28A label narrower than its text cuts the text and ends it with an ellipsis. A label 30 wide drew abcd....measuredWindows 1.26.65.12026-11-20 Windows 1.26.65.1
TXT-29A color code (§a) does not turn off bold (§l). Bold is reset only by §r. An uppercase code (§C) has no effect and disappears. The shadow was still drawn on text with format codes.measuredWindows 1.26.65.12026-11-20 Windows 1.26.65.1

Proposed rules​

These proposals are not merged into the adopted rules yet. Check the evidence before using them.

IDRuleLevelEvidence environmentSource
TXT-18The unknown format code §z is not shown on screen, so use it as an invisible prefix that keeps a result that would be read back as a number as a string. Chest-UI takes out the quantity with (('§z') + (('%.8s' * T) - ('%.6s' * T))). Not checked: whether §z stays invisible in every font.unverified-CU
TXT-191.26.30 added the new color code §w (party chat blue). There is no variable named $w_color_format, and the color of §w is $party_blue_color. So to use the color of §w in a label color, use $party_blue_color (TXT-24). Not checked: whether §w inside label text is colored in JSON UI.unverified, vanilla-ML Update1.26.30, VN _global_variables.json
TXT-21A pack removes a vanilla text ("achievements disabled" on the settings screen) by putting its key options.achievementsDisabled in 29 texts/*.lang files (one file per language is needed). In all 29 files the value is not empty but a single space (28 of them with a BOM). How a lang key whose value is a single space behaves disagrees with TXT-10 and was not checked (conflict C-63).conflict-SP
Sources
idSourceLicenseCommitAccessed
repo-guideJSON UI comprehensive guide (this repository) (guide/)This project's material2026-11-13
private-researchPrivate research (-)-2026-11-13