forked from hazimtimimi/tb_profiles
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build_header.R
73 lines (48 loc) · 2.41 KB
/
build_header.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Build header to show country name and population
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
output$main_heading <- renderText({
# Make sure there is a chosen language
req(input$lan)
if (check_entity_type(input$entity_type) == "group") {
if (input$lan == "FR") {
return(paste0(ltxt(plabs(), "head"), ": ", pdata()$profile_properties[, "group_description_FR"]))
} else if (input$lan == "ES") {
return(paste0(ltxt(plabs(), "head"), ": ", pdata()$profile_properties[, "group_description_ES"]))
} else if (input$lan == "RU") {
return(paste0(ltxt(plabs(), "head"), ": ", pdata()$profile_properties[, "group_description_RU"]))
} else {
return(paste0(ltxt(plabs(), "head"), ": ", pdata()$profile_properties[, "group_description"]))
}
} else {
# Always default back to country
if (input$lan == "FR") {
return(paste0(ltxt(plabs(), "head"), ": ", pdata()$profile_properties[, "country_FR"]))
} else if (input$lan == "ES") {
return(paste0(ltxt(plabs(), "head"), ": ", pdata()$profile_properties[, "country_ES"]))
} else if (input$lan == "RU") {
return(paste0(ltxt(plabs(), "head"), ": ", pdata()$profile_properties[, "country_RU"]))
} else {
return(paste0(ltxt(plabs(), "head"), ": ", pdata()$profile_properties[, "country"]))
}
}
} )
output$population <- renderText({
# Make sure data are loaded
req(pdata()$profile_estimates)
paste0(ltxt(plabs(), "pop"),
" ",
dcyear - 1,
": ",
rounder_mil(pdata()$profile_estimates[, "e_pop_num"]/1e6),
" ",
ltxt(plabs(), "million"))
})
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Build tab names in the appropriate language
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
output$est_tab_name <- renderText({ ltxt(plabs(), "est_tab_name") })
output$not_tab_name <- renderText({ ltxt(plabs(), "not_tab_name") })
output$out_tab_name <- renderText({ ltxt(plabs(), "out_tab_name") })
output$tpt_tab_name <- renderText({ ltxt(plabs(), "tpt_tab_name") })
output$fin_tab_name <- renderText({ ltxt(plabs(), "fin_tab_name") })