WordPress / WordPress/create-block-theme

Consider the ideal approach for text localization

Open
#776 12 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
JavaScript
Stars
417
Forks
66
PR merge metrics
No merged PRs in 30d

Description

When you save changes, if you check "Localize Text", the template content will be saved as a pattern and translation functions (esc_html_e()) will be applied to some of the text:

Image

The text that gets replaced is determined by a hard-coded list of regular expressions and blocks.

As a result, there have been reported issues with anything that doesn't fit these not being localized:

  • #737
  • #742
  • #773
  • #744
  • #756

Maintaining this hard-coded data is impractical.

Perhaps a more generic approach is needed, although this has probably been considered in the past.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with includes/create-theme/theme-locale.php, especially the hard-coded regular expressions and block list linked in the issue. Review the related reports in #737, #742, #773, #744, and #756 to identify cases the current approach misses. Done would mean an agreed generic localization approach that covers those cases without impractical hard-coded maintenance.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
localization
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.