Check families

Hardcoded strings: what the check looks for and how to fix it

How threefold finds user-facing text that never reaches translation, in JSX, Flutter, SwiftUI and Compose, the beta label on the check, and the fix.

Check families · 1 min readMarkdown
On this page

A hardcoded string is text in a screen that was never put in a translation file, so every market sees it in the source language. It is the commonest reason a translated app still has English in it.

The checks

CheckWhat it looks forMeasured status
CHK-CORE-001Raw literal text in UI components instead of a lookupbeta
CHK-WEB-002Untranslated literal text in React JSX and TSXbeta
CHK-CORE-010Text that is untranslated or in the wrong language in a locale filesee the report

Beta means the check is below the 90% precision bar on threefold's benchmark: it finds every planted string but also flags text that is not user-facing (precision 71 to 83% for the beta checks). Read each finding before you act on it.

Run it

npx threefold check . --markets es-MX,de-DE

If npx reports that the package does not exist, it has not been published yet: the i18n check page and the guides say what works meanwhile.

How to fix a finding

  1. Move the text into the source-language resource file under a key.
  2. Replace the literal with the lookup: t("key") in web code, AppLocalizations.of(context) in Flutter, String(localized:) or a String Catalog in SwiftUI, stringResource(R.string.key) in Compose.
  3. Run the check again, then translate the new keys.

What it cannot tell

It reads source files. It cannot see text that arrives from a server or a CMS, or text drawn into an image.

Guides by stack

Hardcoded strings in JSX, in Flutter, in SwiftUI, in Jetpack Compose.

Questions

Why are these checks beta?

They are measured, and they flag some text that does not need translating. The report labels them so you read each finding.

Does it translate the strings?

No. It finds them. Your agent can translate with the market resources threefold serves.

All check familiesGuides