WordPress / WordPress/WordPress-Coding-Standards

report missing context for _x

Open
#1,952 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PHP
Stars
2.8k
Forks
521
Avg merge
5d 20h
Merged PRs (30d)
1

Description

_x( 'foo', '', 'bar' )

If the context of _x is empty, output an error message:
"Do not use _x with empty context. Use __() instead"

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 by locating the sniff that analyzes _x() calls and any tests covering translation-context validation. Reproduce the empty-context example from the issue, then add coverage confirming that it reports the requested message while non-empty contexts remain valid.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
localization, tooling
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.