Skip to content

no-unlocalized-toast

Require translation for literal toast messages in opted-in localized interfaces.

Why

User-facing notifications remain in a fixed language when their messages bypass translation.

Fix

Pass the user-facing message through the configured translation API, or explicitly exempt text that must remain literal.

Examples

Before — flagged Translate a user-facing message
src/message.tsx
import { toast } from "sonner";
toast.success("Saved");
After — preferred Resolve the message through translation
src/message.tsx
import { toast } from "sonner";
toast.success(t("saved"));

Options

{
"additionalProperties": false,
"properties": {
"allowText": {
"items": { "type": "string" },
"type": "array",
"uniqueItems": true
},
"enabled": { "type": "boolean" },
"functions": {
"items": {
"additionalProperties": false,
"properties": {
"export": { "minLength": 1, "type": "string" },
"module": { "minLength": 1, "type": "string" }
},
"required": ["module", "export"],
"type": "object"
},
"type": "array"
},
"methods": {
"items": { "minLength": 1, "type": "string" },
"type": "array",
"uniqueItems": true
},
"translationComponents": {
"items": {
"additionalProperties": false,
"properties": {
"export": { "minLength": 1, "type": "string" },
"module": { "minLength": 1, "type": "string" }
},
"required": ["module", "export"],
"type": "object"
},
"type": "array"
}
},
"type": "object"
}