To translate SelectInputs (Dropdown) using shiny.i18n package

Hello Guys,

I am trying to translate as per language select and everthing in my code is getting translated except the selectInput dropdown values.


# Define UI for app that draws a histogram ----
ui <- fluidPage(

paste0(translator$t("Language"), ":"), 
choices = c("Deutsch"="de", "English"="en"), selected = "de"),
selectInput("kpi",     label = NULL,
                           selected = "costs",
  choices=c(         i18n()$t("Costs")= "costs",
                     i18n()$t("Impressions") = "impressions",
                     i18n()$t("Interactions")= "interactions",
                     i18n()$t("Video Views") ="video_total_views"



    # Main panel for displaying outputs ----

      # Output: Histogram ----

server <- function(input,output,session){
i18n <- reactive({
  selected <- input$selected_language
  if (length(selected) > 0 && selected %in% translator$languages) {


Everything except choices list of selectinput is getting translated
I have already added the translation in csv file and there is some UpdateSelectInput logic required which i am not able to apply!!


Welcome to the RStudio community!

I don't have all the data in order for me to run the app, but I think I know what you're looking for and made a dummy example. Next time, try and generate a reprex so we can actually build on top of your first attempt. Shiny debugging and reprex guide

Here is an example I made that might help:


ui <- fluidPage(
  titlePanel("Welcome to my app!"),
  radioButtons("langChoice", "Language", choices = c("Lang X" = "langx", "Lang Y" = "langy")),
  #Dropdown to translate
  selectInput("myDropdown", "Choose", choices = "")

#Make sure the 'session' argument is set
server <- function(input, output, session) {
  translations = data.frame(
    id = paste("id", 1:5, sep = "_"),
    langx = paste("XXX", 1:5, sep = " "),
    langy = paste("YYY", 1:5, sep = " ")
  observeEvent(input$langChoice, {
    # Call the "updateSelectInput" and edit what needed
    updateSelectInput(session, "myDropdown", 
                      label = input$langChoice,
                      choices = setNames(translations$id, translations[,input$langChoice]))

shinyApp(ui, server)

Hope this helps,