feat: add header language switcher for multilingual pages#137
Merged
Conversation
Contributor
There was a problem hiding this comment.
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
Add a header language switcher for multilingual sites so users can switch to available language versions from the current page context.
Changes
layouts/partials/header.htmli18n/en.yamli18n/ja.yamltests/e2e/navigation.spec.tsassets/css/widgets/amazon.scssassets/css/styles.scssexampleSite/content/posts/tech/hello-world.mdexampleSite/content/posts/tech/hello-world.en.mdpackage.jsonandpackage-lock.jsonRelated Issues
Closes #130
Checklist
review.prompt.md)cd exampleSite && hugo --gc --minifyNotes for Reviewers
npm run test:e2epasses locally after installing Playwright browsers.LanguageCode/LanguageName); behavior is currently valid but may require future migration toLocale/Label.