Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

language dropdownMenu #381

Open
NicolasImberty opened this issue Feb 7, 2022 · 1 comment
Open

language dropdownMenu #381

NicolasImberty opened this issue Feb 7, 2022 · 1 comment

Comments

@NicolasImberty
Copy link

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
Copy link

YongbingDing commented Feb 7, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants