Skip to content

Commit

Permalink
updated translations
Browse files Browse the repository at this point in the history
  • Loading branch information
pvictor committed Nov 23, 2021
1 parent 3faee4d commit dfe2889
Show file tree
Hide file tree
Showing 13 changed files with 61 additions and 18 deletions.
6 changes: 3 additions & 3 deletions R/i18n.R
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ i18n_translations <- function(package = packageName(parent.frame(2))) {
if (is.null(language))
return(NULL)
if (is.character(language) && i18n_exist(language, package = package)) {
language <- fread(file = i18n_file(language, package = package), encoding = "UTF-8")
language <- fread(file = i18n_file(language, package = package), encoding = "UTF-8", fill = TRUE)
}
if (is.character(language) && file.exists(language)) {
language <- fread(file = language, encoding = "UTF-8")
Expand All @@ -71,11 +71,11 @@ i18n_translations <- function(package = packageName(parent.frame(2))) {
#' * a `data.frame` with 2 column: `label` & `translation`.
#' * path to a CSV file with same structure as for `data.frame` above.
#' @param packages Name of packages for which to set i18n, default to esquisse and datamods
#'
#'
#' @export
#'
#' @rdname i18n
#'
#'
#' @importFrom stats setNames
set_i18n <- function(value, packages = c("datamods", "esquisse")) {
if (is.null(packages)) {
Expand Down
2 changes: 1 addition & 1 deletion R/import-copypaste.R
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ import_copypaste_ui <- function(id, title = TRUE) {
textInput(
inputId = ns("name"),
label = NULL,
placeholder = "Add a label to data",
placeholder = i18n("Add a label to data"),
width = "100%"
),
tags$div(
Expand Down
7 changes: 6 additions & 1 deletion examples/filter_data.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ datetime <- data.frame(
num = sample.int(1e5, 300)
)

one_column_numeric <- data.frame(
var1 = rnorm(100)
)

ui <- fluidPage(
tags$h2("Filter data.frame"),

Expand All @@ -30,7 +34,8 @@ ui <- fluidPage(
"mtcars",
"mtcars_na",
"Cars93",
"datetime"
"datetime",
"one_column_numeric"
),
inline = TRUE
),
Expand Down
3 changes: 2 additions & 1 deletion inst/i18n/fr.csv
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
label,translation
label,translation,comment
"Import a dataset from an environment","Importer un jeu de données depuis l'environnement global"
"Select a data.frame:","Sélectionner un data.frame :"
"List of data.frame...","Liste des tableau de données"
Expand Down Expand Up @@ -59,3 +59,4 @@ label,translation
"Number of rows:","Nombre de lignes :"
"No data to display.","Pas de données à afficher."
"Close","Fermer"
"Add a label to data","Ajouter un libellé aux données"
7 changes: 4 additions & 3 deletions inst/i18n/mk.csv
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
label,translation
label,translation,comment
"Import a dataset from an environment","Увезете податочен сет од околината"
"Select a data.frame:","Изберете data.frame"
"List of data.frame...","Список на табели со податоци"
Expand Down Expand Up @@ -50,12 +50,13 @@ label,translation
"Date to use as origin to convert date/datetime:","Датум што треба да се користи за конвертирање на date/datetime променлива"
"Select, rename and convert variables in table above, then apply changes by clicking button below.","Изберете, преименувајте и конвертирајте променливи во табелата горе, а потоа применете ги промените со кликање на копчето долу."
"Apply changes","Применете ги промените"
"Data has %s observations and %s variables.","Податоците имаат % опсервации и % варијабли."
"Data has %s observations and %s variables.","Податоците имаат %s опсервации и %s варијабли."
"Data successfully updated!","Податоците се успешно ажурирани!"
"Validation:","Проверка: "
"OK","Во ред"
"Failed","Неуспех"
"Error","Грешка"
"Number of rows:","Број на редови:"
"No data to display.","Нема податоци за приказ."
"Close","Затвори"
"Close","Затвори",
"Add a label to data","Додадете етикета на податоците","#TODO #CHECK"
3 changes: 2 additions & 1 deletion inst/i18n/pt.csv
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
label,translation
label,translation,comment
Import a dataset from an environment,Importe um conjunto de dados do ambiente local
Select a data.frame:,Selecione um data.frame :
List of data.frame...,Lista de data.frame...
Expand Down Expand Up @@ -59,3 +59,4 @@ Error,Erro
Number of rows:,Número de linhas:
No data to display.,Nenhum dado para mostrar.
Close,Fechar
"Add a label to data","Adicionar uma etiqueta aos dados","#TODO #CHECK"
7 changes: 4 additions & 3 deletions inst/i18n/sq.csv
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
label,translation
label,translation,comment
Import a dataset from an environment,Importoni një grup të dhënash nga mjedisi
Select a data.frame:,Zgjidhni data.frame
List of data.frame...,Lista e tabelave të të dhënave (data.frame)
Expand Down Expand Up @@ -50,12 +50,13 @@ Date format:,Formati i datës:
Date to use as origin to convert date/datetime:,Data që do të përdoret për të konvertuar ndryshoren date/datetime
"Select, rename and convert variables in table above, then apply changes by clicking button below.","Zgjidhni, riemërtoni dhe konvertoni variablat në tabelën e mësipërme, e pastaj aplikoni ndryshimet duke klikuar butonin më poshtë."
Apply changes,Apliko ndryshimet
Data has %s observations and %s variables.,Të dhënat kanë %vëzhgime dhe %variabla
Data has %s observations and %s variables.,Të dhënat kanë %s vëzhgime dhe %s variabla
Data successfully updated!,Të dhënat janë azhurnuar me sukses!
Validation:,Verifikimi:
OK,Në rregull
Failed,Dështim
Error,Gabim
Number of rows:,Numri i rreshtave:
No data to display.,Nuk ka të dhëna për t’u shfaqur.
Close,Мbyll
Close,Мbyll,
"Add a label to data","Shtoni një etiketë në të dhëna","#TODO #CHECK"
7 changes: 6 additions & 1 deletion man/filter-data.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 7 additions & 1 deletion man/import-copypaste.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 7 additions & 1 deletion man/import-file.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion man/import-globalenv.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 7 additions & 1 deletion man/import-googlesheets.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions tests/testthat/test-i18n.R
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,15 @@ test_that("i18n works with file", {
test_that("i18n works with supported language", {
options("datamods.i18n" = "fr")
expect_identical(i18n_test("Help"), "Aide")

options("datamods.i18n" = "mk")
expect_type(i18n_test("Help"), "character")

options("datamods.i18n" = "pt")
expect_type(i18n_test("Help"), "character")

options("datamods.i18n" = "sq")
expect_type(i18n_test("Help"), "character")
})


Expand Down

0 comments on commit dfe2889

Please sign in to comment.