--- slug: /api/misc/@docusaurus/eslint-plugin/string-literal-i18n-messages --- # string-literal-i18n-messages Enforce translate APIs to be called on plain text labels. Docusaurus offers the [`docusaurus write-translations`](../../../cli.mdx#docusaurus-write-translations-sitedir) API, which statically extracts the text labels marked as translatable. Dynamic values used in `` or `translate()` calls will fail to be extracted. This rule will ensure that all translate calls are statically extractable. ## Rule Details {#details} Examples of **incorrect** code for this rule: ```js const text = 'Some text to be translated' // Invalid child {text} // Invalid message attribute translate({message: text}) ``` Examples of **correct** code for this rule: ```js // Valid child Some text to be translated // Valid message attribute translate({message: 'Some text to be translated'}) // Valid child using values object as prop {'Welcome, {firstName}! How are you?'} // Valid message attribute using values object as second argument translate({message: 'The logo of site {siteName}'}, {siteName: 'Docusaurus'}) ``` ## When Not To Use It {#when-not-to-use} If you're not using the [i18n feature](../../../i18n/i18n-introduction.mdx), you can disable this rule. ## Further Reading {#further-reading} - https://docusaurus.io/docs/docusaurus-core#translate - https://docusaurus.io/docs/docusaurus-core#translate-imperative