Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Canada.ca template: Make language swap toggle dynamic based on current URL #561

Open
gordlin opened this issue Feb 25, 2025 · 0 comments
Open
Labels
Bug Something isn't working Canada.ca Template Work in and around the Canada.ca/CDTS template

Comments

@gordlin
Copy link
Member

gordlin commented Feb 25, 2025

Description

On the Canada.ca template, clicking on the language swap toggle (Francais/English) always brings you to the other-language version of the page you initially loaded into, no matter what page you're currently on.

Steps to reproduce

  1. Go to any product on the Canada.ca template
  2. Swap languages. Since you're still on the same page, it works fine.
  3. Change pages (e.g. get into the main editor page).
  4. Swap languages. You're now sent to the other-language version of the page you initially loaded into (in step 1/2)!

Expected behavior

The link in the language swap toggle should be dynamic based on the current URL. It should send you to the current page in the other language.

Actual behavior

The toggle sends you to the initially-loaded page in the other language

Additional information

This is because the code for the toggles (in index-ca-en.html and index-ca.fr.html) hard-codes the links for the toggles on initial creation; whatever the links were at the beginning will be what they are throughout the session, until a page reload.

Related issues

Discussed in #530 (review)

@gordlin gordlin added Bug Something isn't working Canada.ca Template Work in and around the Canada.ca/CDTS template labels Feb 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working Canada.ca Template Work in and around the Canada.ca/CDTS template
Projects
None yet
Development

No branches or pull requests

1 participant