Strings & i18n
Drawn text on the rendered frame (text/strings) and per-string
locale coverage from values*/strings.xml (i18n/translations).
At a glance
| Kinds | text/strings, i18n/translations |
| Schema versions | text/strings: 3 · i18n/translations: 2 |
| Modules | :data-strings-core (published) · :data-strings-connector |
| Render mode | default |
| Cost | low |
| Token usage | ~135 tok inline (text/strings ~470 chars); +~1.5 k per rendered PNG read. See token usage. |
| Transport | inline |
| Platforms | Android (i18n is Android-only) · Desktop · shared (text/strings) |
What it answers
text/strings— every text run that ended up on screen, with locale, fontScale, fontSize, color, bounds, and per-entrytruncated/overflow/lineCount/maxLines/didOverflowWidth/didOverflowHeighttaken straight from Compose’sTextLayoutResult.i18n/translations— for each visible string id, which locales have a translation and which fall through to the default. Highlights missing translations that actually matter on this screen — not the entirestrings.xml.
What it does NOT answer
- It does not score copy quality (clarity, brand voice, jargon) — that is a manual review.
- It does not measure RTL correctness — pair with a render at
locale=arand compare bounds, or use the pseudolocalear-XBruntime override to surface RTL bugs without translating to a real RTL language. i18n/translationsdoes not include Compose Multiplatform string resources (different resolution path, Android-specific for now).
Use cases
- Catch text overflow before it ships: filter
text/stringsfordidOverflowWidth=trueacross every preview. - Audit a feature’s locale coverage by listing visible strings whose missing-locale set is non-empty.
- Verify a
fontScale=2.0accessibility test does not push critical CTAs off-screen. - Drive jump-to-source on a drawn label in the VS Code extension.
Payload shape
TextStringsPayload, TextStringEntry, I18nTranslationsPayload,
I18nVisibleString in
:data-strings-core.
// text/strings
{
"texts": [
{ "text": "Submit", "nodeId": "2", "localeTag": "en-US", "fontScale": 1.0,
"fontSize": "14sp", "foregroundColor": "#FFFFFFFF",
"boundsInRoot": "48,200,144,232",
"boundsInScreen": "48,200,144,232",
"truncated": false, "didOverflowWidth": false, "didOverflowHeight": false,
"lineCount": 1, "maxLines": 1 }
]
}
// i18n/translations
{
"supportedLocales": ["en-US", "fr", "de", "es"],
"renderedLocale": "en-US",
"defaultLocale": "en-US",
"strings": [
{ "nodeId": "2", "boundsInRoot": "48,200,144,232",
"boundsInScreen": "48,200,144,232", "rendered": "Submit",
"resourceName": "R.string.submit",
"translations": { "en-US": "Submit", "fr": "Envoyer" },
"untranslatedLocales": ["de", "es"] }
]
}
Both products retain boundsInScreen as a deprecated compatibility alias; those values were
always root-relative. New consumers should read boundsInRoot.
Enabling
Producer runs once the Strings extension is publicly enabled. CLI /
Gradle output: build/compose-previews/data/<id>/text-strings.json
and i18n-translations.json.
Companion products
- Fonts —
fonts/usedfor the typeface side of the same drawn text. - Resources —
resources/usedfor whichR.string.*references resolved here. - Accessibility —
a11y/hierarchyfor assistive-technology labels alongside drawn copy.