Skip to content

Commit cb61bee

Browse files
committed
feat(i18n,charts): a Spanish chart said Carta natal above Sun and Pisces, and the glyph table had been keyed on a spelling the API never sends
Chrome, vocabulary and formatting now all follow the page rather than the viewer. resolveLang implements the documented four-link chain and keeps the full BCP-47 tag for Intl, while apiLang strips the region and omits unsupported languages, because lang=es-AR is a 400. Catalogues are one locale per payload in all seven languages, 66 keys, key-parity guarded so a new chrome string cannot be added to one language and forgotten in six. English ships no catalogue at all. Components consume the API's additive {identifier}Localized fields for text a human reads, and keep the canonical English for every glyph, sign-order and aspect-class lookup. Inverting that draws a chart with no glyphs on it, in Spanish only, and passes every other gate; a sabotage-proved test now pins it. roxy-data folds each localized twin into the field it translates, so the generic renderer gains no duplicate columns from the API change. Fixes the lookup table itself: PLANET_GLYPH was keyed North node against an API returning North Node, and the slice fallback rendered the miss as a plausible two-letter abbreviation, so No North Node R reached a customer screenshot after passing 603 tests, axe and review. Accessors normalise on define and read, return undefined, and a test walks every enum the spec emits. transit-wheel draws House columns, names its house system, and takes a houses prop for a real cusp ring, rejected whole unless twelve resolve. Deletes four docblock and legend claims that the API returned house 1 for every body, which stopped being true when the house computation shipped. Removes house-system from natal-chart and mode from hexagram: both were declared, typed into the React and Vue wrappers, and never read.
1 parent aa84063 commit cb61bee

328 files changed

Lines changed: 5644 additions & 1072 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

AGENTS.md

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -522,7 +522,7 @@ This is how the WordPress plugin renders: PHP fetches the response server-side,
522522

523523
Most RoxyAPI endpoints return their interpretation text in eight languages, selected with the `lang` query parameter (`en`, `tr`, `de`, `es`, `hi`, `pt`, `fr`, `ru`). Human Design, for example, returns the type, strategy, authority, profile, channel, center, gate, and line readings in the requested language.
524524

525-
The components hold no copy of their own; they print the prose the response carries. So the language of the response is the language of the render, and there is no locale prop to set.
525+
The components hold no copy of their own; they print the prose the response carries. So the language of the response is the language of the render.
526526

527527
```ts
528528
const { data } = await roxy.humanDesign.generateBodygraph({
@@ -531,9 +531,33 @@ const { data } = await roxy.humanDesign.generateBodygraph({
531531
});
532532
```
533533

534-
`lang` is a query parameter even on a POST endpoint. Put it in `query`, never in `body`; a `lang` key in the body is ignored and you get English back. In the self-fetch pattern you do not fill a language field: set `lang` as an attribute on the element (`<roxy-horoscope-card lang="de" ...>`) and the form routes it to the `?lang=` query on submit.
534+
`lang` is a query parameter even on a POST endpoint. Put it in `query`, never in `body`; a `lang` key in the body is ignored and you get English back. In the self-fetch pattern you do not fill a language field: the component reads the page language and routes it to the `?lang=` query on submit.
535535

536-
The structural labels the components draw (section headings such as Reading or Centers, and column headers) are English.
536+
## The labels the components write
537+
538+
Separate from the response, and set separately. The wording a component supplies itself (headings, tab labels, table captions, legends, empty states) comes from a catalogue you load for the language you serve.
539+
540+
```html
541+
<html lang="es-AR">
542+
...
543+
<script src="https://cdn.jsdelivr.net/npm/@roxyapi/ui@latest/dist/cdn/roxy-ui.js"></script>
544+
<script src="https://cdn.jsdelivr.net/npm/@roxyapi/ui@latest/dist/cdn/locales/es.js"></script>
545+
```
546+
547+
```ts
548+
import '@roxyapi/ui';
549+
import '@roxyapi/ui/locales/es';
550+
```
551+
552+
The language comes from `lang` on the element, else the nearest ancestor carrying `lang`, else `<html>`. So a site that already declares its language needs no per-component attribute. A regional tag reads its base language, so `es-AR` and `es-419` both use `es`, and the request goes out as `?lang=es` because that is what the API accepts.
553+
554+
English is the default and needs no catalogue. Load only the languages your site serves; one catalogue covers every Roxy component on the page.
555+
556+
A catalogue ships for every language the API serves: `de`, `es`, `fr`, `hi`, `pt`, `ru`, `tr`. Each covers `<roxy-natal-chart>`, `<roxy-transit-wheel>` and the shared labels every component inherits; the remaining components write English labels until their entries land. **The values the API returns are never rewritten**: a planet, sign, aspect, element or house-system name renders exactly as the response carries it, so the words on the chart and the words in the response can never disagree. Ask for a language and the response carries the reader-facing name beside the English one, so the chart prints the translated name while the English one stays available to compare against in your own code.
557+
558+
Dates, times and numbers need no catalogue at all. They follow the same page language and are written the way that language writes them, hour cycle included, so a German page reads `15. Jan. 1990, 14:30` and an Argentine one `15 de ene de 1990, 2:30 p. m.`.
559+
560+
Ask for the response language AND load the matching catalogue, and the whole card reads in one language.
537561

538562
## Theming and dark mode
539563

README.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -764,6 +764,32 @@ What each family keeps when you set it:
764764

765765
What goes: interpretation paragraphs, the reading accordions, keyword chips attached to a reading, remedies and action steps and strengths lists (sentences laid out as bullets), and any section whose only content was one of those, heading included.
766766

767+
## Languages
768+
769+
A component reads the page language and renders its own labels in it. Set `lang` on the element, on any ancestor of it, or on `<html>`, and add the catalogue for that language.
770+
771+
```html
772+
<html lang="es-AR">
773+
...
774+
<script src="https://cdn.jsdelivr.net/npm/@roxyapi/ui@latest/dist/cdn/roxy-ui.js"></script>
775+
<script src="https://cdn.jsdelivr.net/npm/@roxyapi/ui@latest/dist/cdn/locales/es.js"></script>
776+
```
777+
778+
```ts
779+
import '@roxyapi/ui';
780+
import '@roxyapi/ui/locales/es';
781+
```
782+
783+
With `@roxyapi/ui-react` or `@roxyapi/ui-vue`, add the catalogue with the script tag above: the components themselves are loaded from the CDN, and one tag in your HTML covers the whole app.
784+
785+
A regional tag resolves to its language, so `es-AR`, `es-MX` and `es-419` all read the `es` catalogue and a CMS that emits an accurate tag needs no configuration. English is the default and needs no catalogue, so an English-only page downloads nothing extra. Load only the languages your site serves: each is its own small file, and one of them translates every Roxy component on the page.
786+
787+
Two things are separate on purpose. The catalogue is the wording this library writes: headings, tabs, table captions, legends, empty states. The wording the API returns is localized by the request, as shown above, and the component prints what came back. That covers the vocabulary as well as the interpretations: ask a chart for Spanish and the planet, sign and aspect names read Spanish on the wheel, in its tooltips, in the aspect grid and in the tables, with the same glyphs beside them. Ask for both and the whole card reads in one language.
788+
789+
Dates, times and numbers follow the page as well, in the conventions that language actually uses: a Spanish page reads `15 ene 1990`, an Argentine one `15 de ene de 1990`, a German one `15. Jan. 1990, 14:30`. The hour cycle comes from the language, not from us, so nobody gets a 12-hour clock on a page that writes 24. This needs no catalogue and no attribute: it follows the same `lang` your page already declares.
790+
791+
A catalogue ships for every language the API serves: `de`, `es`, `fr`, `hi`, `pt`, `ru`, `tr`. Each covers `<roxy-natal-chart>`, `<roxy-transit-wheel>` and the shared chrome every component inherits; the remaining components render English labels until their catalogue entries land.
792+
767793
## Reliability
768794

769795
- Verified astronomical calculations from Roxy Ephemeris, verified against NASA JPL Horizons.

0 commit comments

Comments
 (0)