Skip to content

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
@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

2 participants