简体   繁体   中英

Shiny R: Language button in dashboard header

What is the best way to create in the header of a shiny dashboard a button where you can choose languages to appear on the app page(English, French, Spanish...)? What I want is a kind of a dropdown button like this( https://www.conversationexchange.com/resources/keyboard-language.php?lg=en ). I want to add a flag icon as well next to each language choice.

Any solution or tips would be appreciated!

What I tried:

  1. dropdownMenu

It works but it's only useful either for "messages", "notifications" or "tasks". I was able to customise none of them to match my purpose.

  1. navbarMenu

This is exactly what I want but can be used only in navbar . I tried putting this to the header but didn't work.

I assume that you are using shinydashboard , then you can do:

dashboardHeader(
  title = "MY TITLE",
  tags$li(class = "dropdown",     
          radioButtons(inputId = "language",
                       label = "",
                       choices = c("日文" = "cn", "English" = "en"),
                       selected = "jp")
          )
)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM