use crate::i18n::{current, Language};
pub fn body_exceeds(max: usize) -> String {
match current() {
Language::English => format!("body exceeds {max} bytes"),
Language::Portuguese => format!("corpo excede {max} bytes"),
}
}
pub fn description_exceeds(max: usize) -> String {
match current() {
Language::English => format!("description must be <= {max} chars"),
Language::Portuguese => format!("descrição deve ter no máximo {max} caracteres"),
}
}
pub fn empty_body() -> String {
match current() {
Language::English => "body cannot be empty: provide --body, --body-file, or --body-stdin with content, or supply a graph via --entities-file/--graph-stdin".to_string(),
Language::Portuguese => "o corpo não pode estar vazio: forneça --body, --body-file ou --body-stdin com conteúdo, ou um grafo via --entities-file/--graph-stdin".to_string(),
}
}
pub fn empty_query() -> String {
match current() {
Language::English => "query cannot be empty".to_string(),
Language::Portuguese => "a consulta não pode estar vazia".to_string(),
}
}
pub fn file_not_utf8(err: &impl std::fmt::Display) -> String {
match current() {
Language::English => format!("file is not valid UTF-8: {err}"),
Language::Portuguese => format!("arquivo não é UTF-8 válido: {err}"),
}
}
pub fn invalid_memory_source(other: &str, expected: &str) -> String {
match current() {
Language::English => {
format!("invalid memory source: {other}; expected one of {expected}")
}
Language::Portuguese => {
format!("fonte de memória inválida: {other}; esperado um de {expected}")
}
}
}
pub fn max_files_exceeded(found: usize, max: usize) -> String {
match current() {
Language::English => {
format!("found {found} files, exceeds --max-files cap of {max}")
}
Language::Portuguese => {
format!("encontrados {found} arquivos, excede o limite --max-files de {max}")
}
}
}
pub fn max_files_exceeded_all_or_nothing(found: usize, max: usize) -> String {
match current() {
Language::English => format!(
"found {found} files exceeding --max-files cap of {max}; aborting (all-or-nothing)"
),
Language::Portuguese => format!(
"encontrados {found} arquivos excedendo o limite --max-files de {max}; \
abortando (tudo-ou-nada)"
),
}
}
pub fn max_files_exceeded_matching(found: usize, max: usize) -> String {
match current() {
Language::English => format!(
"found {found} files matching pattern, exceeds --max-files cap of {max} \
(raise the cap or narrow the pattern)"
),
Language::Portuguese => format!(
"encontrados {found} arquivos no padrão, excede o limite --max-files de {max} \
(aumente o limite ou restrinja o padrão)"
),
}
}
pub fn batch_line_invalid_json(index: usize, err: &impl std::fmt::Display) -> String {
match current() {
Language::English => format!("line {index}: invalid JSON: {err}"),
Language::Portuguese => format!("linha {index}: JSON inválido: {err}"),
}
}
pub fn batch_line_name_empty(index: usize) -> String {
match current() {
Language::English => format!("line {index}: name normalizes to empty string"),
Language::Portuguese => {
format!("linha {index}: nome normaliza para string vazia")
}
}
}
pub fn batch_line_type_description_required(index: usize) -> String {
match current() {
Language::English => format!(
"line {index}: --type and --description are required when creating a new memory"
),
Language::Portuguese => format!(
"linha {index}: --type e --description são obrigatórios ao criar uma nova memória"
),
}
}
pub fn ingest_aborted_on_first_failure(err: &impl std::fmt::Display) -> String {
match current() {
Language::English => format!("ingest aborted on first failure: {err}"),
Language::Portuguese => format!("ingest abortado na primeira falha: {err}"),
}
}
pub fn system_load_exceeded(load: f64, ncpus: usize) -> String {
match current() {
Language::English => format!(
"system load average {load:.2} exceeds 2x ncpus ({ncpus}); \
pass --no-max-load-check to override (not recommended)"
),
Language::Portuguese => format!(
"carga média do sistema {load:.2} excede 2x ncpus ({ncpus}); \
passe --no-max-load-check para sobrescrever (não recomendado)"
),
}
}