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

Enables i18ned footer links #1119

Merged
merged 3 commits into from
Feb 26, 2024
Merged

Conversation

geichelberger
Copy link
Contributor

This changes the footer custom link type from string to TranslatedString, enabling links to resources, especially documents like PDFs, in different languages with just one link.

This changes the footer custom link type from `string` to
`TranslatedString`, enabling links to resources, especially documents
like PDFs, in different languages with just one link.
Copy link
Member

@LukasKalbertodt LukasKalbertodt left a comment

Choose a reason for hiding this comment

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

That feature makes sense to me! I would still assume that many of those footer entries will only have one link for all languages. And this is a breaking change (which is fine, but slightly annoying to update). Could you make Tobira accept both in the config, a translated map or a simple string? I think it should work with sth like:

#[derive(Deserialize)]
#[serde(untagged)]
enum OptionallyTranslatedString {
    Translated(TranslatedString),
    Simple(String)
}

But I'm not 100% sure. If you can't get it to work quickly, just ping me then either I can try or we can just merge this as is.

Make the translated links optional, as breaking changes in the config is
annoying.
@geichelberger
Copy link
Contributor Author

Initially, I tried to alter the deserialization with Serde to automatically translate a string to a map with an en entry as a fallback. So, I added a Visitor to the Deserializer, but it didn't compile.

Copy link
Member

@LukasKalbertodt LukasKalbertodt left a comment

Choose a reason for hiding this comment

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

Just a small doc remark, otherwise this is good to go!

backend/src/config/general.rs Outdated Show resolved Hide resolved
Extend the footer_inks example to showcase both ways of declaring custom
links and extending the description.
@LukasKalbertodt LukasKalbertodt merged commit f2ffd7b into elan-ev:master Feb 26, 2024
5 checks passed
@LukasKalbertodt LukasKalbertodt added the changelog:admin Changes primarily for admins label Feb 26, 2024
@geichelberger geichelberger deleted the i18n-link branch February 26, 2024 16:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog:admin Changes primarily for admins
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants