# react-core-linter: static-string URL: https://generaltranslation.com/en-US/docs/react-core-linter/rules/static-string.mdx --- title: static-string description: Enforce static string usage in translation functions --- ## Overview Ensures that translation functions like [`gt`](/docs/react/api/strings/use-gt) and [`msg`](/docs/react/api/strings/msg) only accept static strings. ## Reference ### Options | Option | Type | Default | Description | |--------|------|---------|-------------| | `libs` | `string[]` | `["gt-react", "gt-next", "gt-react-native", "gt-i18n", "@generaltranslation/react-core"]` | Array of library modules to check for translation functions | --- ## Examples ### staticStringRequired Registration functions can only accept static strings. #### ❌ Incorrect ```jsx const gt = useGT(); const dynamicKey = 'Hello'; gt(dynamicKey); ``` #### ✅ Correct ```jsx const gt = useGT(); gt('Hello'); ``` ### variableInterpolationRequired Dynamic string construction is not allowed. Use ICU-style variable interpolation instead. #### ❌ Incorrect ```jsx const gt = useGT(); gt(`Hello ${name}!`); gt('Hello ' + name); ``` #### ✅ Correct ```jsx const gt = useGT(); gt('Hello {name}!', { name }); ``` --- ## Configuration ```json { "@generaltranslation/react-core-linter/static-string": ["error", { "libs": ["gt-react", "gt-next", "gt-react-native"] }] } ```