Skip to content

Commit

Permalink
Merge pull request #1894 from olivroy/gt-locale
Browse files Browse the repository at this point in the history
Add `gt.locale` option
  • Loading branch information
rich-iannone authored Sep 27, 2024
2 parents 7e265f7 + 4960543 commit 78f8afb
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 5 deletions.
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

* PDF output now defaults to a full-width floating environment using `tabular*` (@AronGullickson, #1588). Float position can be controlled by the `latex.tbl.pos` argument in `tab_options`. Quarto users can alternatively use the `tbl-pos` argument to control positioning. To use a `longtable` environment instead, use `tab_option(latex.use_longtable = TRUE)`.

* The `locale` argument of `gt()` now defaults to `getOption("gt.locale")` if set (#1894).

## Interactive table support

* Interactive tables will show no border if `opt_table_lines(extent = "none")` is specified (#1307).
Expand Down
5 changes: 3 additions & 2 deletions R/gt.R
Original file line number Diff line number Diff line change
Expand Up @@ -120,12 +120,13 @@
#'
#' @param locale *Locale identifier*
#'
#' `scalar<character>` // *default:* `NULL` (`optional`)
#' `scalar<character>` // *default:* `getOption("gt.locale")` (`optional`)
#'
#' An optional locale identifier that can be set as the default locale for all
#' functions that take a `locale` argument. Examples include `"en"` for
#' English (United States) and `"fr"` for French (France). We can call
#' [info_locales()] as a useful reference for all of the locales that are supported.
#' If set, `options(gt.locale)` is also consulted.
#'
#' @param row_group.sep *Separator text for multiple row group labels*
#'
Expand Down Expand Up @@ -302,7 +303,7 @@ gt <- function(
row_group_as_column = FALSE,
auto_align = TRUE,
id = NULL,
locale = NULL,
locale = getOption("gt.locale"),
row_group.sep = getOption("gt.row_group.sep", " - ")
) {

Expand Down
2 changes: 2 additions & 0 deletions R/zzz.R
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,8 @@ utils::globalVariables(
#'
#' **gt** uses the following [options()] to configure behavior:
#'
#' - `gt.locale`: A [locale][info_locales()] to yse by default in
#' the [gt()] function.
#' - `gt.row_group.sep`: A separator between groups for the row group label. By
#' default this is `" - "`.
#' - `gt.html_tag_check`: A logical scalar indicating whether or not to print a
Expand Down
2 changes: 2 additions & 0 deletions man/gt-options.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions man/gt.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 78f8afb

Please sign in to comment.