AMR/man/translate.Rd

73 lines
4.4 KiB
Plaintext
Raw Normal View History

2019-05-10 16:44:59 +02:00
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/translate.R
2019-05-10 16:44:59 +02:00
\name{translate}
\alias{translate}
\alias{get_AMR_locale}
2022-08-19 12:33:14 +02:00
\alias{set_AMR_locale}
\alias{reset_AMR_locale}
\alias{translate_AMR}
\title{Translate Strings from the AMR Package}
2019-05-10 16:44:59 +02:00
\usage{
get_AMR_locale()
2022-08-19 12:33:14 +02:00
set_AMR_locale(lang)
reset_AMR_locale()
translate_AMR(x, language = get_AMR_locale())
}
\arguments{
\item{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"), "Ukrainian" ("uk").}
\item{x}{text to translate}
2019-05-10 16:44:59 +02:00
}
\description{
2020-05-16 13:05:47 +02:00
For language-dependent output of AMR functions, like \code{\link[=mo_name]{mo_name()}}, \code{\link[=mo_gramstain]{mo_gramstain()}}, \code{\link[=mo_type]{mo_type()}} and \code{\link[=ab_name]{ab_name()}}.
2019-05-10 16:44:59 +02:00
}
\details{
2022-08-19 12:33:14 +02:00
The currently 15 supported languages are English, Chinese, Danish, Dutch, French, German, Greek, Italian, Japanese, Polish, Portuguese, Russian, Spanish, Swedish and Ukrainian. All these languages have translations available for all antimicrobial agents and colloquial microorganism names.
2022-08-19 12:33:14 +02:00
Please suggest your own translations \href{https://github.com/msberends/AMR/issues/new?title=Translations}{by creating a new issue on our repository}. Strings will be translated to foreign languages if they are defined in \href{https://github.com/msberends/AMR/blob/main/data-raw/translations.tsv}{this repository file}. This file will be read by all functions where a translated output can be desired, like all \code{\link[=mo_property]{mo_*}} functions (such as \code{\link[=mo_name]{mo_name()}}, \code{\link[=mo_gramstain]{mo_gramstain()}}, \code{\link[=mo_type]{mo_type()}}, etc.) and \code{\link[=ab_property]{ab_*}} functions (such as \code{\link[=ab_name]{ab_name()}}, \code{\link[=ab_group]{ab_group()}}, etc.).
\subsection{Changing the Default Language}{
2019-05-10 16:44:59 +02:00
2022-08-19 12:33:14 +02:00
The system language will be used at default (as returned by \code{Sys.getenv("LANG")} or, if \code{LANG} is not set, \link{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:
2020-09-14 12:21:23 +02:00
\enumerate{
2022-08-19 12:33:14 +02:00
\item Setting the R option \code{AMR_locale}, either by using \code{set_AMR_locale()} or by running e.g. \code{options(AMR_locale = "de")}.
Note that setting an \R option only works in the same session. Save the command \code{options(AMR_locale = "(your language)")} to your \code{.Rprofile} file to apply it for every session.
\item Setting the system variable \code{LANGUAGE} or \code{LANG}, e.g. by adding \code{LANGUAGE="de_DE.utf8"} to your \code{.Renviron} file in your home directory.
2020-09-14 12:21:23 +02:00
}
Thus, if the R option \code{AMR_locale} is set, the system variables \code{LANGUAGE} and \code{LANG} will be ignored.
2020-09-14 12:21:23 +02:00
}
2019-05-10 16:44:59 +02:00
}
\section{Stable Lifecycle}{
\if{html}{\figure{lifecycle_stable.svg}{options: style=margin-bottom:"5"} \cr}
2020-07-08 14:48:06 +02:00
The \link[=lifecycle]{lifecycle} of this function is \strong{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.
2022-03-10 19:33:25 +01:00
If the unlying code needs breaking changes, they will occur gradually. For example, an argument will be deprecated and first continue to work, but will emit a 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.
}
\section{Read more on Our Website!}{
2019-05-10 16:44:59 +02:00
2021-06-01 15:33:06 +02:00
On our website \url{https://msberends.github.io/AMR/} you can find \href{https://msberends.github.io/AMR/articles/AMR.html}{a comprehensive tutorial} about how to conduct AMR data analysis, the \href{https://msberends.github.io/AMR/reference/}{complete documentation of all functions} and \href{https://msberends.github.io/AMR/articles/WHONET.html}{an example analysis using WHONET data}.
2019-05-10 16:44:59 +02:00
}
\examples{
2022-08-19 12:33:14 +02:00
# Current settings
ab_name("Ciprofloxacin")
mo_name("Coagulase-negative Staphylococcus")
2019-05-10 16:44:59 +02:00
2022-08-19 12:33:14 +02:00
# setting another language
set_AMR_locale("Greek")
ab_name("Ciprofloxacin")
mo_name("Coagulase-negative Staphylococcus")
2019-05-10 16:44:59 +02:00
2022-08-19 12:33:14 +02:00
set_AMR_locale("Spanish")
ab_name("Ciprofloxacin")
mo_name("Coagulase-negative Staphylococcus")
2021-09-29 12:12:35 +02:00
2022-08-19 12:33:14 +02:00
reset_AMR_locale()
2019-05-10 16:44:59 +02:00
}