Skip to contents

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

Usage

get_AMR_locale()

set_AMR_locale(lang)

reset_AMR_locale()

translate_AMR(x, language = get_AMR_locale())

Arguments

lang

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

x

text to translate

Details

The currently 16 supported languages are English, Chinese, Danish, Dutch, French, German, Greek, Italian, Japanese, Polish, Portuguese, Russian, Spanish, Swedish, Turkish and Ukrainian. All these languages have translations available for all antimicrobial agents and colloquial microorganism names.

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 R option AMR_locale, either by using set_AMR_locale() or by running e.g. options(AMR_locale = "de").

    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.

  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 R option AMR_locale is set, the system variables LANGUAGE and LANG will be ignored.

Examples

# Current settings (based on system language)
ab_name("Ciprofloxacin")
#> [1] "Ciprofloxacin"
mo_name("Coagulase-negative Staphylococcus")
#> [1] "Coagulase-negative Staphylococcus (CoNS)"

# setting another language
set_AMR_locale("Greek")
#> ℹ Using the Greek language (Ελληνικά) for the AMR package for this session.
ab_name("Ciprofloxacin")
#> [1] "Σιπροφλοξασίνη"
mo_name("Coagulase-negative Staphylococcus")
#> [1] "Σταφυλόκοκκος με αρνητική πηκτικότητα (CoNS)"

set_AMR_locale("Spanish")
#> ℹ Using the Spanish language (Español) for the AMR package for this
#>   session.
ab_name("Ciprofloxacin")
#> [1] "Ciprofloxacina"
mo_name("Coagulase-negative Staphylococcus")
#> [1] "Staphylococcus coagulasa negativo (SCN)"

# set_AMR_locale() understands endonyms, English exonyms, and ISO-639-1:
set_AMR_locale("Deutsch")
#> ℹ Using the German language (Deutsch) for the AMR package for this session.
set_AMR_locale("German")
#> ℹ Using the German language (Deutsch) for the AMR package for this session.
set_AMR_locale("de")
#> ℹ Using the German language (Deutsch) for the AMR package for this session.

# reset to system default
reset_AMR_locale()