Repository navigation
fix(theme-translations): fix stale Icelandic category description id, and test that localized messages only use existing ids (AI-assisted) - #12767
Merged
Conversation
…on key (AI-assisted) theme.docs.DocCard.categoryDescription was replaced by the .plurals key in #9851, but the Icelandic translation (#9928) still declared the old key, and the new key was untranslated. Move the translation to the plurals key: "atriði" is the same in singular and plural. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…g from the base files (AI-assisted) The update script only logs "Some localized messages do not exist in base.json!" and never fails. When a message id is renamed, the translation stays under the old id that nothing reads anymore, and sites using this locale display the English base text for the new id. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
✅ [V2]
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
Size Change: 0 B Total Size: 12.1 MB ℹ️ View Unchanged
|
|
Size Change: 0 B Total Size: 12.1 MB ℹ️ View Unchanged
|
⚡️ Lighthouse report for the deploy preview of this PR
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Fixes a stale localized message in the Icelandic translations, and adds a test that fails when a locale file uses a message id that doesn't exist anymore.
Icelandic category descriptions
In #9851 (Feb 2024), the
theme.docs.DocCard.categoryDescriptionmessage id was replaced bytheme.docs.DocCard.categoryDescription.plurals. The Icelandic translation (#9928, March 2024) still used the old id: it translatedtheme.docs.DocCard.categoryDescription, which nothing reads anymore, and left the new.pluralsid untranslated. For 2.5 years, Icelandic sites displayed English category descriptions ("3 items") on category cards.This PR moves the translation to the new id:
"atriði" is a neuter noun, identical in singular and plural.
🙏 Review request: could an Icelandic speaker confirm this wording?
I checked all the other locales and files: this was the only stale message id.
Why a test
The update script (
pnpm --filter @docusaurus/theme-translations run update) detects stale ids, but it only logsSome localized messages do not exist in base.json!and never fails. When a message id is renamed in the theme code, the translations stay under the old id, and the new id falls back to the English base text. Nobody noticed for 2.5 years.The new test fails when a locale file contains a message id missing from the matching
locales/base/file, and lists the stale ids as<locale>/<file>: <id>.An alternative would be to make the update script delete unknown ids. A test is still preferable:
Test Plan
pnpm test packages/docusaurus-theme-translationspasses.Restoring the stale Icelandic key makes the new test fail:
pnpm --filter @docusaurus/theme-translations run updatedoesn't log the error anymore, and produces no diff.Test links
Deploy preview: https://deploy-preview-12767--docusaurus-2.netlify.app/
Related issues/PRs
This PR is AI-assisted.
🤖 Generated with Claude Code
Summary by CodeRabbit
Bug Fixes
Tests