> ## Documentation Index
> Fetch the complete documentation index at: https://docs.lumenwipe.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Localization

> How the marketing site holds its copy per locale, how a Spanish locale will be routed, and the rules its translation follows.

The marketing site renders in English, and its landing page, FAQ, security and how it works pages, blog index, translated posts, navigation, footer and 404 also render in Spanish under `/es`. Its copy is held in a typed dictionary keyed by locale, so a second locale is a set of translated entries plus routing, not a rewrite of every page. This page records how the copy is held today, how the Spanish locale is routed, and the language rules for the translation. The app flow (`/mainnet`, `/testnet` and their pages) is out of scope.

## How the copy is held

* `apps/web/lib/i18n/locale.ts` declares the locales (`en` and `es`), `SITE_LOCALE` (the English default), and for each locale the `<html lang>` value, the tag dates and numbers are formatted with, the `og:locale` value and the `hreflang` value.
* `SITE_LOCALE` is a build-time constant. Nothing reads a header or a cookie to choose the locale, so every page under `app/(marketing)` and `app/(marketing-es)` stays prerendered and keeps its per-page hash policy (`apps/web/scripts/marketing-csp.mjs`).
* `apps/web/lib/i18n/messages/` holds one module per surface (`nav`, `footer`, `not-found`, `landing`, `faq`, `security`, `how-it-works`, `hero`, `stats`, `registry`, `playground`, `content`, `blog`, `site`, `common`), each a `Record<Locale, Copy>`. A client component imports only its own section, so the browser never downloads the whole dictionary.
* A post's title and description come from the post, and a video's title and description from the video, each in its own language. The planned article titles on `/content` are titles of posts to come, so they stay with the post list in `lib/site/content-status.ts`. The page around them (headings, labels, and the units of a reading time or a video's length) is dictionary copy.
* A sentence built from data is a function of that data, never a frozen string. The status registry (`lib/site/status.ts`) keeps each feature's id, status and link; its title, noun and summary come from the dictionary, and the sentences that list testnet-only features or live protocol exits are dictionary functions called with the registry's names. The FAQ answers are a function of the registry facts, the trust statements (`lib/site/trust.ts`) and the base reserve (`lib/site/reserve.ts`), built per locale by `faqItems()` (`components/marketing/Faq.tsx`), and the FAQ structured data reads the same answers.
* A sentence with a link or other markup inside it is a function that takes the element, so a translation can move the link within its sentence.
* `apps/web/lib/i18n/format.ts` formats every date and number on these pages with the locale's tag. It also picks a noun's plural form (`plural`, `pluralForm`) and joins lists (`formatList`) by the locale's rules.
* Messages the landing's components share with the app flow are reason codes: `addressProblem()` (`lib/utils/validation.ts`) and `EstimateError.reason` (`lib/api/estimate-client.ts`). Each component reads the sentence for its locale from the `address` and `hero` sections; the app keeps the English. Nothing in this scope calls `toLocaleString`, `toLocaleDateString` or `Intl` directly.
* The lint rule in `apps/web/eslint.config.mjs` (`DICTIONARY_COPY`) fails on text in markup, on a literal in a user-facing attribute or rendered as a child, on a literal page title or description, and on a three-word literal anywhere else in those files. Class names, URLs, roles, import paths, directives, error messages and comparisons pass. The asset code `XLM` is the one word allowed in markup.

## Routing

### Options

The App Router has no configuration-based locale routing: the `i18n` option in `next.config` belongs to the Pages Router, and the App Router guide routes locales with an `app/[lang]` segment, a Proxy redirect and `generateStaticParams` ([Next.js internationalization guide](https://nextjs.org/docs/app/guides/internationalization), updated 2026-11-06, checked 2026-11-16). That leaves two ways to add Spanish.

**A dynamic `[locale]` segment.** Every marketing route moves under `app/(marketing)/[locale]`. English then either gains a prefix, or keeps its URLs through a Proxy rewrite:

* An `/en/` prefix changes every canonical URL, every sitemap entry and every backlink, and needs a redirect for each old path.
* A rewrite from `/faq` to `/en/faq` means the Proxy runs on every marketing path. Today the Proxy matcher in `apps/web/proxy.ts` lists the marketing paths literally so that it skips them: a CDN hit on a prerendered page costs no function call, and the page's only policy is the hash header the build writes. A rewrite gives that up.
* The hash policy is keyed by the requested path. `marketing-csp.mjs` reads the prerendered paths from Next's manifest (`/en/faq`), while the header has to match the path the browser asked for (`/faq`), so the script would need a rewrite map. Its group check (`/(marketing)/`) and plain-path check hold, but the prerender gate would report `/[locale]/faq` routes and their params instead of one route per path.
* The `web vercel build (adapter)` CI job would have to prove that each header route matches the rewritten path, which no test covers today.
* Choosing the locale from `Accept-Language` reads a header, which makes the Proxy or the page dynamic.

**A second route group with a literal prefix (chosen).** English stays at its current URLs under `app/(marketing)`. Spanish lives under `app/(marketing-es)/es/`, a route group with its own root layout that passes `locale="es"` to the shared root document, so `<html lang>` is right without reading a request. Each Spanish page is a thin module that renders the same page component with the Spanish dictionary and builds its metadata with `pageMetadata` for that locale.

* Every page stays static, and the prerender gate, the per-path hash policy and the adapter job work unchanged in mechanism.
* The Proxy matcher gains the literal `es/...` paths, with the test in `apps/web/tests/unit/proxy-matcher.test.ts` extended to them, and `marketing-csp.mjs` accepts both groups.
* Moving between the two root layouts reloads the page, which is acceptable for a language switch.
* There is no automatic redirect by browser language. A visitor switches with a link in the header and footer, and search engines find the Spanish pages through `hreflang`.

### What is in place

* `app/(marketing-es)/layout.tsx` is the Spanish root layout: `RootDocument`, `MarketingShell` and the root metadata, each given `locale="es"`. The navigation and footer read their copy for the locale they are given.
* `SPANISH_PAGES` in `apps/web/lib/site/pages.ts` lists the English pages that have a Spanish version, each with a `translated` flag. That one list drives everything else:
  * an untranslated Spanish page is marked `noindex` and left out of the sitemap; a translated one is indexed and listed in the sitemap with its English page's rank;
  * the language switch (`components/marketing/LanguageSwitch.tsx`) links a page to its other version only when that entry is translated, in both directions, so no link leads to English text under `lang="es-419"`;
  * the `hreflang` set, `og:locale:alternate` and the sitemap alternates are declared only for a translated pair, so no indexed page names a `noindex` page as its alternate.
* `spanishPages()` in `apps/web/lib/site/spanish-pages.ts` adds a translated entry for each post under `content/blog/es`, so a translated post has no entry to keep by hand. It reads the posts from disk, so it runs on the server: `MarketingShell` passes its list to the navigation and footer, and the post pages and the sitemap pass it to `pageMetadata()` and `languageAlternates()`.
* Today the list holds the landing page, the FAQ, the security page, how it works and the blog index, all translated: `/es` renders `components/marketing/LandingPage.tsx`, `/es/faq` renders `components/marketing/FaqPage.tsx`, `/es/security` renders `components/marketing/SecurityPage.tsx` `/es/how-it-works` renders `components/marketing/HowItWorksPage.tsx` and `/es/blog` renders `components/blog/BlogIndexPage.tsx` in Spanish, each is indexed and listed in the sitemap, and the switch links each English page with its `/es` version. The security page's trust statements and server keys come from `trustStatements()` and `serverKeys()` (`lib/site/trust.ts`) for the page's locale, the same data the English page reads. Links from a Spanish page lead to the Spanish version of a page only once it is translated (`localeHref()`), and to the English page until then.
* A translated post is `content/blog/es/<slug>.mdx`, under its English post's slug, and is served at `/es/blog/<slug>` by `app/(marketing-es)/es/blog/[slug]/page.tsx`, which renders `components/blog/PostPage.tsx` like the English route. The pairing is the file name: a translation without a published English post fails the build. The English blog, its feed, `/content` and the English share images read only `content/blog`. A translated post:
  * has its own front matter, validated like an English post's, with `publishedAt` the day the translation was published;
  * links to the Spanish version of a page or post that has one and to the English page otherwise, and to the Spanish entry points (`tests/unit/blog-content.test.ts`);
  * keeps its English post's headings, lists, tables, code, reserve components, external links and app links (the same test), so a claim cannot be dropped or added without the test naming it;
  * states the base reserve through `<BaseReserve />` and `<BaseReserveCheckedOn />`, which format it for the post's locale;
  * has its own share image, drawn from its Spanish title at `/es/blog/<slug>/share.png`;
  * is listed on `/es/blog` and related to other Spanish posts only. There is no Spanish feed: the feed carries the project's updates, which are not translated, and only the English blog pages advertise it.
* An unknown `/es/blog/<slug>` is a routing miss, as an unknown `/blog/<slug>` is: each post route prerenders its slugs and takes no other (`dynamicParams = false`), so the request answers 404 with the full Spanish 404 page.
* The landing page embeds the FAQ. Its questions show in a locale only while `/faq` has a translated entry there (`isTranslated()`), so a Spanish landing never carries English answers.
* The Proxy matcher skips `es` (and its RSC payloads) literally, and `tests/unit/proxy-matcher.test.ts` walks both route groups, so a Spanish page without its matcher line fails the test. `marketing-csp.mjs` requires both groups to be prerendered, hashes each Spanish page like an English one, and checks that `/es/nope` and `/es/blog/nope` keep the nonce policy.
* An unknown path gets the 404 from `app/global-not-found.tsx` in the language of its path. The Proxy already runs on every unknown path for the nonce, and it also writes `x-lumenwipe-locale` (`localeOfPath()`: `es` for `/es` and every path under it, matched case-sensitively as the routes are, `en` for anything else) on every request it forwards, overwriting any value the client sent. The 404 reads it with `headers()`, accepts only a value in `LOCALES` and falls back to English. It was already rendered per request, so this adds no dynamic route and no route under `(marketing-es)`.
* `/` with `/es`, `/faq` with `/es/faq`, `/security` with `/es/security`, `/how-it-works` with `/es/how-it-works`, `/blog` with `/es/blog` and each translated post with its English post declare their `hreflang` set and `og:locale:alternate`, and their sitemap entries list both URLs. Translating another page and setting its flag turns all three on for that pair.

### `hreflang`, canonical and Open Graph

* `pageMetadata()` (`apps/web/lib/site/pages.ts`) keeps a self-referencing canonical per locale: `/faq` is canonical for English and `/es/faq` for Spanish. A Spanish page never points its canonical at the English page.
* `pageMetadata()` declares `alternates.languages` only for a translated pair (`languageAlternates()`): `en` to the English URL, `es` to the Spanish URL, and `x-default` to the English URL. Google ignores a pair that does not point at each other, and each version must list itself as well as the others ([Google Search Central, localized versions](https://developers.google.com/search/docs/specialty/international/localized-versions), checked 2026-11-16). This extends the canonical and share image work of #527 rather than replacing it.
* The sitemap lists the same set under both URLs of each translated pair (`sitemapPages()`).
* Every page shares a card in its own language. `shareImage()` (`apps/web/components/seo/ShareImage.tsx`) draws both locales from the same brand source: `siteShareCard(locale)` takes its copy from `SITE[locale].metadata.shareCard` and the example plan from `reserveExample(locale)`, and `postShareCard(post, locale)` takes the blog label and category from `BLOG[locale]`. The Spanish site card is served at `/es/opengraph-image` by `app/es/opengraph-image.tsx`, outside the route group as the English one is at `app/opengraph-image.tsx` (inside a route group Next serves a metadata image under a hashed path), and each Spanish post's card at `/es/blog/<slug>/share.png`, both prerendered like the English ones. `shareImageFor(locale)` and `postShareImage(slug, title, locale)` give their URL and alt text, which `pageMetadata()` and `rootMetadata()` use for `og:image` and `twitter:image`. The bundled `next/og` font (Geist) covers the Spanish accents, `ñ`, `¿` and `¡`.
* `og:locale` is `en_US` or `es_LA`, and each page of a translated pair lists the other as `og:locale:alternate`.
* The structured data carries `inLanguage`, the `<html lang>` tag of the language the page is written in (`en` or `es-419`), on its page-level nodes: `WebSite`, `WebApplication`, `FAQPage`, `Blog` and `Article`. Its names and labels (the breadcrumb, the blog's name, the live protocol exits in the feature list) come from the dictionary.

### Locale tags

| Use | English | Spanish | Why |
| - | - | - | - |
| `<html lang>` | `en` | `es-419` | A region subtag is used only when it adds information; `es-419` means Spanish as spoken in Latin America ([W3C, choosing a language tag](https://www.w3.org/International/questions/qa-choosing-language-tags), checked 2026-11-16). |
| `hreflang` | `en` | `es` | Google supports only ISO 639-1 language codes and ISO 3166-1 alpha-2 regions, and names `es-419` as unsupported ([Google Search Central](https://developers.google.com/search/docs/specialty/international/localized-versions), checked 2026-11-16). `es` targets every Spanish reader, which is the audience. |
| `og:locale` | `en_US` | `es_LA` | Open Graph uses `language_TERRITORY` ([ogp.me](https://ogp.me/), checked 2026-11-16), and Meta uses `es_LA` as its umbrella Spanish locale ([Meta JavaScript SDK localization](https://developers.facebook.com/docs/javascript/internationalization), checked 2026-11-16). |
| Dates and numbers | `en-US` | `es-419` | The same tag as the document. |

## Language

* **Neutral Latin American Spanish.** No regional vocabulary, no voseo, no vosotros, and no idiom that reads as one country's. Amounts keep the formatting of `es-419` from the format helper.
* **Tú, not usted.** The wallets and exchanges our readers already use address them as tú, and usted reads distant on a page that asks them to sign.
* **Protocol terms stay in English**, because they are what wallets, explorers and the Stellar docs show. On a page's first use, the term is followed by a gloss in parentheses; after that it stands alone.

| Term | Gloss on first use |
| - | - |
| trustline | línea de confianza con un emisor de activos |
| merge, account merge | fusión que cierra la cuenta y envía su saldo |
| offer | orden abierta en el libro de órdenes |
| data entry | dato guardado en la cuenta |
| signer | firmante adicional de la cuenta |
| subentry | elemento que bloquea reserva |
| base reserve | unidad de reserva que fija la red |
| claimable balance | saldo reclamable |
| fee bump | sobre que paga la comisión de otra transacción |
| memo | memo que identifica el depósito |
| relay account | cuenta intermedia que reenvía el saldo |
| pool shares | participaciones en un pool de liquidez AMM |

Product names (LumenWipe, Stellar, Soroban, the protocol names), asset codes (XLM) and code identifiers are never translated.

`apps/web/tests/unit/spanish-dictionary.test.ts` walks every section a translated page reads and fails on a missing entry, or one that reads the same as the English, unless it holds only the names and protocol terms it lists. A translated section is added to its `SECTIONS`.

## Rollout

Two pull requests under #534 do the extraction: the dictionary, the helpers, the guard, the navigation, footer, 404, landing and FAQ first, then security and how it works. Translation is a separate epic, with these issues in order:

1. **\[web] Move the copy of the stats, registry, playground and content pages and the blog index into the locale dictionary.** The same extraction for the pages #534 leaves out, with the guard extended to them.
2. **\[web] Serve a Spanish locale under `/es`.** The `(marketing-es)` route group and its root layout, the locale tags, a language switcher, the Proxy matcher entries and their test, `marketing-csp.mjs` coverage of the second group, and the sitemap alternates. No page is translated yet: the group starts with the landing page in English behind `noindex`.
3. **\[web] Add `hreflang`, Open Graph and structured data alternates for localized pages.** `alternates.languages` with `x-default` in `pageMetadata()`, `og:locale:alternate`, `inLanguage`, and the remaining English strings in `lib/site/structured-data.ts`.
4. **\[web] Translate the navigation, footer, 404 and landing page into Spanish.**
5. **\[web] Translate the FAQ and its structured data into Spanish.**
6. **\[web] Translate the security and how it works pages into Spanish.**
7. **\[web] Translate the five merge-blocker articles into Spanish.** Extra signers, open offers, trustlines, data entries and claimable balances, each with its own canonical and `hreflang` pair.
8. **\[web] Give Spanish pages Spanish share images.**

Each translation issue sets `translated: true` on the `SPANISH_PAGES` entries it ships, which removes their `noindex`, adds them to the sitemap and shows the language switch on both versions, and adds the sitemap alternates with the first one.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.