aien-translate
aien-dev/aien-translate
Brought by drakestapleton
GitHub aien-dev/aien-translate#3 (code only)
Apply it
git checkout -b patch-9219101a4b8f3f6e fc09dfe90e0170e422e44febb6de08c7f0c3a460 curl -fsSL https://interplane.io/drakestapleton/aien-translate/patches/9219101a4b8f3f6e.patch | git am
Provenance
github-import 1
aien-dev/aien-translate
3
7eb8cd67974bcb9a729ceb343ef1710ab45f7146
{"kind":"github-import","owner":"aien-dev","repo":"aien-translate","number":3,"url":"https://github.com/aien-dev/aien-translate/pull/3","export_sha256":"967c79e26a893657b5cdaa45efd442be5dbd2ecfe68e25f9a8c1b5da4d60d452","imported_utc":"2026-11-18T16:39:57Z","metadata":"unavailable","state_derived":true}
Changes
diff --git a/README.md b/README.md index 204997f..f6fa562 100644 --- a/README.md +++ b/README.md @@ -51,7 +51,7 @@ With `--auth-token-file`, the proxy must add the bearer header; unauthenticated Every translation is checked before a visitor sees it: - Links, email addresses, code in backticks, and placeholders such as `{name}` or `%s` must come through unchanged. -- Product names on the keep list (AIEN, Omega, Allen, and others) are never translated. Use `--keep-file` to supply your own list. +- Product names on the keep list (AIEN, Omega, Aien, and others) are never translated. Use `--keep-file` to supply your own list. - A translation that is empty, or far longer than the original, is thrown away. If any check fails, the visitor sees the original text instead of a broken translation. diff --git a/demo/index.html b/demo/index.html index cc76399..ddbc1f5 100644 --- a/demo/index.html +++ b/demo/index.html @@ -5,7 +5,7 @@ <h1>AIENOS: an agent-first sovereign operating system</h1> <p>AIEN runs its own models on the NVIDIA DGX Spark, with no cloud service in the loop.</p> <p>Read the docs at https://www.aienos.com and run <code>aien start</code> to begin.</p> -<p>Omega is the runtime. Allen is the agent who lives on it.</p> +<p>Omega is the runtime. Aien is the agent who lives on it.</p> <button>Get started</button> <script src="/translate.js"></script> <script> diff --git a/src/guard.rs b/src/guard.rs index 4a3cb78..07c30e7 100644 --- a/src/guard.rs +++ b/src/guard.rs @@ -41,7 +41,7 @@ fn contains_word(text: &str, term: &str) -> bool { let i = start + pos; let before = text[..i].chars().next_back(); let after = text[i + term.len()..].chars().next(); - let edge = |c: Option<char>| c.map_or(true, |c| !c.is_alphanumeric()); + let edge = |c: Option<char>| match c { None => true, Some(c) => !c.is_alphanumeric() }; if edge(before) && edge(after) { return true; } diff --git a/src/lib.rs b/src/lib.rs index cc1b9f8..cfd093f 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -28,13 +28,16 @@ use tokio::sync::Semaphore; use subtle::ConstantTimeEq; /// Bump when the prompt changes, so old saved translations are not reused. -pub const PROMPT_VERSION: &str = "p4"; +/// p5: the keep list (part of the prompt) gained "Aien". +pub const PROMPT_VERSION: &str = "p5"; /// Names that are never translated unless the operator overrides the list. +/// "Allen" is the assistant's former name; it stays listed because quotes and +/// history notes on the site still name it, and those must not be translated. pub const DEFAULT_KEEP: &[&str] = &[ - "AIEN", "AIENOS", "Aienix", "Omega", "OMEGA", "Interplane", "INTERPLANE", "Allen", "Synapse", - "Atlas", "Cortex", "Radicle", "Spark", "DGX", "GB10", "NVIDIA", "translate.js", "GitHub", "Rust", - "Linux", + "AIEN", "AIENOS", "Aienix", "Aien", "Omega", "OMEGA", "Interplane", "INTERPLANE", "Allen", + "Synapse", "Atlas", "Cortex", "Radicle", "Spark", "DGX", "GB10", "NVIDIA", "translate.js", + "GitHub", "Rust", "Linux", ]; const BATCH_ITEMS: usize = 40; @@ -426,4 +429,14 @@ mod tests { assert_eq!(parse_text("%5B%22a%22%5D"), vec!["a"]); assert_eq!(parse_text("plain"), vec!["plain"]); } + + #[test] + fn default_keep_protects_aien_and_its_former_name() { + let keep: Vec<String> = DEFAULT_KEEP.iter().map(|s| s.to_string()).collect(); + let p = guard::protected("Aien runs on Aienux; he used to be called Allen.", &keep); + assert!(p.contains(&"Aien".to_string()), "{p:?}"); + assert!(p.contains(&"Allen".to_string()), "{p:?}"); + assert!(guard::check("Aien is here", "Aien est ici", &keep).is_none()); + assert!(guard::check("Aien is here", "艾恩在这里", &keep).is_some()); + } }