fix(docs): Spanish strings were showing on the English docs - #23
Merged
Conversation
The docs are English-only, but Spanish had leaked into the chrome a reader sees. Not the prose, which is written in English: defaults and labels buried in components, which is why review kept missing them. What was showing in production: - "limitaciones conocidas" as the heading of the limits card on /docs/models. It is the default title of <LimitationsCard>, used whenever the tag carries no explicit one. - "Copiar" on every code block, "Copiado" after clicking, "¡Copiado al portapapeles!" in the toast and "Error al copiar" on failure. - "rate limits por API key", "Paralelo máximo", "concurrentes", "tokens / min por modelo" and "requests / min por modelo" in the rate limits card. The card's default title and the rate-limit labels each live in TWO places that have to agree: the component a person reads and the extractor that feeds /api/docs and the Discord bot. Both sides are changed together, and the fixture that pins the extractor's output is updated with them. A guard is added over the docs components and the layout so this cannot come back. It only inspects strings a reader can see, not comments: the repo keeps Spanish comments in the layouts and styles on purpose. DocsTopBar.astro and ApiReference.astro are exempt because their Spanish is the translated chrome of /es/docs/api, which is the point. Verified by mutation: restoring any of the three Spanish strings, or letting the component and the extractor drift apart, makes the suite fail.
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.
The docs are English-only, but Spanish had leaked into the chrome a reader
sees. Not the prose, which is written in English: these are defaults and labels
buried in components, which is why review kept walking past them.
Showing in production right now
/docs/models, limits card headinglimitaciones conocidasCopiar,Copiado,¡Copiado al portapapeles!,Error al copiarrate limits por API key,Paralelo máximo,concurrentes,tokens / min por modelo,requests / min por modeloThe heading came from the default title of
<LimitationsCard>, used wheneverthe tag carries no explicit one, so it only surfaced on the one page that omits
it.
Two places, one string
The card's default title and the rate-limit labels each live in two places
that have to agree: the component a person reads, and the extractor that
generates the text
/api/docsserves to the Discord bot. Both sides arechanged together here, along with the fixture that pins the extractor's output.
That pairing is the same one
rateLimits.tsexists to protect: the page andthe API had already drifted apart once over these numbers.
Guard
A test walks the docs components and the layout and fails on Spanish in
anything a reader can see. It ignores comments, since the repo deliberately
keeps Spanish ones in the layouts and styles.
DocsTopBar.astroandApiReference.astroare exempt: their Spanish is the translated chrome of/es/docs/api, which is the point.It also checks that the component and the extractor agree on the default title,
rather than each being asserted in isolation.
Testing
654 tests green. The guard is verified by mutation: restoring any of the three
Spanish strings, or letting the component and the extractor drift apart, makes
the suite fail.