Words and their translations
Every word a tilolang package shows a person is a message: the text in its views, what the app is called, its actions' labels, what its types and fields are called, its enum cases, its filters' labels and the first sentence of each doc comment. The package writes them once, in its source language, where they belong. Tilo shows them in each reader's language, and a translation never asks for a change to the package's code. There is no new syntax and no key written by hand.
1. One mechanism
Native apps already keep their words in Fluent catalogues (locales/<lang>.ftl, resolved by
ui-core's i18n at draw time). A tilolang package uses the same catalogues and the same
resolver. The only difference is where the source catalogue comes from: the compiler writes it
from the source, so nobody keeps it by hand.
2. What a message is, and its key
| What | Source text | Key |
|---|---|---|
| A declaration's name as people read it (type, field, enum case, action, view) | its label:, else its name in words |
<id> from app.ids (mavvhka7) |
| Its description | the doc comment's first sentence | <id>.doc |
| A type's noun | its name in words, one of it and several | <id>.noun, one Fluent message with $count |
| What the app is called | the title its app declaration gives |
<id of the app> from its app id |
| A filter's label | its label, or its field's name in words | <id of the type>-filter-<snake key> |
| What an action's parameter is called where a person gives it | its label:, else its name in words |
<id of the action>-<name> |
| Text in a view | the string literal | <id of the view>.<slug of the literal> |
| An action's label that follows its target, why it cannot run | the string literal | <id of the action>.<slug of the literal> |
Words code writes into a resource (std.say("Morning: {n} done")) |
the string literal | <id of the action, view or fn>.<slug> |
- Declarations are keyed by their stable id, so renaming a field in code keeps its translation, the way it keeps its data.
- A parameter is named where a person gives it. Its name in words is what a form or a
consent sheet shows beside the value ("At: 2:30"), and a name that reads as something else
when its value stands beside it says what it holds instead:
saved: Bool (label: "On the watch queue") = not queued(yt, v.key)reads as "On the watch queue: yes". The parameter's name is still the name its argument is recorded by, so the label changes the words and never the format of an invocation. - A part a view composes is not a declaration. The row view a loop body becomes stands in its view: it takes that view's name, shows its item's fields' own messages, and has no message of its own. So no name in a catalogue is built from a binding: a screen reader says words, never one letter of one.
- A view's literals are keyed by the view and the text itself, so moving a line inside a view keeps its translation. Changing the English text makes a new message; the old translation is reported as stale, never shown for the new text.
- Only words a component shows are messages. A literal is a message where a component's
text prop shows it: the value given, or what that value takes from an
iformatchbranch,.some(...), a list or aletthat keeps it. An author never has to know where the words were written: a literal aletholds, one a branch chose, and one handed to another view'sTextparameter are the same message, keyed under the declaration that writes them. A prop the toolkit declares as data (#[component(data)]: a key, an address, an emoji) takes its literal as text, and so does a literal a view compares or passes to a function. Astdview that takes aTextand shows it (std.composer(state, "Say something", send)) shows the words given to it, so that literal is the calling view's message too: a sentence is translated where it is written, not by the view that lays it out. An action'slabel: if pinned { "Pin" } else { "Unpin" }and the reasons of itsrequireandapplieslines are words too, attributes of the action's own message wherever a view applies it. - Words code writes into a resource are
std.say("..."). A title an action gives a resource it makes ("Morning: 3 done"), a status afnanswers: a literal that reaches no prop of words may be data (a tag, a query, a key), so the author says which are words.std.saymakes its literal a message of the declaration it is written in, its interpolation an argument, read in the language of whoever runs the code: the person who pressed the button reads the note in their language. A view needs it only where its words take a path no prop shows them — through afnthat hands them back, say; what a prop of words, aletor a parameter shows it is a message without it. It is the library's word (stdlib::NS), never a bare one:sayis a verb an app takes for an action of its own, as a chat app's is ("Say something"), and no built-in name may take it. A view's message key is an attribute of the view's own message,d-<view id>.w-<slug>, since a Fluent name has no dots; two texts of one view with the same slug are numbered. - Interpolation becomes Fluent variables named after what is interpolated:
"{t.count} new"is{ $count } new. Plurals, grammatical gender and word order are the translation's business (Fluent selectors), and the source language's own catalogue may refine its message too:{ $count -> [one] 1 message *[other] { $count } messages }. A type's noun is one of it and several as English writes them, and the derivation knows a name that already names several (Tasksis ataskandtasks) and English's irregular plurals (Personis apersonandpeople), so only a noun the app words its own way (aNoteit calls anotebook) is a line inen-US.ftl.
3. Build and check
tilolang build and check write locales/<source>.ftl from the source, the way they keep
app.ids: generated, committed, and checked so the two can't drift. Translations are
locales/<lang>.ftl beside it, and a translation has every word of its source and no more, so
writing the source catalogue takes out of each translation the words its source stopped saying:
the message, its comment and its attributes go together, and a word the source still says is
never touched, its translation nor its place. What a translation says of a message the source
never had is its translator's own error. check reports a translation key no message has, a
translation older than its source text, and a view whose name reads as code rather than as
words (note_editor_for_t is "Note editor for t", the last word a binding a screen reader
reads out on its own). A package ships its catalogues with its module, and the source one the
module carries is always the one its sources write at that build.
4. Who resolves, and in which language
Words are resolved by whoever shows them, in that reader's language, at the moment they show them:
- The published tree carries keys and source text: a resource's and action's labels, nouns
and descriptions. It never carries one reader's translation. A resource shared between
people reads in each person's own language, as history's sentences already do
(resources.md §5.2). A tree is published and read in one
process, so the resource layer names a resource through that process's catalogue while it
publishes it (
tilo_resource::label): the declaration's text is the key's source, and a catalogue without the key names the resource by that text. - Views resolve at draw time through the package's catalogues in the person's locale, falling back to the source text.
- A window speaks one language. Its language is chosen once, when the package loads, from
the person's preference against the languages the package ships: the person's when it ships
it, the package's source language otherwise. The toolkit's own words and the platform's date
and number formats follow that same language
(
ui::i18n::speak_window_language), so a package written in one language reads in that language throughout, its frames and dates included, rather than mixing its own copy with the desktop's. Only the window's own catalogues say which languages it ships: the toolkit's labels and the Settings index are in every window and ride along in its language, so a word only they carry in the person's language reads in the source language inside a window that does not ship it. A process presents one window, so the language is the window's. A host that draws several windows in one process (the tilolang process of a workspace and author, the shell with its slot views) picks each window's words and each window's language: the session names the person's language with every instance it hands over (InstanceRequest::language), so a host whose own process runs in another locale — a sandbox carrying only the variables its launcher had — still reads every word of a window from the catalogue in the window's language. A language the person chooses in Settings later is said on the host's action API with their formats (Locale), and every window it draws relabels where it stands. The launcher names the same language as the messages' locale of every app it starts, so a window's own chrome speaks it from its first frame. Words a process reads for another window — a development session seeding the demo apps, a host reading a package it does not present — are shared ones too: they read in the person's language where the catalogue carries it, and the language they are written in never becomes the process's. A window with nothing of its own to say — a system menu, a sheet of frames — reads the toolkit's labels in the language selected for the process, which is the person's. - Search matches every language the person reads. A type's noun, its plural and its app's name match in the person's locales and in the source language, so "meine Mails" and "my mails" both find Mail.
- Agents get the source language, plus the person's locale to answer in.
Numbers, dates, durations, money and lists are never words in a message: they go through
ui::format with the reader's locale, as they already do. A day or a moment interpolated into
text ("{t.title} due {t.due}") reads as the person's own dates do (Jun 29, Jun 29, 2025,
Jun 29, 6:00 PM), and d.iso() / t.iso() is its stored text for a machine.
5. What this replaces
noun "…" "…"(removed): a type's noun and plural are the<id>.nounmessage.- English-only
meta(r).nounand.plural: they resolve in the reader's locale. - Labels published as finished English strings in
ActionSpecandResourceType: they carry their key beside the source text.