HTML

Languine supports HTML file localization, handling both text content and attributes. This format is ideal for static websites and HTML templates, with support for preserving HTML structure and formatting.


Setting Up

First, make sure you've got a languine.json config file in your project root. Here's an example:

typescript
{
  "locale": {
    "source": "en",
    "targets": ["sv", "de", "fr"]
  },
  "files": {
    "html": {
      "include": ["pages/[locale]/*.html"]
    }
  }
}

Translating

With your config set, run:

typescript
npx languine@latest translate

When you run this command, Languine will:

  • Load your source HTML files (e.g., pages/en/*.html)
  • Detect any new or modified translation strings
  • Generate translations for your target languages
  • Create or update the target language HTML files (e.g., pages/sv/*.html)
  • Preserve HTML structure and formatting
  • Handle specified attribute translations
  • Maintain comments and special tags