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

Use url builder to generate all URLs #30

Merged
merged 2 commits into from
Oct 17, 2024
Merged

Use url builder to generate all URLs #30

merged 2 commits into from
Oct 17, 2024

Conversation

wheelsandcogs
Copy link
Collaborator

@wheelsandcogs wheelsandcogs commented Oct 16, 2024

This simplifies creating URLs by not having to worry about translation - just pass the builder the actual route and the expected locale, and it will return a URL string with the locale and a translated path.

If the current locale is English, it will just skip the path translation completely to save on the translation lookups.

"confirm": "confirm",
"sources": "sources",
"source_confirmation": "source-confirmation",
"tasklist": "tasklist"
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Technically these should never get used as the url builder skips attempting to translate URLs when the locale is English.

However, we'll need them as fallback if the Welsh is missing, and the Welsh language translations need the right keys in order to work, so it makes sense for the English translation file to have them as a source.

Copy link
Collaborator Author

@wheelsandcogs wheelsandcogs Oct 16, 2024

Choose a reason for hiding this comment

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

PS - these must be flat - the builder translates each part of the path individually not as a whole.

@wheelsandcogs wheelsandcogs merged commit d41058c into main Oct 17, 2024
3 checks passed
@wheelsandcogs wheelsandcogs deleted the task/build-url branch October 17, 2024 08:15
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