dreamRs / shinyWidgets

shinyWidgets : Extend widgets available in shiny
https://dreamrs.github.io/shinyWidgets/
GNU General Public License v3.0
833 stars 153 forks source link

Internationalization for pickerInput's actions-box #679

Closed tamas-ferenci closed 7 months ago

tamas-ferenci commented 8 months ago

While colorPickr (for instance) has an i18n option, I simply couldn't find the way to translate the actions-box of pickerInput (despite the fact the every necessary translation seem to be available in the file https://github.com/dreamRs/shinyWidgets/blob/ae8dbf2a9d0225eb663f38060e2aad017fe9f900/inst/assets/bootstrap-select-1.14.0-beta2/js/i18n/defaults-hu_HU.js).

pvictor commented 7 months ago

Hello, You can specify custom text through the pickerOptions function:

library(shiny)
library(shinyWidgets)

ui <- fluidPage(
  pickerInput(
    inputId = "month",
    label = "Select a month:",
    choices = month.name,
    multiple = TRUE,
    options = pickerOptions(
      actionsBox = TRUE,
      selectedTextFormat = "count",
      noneSelectedText = "Válasszon!",
      noneResultsText = "Nincs találat {0}",
      countSelectedText = "{0} elem kiválasztva",
      maxOptionsText ="Legfeljebb {n} elem választható",
      selectAllText = "Mind",
      deselectAllText = "Egyik sem",
      multipleSeparator = ", "
    )
  )
)

server <- function(input, output, session) {

}

shinyApp(ui, server)
tamas-ferenci commented 7 months ago

It works perfectly, thank you very much!