Skip to content

fix: add Accordion heading text localization - #873

Open
kushagra-goyal-14 wants to merge 1 commit into
WordPress:trunkfrom
kushagra-goyal-14:fix/867-localize-accordion-heading
Open

kushagra-goyal-14 wants to merge 1 commit into
WordPress:trunkfrom
kushagra-goyal-14:fix/867-localize-accordion-heading

Conversation

@kushagra-goyal-14

Copy link
Copy Markdown

Summary

Fixes #867.

Accordion titles are currently skipped when saving theme changes with “Localize Text” enabled.

This adds core/accordion-heading to the text localization handler and targets the title inside .wp-block-accordion-heading__toggle-title. Plain titles and titles containing bold text become translation-ready, while the toggle icon stays unchanged.

Adds regression tests for plain titles, bold text, and repeated localization.

Testing instructions

  1. Activate a block theme and Create Block Theme.
  2. Open a template in the Site Editor.
  3. Insert an Accordion block and add a title and panel text.
  4. Save the template.
  5. Open Create Block Theme → Save Changes to Theme.
  6. Enable “Localize Text” and click “Save Changes”.
  7. Inspect the generated file in the theme’s patterns directory.

The Accordion title should contain translation code using the theme’s text domain. The toggle icon should remain unchanged.

Validation

  • The two new title tests failed before the fix and passed afterward.
  • PHP suite: 254 passed, 3 multisite-only tests skipped.
  • All linters and the build passed.
  • Browser verification confirmed that saving with “Localize Text” generates the expected translation code and the Accordion still opens and closes correctly.

Add core/accordion-heading support to the text localization handler so
Accordion titles are translation-ready when saving theme changes with
Localize Text enabled. Preserve title formatting and leave toggle icons
unchanged.

Add regression tests for plain titles, bold text, and repeated localization.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Localize Text skips Accordion headings

1 participant