-
Notifications
You must be signed in to change notification settings - Fork 7
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
'Home' button doesn't get translated in websites #15
Comments
Nevermind, figured it out: The For example,
Then, set For example,
|
...Sorry for the confusion. Turns out I'm still having problems. I am unable to set Work around for now is just not to have an "About" button in the navbar, which is not so terrible... so this is not high priority. |
I wonder now why have home in the navbar though? I know that's what I did in the example, but since there's the link at the top left, isn't it too much? |
Yes. As I mentioned above, I also realized it's OK just not to have the additional "About" in the navbar. Please feel free to close if you want. ... But I would just say there are some cases where you might want to have slightly different text in the navbar that the page title. The |
Ok, let's leave it open. We have title-ja etc, I'll have to think about how to store other translations. I'd like to not have more than the Quarto configuration and the translated files but maybe I'll end up having to adopt po files or something 🙀 |
for book parts babelquarto detects fields such as "part-es", maybe it could be the same, would that be cumbersome 🤔 |
maybe there should be a general solution: for any field in Could that backfire somehow (could another field be called "the same name + an hyphen + a language code" without being a translation 😅) |
I think that sounds good. That would enable having a single I don't think the backfire situation is likely. But there should be a list of all quarto fields somewhere that you could check. |
brio::read_lines("joel.yaml")
#> [1] "project:"
#> [2] " type: website"
#> [3] ""
#> [4] "website:"
#> [5] " title: \"Joel Nitta\""
#> [6] " navbar:"
#> [7] " background: primary"
#> [8] " right:"
#> [9] " - href: index.qmd"
#> [10] " text: Home"
#> [11] " - href: publications.qmd"
#> [12] " text: Publications"
#> [13] " - href: software.qmd"
#> [14] " text: Software"
#> [15] " - href: blog.qmd"
#> [16] " text: Blog"
#> [17] " - href: talks.qmd"
#> [18] " text: Talks"
#> [19] " - href: content/pdf/Nitta_CV.pdf"
#> [20] " text: \"CV\""
#> [21] " - href: https://www.ja.joelnitta.com"
#> [22] " text: \"Japanese\""
#> [23] ""
#> [24] "format:"
#> [25] " html:"
#> [26] " theme:"
#> [27] " light: cosmo"
#> [28] " dark: superhero"
#> [29] " css: jnitta_theme.css"
#> [30] " toc: true"
#> [31] " comments:"
#> [32] " giscus:"
#> [33] " repo: joelnitta/joelnitta-home"
#> [34] " repo-id: R_kgDOGZGr3w"
#> [35] " category: Comments"
#> [36] " category-id: DIC_kwDOGZGr384B_-52"
#> [37] " mapping: pathname"
#> [38] " reactions-enabled: false"
#> [39] " input-position: top"
#> [40] " theme: light"
#> [41] " language: en"
#> [42] " include-in-header: header.html"
#> [43] ""
#> [44] "babelquarto-ja:"
#> [45] " format:"
#> [46] " html:"
#> [47] " comments:"
#> [48] " giscus:"
#> [49] " language: ja"
yaml <- yaml::read_yaml("joel.yaml")
(general_fields <- yaml[!grepl("^babelquarto-", names(yaml))])
#> $project
#> $project$type
#> [1] "website"
#>
#>
#> $website
#> $website$title
#> [1] "Joel Nitta"
#>
#> $website$navbar
#> $website$navbar$background
#> [1] "primary"
#>
#> $website$navbar$right
#> $website$navbar$right[[1]]
#> $website$navbar$right[[1]]$href
#> [1] "index.qmd"
#>
#> $website$navbar$right[[1]]$text
#> [1] "Home"
#>
#>
#> $website$navbar$right[[2]]
#> $website$navbar$right[[2]]$href
#> [1] "publications.qmd"
#>
#> $website$navbar$right[[2]]$text
#> [1] "Publications"
#>
#>
#> $website$navbar$right[[3]]
#> $website$navbar$right[[3]]$href
#> [1] "software.qmd"
#>
#> $website$navbar$right[[3]]$text
#> [1] "Software"
#>
#>
#> $website$navbar$right[[4]]
#> $website$navbar$right[[4]]$href
#> [1] "blog.qmd"
#>
#> $website$navbar$right[[4]]$text
#> [1] "Blog"
#>
#>
#> $website$navbar$right[[5]]
#> $website$navbar$right[[5]]$href
#> [1] "talks.qmd"
#>
#> $website$navbar$right[[5]]$text
#> [1] "Talks"
#>
#>
#> $website$navbar$right[[6]]
#> $website$navbar$right[[6]]$href
#> [1] "content/pdf/Nitta_CV.pdf"
#>
#> $website$navbar$right[[6]]$text
#> [1] "CV"
#>
#>
#> $website$navbar$right[[7]]
#> $website$navbar$right[[7]]$href
#> [1] "https://www.ja.joelnitta.com"
#>
#> $website$navbar$right[[7]]$text
#> [1] "Japanese"
#>
#>
#>
#>
#>
#> $format
#> $format$html
#> $format$html$theme
#> $format$html$theme$light
#> [1] "cosmo"
#>
#> $format$html$theme$dark
#> [1] "superhero"
#>
#>
#> $format$html$css
#> [1] "jnitta_theme.css"
#>
#> $format$html$toc
#> [1] TRUE
#>
#> $format$html$comments
#> $format$html$comments$giscus
#> $format$html$comments$giscus$repo
#> [1] "joelnitta/joelnitta-home"
#>
#> $format$html$comments$giscus$`repo-id`
#> [1] "R_kgDOGZGr3w"
#>
#> $format$html$comments$giscus$category
#> [1] "Comments"
#>
#> $format$html$comments$giscus$`category-id`
#> [1] "DIC_kwDOGZGr384B_-52"
#>
#> $format$html$comments$giscus$mapping
#> [1] "pathname"
#>
#> $format$html$comments$giscus$`reactions-enabled`
#> [1] FALSE
#>
#> $format$html$comments$giscus$`input-position`
#> [1] "top"
#>
#> $format$html$comments$giscus$theme
#> [1] "light"
#>
#> $format$html$comments$giscus$language
#> [1] "en"
#>
#>
#>
#> $format$html$`include-in-header`
#> [1] "header.html"
(japenese_fields <- modifyList(general_fields, yaml[["babelquarto-ja"]]))
#> $project
#> $project$type
#> [1] "website"
#>
#>
#> $website
#> $website$title
#> [1] "Joel Nitta"
#>
#> $website$navbar
#> $website$navbar$background
#> [1] "primary"
#>
#> $website$navbar$right
#> $website$navbar$right[[1]]
#> $website$navbar$right[[1]]$href
#> [1] "index.qmd"
#>
#> $website$navbar$right[[1]]$text
#> [1] "Home"
#>
#>
#> $website$navbar$right[[2]]
#> $website$navbar$right[[2]]$href
#> [1] "publications.qmd"
#>
#> $website$navbar$right[[2]]$text
#> [1] "Publications"
#>
#>
#> $website$navbar$right[[3]]
#> $website$navbar$right[[3]]$href
#> [1] "software.qmd"
#>
#> $website$navbar$right[[3]]$text
#> [1] "Software"
#>
#>
#> $website$navbar$right[[4]]
#> $website$navbar$right[[4]]$href
#> [1] "blog.qmd"
#>
#> $website$navbar$right[[4]]$text
#> [1] "Blog"
#>
#>
#> $website$navbar$right[[5]]
#> $website$navbar$right[[5]]$href
#> [1] "talks.qmd"
#>
#> $website$navbar$right[[5]]$text
#> [1] "Talks"
#>
#>
#> $website$navbar$right[[6]]
#> $website$navbar$right[[6]]$href
#> [1] "content/pdf/Nitta_CV.pdf"
#>
#> $website$navbar$right[[6]]$text
#> [1] "CV"
#>
#>
#> $website$navbar$right[[7]]
#> $website$navbar$right[[7]]$href
#> [1] "https://www.ja.joelnitta.com"
#>
#> $website$navbar$right[[7]]$text
#> [1] "Japanese"
#>
#>
#>
#>
#>
#> $format
#> $format$html
#> $format$html$theme
#> $format$html$theme$light
#> [1] "cosmo"
#>
#> $format$html$theme$dark
#> [1] "superhero"
#>
#>
#> $format$html$css
#> [1] "jnitta_theme.css"
#>
#> $format$html$toc
#> [1] TRUE
#>
#> $format$html$comments
#> $format$html$comments$giscus
#> $format$html$comments$giscus$repo
#> [1] "joelnitta/joelnitta-home"
#>
#> $format$html$comments$giscus$`repo-id`
#> [1] "R_kgDOGZGr3w"
#>
#> $format$html$comments$giscus$category
#> [1] "Comments"
#>
#> $format$html$comments$giscus$`category-id`
#> [1] "DIC_kwDOGZGr384B_-52"
#>
#> $format$html$comments$giscus$mapping
#> [1] "pathname"
#>
#> $format$html$comments$giscus$`reactions-enabled`
#> [1] FALSE
#>
#> $format$html$comments$giscus$`input-position`
#> [1] "top"
#>
#> $format$html$comments$giscus$theme
#> [1] "light"
#>
#> $format$html$comments$giscus$language
#> [1] "ja"
#>
#>
#>
#> $format$html$`include-in-header`
#> [1] "header.html" Created on 2023-09-29 with reprex v2.0.2 |
I'm sorry to drop the ball on this, but I won't have time to work on this in the sort/medium term. 😞 @beamilz you too might be interested in more configuration tweaks between languages. After using language profiles for something else recently, I agree it'd be a good idea! Then each rendering would "just" need to set the correct environment variable. |
Related comment: #54 (comment) |
If @Nenuial's suggestion works, it means we solved this issue, correct? |
I don't think so, for the reason that we still don't have complete control over translation of the content in the navbar. For a minimal example, please see this repo: https://github.com/joelnitta/test-babelq-profiles In my translation, I want to have different text on the navbar for each of
It is not possible to have
or
So the translated text for |
I'm not sure I understand what you are trying to do. You want index.qmd and about.qmd to show up in the navbar? In each language with their respective title? I don't understand why that shouldn't be possible. Or you want those two pages to show up in the navbar with a text that is different from their title? |
This has expanded a bit past the OP, but I would like to be able to control each item in the navbar. My answer is "yes" to both of your questions. I would like to be able to control the name of the page in the navbar separately from its title on the page. I would like to be able to avoid having to include at least one item under |
I don't understand why you can't control everything from the profiles _quarto-en.yml and _quarto-ja.yml. For a different title you could do something along the lines of: website:
navbar:
left:
- text: "The title you want"
href: index.qmd
- about.qmd In _quarto-en.yml. This changes the title shown for index.qmd but reads the title from the about.qmd file. Depending on what you want, that means you will have to repeat some of the navbar configuration in both |
Did you see my code? The problem is that setting
|
Oh! I think I understand what you mean! You need to have a navbar configuration present in the _quarto.yml file, otherwise babelquarto fails some checks? I have the following on one of my website in the _quarto.yml: website:
navbar:
background: "#ffffff" This way there's a navbar key present but no content. All the navbar content is defined in the language profiles, nothing is set in the main _quarto.yml file. |
Yes, that is what I'm going for. Except that I'd like to define the navbar color from my theme instead of over-riding it. |
This should work for you: website:
title: "test-site"
navbar:
left: [] in _quarto.yml |
Great news! I'll document this in the page about profiles for future reference. Maybe there's a better way to do the checks, but I see no obvious way to do it yet (see #69). I'll close this issue. |
Yay, a happy ending! Thanks @Nenuial! And thanks @joelnitta for kicking the tires! |
This is only relevant for #11.
The 'home' button appears the same in the translated website, but I would like to have it translated into the target language:
The text was updated successfully, but these errors were encountered: