Skip to content

Require other in pluralized default translations - #1292

Open
agustinpabon wants to merge 1 commit into
Shopify:mainfrom
agustinpabon:fix/plural-translations-require-other-452
Open

Require other in pluralized default translations#1292
agustinpabon wants to merge 1 commit into
Shopify:mainfrom
agustinpabon:fix/plural-translations-require-other-452

Conversation

@agustinpabon

Copy link
Copy Markdown

What are you adding in this PR?

Add a requireOther option to MatchingTranslations, enabled by default, to report recognized pluralized entries missing other in storefront default locale files.

Fixes #452.

For example, this entry in locales/en.default.json now produces a diagnostic:

{
  "items": {
    "one": "One item"
  }
}

Reports: The pluralized translation 'items' is missing the 'other' key.

Adding an other translation resolves that diagnostic. Setting MatchingTranslations.requireOther: false disables only the new requirement and preserves the existing missing/extra translation checks:

MatchingTranslations:
  requireOther: false

Detection is intentionally conservative: it recognizes non-empty objects whose immediate members are exact plural-category names with string values. Mixed namespaces and non-string structures are not treated as pluralization objects.

The change leaves schema locales and plural-category differences in other languages unchanged. It preserves external namespace exemptions and reports the affected property without inventing translation content or offering an automatic fix.

This intentionally adds a new default-on lint diagnostic. Themes with affected entries may need to add other or disable this requirement.

What's next? Any followup issues?

A Shopify maintainer may need to update the internal shopify.dev documentation for MatchingTranslations to describe requireOther, its default, and its storefront-only scope. That internal documentation update has not been performed in this PR.

Tophatting

For manual verification, use a storefront default locale containing {"items":{"one":"One item"}}. The rule should report the missing other entry. Adding other or setting requireOther: false should remove only that new diagnostic; existing missing/extra translation checks should remain active.

Automated validation

Recorded on Windows with Node 24.19.0 and the checkout's pnpm 10.16.1:

Command Result
pnpm exec vitest run packages/theme-check-common/src/checks/matching-translations/index.spec.ts on the baseline with the new regression test 18 existing tests passed; regression failed as expected: one diagnostic expected, zero received. The patched rule reports the missing other with the correct file, message and property range.
pnpm exec vitest run packages/theme-check-common/src/checks/matching-translations/index.spec.ts packages/theme-check-node/src/config/load-config.spec.ts 74 tests passed, including 49 rule tests and real YAML-to-production configuration execution.
pnpm exec vitest run packages/theme-check-common packages/theme-check-node 4,994 tests passed across 125 files. This includes the focused tests above; the counts are not additive.
pnpm build Full workspace build passed, including factory configuration generation and the VS Code extension build.
pnpm type-check Workspace type checks passed.
pnpm format:check Source formatting passed.
pnpm exec prettier --check .changeset/plural-translations-require-other.md packages/theme-check-node/configs/all.yml packages/theme-check-node/configs/recommended.yml Changeset and generated YAML formatting passed.
git diff --check and git diff --check 65fd7743556a6fcb554f08fa58ee13a080a65b07 HEAD Patch integrity passed.

The full monorepo unit suite, complete platform matrix, browser E2E and live-store integration were not run. Successful local validation was not repeated solely for publication.

Before you deploy

  • This PR changes the configuration of a check.
    • Included a minor changeset for @shopify/theme-check-common and @shopify/theme-check-node.
    • Ran pnpm build and committed generated all.yml and recommended.yml updates with requireOther: true.
    • theme-app-extension.yml inherits the recommended configuration; no override is needed.
    • [Shopifolk] Update the internal shopify.dev Theme Check documentation.

AI assistance

OpenAI Codex assisted with implementation and validation. The contributor personally reviewed the diff and diagnostic examples before submission.

@agustinpabon
agustinpabon requested a review from a team as a code owner September 8, 2026 06:52
@agustinpabon

Copy link
Copy Markdown
Author

I have signed the CLA!

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.

Require other for pluralized entries in translation files

1 participant