Compare commits
No commits in common. "48dd1155ba75c5cf1425b38f1da2aad4cb75e74a" and "5759fdcd5b528c6f3474cf48f067af4c371e9234" have entirely different histories.
48dd1155ba
...
5759fdcd5b
2 changed files with 7 additions and 10 deletions
|
|
@ -217,8 +217,8 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn test_client_creation() {
|
||||
let client = BotServerClient::new(Some("http://localhost:9000".to_string()));
|
||||
assert_eq!(client.base_url(), "http://localhost:9000");
|
||||
let client = BotServerClient::new(Some("http://localhost:8080".to_string()));
|
||||
assert_eq!(client.base_url(), "http://localhost:8080");
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
|
|||
|
|
@ -1,8 +1,6 @@
|
|||
use crate::error::{BotError, BotResult};
|
||||
use std::collections::HashMap;
|
||||
#[cfg(not(feature = "i18n"))]
|
||||
use std::fs;
|
||||
#[cfg(not(feature = "i18n"))]
|
||||
use std::path::Path;
|
||||
|
||||
#[cfg(feature = "i18n")]
|
||||
|
|
@ -91,7 +89,6 @@ struct LocaleBundle {
|
|||
}
|
||||
|
||||
impl LocaleBundle {
|
||||
#[cfg(not(feature = "i18n"))]
|
||||
fn load(locale_dir: &Path) -> BotResult<Self> {
|
||||
let dir_name = locale_dir
|
||||
.file_name()
|
||||
|
|
@ -175,24 +172,24 @@ pub struct I18nBundle {
|
|||
}
|
||||
|
||||
impl I18nBundle {
|
||||
pub fn load(_base_path: &str) -> BotResult<Self> {
|
||||
pub fn load(base_path: &str) -> BotResult<Self> {
|
||||
// When i18n feature is enabled, locales are ALWAYS embedded via rust-embed
|
||||
// Filesystem loading is deprecated - use embedded assets only
|
||||
#[cfg(feature = "i18n")]
|
||||
{
|
||||
log::info!("Loading embedded locale translations (rust-embed)");
|
||||
Self::load_embedded()
|
||||
return Self::load_embedded();
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "i18n"))]
|
||||
{
|
||||
// let _base_path = base_path; // Suppress unused warning when i18n is enabled
|
||||
let _base_path = base_path; // Suppress unused warning when i18n is enabled
|
||||
|
||||
let base = Path::new(_base_path);
|
||||
let base = Path::new(base_path);
|
||||
|
||||
if !base.exists() {
|
||||
return Err(BotError::config(format!(
|
||||
"locales directory not found: {_base_path}"
|
||||
"locales directory not found: {base_path}"
|
||||
)));
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue