Development

String Extraction

The process of identifying and moving hardcoded text to external translation files.

Definition

String extraction is the process of scanning source code to find hardcoded user-facing text and extracting it to external translation files. This can be done manually or with automated tools. Modern extraction tools can scan JSX, templates, and code to find strings, generate keys, and create translation files. This is often the first step in internationalizing an existing application.

Examples

  • react-i18next's i18next-scanner extracts t() calls
  • FormatJS CLI extracts FormattedMessage components
  • Angular's ng extract-i18n generates XLIFF
  • IntlPull CLI scans code and extracts strings

Frequently Asked Questions

Should I extract strings manually or automatically?

Start automatic, refine manually. Automatic extraction catches most strings quickly. Then manually review for: context (same English, different meaning), key naming conventions, strings that shouldn't be translated (brand names). Hybrid approach works best.

What about strings in variables or computed?

Automatic extraction has limits. Dynamic strings like `t(key)` where key is a variable may not be detected. Computed strings need manual handling. Best practice: keep translatable strings as literal arguments to translation functions.

Related Terms

Ready to simplify your i18n workflow?

Start managing translations with IntlPull.

    String Extraction - Definition & Examples | IntlPull Glossary | IntlPull