WordPress / WordPress/create-block-theme
Consider the ideal approach for text localization
Nobody has claimed this yet.
- 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:
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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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