Skip to main content
HTML combines visible page content with markup. Hyperlocalise translates text nodes and keeps tags as structure. Review the rendered page as well as the text diff. Supported extensions: .html, .htm.

Source file

Save this example as locales/en-US/messages.html.

Configure your files

Use this i18n.yml for the example, or add its file mapping to your existing bucket. See path templates for other layouts.

Translate

Install the CLI and set OPENAI_API_KEY in your project’s .env.local or shell. You can also configure another AI provider.
The dry run previews the work. The second command writes translations to the configured target path and updates the lockfile.

Behavior and limitations

  • Keys are dotted tag paths, like markdown slots: html.body.h1, html.p, html.p.strong, html.p.strong.2, html.body.img.alt. The first occurrence of a path has no suffix.
  • Inline tags start a new segment. For <p>Open <strong>your project</strong> to get started.</p> the keys are html.p (Open ), html.p.strong (your project), and html.p.2 ( to get started.). Punctuation-only text and entity-only cells such as &nbsp; are skipped. Tags stay in the file around those text nodes.
  • script, style, pre, and head content are excluded, including <title>. Comments and whitespace-only text are preserved.
  • <img alt="..."> is extracted as html.*.img.alt. Do not assume every attribute is translatable. Review the rendered result.
  • hl entries page.html --import-settings settings.json applies extra HTML filters. html.excludedElements names more tags to skip. html.icuSubfilter marks ICU-shaped values.

Next steps