Pages
Strings
Every word on this site is marked in the code with fbtee, and each language has a catalog file with its translations. Here is what that takes, with the lines that do it.
One sentence, every count
The same sentence for six counts, in this page's language. The second column is the plural form the language puts each count in, as Intl.PluralRules names it.
| 0 | other | You booked 0 nights |
| 1 | one | You booked 1 night |
| 2 | other | You booked 2 nights |
| 3 | other | You booked 3 nights |
| 11 | other | You booked 11 nights |
| 100 | other | You booked 100 nights |
Every piece of fbtee
Each of fbtee's ways of writing a sentence, in this page's language, with the line that does it. Arabic changes its words by who is meant; Thai and English mostly don't.
A list in a sentence
The menu has Home, Events and Docs.
<fbt:list conjunction="or" items={items} name="pages" />A choice from a set
Laila takes part in person.
<fbt:enum enum-range={{ there: "in person", online: "online" }} value={way} />A name and its gender
Laila booked a seat.
<fbt:name name="name" gender={gender}>{name}</fbt:name>A count
Laila booked 3 seats.
<fbt:plural count={count} many="seats" showCount="ifMany">a seat</fbt:plural>A pronoun
Laila checked her ticket.
<fbt:pronoun type="possessive" gender={gender} human={true} />The same value twice
Laila booked, and Laila got the ticket by email.
<fbt:same-param name="name" />For the reader, by their gender
You're booked.
<fbt desc="…" subject={gender}>You're booked.</fbt>Part of the page in another language
أنتِ مسجَّلة.
คุณจองแล้ว
<InLanguage locale={other.locale} gender={gender}>…</InLanguage>Used here, and explained on the Components page: InLanguage and Formatted.
What it takes
Marked in the code
Text in a component is written inside an fbt element, with a description that tells the translator what's happening, what each placeholder holds and where the text shows: all the context a translator gets. vp dev collects every one, as you save, into each language's catalog, i18n/translations, a file in the app's repository.
<fbt desc="Home feature title: translated strings">Strings, by fbtee</fbt>Plain strings
Where a plain string is needed, in an attribute, a page title or an email, fbs gives it, translated the same way.
aria-label={fbs("Where you are", "Label of the row showing where you are on the site")}Plurals, each language's own
A sentence with a count gets one translation for each plural form the language has: one in Thai, two in English, six in Arabic. vp dev adds the lines each language needs, and the reader's count picks the right one, as in the table above.
<fbt:plural count={count} many="nights" showCount="yes">Common words, once
A word used on many pages, as the menu's, is given once to voidFbtee in vite.config.ts, with its description, and is translated once.
common,return <fbt common>Events</fbt>;Nothing missed
vp build fails on any string still untranslated in any language, and fbtee's lint rules (vp check) report text written in a component without fbt.
- run: vp run -r buildThe full reference is in void-fbtee's skill.