---
id: portfolio.ds.language-switcher
name: "Language Switcher"
type: subcomponent
status: active
relations: [{"type":"composes","target":"portfolio.ds.header-menu-button"},{"type":"related_to","target":"portfolio.ds.header-top-part"}]
sources: ["apps/portfolio-site/src/design-system/docs/language-switcher.astro","apps/portfolio-site/src/lib/designSystemRegistry.ts","packages/design-system/src/components/Header.astro","packages/design-system/src/components/HeaderTopPart.astro","packages/design-system/src/components/LanguageSwitcher.astro"]
catalog: ["apps/portfolio-site/src/design-system/docs/language-switcher.astro"]
previews: ["apps/portfolio-site/src/design-system/docs/language-switcher.astro"]
---
# Language Switcher

## Purpose

Header-only language navigation for English, Russian, and Latvian public pages.

## Contract

- Used only inside `Header Top Part`.
- Renders exactly two native links to the languages other than the requested language.
- Uses visible labels `EN`, `RUS`, and `LV`; does not use flags.
- Preserves the current public page path when localized routes exist.
- Adds `lang` and `hreflang` metadata to every language link.
- Composes `Header Menu Button` and inherits its interaction states.
- Does not mark a language as selected; the active language is omitted.
- Translation fallback does not change which requested language is omitted.

## Use

- Use in `Header Top Part` on pages that participate in the public English, Russian, and Latvian route system.

## Do Not Use

- Do not render the active language as a third option.
- Do not use flags, JavaScript-only navigation, or an application-local replacement for `Header Menu Button`.

## Accessibility

- Uses a named navigation landmark.
- Every link has a visible text label and a language destination.
- Must remain readable and operable at the narrowest supported viewport.

## Code Paths

- `packages/design-system/src/components/LanguageSwitcher.astro`
- `packages/design-system/src/components/HeaderTopPart.astro`
- `packages/design-system/src/components/Header.astro`
- `apps/portfolio-site/src/design-system/docs/language-switcher.astro`

## Verification

- Confirm English renders `RUS` and `LV`, Russian renders `EN` and `LV`, and Latvian renders `EN` and `RUS`.
- Confirm each link preserves the canonical public path.
- Run `scripts/design-system-graph --check --no-write`.
