Expand description
Languages: the source language’s screen text by key (en/ui.ron), and
the packs that overlay it (<tag>/): their screen text (ui.ron), the
game’s data text (data.ron: names, and whatever else the game hands
over by key) and the dialogue’s lines and captions (dialogue/*.ron).
The source is the language the game is written in (SourceLang):
English unless the game declares another
(Lang::with_source_lang), its folder holding its screen text only. A
pack entry carries the source text it was made from; when that is no
longer today’s the entry is stale, and a key with no entry is
missing. Neither fails anything.
Tags. A language is named by its BCP 47 tag (LangCode: ja,
pt-BR, zh-Hans), and its folder by that tag as BCP 47 writes it, so
pt-br never quietly becomes a second language on a file system that
ignores case. The engine reads the subset of tags it takes itself rather
than with icu_locale_core: checking a tag is a short function, and the
engine wants none of CLDR’s data.
The fallback chain. A key a pack lacks, or has stale, falls back
along Lang::chain: the pack of each shorter tag the game has
(pt-BR, then pt), then the source. So a small pt-BR pack can sit
over a full pt one. Which language a game starts in is
best_match of the system’s languages among the source and the
packs: a tag, its shorter tags, Chinese’s script from its region, then
the one pack of the same language.
The game names its folder and says what else its text must keep to
(PackRules); the source text of its data is the SourceText it
builds. As a format (ADR-0007), one pack is read from its lang.ron
(LangPackRon). Lang::texts lists every text of every language,
each with its part, key and file (TextAt). The source’s screen text
can say where each key’s text is drawn (Place: its width in cells
and a note for translators), and Lang::overflow lists a pack’s
entries too wide for it.
Structs§
- English
- A game’s English screen text by key, as one file (
en.ron) holds it: a kind (AssetKind) read withRon::<English>::new()(Ron).Lang::newtakes its map. - Entry
- One piece of a pack’s text.
- Lang
- The source language’s text and every pack.
- Lang
Code - A language’s tag, the name of its folder among the languages: BCP 47
(RFC 5646) in this subset, its subtags joined by
-: - Lang
File - One file of the languages’ directory.
- Lang
Info - A pack’s
lang.ron. - Lang
Pack - One language other than the source.
- Lang
Pack Ron - A language pack (
lang-pack,.ron), read from itslang.ronin its folder (lang/pt-BR/lang.ron), which is named by its tag as BCP 47 writes it: itsui.ronbeside it, checked against the source’s (lang/en/ui.ron, or the folder of the source the game declares,LangPackRon::source_lang), and itsdata.ronanddialogue/*.ron, checked against the game’s data text when it gives it (LangPackRon::with_data; left out otherwise). Any other file in the folder is an error, and the source’s folder is no pack. Checked aspack_from_filessays, with the game’s rules, its limits counting a character of the font atlas’s wide glyphs as two cells when the game gives the atlas (LangPackRon::widths_of), as the pack has them (LangInfo::widths); with the atlas, the wide set itswide_fontnames must be one the atlas has. - Lang
Status - What a pack lacks (
Lang::status): each list has the screen text’s keys, then the data’s, then the dialogue’s, each in key order. - Line
Entry - One dialogue line or caption of a pack.
- Orphan
- A pack entry for a dialogue line that English no longer has.
- Overflow
- A pack’s entry wider than its key’s place (
Lang::overflow). - Pack
Rules - What a game’s packs keep to besides matching English: the rules of its data text, its tokens, its dialogue’s limits and the variants a line may have.
- Pack
Sources - The files of one pack.
- Place
- What English’s screen text says about where a key’s text is drawn.
- Source
Lang - The language the game is written in: its screen text is in its folder
(
<code>/ui.ron), and its data and dialogue in the game’s own files. Every pack is checked against it, and every lookup ends with it. - Source
Line - One dialogue line or caption in English.
- Source
Text - Today’s English for everything
data.ronanddialogue/*.roncan translate, by key. - TextAt
- Where a text of
Lang::textsis from.
Enums§
- Line
Kind - What kind of dialogue text a key is for: its length limit depends on it.
- Line
Text - A line in a pack’s language.
- MadeBy
- Who made a pack’s text.
- TagError
- Why a text isn’t a language tag (
LangCode::parse). - Text
Part - Which part of a language a text is from.
Constants§
- ENGLISH
Deprecated - English’s tag, the source language when a game declares none.
Functions§
- best_
match - The offered language that fits the system’s:
preferredis the system’s languages, most preferred first, andofferedthe source’s tag and the packs’. For each preferred tag in order: - english_
and_ places_ from_ source - The source’s screen text and where it is drawn, by key: what
english_from_sourcereads, with each key’sPlacewhere its value is written as(text: …, max_cells: …, note: …)rather than as text (both optional). Amax_cellsis at least 1, and a note isn’t empty. - english_
from_ source - Parses and validates the source language’s screen text
source(a map of key to text), whatever the language, attributing errors tofile. Reports every problem found. A key’s places (english_and_places_from_source) are read and left out. - from_
files from_files_infor a game written in English.- from_
files_ in - Validates the languages made of
files, for a game written insource: the source’s screen text,<code>/ui.ron(with its keys’ places,english_and_places_from_source), and a pack for every other folder, named by its tag, which needs itslang.ronandui.ronand may have adata.ronanddialogue/<file>.ronfiles (checked againstdata; left out without it). Import settings files are skipped (ADR-0057); any other file is an error, alang.ronin the source’s folder too.displaygives the name a path is reported under. Reports every problem found; with the source’s screen text broken the packs are not checked (each entry would be an unknown key). - names_
key - The key of the name
idof the names table:names.<id>. - pack_
from_ files - Parses and validates the pack made of
sources, its screen text checked againstenglish(the source’s screen text, whatever the language) and its data and dialogue text againstdata(left out without it: the data files failed to load). Reports every problem found; the messages call the sourceen. - pack_
from_ sources - Parses and validates a pack with screen text only: its
lang.ron(info) and itsui.ron(ui), checked againstenglish. Seepack_from_files. - text_
width - How many cells of the screen
texttakes: one per character, two for a characterwidthshas wide (a Japanese or Chinese one, from the font atlas’s wide glyphs). Every length limit on text and every layout that measures it counts with this.