Repository navigation
Description
feat(i18n): take the language set from SahajCloud, not from supportedLanguages
Summary
The widget's language set is a build-time constant — supportedLanguages in
src/config/i18n-options.ts, pinned by i18n-options.test.ts to whatever public/locales/
contains. SahajCloud has just made the same list operator-configurable on the Sahaj Atlas
configuration global (sydevs/SahajCloud#645), and its SEO endpoint already emits hreflang from
it. This repo needs to read it too, or the two disagree the first time somebody changes it.
The widget currently fetches no Payload global at all. Not sy-atlas-config, not
sy-atlas-translations — the generated types exist in src/types/payload/, but the only globals
match in src/ is globals.css. So this is the first runtime config read, and the boot-order
question below is the real work, not the fetch.
Why this side has to change
SahajCloud can now say "the atlas is offered in cs, de, fr, nl". It cannot know whether this repo
ships a UI bundle for each of those — that is a fact about public/locales/, which only this
build knows.
A language enabled in the CMS with no bundle here renders the English fallback while SahajCloud's
hreflang tells crawlers that language has a page. That is a promise we can't keep, and it is
invisible at runtime: nothing errors, the viewer just gets the wrong language.
What to build
- Fetch
sy-atlas-configand read itslanguagesfield — an array of{ code }rows, where
codeis a CMS locale. (It is an array rather than ahasManyselect, and namedlanguages
rather thanlocales, for reasons documented on the field in SahajCloud; treat both as fixed.) - Drive
supportedLanguagesfrom that, replacing the constant. The settings picker and
i18next'ssupportedLngsshould both come from it. - Fail loudly when a bundle is missing. Add a CI check asserting
public/locales/ ⊇ enabled.
This replaces the current equality assertion ini18n-options.test.ts, which becomes wrong the
moment the CMS owns the list — but the drift check itself is the valuable part and should not
just be deleted. Fetching the live global in CI is one option; a committed snapshot refreshed by
a script (likepnpm sync:atlas-contract) is another, and keeps the unit lane off the network. - Decide the boot order. i18n initializes synchronously at module load today; the config fetch
is async and needs the API key. Either defer init until it lands (a visible boot change on
someone else's page) or initialize with the shipped bundles and narrow once the config arrives.
Worth measuring rather than assuming — the widget mounts inside a host page and a delayed first
paint is a cost the host pays.
Interim state, and it is worth stating explicitly
SahajCloud ships first. Between that and this ticket, the global governs hreflang but not the
widget's own picker — so an operator disabling a language removes it from search-engine
alternates while the widget still offers it. That is the safe direction of the two (we stop
advertising something rather than start), but it is a real divergence and shouldn't be discovered.
Until then, the CMS default is the current ten, so nothing changes for an installation that hasn't
touched the setting.
Not in scope
- Changing which languages are enabled. That's now an operator decision, not a code change.
- The translations global (
sy-atlas-translations). Locale bundles still come from
public/locales/over HTTP from this repo's own asset host; only the enabled set moves.
Related
- feat(api): serve SEO metadata for an atlas route (C3) — blocks the WordPress plugin and WeMeditateWeb SSR SahajCloud#645 — the SEO endpoint, and the global field this reads
src/config/i18n-options.ts— the constant being replaced, and its comment explaining why the
list must matchpublic/locales/in both directionssrc/config/i18n-options.test.ts— the drift check that changes meaning
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Hold Until
Projects
- StatusShow more project fieldsDone
Activity
docs: define the #167 changelog link, now that the PR has a number
Ardnived commentedon Sep 5, 2026
Superseded by #198 and the tracker sydevs/SahajCloud#702.
sy-atlas-config.languagesis being replaced byavailableLocales(sydevs/SahajCloud#705), gated on published translations, and the widget will read its strings from the CMS too — so the "shipped ⊇ enabled" check this asked for has nothing to check once nothing is shipped.feat(i18n): source translations and the language set from SahajCloud (#…