Corrected Spansih translations Jordi
This commit is contained in:
parent
fd0e0d0cc6
commit
f583ea838b
|
|
@ -8,7 +8,7 @@ params:
|
||||||
borders: FALSE
|
borders: FALSE
|
||||||
ci_plot_type: "both"
|
ci_plot_type: "both"
|
||||||
colorblind_friendly: TRUE
|
colorblind_friendly: TRUE
|
||||||
lang: "es"
|
lang: "en"
|
||||||
facet_by_season: FALSE
|
facet_by_season: FALSE
|
||||||
x_axis_unit: "days"
|
x_axis_unit: "days"
|
||||||
output:
|
output:
|
||||||
|
|
@ -503,12 +503,13 @@ t <- function(key) {
|
||||||
if (key %in% names(tr)) {
|
if (key %in% names(tr)) {
|
||||||
txt <- glue(tr[key], .envir = parent.frame())
|
txt <- glue(tr[key], .envir = parent.frame())
|
||||||
txt <- gsub("\n", " \n", txt)
|
txt <- gsub("\n", " \n", txt)
|
||||||
|
|
||||||
return(enc2utf8(as.character(txt)))
|
return(enc2utf8(as.character(txt)))
|
||||||
} else if (key == "" | is.na(key)) {
|
} else if (is.na(key)) {
|
||||||
|
return(t("NA"))
|
||||||
|
} else if (key == "") {
|
||||||
return("")
|
return("")
|
||||||
} else {
|
} else {
|
||||||
return(paste0("[", key, "]"))
|
return(paste0(key))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
@ -538,7 +539,7 @@ if (exists("summary_tables") && !is.null(summary_tables) && length(summary_table
|
||||||
|
|
||||||
# 1. Uniformity insights - group by interpretation
|
# 1. Uniformity insights - group by interpretation
|
||||||
if (!is.null(summary_tables$uniformity) && nrow(summary_tables$uniformity) > 0) {
|
if (!is.null(summary_tables$uniformity) && nrow(summary_tables$uniformity) > 0) {
|
||||||
cat(t("field_unif"), "\n\n")
|
cat("\n", t("field_unif"))
|
||||||
uniformity_counts <- summary_tables$uniformity %>%
|
uniformity_counts <- summary_tables$uniformity %>%
|
||||||
dplyr::select(interpretation, count = field_count)
|
dplyr::select(interpretation, count = field_count)
|
||||||
|
|
||||||
|
|
@ -546,14 +547,14 @@ if (exists("summary_tables") && !is.null(summary_tables) && length(summary_table
|
||||||
status <- uniformity_counts$interpretation[i]
|
status <- uniformity_counts$interpretation[i]
|
||||||
count <- uniformity_counts$count[i]
|
count <- uniformity_counts$count[i]
|
||||||
if (!is.na(status) && !is.na(count) && count > 0) {
|
if (!is.na(status) && !is.na(count) && count > 0) {
|
||||||
cat("-", t("unif_status"), "\n\n")
|
cat(" -", t("unif_status"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# 2. Area change insights - group by interpretation
|
# 2. Area change insights - group by interpretation
|
||||||
if (!is.null(summary_tables$area_change) && nrow(summary_tables$area_change) > 0) {
|
if (!is.null(summary_tables$area_change) && nrow(summary_tables$area_change) > 0) {
|
||||||
cat(t("field_area"), "\n\n")
|
cat("\n\n", t("field_area"))
|
||||||
area_counts <- summary_tables$area_change %>%
|
area_counts <- summary_tables$area_change %>%
|
||||||
dplyr::select(interpretation, count = field_count)
|
dplyr::select(interpretation, count = field_count)
|
||||||
|
|
||||||
|
|
@ -561,14 +562,14 @@ if (exists("summary_tables") && !is.null(summary_tables) && length(summary_table
|
||||||
status <- area_counts$interpretation[i]
|
status <- area_counts$interpretation[i]
|
||||||
count <- area_counts$count[i]
|
count <- area_counts$count[i]
|
||||||
if (!is.na(status) && !is.na(count) && count > 0) {
|
if (!is.na(status) && !is.na(count) && count > 0) {
|
||||||
cat("-", t("area_status"), "\n\n")
|
cat(" -", t("area_status"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# 3. Growth trend insights - group by trend_interpretation
|
# 3. Growth trend insights - group by trend_interpretation
|
||||||
if (!is.null(summary_tables$growth_decline) && nrow(summary_tables$growth_decline) > 0) {
|
if (!is.null(summary_tables$growth_decline) && nrow(summary_tables$growth_decline) > 0) {
|
||||||
cat(t("growth_trend"), "\n\n")
|
cat("\n\n", t("growth_trend"))
|
||||||
growth_counts <- summary_tables$growth_decline %>%
|
growth_counts <- summary_tables$growth_decline %>%
|
||||||
dplyr::select(trend_interpretation, count = field_count)
|
dplyr::select(trend_interpretation, count = field_count)
|
||||||
|
|
||||||
|
|
@ -576,14 +577,14 @@ if (exists("summary_tables") && !is.null(summary_tables) && length(summary_table
|
||||||
trend <- growth_counts$trend_interpretation[i]
|
trend <- growth_counts$trend_interpretation[i]
|
||||||
count <- growth_counts$count[i]
|
count <- growth_counts$count[i]
|
||||||
if (!is.na(trend) && !is.na(count) && count > 0) {
|
if (!is.na(trend) && !is.na(count) && count > 0) {
|
||||||
cat("-", t("trend_status"), "\n\n")
|
cat(" -", t("trend_status"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# 4. Patchiness insights - group by patchiness_risk
|
# 4. Patchiness insights - group by patchiness_risk
|
||||||
if (!is.null(summary_tables$patchiness) && nrow(summary_tables$patchiness) > 0) {
|
if (!is.null(summary_tables$patchiness) && nrow(summary_tables$patchiness) > 0) {
|
||||||
cat(t("patch_risk"), "\n\n")
|
cat("\n\n", t("patch_risk"))
|
||||||
patchiness_counts <- summary_tables$patchiness %>%
|
patchiness_counts <- summary_tables$patchiness %>%
|
||||||
dplyr::select(patchiness_risk, count = field_count)
|
dplyr::select(patchiness_risk, count = field_count)
|
||||||
|
|
||||||
|
|
@ -591,14 +592,14 @@ if (exists("summary_tables") && !is.null(summary_tables) && length(summary_table
|
||||||
risk <- patchiness_counts$patchiness_risk[i]
|
risk <- patchiness_counts$patchiness_risk[i]
|
||||||
count <- patchiness_counts$count[i]
|
count <- patchiness_counts$count[i]
|
||||||
if (!is.na(risk) && !is.na(count) && count > 0) {
|
if (!is.na(risk) && !is.na(count) && count > 0) {
|
||||||
cat("-", t("patch_status"), "\n\n")
|
cat(" -", t("patch_status"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# 5. Total fields analyzed
|
# 5. Total fields analyzed
|
||||||
total_fields <- sum(summary_tables$uniformity$field_count, na.rm = TRUE)
|
total_fields <- sum(summary_tables$uniformity$field_count, na.rm = TRUE)
|
||||||
cat(t("tot_fields_analyzed"))
|
cat("\n\n", t("tot_fields_analyzed"))
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
cat(t("kpi_na"))
|
cat(t("kpi_na"))
|
||||||
|
|
@ -1455,14 +1456,14 @@ tryCatch({
|
||||||
if (nrow(field_kpi) > 0) {
|
if (nrow(field_kpi) > 0) {
|
||||||
# Format KPIs as compact single line (no interpretations, just values)
|
# Format KPIs as compact single line (no interpretations, just values)
|
||||||
kpi_parts <- c(
|
kpi_parts <- c(
|
||||||
sprintf("**CV:** %.2f", field_kpi$CV),
|
sprintf("**%s:** %.2f", t("cv_value"), field_kpi$CV),
|
||||||
sprintf("**Mean CI:** %.2f", field_kpi$Mean_CI)
|
sprintf("**%s:** %.2f", t("mean_ci"), field_kpi$Mean_CI)
|
||||||
)
|
)
|
||||||
|
|
||||||
# Add Weekly_CI_Change if available (note: capital C and I)
|
# Add Weekly_CI_Change if available (note: capital C and I)
|
||||||
if (!is.null(field_kpi$Weekly_CI_Change) && !is.na(field_kpi$Weekly_CI_Change)) {
|
if (!is.null(field_kpi$Weekly_CI_Change) && !is.na(field_kpi$Weekly_CI_Change)) {
|
||||||
change_sign <- ifelse(field_kpi$Weekly_CI_Change >= 0, "+", "")
|
change_sign <- ifelse(field_kpi$Weekly_CI_Change >= 0, "+", "")
|
||||||
kpi_parts <- c(kpi_parts, sprintf("**Δ CI:** %s%.2f", change_sign, field_kpi$Weekly_CI_Change))
|
kpi_parts <- c(kpi_parts, sprintf("**Δ%s:** %s%.2f", t("CI"), change_sign, field_kpi$Weekly_CI_Change))
|
||||||
}
|
}
|
||||||
|
|
||||||
# Compact trend display with symbols
|
# Compact trend display with symbols
|
||||||
|
|
@ -1474,17 +1475,17 @@ tryCatch({
|
||||||
grepl("Strong decline|Severe", field_kpi$Trend_Interpretation, ignore.case = TRUE) ~ "↓↓",
|
grepl("Strong decline|Severe", field_kpi$Trend_Interpretation, ignore.case = TRUE) ~ "↓↓",
|
||||||
TRUE ~ field_kpi$Trend_Interpretation
|
TRUE ~ field_kpi$Trend_Interpretation
|
||||||
)
|
)
|
||||||
kpi_parts <- c(kpi_parts, sprintf("**Trend:** %s", trend_compact))
|
kpi_parts <- c(kpi_parts, sprintf("**%s:** %s", t("Trend"), trend_compact))
|
||||||
|
|
||||||
if (!is.na(field_kpi$TCH_Forecasted) && field_kpi$TCH_Forecasted > 0) {
|
if (!is.na(field_kpi$TCH_Forecasted) && field_kpi$TCH_Forecasted > 0) {
|
||||||
kpi_parts <- c(kpi_parts, sprintf("**Yield:** %.1f t/ha", field_kpi$TCH_Forecasted))
|
kpi_parts <- c(kpi_parts, sprintf("**%s:** %.1f t/ha", t("Yield"), field_kpi$TCH_Forecasted))
|
||||||
}
|
}
|
||||||
|
|
||||||
kpi_parts <- c(
|
kpi_parts <- c(
|
||||||
kpi_parts,
|
kpi_parts,
|
||||||
sprintf("**Gap:** %.0f", field_kpi$Gap_Score),
|
sprintf("**%s:** %.0f%%", t("Gaps"), field_kpi$Gap_Score),
|
||||||
sprintf("**Patchiness:** %s", field_kpi$Patchiness_Risk),
|
sprintf("**%s:** %s", t("Patchiness"), t(field_kpi$Patchiness_Risk)),
|
||||||
sprintf("**Decline:** %s", field_kpi$Decline_Severity)
|
sprintf("**%s:** %s", t("Decline"), t(field_kpi$Decline_Severity))
|
||||||
)
|
)
|
||||||
|
|
||||||
cat(paste(kpi_parts, collapse = " | "), "\n\n") # Double newline for markdown paragraph break
|
cat(paste(kpi_parts, collapse = " | "), "\n\n") # Double newline for markdown paragraph break
|
||||||
|
|
@ -1667,7 +1668,7 @@ img_path <- ifelse(file.exists(target_img), target_img, "CI_graph_example.png")
|
||||||
```
|
```
|
||||||
|
|
||||||
<div align="center">
|
<div align="center">
|
||||||

|
{width=4in}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
`r t("sec_iii_1")`
|
`r t("sec_iii_1")`
|
||||||
|
|
@ -1725,18 +1726,6 @@ img_path <- ifelse(file.exists(target_img), target_img, "CI_graph_example.png")
|
||||||
- `r t("kpi_v_high")`
|
- `r t("kpi_v_high")`
|
||||||
- `r t("kpi_v_why")`
|
- `r t("kpi_v_why")`
|
||||||
|
|
||||||
- `r t("unif_v_patch")`
|
|
||||||
- `r t("unif")`
|
|
||||||
- `r t("patch")`
|
|
||||||
|
|
||||||
|
|
||||||
`r t("practical_example")`
|
|
||||||
|
|
||||||
- `r t("field_a")`
|
|
||||||
- `r t("field_b")`
|
|
||||||
|
|
||||||
`r t("scouting")`
|
|
||||||
|
|
||||||
- `r t("kpi_vi")`
|
- `r t("kpi_vi")`
|
||||||
- `r t("kpi_vi_calc")`
|
- `r t("kpi_vi_calc")`
|
||||||
- `r t("kpi_vi_identify")`
|
- `r t("kpi_vi_identify")`
|
||||||
|
|
@ -1754,6 +1743,18 @@ img_path <- ifelse(file.exists(target_img), target_img, "CI_graph_example.png")
|
||||||
|
|
||||||
`r t("hist_benchmark")`
|
`r t("hist_benchmark")`
|
||||||
|
|
||||||
|
`r t("unif_v_patch")`
|
||||||
|
|
||||||
|
- `r t("unif")`
|
||||||
|
- `r t("patch")`
|
||||||
|
|
||||||
|
`r t("practical_example")`
|
||||||
|
|
||||||
|
- `r t("field_a")`
|
||||||
|
- `r t("field_b")`
|
||||||
|
|
||||||
|
`r t("scouting")`
|
||||||
|
|
||||||
\newpage
|
\newpage
|
||||||
`r t("metadata")`
|
`r t("metadata")`
|
||||||
|
|
||||||
|
|
|
||||||
Binary file not shown.
Loading…
Reference in a new issue