Skip to content

fix(i18n): resolve translation warnings in make-pot#4323

Open
faisalahammad wants to merge 1 commit into
10up:developfrom
faisalahammad:fix/4313-translation-warnings
Open

fix(i18n): resolve translation warnings in make-pot#4323
faisalahammad wants to merge 1 commit into
10up:developfrom
faisalahammad:fix/4313-translation-warnings

Conversation

@faisalahammad

@faisalahammad faisalahammad commented Jun 19, 2026

Copy link
Copy Markdown

Summary

Running wp i18n make-pot produced two warnings in the JS files: one duplicate translator comment on the string %1$s and %2$s and one missing translator comment on Page %d. This change unifies the comments and adds the missing ones so the POT file builds cleanly.

Fixes #4313

Changes

assets/js/features/components/control.js

Before:

/* translators: %1$s: first feature name, %2$s: second feature name */
__('%1$s and %2$s', 'elasticpress'),
// ...
/* translators: %1$s: comma-separated list of feature names, %2$s: last feature name */
__('%1$s and %2$s', 'elasticpress'),

After:

/* translators: %1$s: feature name(s), %2$s: last feature name */
__('%1$s and %2$s', 'elasticpress'),
// ...
/* translators: %1$s: feature name(s), %2$s: last feature name */
__('%1$s and %2$s', 'elasticpress'),

Why: The same string literal had two different translator comments, which triggers a make-pot warning. A single comment describing both placeholders works for both call sites.

assets/js/instant-results/components/results/pagination.js

Before:

aria-label={sprintf(__('Page %d', 'elasticpress'), page.value)}

After:

/* translators: %d: Page number. */
aria-label={sprintf(__('Page %d', 'elasticpress'), page.value)}

Why: %d needs a translator comment to explain it is the page number.

assets/js/synonyms/apps/synonyms-settings.js

Before:

/* translators: Synonyms count */
sprintf(__('Synonyms (%d)', 'elasticpress'), synonyms.length)

After:

/* translators: %d: Number of synonyms. */
sprintf(__('Synonyms (%d)', 'elasticpress'), synonyms.length)

Why: The %d placeholder is clearer for translators when the comment references it directly. Same change applied to hyponyms and replacements tabs.

Testing

Test 1: Generate POT file

  1. Go to the plugin folder.
  2. Run wp i18n make-pot . lang/elasticpress.pot.

Result: No warnings. POT file builds successfully.

Screenshots

Before:
SCR-20260619-ttck

After:
image

- Unify translator comments for %1 and %2 in feature control.js
- Add translator comment for Page %d in pagination.js
- Improve translator comments for %d placeholders in synonyms settings

Fixes 10up#4313
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.

BUG: Fix translation warnings

1 participant