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

Ensure that supplied locale is normalized when creating an interactive table #1643

Merged
merged 1 commit into from Apr 27, 2024

Conversation

rich-iannone
Copy link
Member

When using an interactive table, the locale value (supplied in the initial gt() call) is retrieved in order to display elements/controls in the language of the locale. However, there are a few ways to write a locale and internally normalize_locale() is used to standardize a provided locale to a chosen form.

This wasn't done in the codepath for making an interactive table so using "fr_CH" instead of "fr-CH" would have resulted in english text (the result of a failed lookup). This PR ensures that the locale value is normalized so the following code works as expected:

library(gt)
library(tidyverse)

mtcars |> 
  mutate(mpg = mpg*1000) |> 
  gt(locale = "de_CH") |> # or "fr_CH"
  fmt_number(mpg, decimals = 2) |>
  opt_interactive()

Fixes: #1637

@rich-iannone rich-iannone merged commit f327659 into master Apr 27, 2024
12 checks passed
@rich-iannone rich-iannone deleted the fix-normalize-locale-interactive-tbl branch April 27, 2024 22:14
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.

opt_interactive() with locale "de_CH" and "fr_CH" not working
1 participant