Skip to content
This repository has been archived by the owner on Jan 30, 2025. It is now read-only.

Commit

Permalink
Translate into French
Browse files Browse the repository at this point in the history
  • Loading branch information
nfrerebeau committed Dec 16, 2024
1 parent 53c508d commit 69c0268
Show file tree
Hide file tree
Showing 17 changed files with 204 additions and 31 deletions.
24 changes: 14 additions & 10 deletions R/diversity_alpha.R
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ setMethod(

F1 <- sum(x == 1) # Number of singleton species
if (F1 == N_rare)
stop("ACE is undefined when all rare species are singletons, ",
"consider using the bias-corrected Chao1 index instead.",
stop(tr_("ACE is undefined when all rare species are singletons."),
tr_("Consider using the bias-corrected Chao1 estimator instead."),
call. = FALSE)

## Sample coverage estimate for rare species
Expand Down Expand Up @@ -186,11 +186,13 @@ setMethod(
}
}
if (improved) {
f3 <- sum(x == 3) # Number of tripleton species
f4 <- sum(x == 4) # Number of quadrupleton species
f3 <- sum(x == 3) # Number of triple species
f4 <- sum(x == 4) # Number of quadruple species
if (f4 == 0)
stop("Improved Chao1 estimator is undefined ",
"when there is no quadrupleton species.", call. = FALSE)
stop(
tr_("Improved Chao1 estimator is undefined when there is no quadruple species."),
call. = FALSE
)

k <- f1 - ((N - 3) / (N - 1)) * ((f2 * f3) / (2 * f4))
D <- D + ((N - 3) / N) * (f3 / (4 * f4)) * max(k, 0)
Expand Down Expand Up @@ -230,8 +232,10 @@ setMethod(
q3 <- sum(q == 3) # Number of triple species
q4 <- sum(q == 4) # Number of quadruple species
if (q4 == 0)
stop("Improved Chao2 estimator is undefined ",
"when there is no quadruple species.", call. = FALSE)
stop(
tr_("Improved Chao2 estimator is undefined when there is no quadruple species."),
call. = FALSE
)

k <- q1 - ((t - 3) / (t - 1)) * ((q2 * q3) / (2 * q4))
D <- D + ((t - 3) / (4 * t)) * (q3 / q4) * max(k, 0)
Expand Down Expand Up @@ -262,8 +266,8 @@ setMethod(

q1 <- sum(q == 1) # Number of unique species in the assemblage
if (q1 == N_infr)
stop("ICE is undefined when all infrequent species are unique, ",
"consider using the bias-corrected Chao2 estimator instead.",
stop(tr_("ICE is undefined when all rare species are singletons."),
tr_("Consider using the bias-corrected Chao2 estimator instead."),
call. = FALSE)

## Sample coverage estimate
Expand Down
3 changes: 2 additions & 1 deletion R/plot_diceleraas.R
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,8 @@ setMethod(

## Add annotation
if (ann) {
graphics::title(main = main, sub = sub, xlab = "Count", ylab = NULL, ...)
graphics::title(main = main, sub = sub,
xlab = tr_("Absolute frequency"), ylab = NULL, ...)
}

invisible(object)
Expand Down
16 changes: 8 additions & 8 deletions R/plot_diversity.R
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,12 @@ plot.DiversityIndex <- function(x, log = "x",
if (ann) {
y_lab <- switch (
class(x),
HeterogeneityIndex = "Heterogeneity",
EvennessIndex = "Evenness",
RichnessIndex = "Richness",
"Diversity"
HeterogeneityIndex = tr_("Heterogeneity"),
EvennessIndex = tr_("Evenness"),
RichnessIndex = tr_("Richness"),
tr_("Diversity")
)
graphics::title(main = main, sub = sub, xlab = "Sample size",
graphics::title(main = main, sub = sub, xlab = tr_("Sample size"),
ylab = sprintf("%s (%s)", y_lab, x@method))
}

Expand Down Expand Up @@ -134,8 +134,8 @@ setMethod(

## Add annotation
if (ann) {
graphics::title(main = main, sub = sub, xlab = "Sample size",
ylab = "Diversity", ...)
graphics::title(main = main, sub = sub, xlab = tr_("Sample size"),
ylab = tr_("Diversity"), ...)
}

## Legend
Expand Down Expand Up @@ -270,7 +270,7 @@ setMethod(
## Add annotation
if (ann) {
graphics::title(main = main, sub = sub, xlab = "alpha",
ylab = "Diversity", ...)
ylab = tr_("Diversity"), ...)
}

## Legend
Expand Down
4 changes: 2 additions & 2 deletions R/plot_rank.R
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ setMethod(

## Add annotation
if (ann) {
graphics::title(main = main, sub = sub, xlab = "Rank",
ylab = "Frequency", ...)
graphics::title(main = main, sub = sub, xlab = tr_("Rank"),
ylab = tr_("Frequency"), ...)
}

## Legend
Expand Down
4 changes: 2 additions & 2 deletions R/rarefaction.R
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,8 @@ plot.RarefactionIndex <- function(x, color = NULL, symbol = FALSE,

## Add annotation
if (ann) {
graphics::title(main = main, sub = sub, xlab = "Sample size",
ylab = "Expected species index")
graphics::title(main = main, sub = sub, xlab = tr_("Sample size"),
ylab = tr_("Expected species index"))
}

## Legend
Expand Down
8 changes: 3 additions & 5 deletions R/statistics.R
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,11 @@ setMethod(
#' @noRd
combination <- function(n, k) {
# Validation
if (!is.numeric(n))
stop("`n` must be a numeric vector.")
if (!is.numeric(k))
stop("`k` must be a numeric vector.")
arkhe::assert_scalar(n, "numeric")
arkhe::assert_scalar(k, "numeric")

if (n > 170 | k > 170) {
if (getOption("tabula.verbose")) message("Ramanujan approximation of x!")
if (getOption("tabula.verbose")) message(tr_("Ramanujan approximation of x!"))
c <- exp(ramanujan(n) - ramanujan(k) - ramanujan(n - k))
} else {
c <- factorial(n) / (factorial(k) * factorial(n - k))
Expand Down
5 changes: 5 additions & 0 deletions R/tabula-internal.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# HELPERS

## https://michaelchirico.github.io/potools/articles/developers.html
tr_ <- function(...) {
enc2utf8(gettext(paste0(...), domain = "R-tabula"))
}

is_incidence <- function(x) {
if (is.logical(x)) return(TRUE)
x <- as.numeric(x)
Expand Down
2 changes: 1 addition & 1 deletion README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Sys.setlocale("LC_MESSAGES", 'en_GB.UTF-8') # Force locale

<!-- badges: start -->
[![R-CMD-check](https://github.com/tesselle/tabula/workflows/R-CMD-check/badge.svg)](https://github.com/tesselle/tabula/actions)
[![codecov](https://codecov.io/gh/tesselle/tabula/branch/master/graph/badge.svg)](https://app.codecov.io/gh/tesselle/tabula)
[![codecov](https://codecov.io/gh/tesselle/tabula/branch/main/graph/badge.svg)](https://app.codecov.io/gh/tesselle/tabula)
[![CodeFactor](https://www.codefactor.io/repository/github/tesselle/tabula/badge)](https://www.codefactor.io/repository/github/tesselle/tabula)
[![Dependencies](https://tinyverse.netlify.app/badge/tabula)](https://cran.r-project.org/package=tabula)

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<!-- badges: start -->

[![R-CMD-check](https://github.com/tesselle/tabula/workflows/R-CMD-check/badge.svg)](https://github.com/tesselle/tabula/actions)
[![codecov](https://codecov.io/gh/tesselle/tabula/branch/master/graph/badge.svg)](https://app.codecov.io/gh/tesselle/tabula)
[![codecov](https://codecov.io/gh/tesselle/tabula/branch/main/graph/badge.svg)](https://app.codecov.io/gh/tesselle/tabula)
[![CodeFactor](https://www.codefactor.io/repository/github/tesselle/tabula/badge)](https://www.codefactor.io/repository/github/tesselle/tabula)
[![Dependencies](https://tinyverse.netlify.app/badge/tabula)](https://cran.r-project.org/package=tabula)

Expand Down
Binary file added inst/po/fr/LC_MESSAGES/R-tabula.mo
Binary file not shown.
2 changes: 1 addition & 1 deletion inst/tinytest/_tinysnapshot/plot_dice_leraas.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions inst/tinytest/test_diversity.R
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
Sys.setlocale("LC_MESSAGES", 'en_GB.UTF-8') # Force locale

source("helpers.R")
data("cantabria")

Expand Down
2 changes: 2 additions & 0 deletions inst/tinytest/test_plots.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
if (at_home()) {
Sys.setlocale("LC_MESSAGES", 'en_GB.UTF-8') # Force locale

source("helpers.R")
using("tinysnapshot")
options(tinysnapshot_device = "svglite")
Expand Down
2 changes: 2 additions & 0 deletions inst/tinytest/test_rarefaction.R
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
Sys.setlocale("LC_MESSAGES", 'en_GB.UTF-8') # Force locale

# Data from Magurran 1988, p. 128-129
trap <- matrix(data = c(9, 3, 0, 4, 2, 1, 1, 0, 1, 0, 1, 1,
1, 0, 1, 0, 0, 0, 1, 2, 0, 5, 3, 0),
Expand Down
2 changes: 2 additions & 0 deletions inst/tinytest/test_richness.R
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
Sys.setlocale("LC_MESSAGES", 'en_GB.UTF-8') # Force locale

source("helpers.R")
data("cantabria")

Expand Down
80 changes: 80 additions & 0 deletions po/R-fr.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
msgid ""
msgstr ""
"Project-Id-Version: tabula 3.1.1.9000\n"
"POT-Creation-Date: 2024-12-16 19:01+0100\n"
"PO-Revision-Date: 2024-12-16 19:01+0100\n"
"Last-Translator: Nicolas Frerebeau <nicolas.frerebeau@u-bordeaux-montaigne.fr>\n"
"Language-Team: fr\n"
"Language: fr\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"

#: diversity_alpha.R:62
msgid "ACE is undefined when all rare species are singletons."
msgstr "L'estimateur ACE est indéfini lorsque toutes les espèces rares sont des singletons."

#: diversity_alpha.R:63
msgid "Consider using the bias-corrected Chao1 estimator instead."
msgstr "Envisagez plutôt d'utiliser l'estimateur Chao1 non biaisé."

#: diversity_alpha.R:193
msgid ""
"Improved Chao1 estimator is undefined when there is no quadruple species."
msgstr ""
"L'estimateur Chao1 amélioré est indéfini lorsqu'il n'y a pas d'espèce quadruple."

#: diversity_alpha.R:236
msgid ""
"Improved Chao2 estimator is undefined when there is no quadruple species."
msgstr ""
"L'estimateur Chao2 amélioré est indéfini lorsqu'il n'y a pas d'espèce quadruple."

#: diversity_alpha.R:269
msgid "ICE is undefined when all rare species are singletons."
msgstr "L'estimateur ICE est indéfini lorsque toutes les espèces rares sont des singletons."

#: diversity_alpha.R:270
msgid "Consider using the bias-corrected Chao2 estimator instead."
msgstr "Envisagez plutôt d'utiliser l'estimateur Chao2 non biaisé."

#: plot_diceleraas.R:114
msgid "Absolute frequency"
msgstr "Fréquence absolue"

#: plot_diversity.R:68
msgid "Heterogeneity"
msgstr "Hétérogénéité"

#: plot_diversity.R:69
msgid "Evenness"
msgstr "Équitabilité"

#: plot_diversity.R:70
msgid "Richness"
msgstr "Richesse"

#: plot_diversity.R:71 plot_diversity.R:138 plot_diversity.R:273
msgid "Diversity"
msgstr "Diversité"

#: plot_diversity.R:73 plot_diversity.R:137 rarefaction.R:124
msgid "Sample size"
msgstr "Effectif"

#: plot_rank.R:79
msgid "Rank"
msgstr "Rang"

#: plot_rank.R:80
msgid "Frequency"
msgstr "Fréquence"

#: rarefaction.R:125
msgid "Expected species index"
msgstr "Indice de diversité attendu"

#: statistics.R:52
msgid "Ramanujan approximation of x!"
msgstr ""
77 changes: 77 additions & 0 deletions po/R-tabula.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
msgid ""
msgstr ""
"Project-Id-Version: tabula 3.1.1.9000\n"
"POT-Creation-Date: 2024-12-16 19:01+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"

#: diversity_alpha.R:62
msgid "ACE is undefined when all rare species are singletons."
msgstr ""

#: diversity_alpha.R:63
msgid "Consider using the bias-corrected Chao1 estimator instead."
msgstr ""

#: diversity_alpha.R:193
msgid ""
"Improved Chao1 estimator is undefined when there is no quadruple species."
msgstr ""

#: diversity_alpha.R:236
msgid ""
"Improved Chao2 estimator is undefined when there is no quadruple species."
msgstr ""

#: diversity_alpha.R:269
msgid "ICE is undefined when all rare species are singletons."
msgstr ""

#: diversity_alpha.R:270
msgid "Consider using the bias-corrected Chao2 estimator instead."
msgstr ""

#: plot_diceleraas.R:114
msgid "Absolute frequency"
msgstr ""

#: plot_diversity.R:68
msgid "Heterogeneity"
msgstr ""

#: plot_diversity.R:69
msgid "Evenness"
msgstr ""

#: plot_diversity.R:70
msgid "Richness"
msgstr ""

#: plot_diversity.R:71 plot_diversity.R:138 plot_diversity.R:273
msgid "Diversity"
msgstr ""

#: plot_diversity.R:73 plot_diversity.R:137 rarefaction.R:124
msgid "Sample size"
msgstr ""

#: plot_rank.R:79
msgid "Rank"
msgstr ""

#: plot_rank.R:80
msgid "Frequency"
msgstr ""

#: rarefaction.R:125
msgid "Expected species index"
msgstr ""

#: statistics.R:52
msgid "Ramanujan approximation of x!"
msgstr ""

0 comments on commit 69c0268

Please sign in to comment.