WordPress / WordPress/WordPress-Coding-Standards

Check for missing text domain in JavaScript i18n function calls

Open
#1,641 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Is your feature request related to a problem?

wp.i18n JavaScript functions can be used in plugins and themes, but there is currently no check to ensure that they have a text domain argument.

Describe the solution you'd like

Add a sniff that checks for text domain (and possibly other i18n-related issues), for JS, like the one for PHP. It could be that this one gets updated to cover PHP and JS, but that may make it trickier to understand, since it's not the same groups of functions.

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 reviewing the existing PHP implementation in WordPress/Sniffs/WP/I18nSniff.php and the linked wp.i18n JavaScript functions. Define the JavaScript calls that require a text domain and whether other i18n checks are in scope; done means the new sniff detects missing text domains consistently.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, php
Domain
internationalization, tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.