Skip to contents

For language-dependent output of AMR functions, such as mo_name(), mo_gramstain(), mo_type() and ab_name().

Usage

get_AMR_locale()

set_AMR_locale(language)

reset_AMR_locale()

translate_AMR(x, language = get_AMR_locale())

Arguments

language

language to choose. Use one of these supported language names or ISO-639-1 codes: English (en), Chinese (zh), Czech (cs), Danish (da), Dutch (nl), Finnish (fi), French (fr), German (de), Greek (el), Italian (it), Japanese (ja), Norwegian (no), Polish (pl), Portuguese (pt), Romanian (ro), Russian (ru), Spanish (es), Swedish (sv), Turkish (tr), or Ukrainian (uk).

x

text to translate

Details

The currently 20 supported languages are English (en), Chinese (zh), Czech (cs), Danish (da), Dutch (nl), Finnish (fi), French (fr), German (de), Greek (el), Italian (it), Japanese (ja), Norwegian (no), Polish (pl), Portuguese (pt), Romanian (ro), Russian (ru), Spanish (es), Swedish (sv), Turkish (tr), and Ukrainian (uk). All these languages have translations available for all antimicrobial drugs and colloquial microorganism names.

To permanently silence the once-per-session language note on a non-English operating system, you can set the package option AMR_locale in your .Rprofile file like this:

# Open .Rprofile file
utils::file.edit("~/.Rprofile")

# Then add e.g. Italian support to that file using:
options(AMR_locale = "Italian")

And then save the file.

Please read about adding or updating a language in our Wiki.

Changing the Default Language

The system language will be used at default (as returned by Sys.getenv("LANG") or, if LANG is not set, Sys.getlocale("LC_COLLATE")), if that language is supported. But the language to be used can be overwritten in two ways and will be checked in this order:

  1. Setting the package option AMR_locale, either by using e.g. set_AMR_locale("German") or by running e.g. options(AMR_locale = "German").

    Note that setting an R option only works in the same session. Save the command options(AMR_locale = "(your language)") to your .Rprofile file to apply it for every session. Run utils::file.edit("~/.Rprofile") to edit your .Rprofile file.

  2. Setting the system variable LANGUAGE or LANG, e.g. by adding LANGUAGE="de_DE.utf8" to your .Renviron file in your home directory.

Thus, if the package option AMR_locale is set, the system variables LANGUAGE and LANG will be ignored.

Examples

# Current settings (based on system language)
ab_name("Ciprofloxacin")
#> Error in .Call(Cchin, x, table): NULL value passed as symbol address
mo_name("Coagulase-negative Staphylococcus (CoNS)")
#> Error in .Call(Cchin, x, table): NULL value passed as symbol address

# setting another language
set_AMR_locale("Spanish")
#> Error in .Call(Cchin, x, table): NULL value passed as symbol address
ab_name("Ciprofloxacin")
#> Error in .Call(Cchin, x, table): NULL value passed as symbol address
mo_name("Coagulase-negative Staphylococcus (CoNS)")
#> Error in .Call(Cchin, x, table): NULL value passed as symbol address

# setting yet another language
set_AMR_locale("Greek")
#> Error in .Call(Cchin, x, table): NULL value passed as symbol address
ab_name("Ciprofloxacin")
#> Error in .Call(Cchin, x, table): NULL value passed as symbol address
mo_name("Coagulase-negative Staphylococcus (CoNS)")
#> Error in .Call(Cchin, x, table): NULL value passed as symbol address

# setting yet another language
set_AMR_locale("Ukrainian")
#> Error in .Call(Cchin, x, table): NULL value passed as symbol address
ab_name("Ciprofloxacin")
#> Error in .Call(Cchin, x, table): NULL value passed as symbol address
mo_name("Coagulase-negative Staphylococcus (CoNS)")
#> Error in .Call(Cchin, x, table): NULL value passed as symbol address

# set_AMR_locale() understands endonyms, English exonyms, and ISO-639-1:
set_AMR_locale("Deutsch")
#> Error in .Call(Cchin, x, table): NULL value passed as symbol address
set_AMR_locale("German")
#> Error in .Call(Cchin, x, table): NULL value passed as symbol address
set_AMR_locale("de")
#> Error in .Call(Cchin, x, table): NULL value passed as symbol address
ab_name("amox/clav")
#> Error in .Call(Cchin, x, table): NULL value passed as symbol address

# reset to system default
reset_AMR_locale()
#> ℹ Using the English language (English) for the AMR package for this
#>   session.
ab_name("amox/clav")
#> Error in .Call(Cchin, x, table): NULL value passed as symbol address