# gt-next: General Translation Next.js SDK: Compiler URL: https://generaltranslation.com/en-US/docs/next/concepts/compiler.mdx --- title: Compiler description: gt-next's Rust-based SWC plugin --- # Compiler gt-next includes a Rust-based SWC plugin that performs build-time analysis to catch common translation errors and optimize performance. ## Features ### Dynamic content detection Detects unwrapped dynamic content in translation components: ```jsx // ❌ Invalid - dynamic content not wrapped Hello {userName} // ✅ Valid - dynamic content wrapped in variable component Hello {userName} ``` ### Function call validation Detects non-literal arguments passed to translation functions: ```jsx const gt = useGT(); // ❌ Invalid - template literals and concatenation gt(`Hello ${name}`) gt("Hello " + name) // ✅ Valid - string literals with variable substitution gt("Hello, {name}!", { name }) ``` ### Compile-time hash generation Pre-computes translation hashes for better runtime performance: ```jsx // Input Hello world // Output (when enabled) Hello world ``` ## Configuration Configure the SWC plugin in your `next.config.js`: ```javascript import { withGTConfig } from 'gt-next/config'; export default withGTConfig(nextConfig, { locales: ['en', 'es'], swcPluginOptions: { logLevel: 'silent', // Control warning output compileTimeHash: false, // Enable hash generation }, }); ``` ### Options - **`logLevel`**: Controls warning output level - `'silent'` - No warnings (default for production) - `'error'` - Show as build errors - `'warn'` - Show as warnings (default for development) - `'info'` - Show info-level messages - `'debug'` - Show all debug information - **`compileTimeHash`**: Enables compile-time hash generation - `false` - Disabled (default) - `true` - Generate hashes at build time for better performance ## Limitations The SWC plugin processes files individually and cannot detect violations in re-exported components: ```jsx // File A: export { T as Translate } from 'gt-next' // File B: import { Translate } from './A' Hello {name} // Won't be detected ```