-
Notifications
You must be signed in to change notification settings - Fork 38
/
app.R
43 lines (36 loc) · 1.08 KB
/
app.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
library(shiny)
library(shiny.i18n)
#' This example uses automatic translation using Google Cloud services.
#' We use `googleLanguageR` package to connect to API.
#' You need to set google cloud API credentials first to run this example
#' Learn how here: https://github.com/ropensci/googleLanguageR/
i18n <- Translator$new(automatic = TRUE)
# change this to the target language
i18n$set_translation_language("pl")
ui <- fluidPage(
titlePanel(i18n$at("Hello Shiny!")),
sidebarLayout(
sidebarPanel(
sliderInput("bins",
i18n$at("Number of bins:"),
min = 1,
max = 50,
value = 30)
),
mainPanel(
plotOutput("distPlot"),
p(i18n$at("This is description of the plot."))
)
)
)
server <- function(input, output) {
output$distPlot <- renderPlot({
x <- faithful[, 2]
bins <- seq(min(x), max(x), length.out = input$bins + 1)
hist(x, breaks = bins,
col = "darkgray", border = "white",
main = i18n$at("Histogram of x")
)
})
}
shinyApp(ui = ui, server = server)