Tea ships with a built-in English UI — dialog titles, button labels, error messages, and warning copy — all of which can be replaced through a single JavaScript object calledDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/pompom454/tea/llms.txt
Use this file to discover all available pages before exploring further.
l10nStrings. This is Tea’s localization system: rather than hunting through source files to change the word “game” to “story” or translating a Restart dialog to German, you set properties on l10nStrings in your Story JavaScript (Twine 2) or a script-tagged passage (Twee), and Tea uses your values everywhere.
The l10nStrings Object
l10nStrings is a flat object with string properties. Some examples from the defaults:
Replacement Patterns
Replacement patterns use the format{NAME} where NAME is either a property of l10nStrings or, in a few cases, a locally supplied object (noted in comments in the source). Replacements are processed recursively: a replacement string can itself contain {…} patterns whose values contain further patterns. Take care not to create circular references — Tea detects infinite loops and throws an error.
Template properties
By convention, properties starting with an underscore (e.g.,_warningOutroDegraded) are templates — they are only referenced inside other strings and are never displayed directly. You can add your own template properties to handle gender, plurals, or any other complex substitution pattern.
How to Override Strings
Set your overrides in the Story JavaScript section (Twine 2) or ascript-tagged passage (Twee). Only the properties you set are changed; everything else keeps its default.
Tea uses
l10nStrings internally at the point each UI string is rendered, not at startup. Overrides set before the story starts take effect for all UI text throughout the session.Creating a Full Locale
For a complete translation, use the official locale template as your starting point. The template file (formatxx-YY.js, e.g., en-US.js) contains every overridable property with comments, and ready-made locale files for many languages are available in the same directory.
Download the template
Grab
locale/TEMPLATE.js from the SugarCube 2 repository and rename it to your locale code (e.g., de-DE.js).Translate each property
Work through the template top-to-bottom, replacing the English default values. Preserve capitalization and punctuation conventions — error and warning strings are deliberately styled.
Translation Notes
Keep these conventions in mind when writing a locale:- Capitalization and punctuation in error/warning strings is deliberate. Try to preserve the same style in your translations.
- Replacement patterns (
{NAME}) must be preserved exactly — if the original string has{textIdentity}, your translation must too (or the substitution will silently fail to render). - Recursive replacements can loop. If property A’s value references
{B}and B’s value references{A}, Tea will detect the loop and throw an error. Keep your template chains strictly one-directional. - The
stringslegacy object — prior to v2.10.0 the object was namedstrings. If an old project’s scripts define astringsobject, Tea maps it tol10nStringsfor backwards compatibility. The two object formats are incompatible; switching tol10nStringsdirectly is recommended.