Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

feat(config): add channels locale configuration

Steven Enamakelee4850101177
diff --git a/crates/openhuman-core/src/config/schema/types/config.rs b/crates/openhuman-core/src/config/schema/types/config.rs
index 56cdd026ee..5f3b0f3c36 100644
--- a/crates/openhuman-core/src/config/schema/types/config.rs
+++ b/crates/openhuman-core/src/config/schema/types/config.rs
@@ -140,6 +140,13 @@ pub struct Config {
#[serde(default)]
pub output_language: Option<String>,
+ /// Trusted interface locale for user-facing native channel replies and
+ /// failure copy. This is separate from `output_language`, which guides
+ /// the assistant's model-authored response. Unsupported or unset locales
+ /// use English for host-generated copy.
+ #[serde(default)]
+ pub channels_locale: Option<String>,
+
/// The user's IANA time zone (`Asia/Kolkata`), chosen in Settings →
/// Account. `None` follows the device. Read it through
/// [`Config::time_zone`], which also validates it.
diff --git a/crates/openhuman-core/src/config/schema/types/config_clone.rs b/crates/openhuman-core/src/config/schema/types/config_clone.rs
index 30cc86a1f0..fe2ec59f8d 100644
--- a/crates/openhuman-core/src/config/schema/types/config_clone.rs
+++ b/crates/openhuman-core/src/config/schema/types/config_clone.rs
@@ -28,6 +28,7 @@ impl Clone for Config {
default_model: self.default_model.clone(),
default_temperature: self.default_temperature,
output_language: self.output_language.clone(),
+ channels_locale: self.channels_locale.clone(),
user_timezone: self.user_timezone.clone(),
temperature_unsupported_models: self.temperature_unsupported_models.clone(),
dashboard: self.dashboard.clone(),
diff --git a/crates/openhuman-core/src/config/schema/types/defaults.rs b/crates/openhuman-core/src/config/schema/types/defaults.rs
index fe1b8c536b..f456870a90 100644
--- a/crates/openhuman-core/src/config/schema/types/defaults.rs
+++ b/crates/openhuman-core/src/config/schema/types/defaults.rs
@@ -42,6 +42,7 @@ impl Default for Config {
default_model: Some(DEFAULT_MODEL.to_string()),
default_temperature: DEFAULT_TEMPERATURE,
output_language: None,
+ channels_locale: None,
user_timezone: None,
temperature_unsupported_models: default_temperature_unsupported_models(),
observability: ObservabilityConfig::default(),
diff --git a/crates/openhuman-core/src/config/schema/types_model_pin_tests.rs b/crates/openhuman-core/src/config/schema/types_model_pin_tests.rs
index 2a72294e51..1f94c0ca39 100644
--- a/crates/openhuman-core/src/config/schema/types_model_pin_tests.rs
+++ b/crates/openhuman-core/src/config/schema/types_model_pin_tests.rs
@@ -37,6 +37,27 @@ fn output_language_directive_strips_control_characters_and_blank_input() {
assert_eq!(output_language_directive(None), None);
}
+#[test]
+fn channels_locale_round_trips_and_old_configs_default_to_unset() {
+ let mut config = crate::config::schema::Config::default();
+ assert_eq!(config.channels_locale, None);
+
+ config.channels_locale = Some("zh-CN".to_string());
+ let serialized = toml::to_string(&config).expect("serialize config");
+ let restored: crate::config::schema::Config =
+ toml::from_str(&serialized).expect("deserialize config with channels locale");
+ assert_eq!(restored.channels_locale.as_deref(), Some("zh-CN"));
+
+ let legacy = serialized
+ .lines()
+ .filter(|line| !line.starts_with("channels_locale = "))
+ .collect::<Vec<_>>()
+ .join("\n");
+ let restored_legacy: crate::config::schema::Config =
+ toml::from_str(&legacy).expect("deserialize config without the new optional field");
+ assert_eq!(restored_legacy.channels_locale, None);
+}
+
#[test]
fn config_parses_orchestrator_and_team_model_pins() {
let config: Config = toml::from_str(
diff --git a/package.json b/package.json
index 13e5a1acd3..501e006a31 100644
--- a/package.json
+++ b/package.json
@@ -77,7 +77,8 @@
"tauri:android:init": "bash scripts/android-init.sh",
"tauri:android:dev": "pnpm --filter openhuman-app tauri:android:dev",
"tauri:android:build": "pnpm --filter openhuman-app tauri:android:build",
- "i18n:check": "tsx scripts/i18n-coverage.ts",
+ "i18n:check": "tsx scripts/i18n-coverage.ts && tsx scripts/generate-rust-chat-error-catalog.ts --check",
+ "i18n:chat-errors:generate": "tsx scripts/generate-rust-chat-error-catalog.ts --write",
"i18n:english:check": "tsx scripts/i18n-find-english.ts",
"i18n:react:check": "tsx scripts/i18n-react-audit.ts",
"i18n:bundle:check": "node scripts/verify-i18n-bundle.mjs",