mirror of
https://github.com/msberends/AMR.git
synced 2025-07-08 12:31:58 +02:00
(v1.3.0.9018) language corrections
This commit is contained in:
@ -16,6 +16,7 @@ as.mo(
|
||||
allow_uncertain = TRUE,
|
||||
reference_df = get_mo_source(),
|
||||
ignore_pattern = getOption("AMR_ignore_pattern"),
|
||||
language = get_locale(),
|
||||
...
|
||||
)
|
||||
|
||||
@ -44,6 +45,8 @@ This excludes \emph{Enterococci} at default (who are in group D), use \code{Lanc
|
||||
|
||||
\item{ignore_pattern}{a regular expression (case-insensitive) of which all matches in \code{x} must return \code{NA}. This can be convenient to exclude known non-relevant input and can also be set with the option \code{AMR_ignore_pattern}, e.g. \code{options(AMR_ignore_pattern = "(not reported|contaminated flora)")}.}
|
||||
|
||||
\item{language}{language to translate text like "no growth", which defaults to the system language (see \code{\link[=get_locale]{get_locale()}})}
|
||||
|
||||
\item{...}{other parameters passed on to functions}
|
||||
}
|
||||
\value{
|
||||
@ -106,7 +109,7 @@ With the default setting (\code{allow_uncertain = TRUE}, level 2), below example
|
||||
|
||||
There are three helper functions that can be run after using the \code{\link[=as.mo]{as.mo()}} function:
|
||||
\itemize{
|
||||
\item Use \code{\link[=mo_uncertainties]{mo_uncertainties()}} to get a \code{\link{data.frame}} that prints in a pretty format with all taxonomic names that were guessed. The output contains a score that is based on the human pathogenic prevalence and the \href{https://en.wikipedia.org/wiki/Levenshtein_distance}{Levenshtein distance} between the full taxonomic name and the user input.
|
||||
\item Use \code{\link[=mo_uncertainties]{mo_uncertainties()}} to get a \code{\link{data.frame}} that prints in a pretty format with all taxonomic names that were guessed. The output contains a score that is based on the human pathogenic prevalence and the \href{https://en.wikipedia.org/wiki/Levenshtein_distance}{Levenshtein distance} between the user input and the full taxonomic name.
|
||||
\item Use \code{\link[=mo_failures]{mo_failures()}} to get a \code{\link{character}} \code{\link{vector}} with all values that could not be coerced to a valid value.
|
||||
\item Use \code{\link[=mo_renamed]{mo_renamed()}} to get a \code{\link{data.frame}} with all values that could be coerced based on old, previously accepted taxonomic names.
|
||||
}
|
||||
|
@ -55,23 +55,23 @@ mo_type(x, language = get_locale(), ...)
|
||||
|
||||
mo_gramstain(x, language = get_locale(), ...)
|
||||
|
||||
mo_snomed(x, ...)
|
||||
mo_snomed(x, language = get_locale(), ...)
|
||||
|
||||
mo_ref(x, ...)
|
||||
mo_ref(x, language = get_locale(), ...)
|
||||
|
||||
mo_authors(x, ...)
|
||||
mo_authors(x, language = get_locale(), ...)
|
||||
|
||||
mo_year(x, ...)
|
||||
mo_year(x, language = get_locale(), ...)
|
||||
|
||||
mo_rank(x, ...)
|
||||
mo_rank(x, language = get_locale(), ...)
|
||||
|
||||
mo_taxonomy(x, language = get_locale(), ...)
|
||||
|
||||
mo_synonyms(x, ...)
|
||||
mo_synonyms(x, language = get_locale(), ...)
|
||||
|
||||
mo_info(x, language = get_locale(), ...)
|
||||
|
||||
mo_url(x, open = FALSE, ...)
|
||||
mo_url(x, open = FALSE, language = get_locale(), ...)
|
||||
|
||||
mo_property(x, property = "fullname", language = get_locale(), ...)
|
||||
}
|
||||
|
@ -11,13 +11,21 @@ get_locale()
|
||||
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()}}.
|
||||
}
|
||||
\details{
|
||||
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: \url{https://github.com/msberends/AMR/blob/master/data-raw/translations.tsv}. This file will be read by all functions where a translated output can be desired, like all \code{\link[=mo_property]{mo_property()}} functions (\code{\link[=mo_name]{mo_name()}}, \code{\link[=mo_gramstain]{mo_gramstain()}}, \code{\link[=mo_type]{mo_type()}}, etc.).
|
||||
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: \url{https://github.com/msberends/AMR/blob/master/data-raw/translations.tsv}. This file will be read by all functions where a translated output can be desired, like all \code{\link[=mo_property]{mo_property()}} functions (\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_property()}} functions (\code{\link[=ab_name]{ab_name()}}, \code{\link[=ab_group]{ab_group()}} etc.).
|
||||
|
||||
Currently supported languages are: Dutch, English, French, German, Italian, Portuguese, Spanish. Please note that currently not all these languages have translations available for all antimicrobial agents and colloquial microorganism names.
|
||||
|
||||
Please suggest your own translations \href{https://github.com/msberends/AMR/issues/new?title=Translations}{by creating a new issue on our repository}.
|
||||
\subsection{Changing the default language}{
|
||||
|
||||
The system language will be used at default (as returned by \code{\link[=Sys.getlocale]{Sys.getlocale()}}), if that language is supported. The language to be used can be overwritten by setting the option \code{AMR_locale}, e.g. \code{options(AMR_locale = "de")}.
|
||||
The system language will be used at default (as returned by \link{Sys.getenv("LANG")} or, if \code{LANG} is not set, \code{\link[=Sys.getlocale]{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:
|
||||
\enumerate{
|
||||
\item Setting the R option \code{AMR_locale}, e.g. by running \code{options(AMR_locale = "de")}
|
||||
\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
|
||||
}
|
||||
|
||||
So if the R option \code{AMR_locale} is set, the system variables \code{LANGUAGE} and \code{LANG} will be ignored.
|
||||
}
|
||||
}
|
||||
\section{Stable lifecycle}{
|
||||
|
||||
|
Reference in New Issue
Block a user