-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNew-Dashboard.Rmd
1029 lines (879 loc) · 31.8 KB
/
New-Dashboard.Rmd
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
---
title: "Weblate dashboard"
output:
flexdashboard::flex_dashboard:
theme:
version: 4
heading_font:
google: Sen
base_font:
google: Prompt
orientation: rows
self_contained: false
vertical_layout: scroll
source_code: embed
navbar:
- { title: "Github", href: "https://github.com/shrish-shete20/weblate", align: right, icon: fa-github}
css: ["fragments/custom.css"]
skin:
header_bg: "#ffffff"
header_fg: "#000000"
sidebar_bg: "#00438d"
sidebar_fg: "#ffffff"
body_bg: "#f8f9fa"
body_fg: "#000000"
---
```{r setup, include=FALSE}
library(flexdashboard)
library(htmltools)
library(fontawesome)
library(reactable)
library(dplyr)
library(crosstalk)
library(DT)
library(plotly)
library(reshape2)
library(formattable)
library(htmlwidgets)
library(curl)
library(lubridate)
library(jsonlite)
source("Data_contains.R")
compute_active <- function() {
active_count<-nrow(subset(Statistics,Active=="Active"))
total<-nrow(Statistics)
return(active_count*100/total)
}
compute_inactive <- function() {
inactive_count<-nrow(subset(Statistics,Active=="Inactive"))
total<-nrow(Statistics)
return(inactive_count*100/total)
}
compute_unbegun <- function() {
unbegun_count<-nrow(subset(Statistics,Active=="Unbegun"))
total<-nrow(Statistics)
return(unbegun_count*100/total)
}
# Install thematic and un-comment for themed static plots (i.e., ggplot2)
#thematic::thematic_rmd()
```
Sidebar {.sidebar data-width=200}
=====================================
```{r, echo=FALSE, results='asis'}
htmltools::includeHTML('fragments/sidebar.html')
```
Languages
=====================================
Row
---------------------------------------------------------------
--------
### Total Languages
```{r}
valueBox(nrow(Language_Statistics_new), icon = "fa-language", color = "white")
```
### Translated Messages
```{r}
valueBox(sum(Language_Statistics_new$Translated), icon = "fa-comment", color = "white")
```
### Untranslated Messages
```{r}
valueBox(sum(Language_Statistics_new$Untranslated), icon = "fa-comment-slash", color = "white")
```
### Fuzzy Messages
```{r}
valueBox(sum(Language_Statistics_new$Fuzzy), icon = "fa-puzzle-piece", color = "white")
```
Row{data-height=800px}
-----------------------------------------------------------------------
### Languages V/S Translations
```{r fig.width=10,fig.height=30}
Statistics$Languages <- lapply(Statistics$Languages, function(x) {
if (startsWith(x, "c(")) {
eval(parse(text = x))
} else {
x
}
})
board<-Statistics[order(Statistics$translated,decreasing = TRUE),]
boards<-board %>% select(name,username,translated,Languages,Active)
boards<-boards%>%mutate(Rank=row_number())
df<-select(Language_Statistics_new,c(Name,Translated,Fuzzy,Untranslated))
df_long <- reshape2::melt(df, id.vars = "Name")
p<-ggplot(df_long, aes(x = Name, y = value, fill = variable)) +
geom_bar(stat = "identity") +
labs(x = "Languages", y = "Translation",fill="Legend") +
scale_fill_manual(values = c("Translated" = "#A2FF86", "Fuzzy" = "#0079FF", "Untranslated" = "#F31559")) +theme(axis.text.x = element_text(angle = 90,size=18),legend.text = element_text(size = 14),legend.box = "horizontal",legend.title = element_text(size=30),axis.title.x = element_text(angle = 0,size=22),axis.title.y = element_text(angle = 90,size=22),axis.text.y = element_text(angle = 0,size=18),legend.background=element_rect(fill="pink", size=1, linetype="solid"))
p_plotly <- ggplotly(p)
```
This graph decipts the translation status of each language.
This graph gives a clear idea of which languages require more attention.
```{r fig.width=10,fig.height=10}
p <- p_plotly %>% layout(xaxis = list(tickfont = list(size = 10),titlefont = list(size = 1)),yaxis = list(tickfont = list(size = 10)),legend=list(font=list(size=10),title=list(font=list(size=16))))
p
```
Row
----------------------------------------------------------------------------
### Population V/S Translations
```{r}
fig1 <- plot_ly(Language_Statistics_new, y = ~Population, x = ~Name, name = 'Population', type = 'bar')
fig2 <- plot_ly(Language_Statistics_new, y = ~Translated, x = ~Name, name = 'Translation', type = 'bar')
fig <- subplot(fig1,fig2,nrows=2,margin = 0.07,shareX = TRUE)%>%
layout(title = list(text = "Population v/s Translations Completed"), plot_bgcolor='#e5ecf6', xaxis = list(title="Language",zerolinecolor = '#ffff', zerolinewidth = 2, gridcolor = 'ffff'), yaxis = list(title="Population",zerolinecolor = '#ffff', zerolinewidth = 2, gridcolor = 'ffff'),yaxis2=list(title="Translations"),showlegend=FALSE,barmode="stack")
# Add hyperlinks to x-axis labels
fig <- fig %>% add_annotations(
x=Language_Statistics_new$Name,
y=rep(-0.3,length(Language_Statistics_new$Name)),
text=paste0("<a href='https://translate.rx.studio/languages/",Language_Statistics_new$Code,"/'>Link</a>"),
xref='x',
yref='paper',
showarrow=FALSE,
font=list(color='blue',size=10),
xshift=10
)
fig
```
Row
-----------------------------------------------------------------------
### Languages V/S Translation Status
```{r}
plot_trans<-plot_ly(Language_Statistics_new,x=~Name,y=~Translated,name="Translated",type = "bar")
plot_trans<-plot_trans%>%add_trace(y=~Untranslated,name="Untranslated")
plot_trans<-plot_trans%>%add_trace(y=~Fuzzy,name="Fuzzy")%>%layout(barmode="stack")
plot_trans
```
Row {data-height=450}
-----------------------------------------------------------------------
### Languages V/S Users
```{r}
vec<-numeric()
for(i in board$Languages)
{
vec<-c(vec,i)
}
counting<-Language_Statistics_new
counting$Contributors<-rep(0,length(counting$Name))
for(i in vec)
{
if(i %in% counting$Name)
{
index<-which(counting$Name==i)
counting$Contributors[index]<-counting$Contributors[index]+1
}
}
counting<-counting[ ,!(colnames(counting) %in% c("Code", "Date","Time"))]
counting$`50% translation`<-ifelse(counting$Translated*2>=counting$Total_Words,TRUE,FALSE)
counting<-subset(counting,select = -...1)
```
```{r}
formattable(counting,list(Population = color_tile("white", "orange"),area(col = c("Total_Words")) ~ normalize_bar("pink", 0.2),area(col = c("Translated")) ~ normalize_bar("lightgreen", 0.2),area(col = c("Fuzzy")) ~ normalize_bar("lightblue", 0.2),area(col = c("Untranslated")) ~ normalize_bar("rgb(255, 182, 193)", 0.2),Name = formatter(
"span",
style = x ~ ifelse(counting$Contributors == 0, "color:red; font-weight:bold","color:black")
),Contributors = formatter(
"span",
style = x ~ ifelse(x == 0, "color:red", "color:black")
),`50% translation` = formatter("span",
style = x ~ style(color = ifelse(x, "green", "red")),
x ~ icontext(ifelse(x, "ok", "remove"), ifelse(x, "Yes", "No")))
))
```
*The Languages marked in RED have no Contributors.
```{css,echo=FALSE}
.bootstrap-table{
overflow-y: scroll !important;
height: 450px;
}
```
Leaderboard
=====================================
Row {data-height=450}
-----------------------------------------------------------------------
### Weblate Leaderboard <span style="float: right;"><small>*Active Users : Users who are active within 6 months.</small></span>
```{r table, echo=FALSE, message=FALSE}
shared_data <- SharedData$new(boards)
shared_data%>%reactable(
.,
pagination = TRUE,
showPageSizeOptions = TRUE,
defaultColDef = colDef(vAlign = "center", headerClass = "header"),
columns = list(
Rank = colDef(
name = "Rank",
align = "center",
minWidth = 70,
maxWidth = 120,
cell = JS('function(cellInfo) {
let units;
if(cellInfo.viewIndex === 0)
{
units="🥇"
}else if(cellInfo.viewIndex === 1)
{
units="🥈"
}else if(cellInfo.viewIndex === 2)
{
units="🥉"
}else
{
units=""
}
return cellInfo.value + `<div class="units">${units}</div>`
}'),
html = TRUE
),
name = colDef(
name = "Name",
# Since there are so many rows, we use a JS render function to keep the
# page size down. This would be much easier to code in R, but that would
# significantly increase the file size.
html = TRUE,
minWidth = 150,
filterable = TRUE
),
username = colDef(
name = "User-Name",
# Since there are so many rows, we use a JS render function to keep the
# page size down. This would be much easier to code in R, but that would
# significantly increase the file size.
cell = JS("renderMovie"),
html = TRUE,
minWidth = 150
),
translated = colDef(
name = "Translations",
defaultSortOrder = "desc",
# Show the user score in a donut chart like TMDb does. Since donut charts
# are hard to compare, apply a color scale as well.
html = TRUE,
align = "center",
width = 140,
class = "user-score"
),
Active = colDef(cell = function(value){
class<-paste0("tag status-",tolower(value))
div(class=class,value)
}),
Languages = colDef(show = FALSE)
),
highlight = TRUE,
bordered = TRUE,
compact = TRUE,
class = "movies-tbl"
)
```
```{js table_js, echo=FALSE}
// Custom JavaScript cell renderer for the Movie column
function renderMovie(cellInfo) {
const url = 'https://translate.rx.studio/user/' + cellInfo.row['username']
const imageSrc = 'https://translate.rx.studio/avatar/128/' + cellInfo.row['username']+'.png'
const altText = cellInfo.value + ' movie poster'
const poster = `<a href="${url}"><img src="${imageSrc}" class="movie-poster" alt="${altText}"></a>`
const title = `<a href="${url}">${cellInfo.value}</a>`
const text = `<div class="movie-info-text">${title}</div>`
return `<div class="movie-info">${poster}${text}</div>`
}
```
```{css,echo=FALSE}
/* Font from https://fontsarena.com/hanken-grotesk-by-hanken-design-co/ */
.movies {
font-family: 'Hanken Grotesk', Helvetica, Arial, sans-serif;
}
.movies h2 {
font-weight: 600;
}
.movies a {
color: #007899;
text-decoration: none;
}
.movies a:hover,
.movies a:focus {
text-decoration: underline;
text-decoration-thickness: max(1px, 0.0625rem);
}
.movies-tbl {
margin-top: 1rem;
font-size: 0.9rem;
}
.header {
color: hsl(220, 100%, 75%);
font-weight: 700;
font-size: 0.8125rem;
letter-spacing: 0.4px;
text-transform: uppercase;
}
.header:hover[aria-sort],
.header[aria-sort='ascending'],
.header[aria-sort='descending'] {
color: hsl(0, 100%, 55%);
}
.units {
display: inline-block;
width: 1.125rem;
}
.movie-info {
display: flex;
align-items: center;
}
.movie-info-text {
margin-left: 0.75rem;
font-weight: 600;
overflow: hidden;
text-overflow: ellipsis;
}
.movie-info-details {
margin-top: 0.125rem;
font-size: 0.875rem;
font-weight: 400;
color: hsl(0, 0%, 40%);
overflow: hidden;
text-overflow: ellipsis;
}
.tag {
display: inline-block;
padding: 0.125rem 0.75rem;
border-radius: 15px;
font-weight: 600;
font-size: 0.75rem;
}
.status-active {
background: hsl(116, 60%, 90%);
color: hsl(116, 30%, 25%);
}
.status-inactive {
background: hsl(230, 70%, 90%);
color: hsl(230, 45%, 30%);
}
.status-unbegun {
background: hsl(350, 70%, 90%);
color: hsl(350, 45%, 30%);
}
.movie-poster {
width: 45px;
height: 68px;
box-shadow: 0 0 0 1px hsl(0, 0%, 95%);
}
.user-score {
font-weight: 600;
}
```
Row
-----------------------------------------------------------------------
### Active Users
```{r}
active <- compute_active()
gauge(active, min = 0, max = 100, symbol = '%', gaugeSectors(
success = c(50, 100), warning = c(30,50), danger = c(0, 30)
))
```
### Inactive Users
```{r}
inactive <- compute_inactive()
gauge(inactive, min = 0, max = 100, symbol = '%', gaugeSectors(
success = c(0,20), warning = c(20,50), danger = c(50, 100)
))
```
### Unbegun Users
```{r}
unbegun <- compute_unbegun()
gauge(unbegun, min = 0, max = 50, symbol = '%', gaugeSectors(
success = c(0,5), warning = c(5,15), danger = c(15,50)
))
```
Row
---------------------------------------------------------------
--------
### primary
```{r}
valueBox(nrow(subset(Statistics,Active=="Active")), caption = "Active Users", icon = "fa-solid fa-users")
```
### Warning
```{r}
valueBox(nrow(subset(Statistics,Active=="Inactive")), caption = "Inactive Users", color = "warning", icon = "fa-solid fa-user-minus")
```
### Danger
```{r}
valueBox(nrow(subset(Statistics,Active=="Unbegun")), caption = "Unbegun users", color = "danger", icon = "fa-solid fa-user-slash")
```
Row
---------------------------------------------------------------
--------
### Graph of Top 10 Users vs Translation
```{r}
fig <- plot_ly(boards[1:10,], x = ~name, y = ~translated, type = 'bar', color=~name)
fig <- fig %>% layout(xaxis = list(title = "Name", tickangle = -45,categoryorder = "total descending"),
yaxis = list(title = "Translations"),
margin = list(b = 100),showlegend=FALSE,rangeslider=list(type="name"))
fig
```
Library
=====================================
Row
-----------------------------------------------------------------------
### Libraries
```{r fig.height=7}
# Your code for creating the initial plot
fig <- plot_ly(Library_Language_Statistics, x = ~Language, y = ~Translated, text = ~paste("Translated:", Translated, "<br>",
"Library:", Library, "<br>",
"Language:", Language), type = 'scatter', mode = 'markers', marker = list(opacity = 0.5, sizemode = 'diameter',size=8))
fig <- fig %>% layout(title = 'Status of Languages in each Library',
xaxis = list(showgrid = FALSE),
yaxis = list(showgrid = FALSE),
showlegend = FALSE)
# Create a list of buttons for the dropdown menu
buttons <- lapply(unique(Library_Language_Statistics$Library), function(lib) {
list(
method = "restyle",
args = list(
list(
x = list(Library_Language_Statistics$Language[Library_Language_Statistics$Library == lib]),
y = list(Library_Language_Statistics$Translated[Library_Language_Statistics$Library == lib]),
text = list(paste("Library:", Library_Language_Statistics$Library[Library_Language_Statistics$Library == lib], "<br>",
"Language:", Library_Language_Statistics$Language[Library_Language_Statistics$Library == lib], "<br>",
"Translated:", Library_Language_Statistics$Translated[Library_Language_Statistics$Library == lib])),
hovertext = list(paste("Library:", Library_Language_Statistics$Library[Library_Language_Statistics$Library == lib], "<br>",
"Language:", Library_Language_Statistics$Language[Library_Language_Statistics$Library == lib], "<br>",
"Translated:", Library_Language_Statistics$Translated[Library_Language_Statistics$Library == lib]))
, marker = list(
size=10,
color = "blue"
)
)
),
label = lib
)
})
# Add the dropdown menu to the plot
fig <- fig %>% layout(
updatemenus = list(
list(
y = 1,
buttons = buttons
)
)
)
fig
```
Row{data-height=620px}
-----------------------------------------------------------------------------
```{r}
libraries <- unique(Library_Language_Statistics$Library)
plots <- list()
top_label <- c('Total<br>Words', 'Translated', 'Fuzzy', 'Untranslated')
for (libr in libraries) {
df <- subset(Library_Language_Statistics, Library == libr)
fi <- plot_ly(df, x = ~Total_words, y = ~Language, type = 'bar', orientation = 'h',
name = 'Total Words',
marker = list(color = 'rgba(38, 24, 74, 0.8)',
line = list(color = 'rgb(248, 248, 249)', width = 1)))
fi <- fi %>% add_trace(x = ~Translated, name = 'Translated', marker = list(color = 'rgba(71, 58, 131, 0.8)'))
fi <- fi %>% add_trace(x = ~Fuzzy, name = 'Fuzzy', marker = list(color = 'rgba(122, 120, 168, 0.8)'))
fi <- fi %>% add_trace(x = ~Untranslated, name = 'Untranslated', marker = list(color = 'rgba(164, 163, 204, 0.85)'))
fi <- fi %>% layout(
xaxis = list(
title = "",
showgrid = FALSE,
showline = FALSE,
showticklabels = FALSE,
zeroline = FALSE,
domain = c(0.15, 1)
),
yaxis = list(
title = "",
showgrid = FALSE,
showline = FALSE,
showticklabels = FALSE,
zeroline = FALSE
),
barmode = 'stack',
paper_bgcolor = 'rgb(248, 248, 255)',
plot_bgcolor = 'rgb(248, 248, 255)',
margin = list(),
showlegend = F
)
fi <- fi %>% add_annotations(
xref = 'paper',
yref = 'y',
x = 0.14,
y = df$Language,
xanchor = 'right',
text = df$Language,
font = list(family = 'Arial', size = 10, color = 'rgb(67, 67, 67)'),
showarrow = FALSE,
align = 'right'
)
fi <- fi %>% add_annotations(
xref = 'x',
yref = 'y',
x = df$Total_words / 2,
y = df$Language,
text = paste(df$Total_words),
font = list(family = 'Arial', size = 10, color = 'rgb(248, 248, 255)'),
showarrow = FALSE
)
fi <- fi %>% add_annotations(
xref = 'x',
yref = 'y',
x = df$Total_words + df$Translated / 2,
y = df$Language,
text = ifelse(df$Translated != 0, paste(df$Translated), ""),
font = list(family = 'Arial', size = 10, color = 'rgb(248, 248, 255)'),
showarrow = FALSE
)
fi <- fi %>% add_annotations(
xref = 'x',
yref = 'y',
x = df$Total_words + df$Translated + df$Fuzzy / 2,
y = df$Language,
text = ifelse(df$Fuzzy != 0, paste(df$Fuzzy), ""),
font = list(family = 'Arial', size = 10, color = 'rgb(248, 248, 255)'),
showarrow = FALSE
)
fi <- fi %>% add_annotations(
xref = 'x',
yref = 'y',
x = df$Total_words + df$Translated + df$Fuzzy + df$Untranslated / 2,
y = df$Language,
text = ifelse(df$Untranslated != 0, paste(df$Untranslated), ""),
font = list(family = 'Arial', size = 10, color = 'rgb(248, 248, 255)'),
showarrow = FALSE
)
fi <- fi %>% layout(annotations = list(
list(
x = 0.5,
y = 1.1,
text = libr,
showarrow = F,
xref = 'paper',
yref = 'paper',
xanchor = 'center',
yanchor = 'top',
font = list(size = 16)
)
))
plots[[libr]] <- fi
}
```
### Library Translation Status
```{r}
subplot1 <- subplot(plots[[5]], plots[[6]], nrows = 1)
subplot2 <- subplot(plots[[7]], plots[[8]], nrows = 1)
subplot1 <- subplot1 %>% layout(margin = list(t = 30, b = 30))
subplot2 <- subplot2 %>% layout(margin = list(t = 30, b = 30))
subplots <- subplot(subplot1, subplot2, subplot2, nrows = 3) %>% layout(width = 1030, height = 305 * 3)
for (i in seq_along(plots)) {
plots[[i]] <- plots[[i]] %>% layout(margin = list(t = 60, b = 30))
}
subplots2 <- subplot(plots, nrows = ceiling(length(libraries) / 2)) %>% layout(width = 1030, height = 305 * length(libraries))
scrollable_div <- div(
style = "overflow-y: scroll; height: 600px;",
subplots2
)
scrollable_div
```
Row{data-height=800px}
---------------------------------------------------------------------------------
### Translation Status per Language
```{r}
component<-unique(Library_Language_Statistics$Component)
r_component<-subset(Library_Language_Statistics,Component==component[1])
c_component<-subset(Library_Language_Statistics,Component==component[3])
english_component<-subset(Library_Language_Statistics,Component==component[2])
library<-unique(r_component$Library)
libra<-c()
total_word<-c()
translate<-c()
for(lib in library)
{
indexes<-which(r_component$Library==lib)
total_word<-c(total_word,sum(r_component$Total_words[indexes]))
translate<-c(translate,sum(r_component$Translated[indexes]))
libra<-c(libra,lib)
}
r_df<-data.frame(libra,total_word,translate)
library<-unique(c_component$Library)
libra<-c()
total_word<-c()
translate<-c()
for(lib in library)
{
indexes<-which(c_component$Library==lib)
total_word<-c(total_word,sum(c_component$Total_words[indexes]))
translate<-c(translate,sum(c_component$Translated[indexes]))
libra<-c(libra,lib)
}
c_df<-data.frame(libra,total_word,translate)
library<-unique(english_component$Library)
libra<-c()
total_word<-c()
translate<-c()
for(lib in library)
{
indexes<-which(english_component$Library==lib)
total_word<-c(total_word,sum(english_component$Total_words[indexes]))
translate<-c(translate,sum(english_component$Translated[indexes]))
libra<-c(libra,lib)
}
eng_df<-data.frame(libra,total_word,translate)
#
# television_2 <- list(
# xref = 'paper',
# x = 0.95,
# y = 0.95,
# xanchor = 'left',
# yanchor = 'middle',
# text = paste("Total words"),
# font = list(family = 'Arial',
# size = 16,
# color = 'rgba(67,67,67,1)'),
# showarrow = FALSE)
#
# internet_2 <- list(
# xref = 'paper',
# x = 0.95,
# y = 0.95,
# xanchor = 'left',
# yanchor = 'middle',
# text = paste("Translated"),
# font = list(family = 'Arial',
# size = 16,
# color = 'rgba(67,67,67,1)'),
# showarrow = FALSE)
#
plot_r<-plot_ly(r_df,x=~libra,y=~total_word,name="Total words",type = "bar")
plot_r<-plot_r%>%add_trace(y=~translate,name="Translate")%>%layout(showlegend = FALSE,annotations = list(
list(
x = 0.5,
y = 1.1,
text = "R",
showarrow = F,
xref = 'paper',
yref = 'paper',
xanchor = 'center',
yanchor = 'top',
font=list(size=16)
)),barmode="stack")
plot_c<-plot_ly(c_df,x=~libra,y=~total_word,name="Total words",type = "bar")
plot_c<-plot_c%>%add_trace(y=~translate,name="Translate",mode="lines+markers")%>%layout(showlegend = FALSE,annotations = list(
list(
x = 0.5,
y = 1.1,
text = "C",
showarrow = F,
xref = 'paper',
yref = 'paper',
xanchor = 'center',
yanchor = 'top',
font=list(size=16)
)),barmode="stack")
# plot_eng<-plot_ly(eng_df,x=~libra,y=~total_word,name="Total words",type = "scatter",mode="lines+markers",line=list(color="pink"))
# plot_eng<-plot_eng%>%add_trace(y=~translate,name="Translate",mode="lines+markers",line=list(color="rgb(0,100,80)"))%>%layout(showlegend = FALSE,annotations = list(
# list(
# x = 0.5,
# y = 1.1,
# text = "English",
# showarrow = F,
# xref = 'paper',
# yref = 'paper',
# xanchor = 'center',
# yanchor = 'top',
# font=list(size=16)
# )))
subplot(plot_r,plot_c,nrows=2,margin = 0.07)
```
Translations
=====================================
```{r}
linked<-c()
for(u in Marked_for_Edit$units)
{
url<-paste0("https://translate.rx.studio/api/units/",u,"/")
h <- new_handle()
handle_setopt(h, ssl_verifyhost = 0L, ssl_verifypeer = 0L)
handle_setopt(h, customrequest = "GET")
handle_setopt(h, httpheader = c("Authorization: Token wlu_U8k6Kk12pyhXuBeXOP6imHRFiPrUMwHgHari"))
res <- curl_fetch_memory(url, handle = h)
content <- rawToChar(res$content)
users_last <- fromJSON(content)
linked<-c(linked,users_last$web_url)
}
data <- cbind(
Marked_for_Edit,links=NA
)
data$linked <- linked
data$date<-as.Date(data$date)
```
Row
--------------------------------------------------------------------------------
### Translation in Weblate that require review
```{r}
htmltools::div(
style = "width: 100%;
height:450px;
overflow:auto;",
reactable(
data,
filterable = TRUE,
defaultColDef = colDef(show = TRUE),
groupBy=c("language","library"),
showPageSizeOptions = TRUE,
pagination = TRUE,
columns = list(
linked = colDef(show = FALSE),
units =colDef(name="Translation_message_id"),
links = colDef(
name = "",
sortable = FALSE,
cell = function() htmltools::tags$button("Links")
)
),
onClick = JS("function(rowInfo, column) {
if (column.id !== 'links') {
return
}
var link = rowInfo.row.linked;
console.log(link);
window.open(link, '_blank');
}")
)
)
```
Row
---------------------------------------------------------------------------------
### Growth of Translations over Last Year
```{r}
all_date<-as.POSIXct.Date(New_Translation$date,origin="1970-01-01")
all_date2<-as.POSIXct.Date(Marked_for_Edit$date,origin="1970-01-01")
all_date<-c(all_date,all_date2)
# extract the year and month from each date
year_month <- format(all_date, "%Y-%m")
# count the number of dates in each month
date_counts <- table(year_month)
# display the result
date_counts<-as.data.frame(date_counts)
date_counts$cumFreq<-cumsum(date_counts$Freq)
date_counts<-date_counts[(nrow(date_counts)-11):nrow(date_counts),]
fig <- plot_ly(date_counts, x = ~year_month, y = ~cumFreq, name = 'Graph', type = 'scatter', mode = 'line', stackgroup = 'one', fillcolor = 'pink')
fig <- fig %>% layout(title = 'Growth of Translations over time',
xaxis = list(title = "Dates",
showgrid = FALSE),
yaxis = list(title = "Transaltions",
showgrid = FALSE))
fig
```
Row
--------------------------------------------------------------------------------
### Translated
```{r}
New_Translation$date<-as.Date(New_Translation$date)
htmltools::div(
style = "width: 100%;
height:450px;
overflow:auto;",
reactable(
New_Translation,
filterable = TRUE,
defaultColDef = colDef(show = TRUE),
groupBy=c("library","language"),
showPageSizeOptions = TRUE,
columns = list(
new_linked = colDef(show = FALSE),
units =colDef(show=FALSE),
links = colDef(
name = "",
sortable = FALSE,
cell = function() htmltools::tags$button("Links")
)
),
onClick = JS("function(rowInfo, column) {
if (column.id !== 'links') {
return
}
var link = rowInfo.row.linked;
console.log(link);
window.open(link, '_blank');
}")
)
)
```
Information
=====================================
Row
---------------------------------------------------------------------------------
### R Translation Weblate Status
:::: {.blackbox data-latex=""}
::: {.center data-latex=""}
<strong>Dashboard Developer</strong>
:::
<p><h3>Shrish Shete</h3>(<em>Contributor at GSOC 2023</em>)</p>
<i class="fa-solid fa-circle-info"></i> <b>About</b> : Student at <b>IIT Kanpur</b>,India (Statistics and Data Science)<br>
<i class="fa-regular fa-envelope"></i> <b>Email</b> : [email protected]<br>
<i class="fa-brands fa-github"></i> <b>Github</b> : https://github.com/shrish-shete20<br>
<i class="fa-brands fa-linkedin"></i> <b>Linkedin</b> : https://www.linkedin.com/in/shrish-shete-31a34a249/<br>
::::
### R Translation Weblate Status
:::: {.blackbox data-latex=""}
::: {.centers data-latex=""}
<strong>Mentors</strong>
:::
<h5 class="Mentor1">Ben Ubah</h5>
<i class="fa-solid fa-circle-info"></i> <b>About</b> : Mentor at GSOC 2023<br>
<i class="fa-regular fa-envelope"></i> <b>Email</b> : [email protected]<br>
<h5 class="Mentor2">Gabriel Becker</h5>
<i class="fa-solid fa-circle-info"></i> <b>About</b> : Mentor at GSOC 2023<br>
<i class="fa-regular fa-envelope"></i> <b>Email</b> : [email protected]<br>
::::
<style>
.centers {
text-align: center;
}
</style>
Row
---------------------------------------------------------------------------------
### <small> <em>About the Dashboard</em></small>
This R project seeks to develop a dashboard that provides a clear overview of the current
status of language translations, enabling the R community to comprehend the progress
made thus far easily.
The development of this tool has the potential to serve as a primary resource for exploring
and comprehending the progress made in translating a specific language. It can benefit a
wide range of stakeholders, including community developers and organizers seeking
information on language translations.
By providing a comprehensive report on the translation status of messages in different
languages, the tool can support the planning of diversity packages and recognize the
contributions of regional volunteers who devote considerable time and effort to translating
messages into their native languages by acknowledging the efforts.
The project aims to establish a robust framework for monitoring the translation status of R.
<i class="fa-solid fa-star"></i> <strong> Features</strong>
- <b>Leaderboard Page</b> : Contains a Leaderboard of all Users on Weblate. This allowed users to view their rank on the platform, providing a clear visual representation of translation progress. The leaderboard is expected to motivate contributors to continue their efforts.
- <b> Language Page</b> : The Language Page provides a comprehensive overview of the translation status of each language. This is achieved through the use of a variety of visualizations, which display information such as the number of translators working on each language, the amount of work that remains to be translated, and the overall progress of the translation project. The Language Page is an essential tool for project managers and translators, as it allows them to track the progress of the translation project and identify areas where additional resources may be needed. It is also a valuable resource for users who are interested in contributing to the translation project.
- <b> Library Page</b> : The Library Page provides an overview of the translation status of each library in each language. It includes information such as the number of components that have been translated, the amount of work that remains to be translated, and the overall progress of the translation project. The Library Page also includes an overview of the translation status in each component. It is also a valuable resource for users who are interested in contributing to the translation project.
- <b> Translation Page</b> : The Translation Page provides a list of strings that have been translated, but still need editing. The list includes links to the translation site, so that users can easily contribute their edits. The Translation Page is designed to be user-friendly and informative. The list of strings is clear and easy to understand, and the links to the translation site are easy to find. The Translation Page is a valuable resource for anyone who is involved in the translation project, and it is an essential tool for ensuring the success of the project.
<i class="fa-solid fa-toolbox"></i> <strong>TOOLS</strong>
- <i class="fa-solid fa-wrench"></i> Front-End : HTML <i class="fa-brands fa-html5"></i>,CSS <i class="fa-brands fa-css3-alt"></i>,Java Script <i class="fa-brands fa-js"></i>,bslib theme template <i class="fa-solid fa-code"></i>.
- <i class="fa-solid fa-wrench"></i> Back-End : A small ETL infrastructure based on R <i class="fa-brands fa-r-project"></i>,Github actions <i class="fa-brands fa-github"></i>, Github Pages <i class="fa-brands fa-square-github"></i> that daily retrieves data from Weblate API. This infrastructure provides a way to work with Weblate's authentication system automatically. The back-end is completely separated from the front-end.
- <i class="fa-solid fa-clock"></i> Update : The dashboard is updated daily.
<style>
ul {