Skip to content

feat: add header language switcher for multilingual pages#137

Merged
htnabe merged 2 commits into
devfrom
feat/add-language-select
May 23, 2026
Merged

feat: add header language switcher for multilingual pages#137
htnabe merged 2 commits into
devfrom
feat/add-language-select

Conversation

@htnabe
Copy link
Copy Markdown
Owner

@htnabe htnabe commented May 23, 2026

Overview

Add a header language switcher for multilingual sites so users can switch to available language versions from the current page context.

Changes

  • Add header language dropdown in layouts/partials/header.html
    • Shows configured site languages
    • Links to translated page when available, with language-home fallback
  • Add i18n keys for language switch aria label
    • i18n/en.yaml
    • i18n/ja.yaml
  • Add/adjust E2E tests for language switch behavior
    • tests/e2e/navigation.spec.ts
  • Replace/removal updates around styling and examples
    • Remove unused assets/css/widgets/amazon.scss
    • Remove its import from assets/css/styles.scss
    • Add Amazon shortcode examples in:
      • exampleSite/content/posts/tech/hello-world.md
      • exampleSite/content/posts/tech/hello-world.en.md
  • Include dependency updates reflected in package.json and package-lock.json

Related Issues

Closes #130

Checklist

  • Self-review done (following review.prompt.md)
  • Hugo production build passes: cd exampleSite && hugo --gc --minify
  • Docs updated if behavior changed
  • No unrelated changes included

Notes for Reviewers

  • npm run test:e2e passes locally after installing Playwright browsers.
  • Hugo prints deprecation warnings for language keys/properties (LanguageCode / LanguageName); behavior is currently valid but may require future migration to Locale / Label.

Copilot AI review requested due to automatic review settings May 23, 2026 16:01
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a header-level language switcher to support multilingual Hugo sites, enabling users to switch languages while staying on the translated version of the current page when available.

Changes:

  • Add a Bootstrap dropdown language switcher to layouts/partials/header.html, linking to the translated page when present and falling back to the target language’s home page.
  • Add i18n strings for the switcher’s accessibility label (i18n/en.yaml, i18n/ja.yaml) and extend Playwright E2E navigation tests for the switcher.
  • Housekeeping updates: remove unused Amazon widget SCSS/import, add Amazon shortcode examples to example content, and update dev dependencies/lockfile.

Reviewed changes

Copilot reviewed 9 out of 10 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
layouts/partials/header.html Adds a header language dropdown that resolves translation URLs per page with home fallback.
i18n/en.yaml Adds i18n key for the language switcher aria-label.
i18n/ja.yaml Adds i18n key for the language switcher aria-label.
tests/e2e/navigation.spec.ts Adds E2E coverage for language switcher visibility and navigation.
assets/css/widgets/amazon.scss Removes an unused Amazon widget stylesheet.
assets/css/styles.scss Removes the Amazon widget SCSS import.
exampleSite/content/posts/tech/hello-world.md Adds an Amazon shortcode usage example (JA).
exampleSite/content/posts/tech/hello-world.en.md Adds an Amazon shortcode usage example (EN).
package.json Updates devDependency versions (notably lint-staged).
package-lock.json Lockfile updates reflecting dependency bumps.

Comment thread package.json
Comment thread tests/e2e/navigation.spec.ts
@htnabe htnabe merged commit cd9640e into dev May 23, 2026
3 checks passed
@htnabe htnabe deleted the feat/add-language-select branch May 23, 2026 16:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants