Fix docs localization consistency#276
Conversation
📝 WalkthroughWalkthroughAdds a localization validator invoked during docs build, parameterizes benchmark i18n templates and replaces pluralized peer-count keys with static labels across locales, introduces locale-aware number/latency formatters in the benchmarks UI, updates benchmarks styles, and adds navbar translations for multiple locales. Changes
Sequence Diagram(s)sequenceDiagram
participant DevCI as Developer/CI
participant NPM as npm (scripts)
participant Check as check-localization.js
participant FS as Filesystem (i18n, docs)
participant Docusaurus as docusaurus build
DevCI->>NPM: npm run build
NPM->>Check: run check-localization.js
Check->>FS: read i18n/*/code.json, navbar.json, docs/*
FS-->>Check: return file sets & contents
alt validation passes
Check-->>NPM: exit 0 / "Localization validation passed."
NPM->>Docusaurus: docusaurus build
Docusaurus-->>NPM: build artifacts
NPM-->>DevCI: build succeeded
else validation fails
Check-->>NPM: exit 1 / "Localization validation failed"
NPM-->>DevCI: build aborted (non-zero exit)
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 596c6e4ad7
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@docs/TunGo/i18n/ru/code.json`:
- Around line 107-108: The "bench.peerCount.plurals" entry only provides three
variants; update it to include all four Russian plural forms ("one", "few",
"many", "other") by supplying a fourth message string for the missing form while
preserving the {countLabel} placeholder; modify the "bench.peerCount.plurals"
object to contain four plural variants in the correct order (one, few, many,
other) so Intl.PluralRules for Russian is satisfied.
In `@docs/TunGo/scripts/check-localization.js`:
- Around line 71-79: The plural validation currently checks if forms < 2 which
misses languages with more categories; update the check in the block that
handles keys ending with '.plurals' to compare forms against
pluralCategories.length (i.e., if (forms < pluralCategories.length) push an
error), and adjust the error text built with path.relative(projectRoot,
codeJsonPath), key, forms and locale to state that it defines only X plural
forms but Y are required for that locale (use pluralCategories.length for the
required count).
In `@docs/TunGo/src/pages/benchmarks.js`:
- Around line 342-351: The MetricCard for the fast-path lookup currently
hardcodes "~4-15 ns"; update it to derive its value from the data
(repository.fastPath or benchmarkSnapshot.fastPath) and format it using the same
helpers as the note (i.e., useBenchmarkFormatting() / the existing formatting
function used elsewhere) so the displayed range stays in sync; replace the
literal value prop on the MetricCard with a computed string built from
repository.fastPath (or benchmarkSnapshot) and the existing translate/format
helpers (same pattern as formatPeerCount) so localization and snapshot
consistency are preserved.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 57a82715-4d48-4db6-b9ff-67a7d271b773
📒 Files selected for processing (25)
docs/TunGo/i18n/ar/code.jsondocs/TunGo/i18n/ar/docusaurus-theme-classic/navbar.jsondocs/TunGo/i18n/de/code.jsondocs/TunGo/i18n/de/docusaurus-theme-classic/navbar.jsondocs/TunGo/i18n/en/code.jsondocs/TunGo/i18n/es/code.jsondocs/TunGo/i18n/es/docusaurus-theme-classic/navbar.jsondocs/TunGo/i18n/fr/code.jsondocs/TunGo/i18n/fr/docusaurus-theme-classic/navbar.jsondocs/TunGo/i18n/id/code.jsondocs/TunGo/i18n/id/docusaurus-theme-classic/navbar.jsondocs/TunGo/i18n/ja/code.jsondocs/TunGo/i18n/ja/docusaurus-theme-classic/navbar.jsondocs/TunGo/i18n/pt/code.jsondocs/TunGo/i18n/pt/docusaurus-theme-classic/navbar.jsondocs/TunGo/i18n/ru/code.jsondocs/TunGo/i18n/ru/docusaurus-theme-classic/navbar.jsondocs/TunGo/i18n/zh-Hans/code.jsondocs/TunGo/i18n/zh-Hans/docusaurus-theme-classic/navbar.jsondocs/TunGo/package.jsondocs/TunGo/scripts/check-localization.jsdocs/TunGo/src/i18n/usePluralMessage.jsdocs/TunGo/src/pages/benchmarks.jsdocs/TunGo/src/pages/index.jsdocs/TunGo/src/pages/markdown-page.md
💤 Files with no reviewable changes (2)
- docs/TunGo/src/pages/markdown-page.md
- docs/TunGo/src/pages/index.js
There was a problem hiding this comment.
♻️ Duplicate comments (1)
docs/TunGo/src/pages/benchmarks.js (1)
343-352:⚠️ Potential issue | 🟡 MinorFast-path metric value is still hardcoded and can drift from snapshot data.
The
valuefor fast-path lookup still bypassesbenchmarkSnapshot+ formatting helpers, so it can become inconsistent with the localized note and underlying data.💡 Suggested fix
@@ const missPathStart = benchmarkSnapshot.repository.missPath[0]; const missPathEnd = benchmarkSnapshot.repository.missPath[benchmarkSnapshot.repository.missPath.length - 1]; + const fastPathLatencies = benchmarkSnapshot.repository.fastPath.flatMap((row) => + row.series.map((point) => point.ns), + ); + const fastPathMinNs = Math.min(...fastPathLatencies); + const fastPathMaxNs = Math.max(...fastPathLatencies); @@ <MetricCard label={translate({id: 'bench.metric.lookup', message: 'Fast-path lookup'})} - value="~4-15 ns" + value={`${formatNs(fastPathMinNs)} -> ${formatNs(fastPathMaxNs)}`} note={translate( { id: 'bench.metric.lookupNote',🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@docs/TunGo/src/pages/benchmarks.js` around lines 343 - 352, The MetricCard for the "Fast-path lookup" is using a hardcoded value "~4-15 ns" which can drift from snapshot data; update the value prop to derive its string from the benchmarkSnapshot and existing formatting helpers (e.g., use benchmarkSnapshot.lookup or the appropriate snapshot key and pass it through the latency/metric formatter function used elsewhere such as formatLatency or formatMetric) instead of the literal string so the displayed value stays consistent with the localized note and snapshot data in the MetricCard component.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Duplicate comments:
In `@docs/TunGo/src/pages/benchmarks.js`:
- Around line 343-352: The MetricCard for the "Fast-path lookup" is using a
hardcoded value "~4-15 ns" which can drift from snapshot data; update the value
prop to derive its string from the benchmarkSnapshot and existing formatting
helpers (e.g., use benchmarkSnapshot.lookup or the appropriate snapshot key and
pass it through the latency/metric formatter function used elsewhere such as
formatLatency or formatMetric) instead of the literal string so the displayed
value stays consistent with the localized note and snapshot data in the
MetricCard component.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: c923d640-6cfc-46c8-8341-d5e9036701b5
📒 Files selected for processing (1)
docs/TunGo/src/pages/benchmarks.js
…tion-audit # Conflicts: # docs/TunGo/src/pages/benchmarks.js # docs/TunGo/src/pages/benchmarks.module.css
There was a problem hiding this comment.
Actionable comments posted: 4
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@docs/TunGo/src/pages/benchmarks.js`:
- Around line 177-180: The legend currently renders numeric-only peer counts in
series.map (inside the element with class Styles.legendEntry and child classes
Styles.legendPeers / Styles.legendValue) causing loss of context for assistive
tech; update the JSX that uses peerLabelFormatter(point.peers) and
formatter(point[valueKey]) to include an accessible string that preserves the
"Peers" context (e.g., add a visually-hidden or aria-only label combining a
translated "Peers" string with the count) so screen readers announce "X peers"
while keeping the visible numeric-only label unchanged; use the existing
peerLabelFormatter and your i18n translation function for the "Peers" text to
build the accessible label.
- Line 225: FullCycleTable is currently stringifying entry.allocs directly
(leaving allocs/op unlocalized); update FullCycleTable to format allocs with a
locale-aware formatter instead of raw stringifying—either call
Number(entry.allocs).toLocaleString() when rendering allocs/op or add a
formatAlloc (or reuse an existing numeric formatter) prop and use that
(referencing FullCycleTable and the entry.allocs render spot) so allocs/op
respects the user locale and non-Latin numerals.
- Around line 302-305: The table body currently renders every cell as a <td>,
which loses the lookup-name association for screen readers; update the rows
rendering inside rows.map (the row.map callback using rowIndex and columnIndex)
so that when columnIndex === 0 you render the first cell as a row header (use a
<th> with scope="row" and the same key pattern) and render all other cells as
<td>, preserving keys and content to maintain existing layout and keys like
`row-${rowIndex}-col-${columnIndex}`.
In `@docs/TunGo/src/pages/benchmarks.module.css`:
- Around line 64-66: The new flex-column rules intended to bottom-align
sparklines are being overridden by a later `.chartCard { display: grid; }`;
either keep `.chartCard` as flex or move the vertical-alignment rules to a
dedicated inner wrapper. Update the stylesheet so that `chartCard` retains
`display: flex; flex-direction: column; min-height: 100%; margin-top: auto;`
(remove or change the later `.chartCard { display: grid; }`), or instead create
a child selector (e.g., `.chartCard > .contentWrapper`) and apply the
flex/column/min-height/margin-top rules there, and ensure other grid rules
target the correct child so the layout is not overridden.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: bbfc8844-558f-412b-8817-2e9d9bedad73
📒 Files selected for processing (12)
docs/TunGo/i18n/ar/code.jsondocs/TunGo/i18n/de/code.jsondocs/TunGo/i18n/en/code.jsondocs/TunGo/i18n/es/code.jsondocs/TunGo/i18n/fr/code.jsondocs/TunGo/i18n/id/code.jsondocs/TunGo/i18n/ja/code.jsondocs/TunGo/i18n/pt/code.jsondocs/TunGo/i18n/ru/code.jsondocs/TunGo/i18n/zh-Hans/code.jsondocs/TunGo/src/pages/benchmarks.jsdocs/TunGo/src/pages/benchmarks.module.css
🚧 Files skipped from review as they are similar to previous changes (7)
- docs/TunGo/i18n/ar/code.json
- docs/TunGo/i18n/en/code.json
- docs/TunGo/i18n/fr/code.json
- docs/TunGo/i18n/ru/code.json
- docs/TunGo/i18n/pt/code.json
- docs/TunGo/i18n/ja/code.json
- docs/TunGo/i18n/id/code.json
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
docs/TunGo/src/pages/benchmarks.module.css (1)
471-474: Optional: drop duplicatedmin-heightreset in the 640px block.This reset is already applied at the 996px breakpoint, so the second declaration is redundant.
🧹 Simplification
- .metricCard, - .chartCard { - min-height: auto; - }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@docs/TunGo/src/pages/benchmarks.module.css` around lines 471 - 474, Remove the duplicated min-height reset in the 640px breakpoint: the selectors .metricCard and .chartCard already set min-height: auto at the 996px breakpoint, so delete the redundant min-height: auto declaration inside the 640px block (or consolidate the rule so only the 996px breakpoint contains min-height: auto) to avoid repetition.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@docs/TunGo/src/pages/benchmarks.module.css`:
- Around line 342-352: The .srOnly CSS rule uses the deprecated clip: rect(...)
property; replace that property with the modern clip-path approach by removing
clip: rect(0, 0, 0, 0) and adding clip-path: inset(50%) (keeping all other
properties intact) in the .srOnly selector so stylelint no longer flags
property-no-deprecated for the .srOnly rule.
---
Nitpick comments:
In `@docs/TunGo/src/pages/benchmarks.module.css`:
- Around line 471-474: Remove the duplicated min-height reset in the 640px
breakpoint: the selectors .metricCard and .chartCard already set min-height:
auto at the 996px breakpoint, so delete the redundant min-height: auto
declaration inside the 640px block (or consolidate the rule so only the 996px
breakpoint contains min-height: auto) to avoid repetition.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 58b2b001-deab-4087-96e8-fc232f614f6b
📒 Files selected for processing (2)
docs/TunGo/src/pages/benchmarks.jsdocs/TunGo/src/pages/benchmarks.module.css
🚧 Files skipped from review as they are similar to previous changes (1)
- docs/TunGo/src/pages/benchmarks.js
There was a problem hiding this comment.
♻️ Duplicate comments (1)
docs/TunGo/src/pages/benchmarks.module.css (1)
342-352:⚠️ Potential issue | 🟡 MinorReplace deprecated
clipproperty withclip-path: inset(50%).The
.srOnlyclass usesclip: rect(0, 0, 0, 0)which is deprecated and flagged by your stylelint config (property-no-deprecated). The modern equivalent isclip-path: inset(50%).Proposed fix
.srOnly { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; - clip: rect(0, 0, 0, 0); + clip-path: inset(50%); white-space: nowrap; border: 0; }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@docs/TunGo/src/pages/benchmarks.module.css` around lines 342 - 352, Update the .srOnly utility to remove the deprecated clip declaration and replace it with clip-path: inset(50%) (keeping the existing position, width, height, padding, margin, overflow, white-space and border rules); specifically, locate the .srOnly class in the CSS and delete clip: rect(0, 0, 0, 0) and add clip-path: inset(50%) so it satisfies the stylelint property-no-deprecated rule while preserving the same visually-hidden behavior.
🧹 Nitpick comments (1)
docs/TunGo/src/pages/benchmarks.js (1)
276-292: Consider removing duplicatearia-label.Both the wrapper
<div>(line 280) and the<table>(line 288) have identicalaria-labelattributes. Screen readers may announce this twice. Keep just one—typically on the<table>since it's the semantic data structure, and usearia-labelledbyor remove the label from the wrapper.Optional cleanup
<div className={Styles.tableWrap} role="region" - aria-label={translate({ - id: 'bench.table.lookupAria', - message: 'Repository lookup and miss-path benchmark results', - })} + aria-labelledby="lookup-table-label" tabIndex={0} > <table className={`${Styles.dataTable} ${Styles.fastPathTable}`} + id="lookup-table-label" aria-label={translate({ id: 'bench.table.lookupAria', message: 'Repository lookup and miss-path benchmark results', })} >🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@docs/TunGo/src/pages/benchmarks.js` around lines 276 - 292, The wrapper div currently repeats the same aria-label used on the table (the translate({...}) call) which causes duplicate announcements; remove the aria-label from the wrapper (the element using Styles.tableWrap) and leave the aria-label on the table (the element using Styles.dataTable and Styles.fastPathTable), or if you need a wrapper label use aria-labelledby pointing to the table instead; update the JSX so only the table contains the translate(...) aria-label (or use aria-labelledby) to avoid double announcements.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Duplicate comments:
In `@docs/TunGo/src/pages/benchmarks.module.css`:
- Around line 342-352: Update the .srOnly utility to remove the deprecated clip
declaration and replace it with clip-path: inset(50%) (keeping the existing
position, width, height, padding, margin, overflow, white-space and border
rules); specifically, locate the .srOnly class in the CSS and delete clip:
rect(0, 0, 0, 0) and add clip-path: inset(50%) so it satisfies the stylelint
property-no-deprecated rule while preserving the same visually-hidden behavior.
---
Nitpick comments:
In `@docs/TunGo/src/pages/benchmarks.js`:
- Around line 276-292: The wrapper div currently repeats the same aria-label
used on the table (the translate({...}) call) which causes duplicate
announcements; remove the aria-label from the wrapper (the element using
Styles.tableWrap) and leave the aria-label on the table (the element using
Styles.dataTable and Styles.fastPathTable), or if you need a wrapper label use
aria-labelledby pointing to the table instead; update the JSX so only the table
contains the translate(...) aria-label (or use aria-labelledby) to avoid double
announcements.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: fb4238c1-f1c3-46dc-a18d-d684da7531d6
📒 Files selected for processing (2)
docs/TunGo/src/pages/benchmarks.jsdocs/TunGo/src/pages/benchmarks.module.css
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
🧹 Nitpick comments (1)
docs/TunGo/i18n/fr/code.json (1)
129-129: Unify “Lookup” vs “Recherche” terminology for consistency.Line 129 and Line 156 use “Recherche”, while adjacent benchmark strings still use “Lookup”. Pick one term across this section to keep the UI lexicon consistent.
Also applies to: 156-156
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@docs/TunGo/i18n/fr/code.json` at line 129, The French localization uses both “Recherche” and “Lookup” inconsistently; update the JSON message values so the same term is used across this section by replacing the "message": "Recherche" entries (e.g., the occurrences at the JSON message keys around the current diff and the other occurrence near line 156) to the chosen unified term (either "Recherche" or "Lookup") and also update adjacent benchmark strings that still use "Lookup" so all related "message" values match; ensure you change every instance of the conflicting "message" keys within this file section to the selected term.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@docs/TunGo/i18n/fr/code.json`:
- Line 129: The French localization uses both “Recherche” and “Lookup”
inconsistently; update the JSON message values so the same term is used across
this section by replacing the "message": "Recherche" entries (e.g., the
occurrences at the JSON message keys around the current diff and the other
occurrence near line 156) to the chosen unified term (either "Recherche" or
"Lookup") and also update adjacent benchmark strings that still use "Lookup" so
all related "message" values match; ensure you change every instance of the
conflicting "message" keys within this file section to the selected term.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 96f52c8c-2a18-475c-a28b-156ce3eaeb19
📒 Files selected for processing (13)
docs/TunGo/i18n/ar/code.jsondocs/TunGo/i18n/de/code.jsondocs/TunGo/i18n/en/code.jsondocs/TunGo/i18n/es/code.jsondocs/TunGo/i18n/fr/code.jsondocs/TunGo/i18n/id/code.jsondocs/TunGo/i18n/ja/code.jsondocs/TunGo/i18n/pt/code.jsondocs/TunGo/i18n/ru/code.jsondocs/TunGo/i18n/zh-Hans/code.jsondocs/TunGo/scripts/check-localization.jsdocs/TunGo/src/pages/benchmarks.jsdocs/TunGo/src/pages/benchmarks.module.css
✅ Files skipped from review due to trivial changes (1)
- docs/TunGo/scripts/check-localization.js
🚧 Files skipped from review as they are similar to previous changes (8)
- docs/TunGo/i18n/en/code.json
- docs/TunGo/i18n/de/code.json
- docs/TunGo/i18n/ar/code.json
- docs/TunGo/src/pages/benchmarks.module.css
- docs/TunGo/src/pages/benchmarks.js
- docs/TunGo/i18n/id/code.json
- docs/TunGo/i18n/ru/code.json
- docs/TunGo/i18n/ja/code.json
Summary
Testing
Summary by CodeRabbit