Detection Rule
Text is flagged as hardcoded if it contains at least one Unicode alphabetic character (char::is_alphabetic()). This approach:
- Supports all languages (English, Chinese, Japanese, etc.)
- Ignores pure numbers like
123or456.78 - Ignores pure symbols like
---or*** - Catches mixed content like
Price: $99(contains letters)
What Gets Detected
JSX Text Content
Direct text inside JSX elements:String Expressions
String literals in JSX expressions:Ternary Operators
Text in conditional expressions:Logical Operators
Text in logical expressions:Template Literals
Template strings with text:Multiline JSX Text
Text spanning multiple lines:JSX Fragments
Text in fragments:Checked Attributes
By default, glot checks these JSX attributes for hardcoded text:| Attribute | Example |
|---|---|
placeholder | <input placeholder="Enter email" /> |
title | <button title="Submit form">...</button> |
alt | <img alt="Profile picture" /> |
aria-label | <button aria-label="Close">X</button> |
aria-description | <div aria-description="Help text">...</div> |
aria-placeholder | <input aria-placeholder="Search..." /> |
aria-roledescription | <div aria-roledescription="carousel">...</div> |
aria-valuetext | <input aria-valuetext="50 percent" /> |
Configuring Checked Attributes
You can customize which attributes are checked in.glotrc.json:
Setting
checkedAttributes overrides the defaults. Include all attributes you
want checked.What’s NOT Detected
Glot is smart about ignoring certain patterns:Translation Function Calls
Recognized translation patterns are ignored:Pure Numbers and Symbols
Code Examples
Code blocks typically aren’t in JSX context and aren’t checked.Suppressed Lines
Lines with suppression directives:Examples
Form Component
Form Component