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

[feature request] show all languages in navbar or a button with the active language instead of "world button" #91

Open
tjebo opened this issue Dec 19, 2024 · 7 comments
Labels
enhancement New feature or request

Comments

@tjebo
Copy link

tjebo commented Dec 19, 2024

Maybe this is already possible, but I didn't see this in the vignette nor in the readme.
I wondered if it might be possible, instead of having a "world" button and a dropdown, to show the active language on the button, (with same functionality, a dropdown). (maybe by default the language code, e.g. "EN","FR", etc)

Or, if we have only say two languages, to show both languages as buttons?

Anyways, thanks for the package! It helped me creating my bilingual website. I am more than happy to credit your package if you have a suggestion where you would usually put those credits.

@maelle maelle added the enhancement New feature or request label Dec 20, 2024
@maelle
Copy link
Contributor

maelle commented Dec 20, 2024

Thank you! I think @yabellini will agree with you as I think she said the world button was not optimal. Yani, could you please refresh my memory?

Thanks for asking about credits. You don't have to add them at all, even our very own https://devguide.ropensci.org/ (which was why we created babelquarto) doesn't refer to the tool at all. 🙈

@yabellini
Copy link

I agree with @tjebo and like the suggestion to have the language as a dropdown menu. I would use the full name:
-English
-Español

I suggested we did as Wikipedia:
image

@yabellini
Copy link

About the credit for the package, I also agree with @maelle , but if you want to mention it anyway, some website mention the tools they use in a kind of footer, here is an example of my website mentioning Hugo Apero:

image

Thank you for asking!

@maelle
Copy link
Contributor

maelle commented Dec 20, 2024

Thanks @yabellini!

Let's collect others' thoughts and then I could work on this next year. @Nenuial @joelnitta do you have any preference regarding the language button? Would using a Wikipedia-style one be ok with you?

I am not sure about showing the number of languages, as for most projects the goal won't be to have as many as possible.

I like the language button on https://developer.mozilla.org/fr/docs/Web/HTML, it's really nice how one of them has an experimental button to indicate a language translation is in progress.

@yabellini
Copy link

I like the Mozilla one! I'm also okay with no showing the number of languages. It makes sense for Wikipedia, but probably not for us.

@tjebo
Copy link
Author

tjebo commented Dec 22, 2024

thanks for your feedback and comments. I'm glad to hear that this is of interest.

Maybe the below might also be of interest for you:
In order to make the possibility to switch to a different language more visible for my website, I have added a direct link on my index page for my portuguese readers like here:

Capture

For this to work, I have simply inserted a hyperlink to the portuguese index page. This works, but it feels a bit like a hack, because I am essentially using a link for a page that "not yet exists", and it might also break when you should maybe at some point modify the page structure.

@joelnitta
Copy link
Contributor

What if the following options were made available in the YAML configuration:

  • icon: path or shortcode for icon to use for language selector button (it would be great to be able to use a shortcode to take advantage of all of the Quarto icon extensions).
  • show-lang: boolean, to show the currently selected language next to the button or not.
  • show-lang-count: boolean, to show the total number of languages in Wikipedia style next to the button or not.

show-lang could grab the text from languagecodes. But show-lang-count would be trickier to show in the current language of the website as the user would need to provide a translation for each language.

For the text link... maybe an R function could be provided that returns a link to the current page in the selected language?

In a Quarto file:

`r show_lang_link("See a version in English", "en")`

It is a fundamentally different use of babelquarto than so far, but I don't think that is necessarily a problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants