Files
Oxicloud/src/application/dtos/i18n_dto.rs
T
Dionisio 3050955f9c feat: add admin/profile UI, i18n (fr/de/pt), fix CI pipelines
- Add admin panel link and profile modal in user menu dropdown
- Add French, German and Portuguese locale support (full translations)
- Register new locales across JS frontend and Rust backend
- Create CI pipeline (fmt, clippy, test, audit, build)
- Fix docker-build.yml (cache, real tests, reduced timeout)
- Fix docker-publish.yml (multi-arch via QEMU, latest tag, pre-publish tests)
- Add dependabot.yml for automated dependency updates
2026-02-11 12:37:03 +01:00

65 lines
1.6 KiB
Rust

use serde::{Serialize, Deserialize};
use crate::domain::services::i18n_service::Locale;
/// DTO for locale information
#[derive(Debug, Serialize, Deserialize)]
pub struct LocaleDto {
/// Locale code (e.g., "en", "es")
pub code: String,
/// Locale name in its own language (e.g., "English", "Español")
pub name: String,
}
impl From<Locale> for LocaleDto {
fn from(locale: Locale) -> Self {
let (code, name) = match locale {
Locale::English => ("en", "English"),
Locale::Spanish => ("es", "Español"),
Locale::French => ("fr", "Français"),
Locale::German => ("de", "Deutsch"),
Locale::Portuguese => ("pt", "Português"),
};
Self {
code: code.to_string(),
name: name.to_string(),
}
}
}
/// DTO for translation request
#[derive(Debug, Deserialize)]
pub struct TranslationRequestDto {
/// The translation key
pub key: String,
/// The locale code (optional, defaults to "en")
pub locale: Option<String>,
}
/// DTO for translation response
#[derive(Debug, Serialize)]
pub struct TranslationResponseDto {
/// The translation key
pub key: String,
/// The locale code used for translation
pub locale: String,
/// The translated text
pub text: String,
}
/// DTO for translation error
#[derive(Debug, Serialize)]
pub struct TranslationErrorDto {
/// The translation key that was not found
pub key: String,
/// The locale code used for translation
pub locale: String,
/// The error message
pub error: String,
}