For language-dependent output of AMR functions, like mo_name()
, mo_gramstain()
, mo_type()
and ab_name()
.
get_locale()
Strings will be translated to foreign languages if they are defined in a local translation file. Additions to this file can be suggested at our repository. The file can be found here: https://github.com/msberends/AMR/blob/main/data-raw/translations.tsv. This file will be read by all functions where a translated output can be desired, like all mo_*
functions (such as mo_name()
, mo_gramstain()
, mo_type()
, etc.) and ab_*
functions (such as ab_name()
, ab_group()
, etc.).
Currently supported languages are: Danish, Dutch, English, French, German, Italian, Portuguese and Spanish. All these languages have translations available for all antimicrobial agents and colloquial microorganism names.
Please suggest your own translations by creating a new issue on our repository.
The system language will be used at default (as returned by Sys.getenv("LANG")
or, if LANG
is not set, Sys.getlocale()
), if that language is supported. But the language to be used can be overwritten in two ways and will be checked in this order:
Setting the R option AMR_locale
, e.g. by running options(AMR_locale = "de")
Setting the system variable LANGUAGE
or LANG
, e.g. by adding LANGUAGE="de_DE.utf8"
to your .Renviron
file in your home directory
So if the R option AMR_locale
is set, the system variables LANGUAGE
and LANG
will be ignored.
The lifecycle of this function is stable. In a stable function, major changes are unlikely. This means that the unlying code will generally evolve by adding new arguments; removing arguments or changing the meaning of existing arguments will be avoided.
If the unlying code needs breaking changes, they will occur gradually. For example, a argument will be deprecated and first continue to work, but will emit an message informing you of the change. Next, typically after at least one newly released version on CRAN, the message will be transformed to an error.
On our website https://msberends.github.io/AMR/ you can find a comprehensive tutorial about how to conduct AMR data analysis, the complete documentation of all functions and an example analysis using WHONET data.
# The 'language' argument of below functions
# will be set automatically to your system language
# with get_locale()
# English
mo_name("CoNS", language = "en")
#> "Coagulase-negative Staphylococcus (CoNS)"
# Danish
mo_name("CoNS", language = "nl")
#> "Koagulase-negative stafylokokker (CoNS)"
# Dutch
mo_name("CoNS", language = "nl")
#> "Coagulase-negatieve Staphylococcus (CNS)"
# German
mo_name("CoNS", language = "de")
#> "Koagulase-negative Staphylococcus (KNS)"
# Italian
mo_name("CoNS", language = "it")
#> "Staphylococcus negativo coagulasi (CoNS)"
# Portuguese
mo_name("CoNS", language = "pt")
#> "Staphylococcus coagulase negativo (CoNS)"
# Spanish
mo_name("CoNS", language = "es")
#> "Staphylococcus coagulasa negativo (SCN)"