Theme strings are seeded into the phrase table on install and read with
useT; the tag dictionary and its checks are in the contract, and the client fills merge tags at render time.
A theme ships strings that operators translate like any other phrase. Editable text may contain merge tags; the contract defines their grammar and dictionary, the validator checks them, and the client fills them in when it renders.
Theme strings
- Files:
strings/<lang>.jsonin the archive, one per code listed in the manifest’sstrings(["en"]). Each is a flat object of key to text (strings.invalidotherwise). - Namespace:
theme.<slug>.*, for exampletheme.sample-parts.nav.home. Keys outside the theme’s namespace are not seeded. - On upload the strings are seeded into the product’s phrase table for languages that exist, skipping keys that already exist, so a theme file never overwrites an operator’s edit. They appear in Site & Content › Languages, where operators edit and translate them.
- On theme deletion its strings are removed.
- Theme code reads strings through the SDK’s
useT, never by importing the translation library. Always pass the English text as the fallback, so the part renders before the phrases load:
const t = useT();
t('theme.sample-parts.nav.lobby', 'Lobby');
Every string must have an English source value.
Merge tags
Merge tags use the interpolation grammar the client already runs for translations:
| Form | Example |
|---|---|
| Plain path | {{viewer.firstName}} |
| Named format | {{viewer.balance, money}} |
| Format with an option | {{viewer.firstName, fallback(there)}} |
Formats: money, number, percent, date(short|long), upper, truncate(n), fallback(text). There are no conditionals and no loops; sections and fields use visibleIf instead.
Namespaces
| Namespace | Tags | Resolved where |
|---|---|---|
site.* | name, tagline, url, logoUrl, supportEmail, year | client, SEO head, email |
viewer.* | username, firstName, lastName, displayName, avatarUrl, country, language, memberSince, balance, virtualBalance, currency, isLoggedIn, role | client only, the viewer’s own data |
viewer.stats.*, viewer.stats.<variant>.* | handsPlayed, handsWon, winRate, vpip, pfr, totalWinnings, leaderboardRank, tournamentsPlayed | client only |
lobby.* | playersOnline, tablesRunning, tournamentsUpcoming, nextTournamentName, nextTournamentStart | client |
page.*, post.*, category.* | title, excerpt, author, publishedAt, readingTime, category | client, SEO head |
table.* | name, blinds, variant, seatsTaken, seatCount, pot | client, from TableView |
theme.settings.* | The active theme’s settings | client |
The dictionary is TAG_DICTIONARY in src/themes/tags.ts, exported as tags.json with the contract.
Rules
- The tag dictionary is host-owned and versioned with the contract.
- Unknown tags, unknown formats and missing options are warnings in the validator (
strings.merge-tag). - Plain placeholders such as
{{count}}are not merge tags and pass untouched. - Unknown tags (an unknown path, or a known one with no value) render empty, never as the raw tag. Values put into markup are escaped. Viewer tags resolve in the browser only, so they never reach cached public HTML. Plugins registering tags is follow-on work; themes expose only their settings.
Where tags are filled
The resolver is i18next’s interpolator, the one the client already runs for translations, over the dictionary’s data for the current viewer. It fills:
- Theme strings:
useT()and<Text value="…" />. A string goes through the translator first (yourvaluesfill plain placeholders as before), then its merge tags are filled. An operator who editstheme.sample-parts.footer.notein Site & Content › Languages toHosted by {{site.name}}sees the site title in the footer. - Rich text:
<RichText html="…" />fills tags, escaping the values, before it sanitises the markup. - Section settings: the section renderer fills every text or textarea setting whose field has
mergeTags: truebefore the component reads it. All host section text fields accept tags except thehtmlsection’s markup, links and alternative text; a theme’s section type opts in per field in its manifest schema ("mergeTags": true). The theme configuration carries the map (mergeTagFields).
What each namespace holds today:
| Namespace | Filled from |
|---|---|
site.* | The SEO site title, description and canonical URL; logoUrl from Site & Content › Branding; year; supportEmail is empty |
viewer.* | The signed-in player (empty for a guest; isLoggedIn is false) |
viewer.stats.* | Empty until the profile view model lands (useViewerStats() is null) |
lobby.* | The lobby’s tables and tournaments as the client knows them |
page.* | title inside a page’s sections and sidebars; the other page tags are empty |
post.*, category.*, table.* | Empty: the blog and the table surface do not provide them yet |
theme.settings.* | The active theme’s settings, with the operator’s overrides |
Text without a merge tag is returned exactly as it was, so default‘s own phrases (which hold none) render unchanged, and a placeholder outside the namespaces, such as {{count}}, is left for the translator. Email keeps its existing {{word}} renderer; server-side resolution for SEO heads arrives with the SEO phase.
The tag picker
The tag picker with a live preview in the admin editors is not yet supported.