Skip to content

Blade: <h1> extracted with kind "text" but replaced with kind "heading" — headings are never substituted #4

Closed

Description

@ViniMayerFontana

What happens

In the Blade rewriter (src/i18n/rewrite-i18n-blade.js), inferKindFromTagName()
maps h1–h6 to kind heading. But the extraction phase registered our <h1>
string under kind text — the base locale contains
Errors.TurnstileMisconfigured.text.this_page_isn_t for
<h1>This page isn't set up yet</h1>.

Replacement then builds ns|heading|This page isn't set up yet, which does not exist
in the key map (only ns|text|... does) → the heading is never replaced, even though
its key is present in the base locale.

Repro

  1. extract on a view with <h1>This page isn't set up yet</h1> → key written under
    ...text.this_page_isn_t.
  2. replace (Blade backend) → <h1> line unchanged; neighboring <p>/<strong>
    lines (kind text) are replaced.

Expected

Consistent kind inference between the two phases (either the extractor tags headings
as heading, or the Blade key map adds a heading→text fallback the way
replace-i18n.js does for the Vue/JS path).

Note

No retranslation needed once fixed: the keys are already in the base locale under
text.

Environment

@ai-localizer/cli / @ai-localizer/core v0.1.1, Windows 11, Node v24.20.0.

Happy to contribute a PR (Apache-2.0).


Reported by @ViniMayerFontana via the Relief Inventory pt-BR localization effort (Apache-2.0, happy to PR).

Activity

  1. xwiz commented on Nov 14, 2026

    @xwiz
    Contributor

    Thanks for the example. #13 lets the Blade rewriter fall back from a heading key to the existing text key, so these headings don’t need to be translated again.

    The fix is in the PR and has regression coverage. It’s awaiting merge, so it isn’t in a release yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions