feat: starting to implement translations throughout the UI

This commit is contained in:
Andreas Gammelgaard Damsbo 2025-09-10 12:00:03 +02:00
commit 96e08e44d8
No known key found for this signature in database
42 changed files with 1547 additions and 750 deletions

View file

@ -21,7 +21,7 @@ list_allowed_operations()
modal_create_column(
id,
title = i18n("Create a new column"),
title = i18n$t("Create a new column"),
easyClose = TRUE,
size = "l",
footer = NULL
@ -29,7 +29,7 @@ modal_create_column(
winbox_create_column(
id,
title = i18n("Create a new column"),
title = i18n$t("Create a new column"),
options = shinyWidgets::wbOptions(),
controls = shinyWidgets::wbControls()
)

View file

@ -13,7 +13,7 @@ cut_variable_server(id, data_r = reactive(NULL))
modal_cut_variable(
id,
title = datamods:::i18n("Convert Numeric to Factor"),
title = i18n$t("Convert Numeric to Factor"),
easyClose = TRUE,
size = "l",
footer = NULL

21
man/dim_change_call.Rd Normal file
View file

@ -0,0 +1,21 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/validation.R
\name{dim_change_call}
\alias{dim_change_call}
\title{Dimensions validation}
\usage{
dim_change_call(before, after, fun)
}
\arguments{
\item{before}{data before}
\item{after}{data after}
\item{fun}{dimension function. ncol or nrow}
}
\value{
data.frame
}
\description{
Dimensions validation
}

View file

@ -20,6 +20,8 @@ import_file_server(
btn_show_data = TRUE,
show_data_in = c("popup", "modal"),
trigger_return = c("button", "change"),
file_extensions_text = paste(c(".csv", ".txt", ".xls", ".xlsx", ".rds", ".fst",
".sas7bdat", ".sav"), collapse = ", "),
return_class = c("data.frame", "data.table", "tbl_df", "raw"),
reset = reactive(NULL)
)

48
man/make_validation.Rd Normal file
View file

@ -0,0 +1,48 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/validation.R
\name{make_validation}
\alias{make_validation}
\title{Create validation data.frame}
\usage{
make_validation(ls, ...)
}
\arguments{
\item{ls}{validation list}
\item{...}{magic dots}
}
\value{
data.frame
}
\description{
Create validation data.frame
}
\examples{
i18n <- shiny.i18n::Translator$new(translation_csvs_path = here::here("inst/translations"))
i18n$set_translation_language("en")
df_original <- mtcars
df_original[1,2:4] <- NA
df_obs <- df_original |> dplyr::filter(carb==4)
df_vars <- df_original[1:7]
val <- purrr::map2(
.x = validation_lib(),
.y = list(
list(x = df_original, y = df_obs),
list(x = df_original, y = df_vars),
list(x=df_original)),
make_validation
)
val |> make_validation_alerts()
val2 <- purrr::map2(
.x = validation_lib()[2],
.y = list(list(x = mtcars, y = mtcars[0])),
make_validation
)
val2 |> make_validation_alerts()
val3 <- make_validation(
ls = validation_lib()[[2]],
list(x = mtcars, y = mtcars[0])
)
}

View file

@ -0,0 +1,14 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/validation.R
\name{make_validation_alerts}
\alias{make_validation_alerts}
\title{Create alert from validation data.frame}
\usage{
make_validation_alerts(data)
}
\arguments{
\item{data}{}
}
\description{
Create alert from validation data.frame
}

22
man/missings_validate.Rd Normal file
View file

@ -0,0 +1,22 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/validation.R
\name{missings_validate}
\alias{missings_validate}
\title{Validate function of missingness in data}
\usage{
missings_validate(data)
}
\arguments{
\item{data}{data set}
}
\value{
data.frame
}
\description{
Validate function of missingness in data
}
\examples{
df <- mtcars
df[1,2:4] <- NA
missings_validate(df)
}

View file

@ -0,0 +1,19 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/validation.R
\name{obs_filter_validate}
\alias{obs_filter_validate}
\title{Observations filter test wrapper}
\usage{
obs_filter_validate(before, after)
}
\arguments{
\item{before}{data before}
\item{after}{data after}
}
\value{
vector
}
\description{
Observations filter test wrapper
}

View file

@ -14,7 +14,7 @@ update_factor_server(id, data_r = reactive(NULL))
modal_update_factor(
id,
title = i18n("Update levels of a factor"),
title = i18n$t("Update levels of a factor"),
easyClose = TRUE,
size = "l",
footer = NULL
@ -22,7 +22,7 @@ modal_update_factor(
winbox_update_factor(
id,
title = i18n("Update levels of a factor"),
title = i18n$t("Update levels of a factor"),
options = shinyWidgets::wbOptions(),
controls = shinyWidgets::wbControls()
)