fix: installateur Windows — accepter l'entree am-windows-x86_64.exe dans l'archive de release + i18n lang-aware pour am ai
release / release (push) Successful in 13m14s
release / macos (push) Canceled after 0s

- install.ps1 ne trouvait que 'am.exe' dans le zip : les archives (CI et
  manuelles) utilisent le nom plateforme 'am-windows-x86_64.exe' -> repli
  systematique sur cargo install au lieu du binaire precompile
- Le script accepte desormais les deux noms (copie vers am.exe) ; chemin
  du message cargo install corrige (.cargo\bin\am.exe au lieu de binam)
- i18n : am ai utilisait tr()/tr_fmt() globaux (flaky selon le process) —
  passage a tr_in/tr_fmt_in(app.lang()) + helper tr_fmt_in ajoute a i18n.rs
- Archive v1.0.6 : les deux entrees (am.exe + am-windows-x86_64.exe) pour
  la compatibilite maximale (installateurs et self-update)
- Tests ai_test insensibles a la locale (FR/EN)
- v1.0.6 ; ROADMAP maintenance note ajoutee
This commit is contained in:
2026-08-20 12:45:10 -04:00
parent 313645eea2
commit 50f515e406
8 changed files with 58 additions and 22 deletions
+9 -5
View File
@@ -129,22 +129,26 @@ fn exec_mode(
);
let decision = crate::shell_ai::decide(mode, risk, dry_run, yes);
let lang = app.lang();
let mut executed = false;
match decision {
Decision::Abort => {
let msg = if dry_run {
"dry-run : commande non exécutée"
crate::i18n::tr_in(lang, "dry-run : commande non exécutée")
} else {
"politique de sécurité (dry-run par défaut) : commande non exécutée — utilisez --yes"
crate::i18n::tr_in(
lang,
"politique de sécurité (dry-run par défaut) : commande non exécutée — utilisez --yes",
)
};
app.log.info(crate::i18n::tr(msg));
app.log.info(msg);
}
Decision::Ask => {
let ok = app.confirm(crate::i18n::tr("Exécuter ?"))?;
let ok = app.confirm(crate::i18n::tr_in(lang, "Exécuter ?"))?;
if ok {
executed = true;
} else {
app.log.info(crate::i18n::tr("annulé"));
app.log.info(crate::i18n::tr_in(lang, "annulé"));
}
}
Decision::Execute => {
+9
View File
@@ -436,6 +436,15 @@ pub fn tr_fmt<'a>(key: &'a str, args: &[&dyn std::fmt::Display]) -> String {
}
}
/// Format a message for a GIVEN locale (deterministic — follows the app's
/// resolved language instead of the process-global locale).
pub fn tr_fmt_in<'a>(lang: Lang, key: &'a str, args: &[&dyn std::fmt::Display]) -> String {
match lang {
Lang::Fr => fmt_args(key, args),
Lang::En => fmt_args(lookup_en(key).unwrap_or(key), args),
}
}
/// Replace `{}` placeholders (positional) with the Display of each argument.
fn fmt_args(template: &str, args: &[&dyn std::fmt::Display]) -> String {
let mut out = String::with_capacity(template.len() + 16);
+19 -9
View File
@@ -226,10 +226,10 @@ pub fn provider_env(
} else {
known.join(", ")
};
bail!(crate::tr_fmt!(
bail!(crate::i18n::tr_fmt_in(
app.lang(),
"provider '{}' inconnu — providers enregistrés: {}",
provider.unwrap_or(""),
hint
&[&provider.unwrap_or(""), &hint]
));
}
return Ok((Vec::new(), BTreeMap::new()));
@@ -307,16 +307,26 @@ pub fn generate(
if !out.status.success() {
let err = String::from_utf8_lossy(&out.stderr);
let err = err.trim();
bail!(crate::tr_fmt!(
bail!(crate::i18n::tr_fmt_in(
app.lang(),
"aichat n'a pas généré de commande (exit {}){}",
out.status.code().unwrap_or(-1),
if err.is_empty() { String::new() } else { format!(": {err}") }
&[
&out.status.code().unwrap_or(-1).to_string(),
&if err.is_empty() {
String::new()
} else {
format!(": {err}")
},
]
));
}
let stdout = String::from_utf8_lossy(&out.stdout);
extract_command(&stdout).ok_or_else(|| anyhow!(crate::i18n::tr(
"aichat n'a retourné aucune commande (dry-run)"
)))
extract_command(&stdout).ok_or_else(|| {
anyhow!(crate::i18n::tr_in(
app.lang(),
"aichat n'a retourné aucune commande (dry-run)"
))
})
}
/// Execute a generated command through the user's shell (default_shell >