Skip to content

Commit

Permalink
i18n for create_column and cut_variable
Browse files Browse the repository at this point in the history
  • Loading branch information
pvictor committed Apr 18, 2024
1 parent 86c607b commit 196032a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
24 changes: 12 additions & 12 deletions R/create-column.R
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ create_column_ui <- function(id) {
width = 6,
textInput(
inputId = ns("new_column"),
label = "New column name:",
label = i18n("New column name:"),
value = "new_column1",
width = "100%"
)
Expand All @@ -42,7 +42,7 @@ create_column_ui <- function(id) {
width = 6,
virtualSelectInput(
inputId = ns("group_by"),
label = "Group calculation by:",
label = i18n("Group calculation by:"),
choices = NULL,
multiple = TRUE,
disableSelectAll = TRUE,
Expand All @@ -53,15 +53,15 @@ create_column_ui <- function(id) {
),
textAreaInput(
inputId = ns("expression"),
label = "Enter an expression to define new column:",
label = i18n("Enter an expression to define new column:"),
value = "",
width = "100%",
rows = 6
),
tags$i(
class = "d-block",
ph("info"),
"Click on a column to add it to the expression:"
i18n("Click on a column name to add it to the expression:")
),
uiOutput(outputId = ns("columns")),
tags$div(
Expand All @@ -74,7 +74,7 @@ create_column_ui <- function(id) {
actionButton(
inputId = ns("compute"),
label = tagList(
ph("gear"), "Create column"
ph("gear"), i18n("Create column")
),
class = "btn-outline-primary",
width = "100%"
Expand Down Expand Up @@ -114,9 +114,9 @@ create_column_server <- function(id,
info_alert <- alert(
status = "info",
ph("question"),
"Choose a name for the column to be created or modified,",
"then enter an expression before clicking on the button above to validate or on ",
ph("trash"), "to delete it."
i18n("Choose a name for the column to be created or modified,"),
i18n("then enter an expression before clicking on the button above to validate or on "),
ph("trash"), i18n("to delete it.")
)

rv <- reactiveValues(
Expand Down Expand Up @@ -155,7 +155,7 @@ create_column_server <- function(id,
if (input$new_column == "") {
rv$feedback <- alert(
status = "warning",
ph("warning"), "New column name cannot be empty"
ph("warning"), i18n("New column name cannot be empty")
)
}
})
Expand Down Expand Up @@ -279,7 +279,7 @@ try_compute_column <- function(expression,
}
funs <- unlist(c(extract_calls(parsed), lapply(parsed, extract_calls)), recursive = TRUE)
if (!are_allowed_operations(funs, allowed_operations)) {
return(alert_error("Some operations are not allowed"))
return(alert_error(i18n("Some operations are not allowed")))
}
if (!isTruthy(by)) {
result <- try(
Expand Down Expand Up @@ -319,7 +319,7 @@ try_compute_column <- function(expression,
)
alert(
status = "success",
ph("check"), "Column added!"
ph("check"), i18n("Column added!")
)
}

Expand Down Expand Up @@ -391,7 +391,7 @@ make_choices_with_infos <- function(data) {
icon, nm
)),
value = nm,
description = paste("Unique values:", data.table::uniqueN(values))
description = paste(i18n("Unique values:"), data.table::uniqueN(values))
)
}
)
Expand Down
12 changes: 6 additions & 6 deletions R/cut-variable.R
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ cut_variable_ui <- function(id) {
width = 3,
virtualSelectInput(
inputId = ns("variable"),
label = "Variable to cut:",
label = i18n("Variable to cut:"),
choices = NULL,
width = "100%"
)
Expand All @@ -34,7 +34,7 @@ cut_variable_ui <- function(id) {
width = 3,
virtualSelectInput(
inputId = ns("method"),
label = "Method:",
label = i18n("Method:"),
choices = c(
"sd",
"equal",
Expand All @@ -57,7 +57,7 @@ cut_variable_ui <- function(id) {
width = 3,
numericInput(
inputId = ns("n_breaks"),
label = "Number of breaks:",
label = i18n("Number of breaks:"),
value = 5,
min = 2,
max = 12,
Expand All @@ -68,12 +68,12 @@ cut_variable_ui <- function(id) {
width = 3,
checkboxInput(
inputId = ns("right"),
label = "Close intervals on the right",
label = i18n("Close intervals on the right"),
value = TRUE
),
checkboxInput(
inputId = ns("include_lowest"),
label = "Include lowest value",
label = i18n("Include lowest value"),
value = FALSE
)
)
Expand All @@ -82,7 +82,7 @@ cut_variable_ui <- function(id) {
datagridOutput2(outputId = ns("count")),
actionButton(
inputId = ns("create"),
label = tagList(ph("scissors"), "Create factor variable"),
label = tagList(ph("scissors"), i18n("Create factor variable")),
class = "btn-outline-primary float-end"
),
tags$div(class = "clearfix")
Expand Down

0 comments on commit 196032a

Please sign in to comment.