rstudio / shinydashboard

Shiny Dashboarding framework
https://rstudio.github.io/shinydashboard/
Other
893 stars 298 forks source link

language dropdownMenu #381

Open NicolasImberty opened 2 years ago

NicolasImberty commented 2 years ago

Hello

Is it possible add option to change language for headerText in dropdownMenu ? For example :

function (..., type = c("messages", "notifications", "tasks"), 
          badgeStatus = "primary", icon = NULL, headerText = NULL, 
          .list = NULL,
          text_language = "You have") 
{
  type <- match.arg(type)
  if (!is.null(badgeStatus)) 
    validateStatus(badgeStatus)
  items <- c(list(...), .list)
  lapply(items, tagAssert, type = "li")
  dropdownClass <- paste0("dropdown ", type, "-menu")
  if (is.null(icon)) {
    icon <- switch(type, messages = shiny::icon("envelope"), 
                   notifications = shiny::icon("warning"), tasks = shiny::icon("tasks"))
  }
  numItems <- length(items)
  if (is.null(badgeStatus)) {
    badge <- NULL
  }
  else {
    badge <- span(class = paste0("label label-", badgeStatus), 
                  numItems)
  }
  if (is.null(headerText)) {
    headerText <- paste(text_language, numItems, type)
  }
  tags$li(class = dropdownClass, a(href = "#", class = "dropdown-toggle", 
                                   `data-toggle` = "dropdown", icon, badge), tags$ul(class = "dropdown-menu", 
                                                                                     tags$li(class = "header", headerText), tags$li(tags$ul(class = "menu", 
                                                                                                                                            items))))
}
YongbingDing commented 2 years ago

您好,丁永兵已经收到您的邮件,谢谢。