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

Guidance on translating plots and tables #43

Open
olivroy opened this issue Aug 15, 2023 · 5 comments
Open

Guidance on translating plots and tables #43

olivroy opened this issue Aug 15, 2023 · 5 comments
Labels
enhancement New feature or request

Comments

@olivroy
Copy link

olivroy commented Aug 15, 2023

For example, gt, or ggplot2.

I know gt started supporting a more centralized locale definition.
rstudio/gt#1347

In ggplot2, I don't think it's possible,

I mostly manually do

# EN
scale_x_continuous(name = "count", labels = scales::label_comma())
# FR
scale_x_continuous(name = "Fréquence", labels = scales::label_number(decimal.mark = ",", big.mark = " "))

But I wonder if this package could possibly help or direct people to resources.

Nice work so far, excited to see what's next

Edited to add the translation of the label.

@maelle
Copy link
Contributor

maelle commented Aug 29, 2023

Oh, that's interesting! babeldown does nothing for code translation yet.

I'll leave this open to check again later if ggplot2 introduces some sort of central locale definition.

I imagine an ideal document to translate would have a "setup" code chunk with locale stuff, and babeldown could store/use some standard definitions by language.

@olivroy
Copy link
Author

olivroy commented Aug 29, 2023

Sounds good. I also updated my example to reflect better that my label needs to be updated as well. :)

But I think there is a growing desire for multilingual support, such as the (recent) addition of French in the RStudio IDE, and this issue to help toggle more easily between languages rstudio/rstudio#12223 in a document.

Excited to see where this will lead!

@maelle
Copy link
Contributor

maelle commented Aug 29, 2023

if babeldown were to ever translate strings in code, these would need to be marked up somehow. something to think about.

@maelle maelle added the enhancement New feature or request label Jan 25, 2024
@olivroy
Copy link
Author

olivroy commented May 16, 2024

Since RStudio added support for displaying label attribute in tooltip, it made me dig a little bit more on that and I am thinking this could be an interesting avenue to explore.

rstudio/rstudio#14242

I learned that gt applies the labels by default columns with a label attribute and ggplot2.

mtcars |> 
  labelled::set_variable_labels(
    vs = "a label"
   ) |>
  gt::gt()

ggplot2 has a PR opened to support this tidyverse/ggplot2#5879. I think this is an interesting framework to work with to standardize some labelling and translations.

This would make it easier to translate plots and tables since it is easy to get a set of labels somewhere.

I made this post a few months ago with not much luck unfortunately, https://fosstodon.org/@olivroy/111981211310295084

Having a data source where you store label attributes is pretty easy to use

@teunbrand
Copy link

I'll leave this open to check again later if ggplot2 introduces some sort of central locale definition.

You can open this as a feature request in ggplot2, but as I work exclusively in English while Dutch is my native tongue, I don't really know what types of things are expected to change.

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

3 participants