翻訳のスキップ
問題
デフォルトでは、Lingo.dev CompilerはReact要素内のすべてのテキストを翻訳します。しかし、場合によっては特定のテキストを翻訳したくないことがあります。
解決策
いくつかの選択肢があります:
- テキストを含む要素に
data-lingo-skip
属性を使用する。 - テキストを文字列リテラルに入れる。(コンパイラはこれらを設計上スキップします。)
例:属性によるスキップ
export function App() {
return <div data-lingo-skip>This content will not be translated.</div>;
}
例:文字列リテラルのスキップ
export function App() {
const text = "This content is a string literal and will not be translated.";
return <div>{text}</div>;
}