1
0
mirror of https://github.com/msberends/AMR.git synced 2025-07-12 01:42:08 +02:00

(v2.1.1.9268) WISCA vignette, antibiogram sorting, fix translations

This commit is contained in:
2025-05-01 14:38:51 +02:00
parent 5e6bbdf3d1
commit 2461631bce
16 changed files with 156 additions and 134 deletions

View File

@ -203,7 +203,25 @@ translate_into_language <- function(from,
df_trans <- TRANSLATIONS # internal data file
from.bak <- from
from_unique <- unique(from)
from_unique_translated <- from_unique
from_split_combined <- function(vec) {
sapply(vec, function(x) {
if (grepl("/", x, fixed = TRUE)) {
parts <- strsplit(x, "/", fixed = TRUE)[[1]]
# Translate each part separately
translated_parts <- translate_into_language(
parts,
language = lang,
only_unknown = only_unknown,
only_affect_ab_names = only_affect_ab_names,
only_affect_mo_names = only_affect_mo_names
)
paste(translated_parts, collapse = "/")
} else {
x
}
}, USE.NAMES = FALSE)
}
from_unique_translated <- from_split_combined(from_unique)
# only keep lines where translation is available for this language
df_trans <- df_trans[which(!is.na(df_trans[, lang, drop = TRUE])), , drop = FALSE]