Skip to content

Files

Latest commit

 

History

History
27 lines (16 loc) · 736 Bytes

File metadata and controls

27 lines (16 loc) · 736 Bytes

Pattern: Use of English text in string literal

Issue: -

Description

Reports English text in string literals.

Embedding messages in JavaScript files prevents them from being translated into other languages. An alternative is to embed the translated text in the markup and find it with JavaScript.

This pattern allows the web framework that's generating the markup to use its translation library to insert the appropriate translated text.

Example of incorrect code:

el.textContent = "Some message text"

Example of correct code:

console.log("Informational message")

Further Reading