Files
hcie-rust-v3.05/hcie-iced-app/crates/hcie-iced-gui/src/i18n.rs
T
phantom 9388e6f096 GOOD Refactor GUI components and add PlainSlider widget
- Added a new `PlainSlider` widget for keyboard-editable numeric sliders.
- Updated various panels to utilize the new `PlainSlider` for better user interaction.
- Removed unused code and dead code warnings across multiple files.
- Improved organization of modules by adding a `widgets` module.
- Cleaned up imports in several files to streamline the codebase.
- Added Qodana configuration file for code analysis and quality checks.
2026-07-19 00:55:40 +03:00

88 lines
2.8 KiB
Rust
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
//! Internationalization (i18n) support for the HCIE Iced GUI.
//!
//! Provides translation keys for UI strings with English and Turkish locales.
//! The `t()` function returns a `&'static str` for the given language and key,
//! enabling zero-cost string lookups at render time.
use serde::{Deserialize, Serialize};
/// Supported UI languages.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default, Serialize, Deserialize)]
pub enum Language {
#[default]
English,
Turkish,
}
/// Translation keys for menu items and common UI strings.
#[allow(dead_code)]
pub enum TranslationKey {
File,
Edit,
Image,
Layer,
Filter,
Select,
View,
Window,
Help,
Tools,
New,
Open,
Save,
Export,
Quit,
Undo,
Redo,
Settings,
}
/// Returns the translated string for the given language and key.
///
/// Uses match arms to return `&'static str` — no allocations at call site.
#[allow(dead_code)]
pub fn t(lang: Language, key: TranslationKey) -> &'static str {
match lang {
Language::Turkish => match key {
TranslationKey::File => "Dosya",
TranslationKey::Edit => "Düzen",
TranslationKey::Image => "Görüntü",
TranslationKey::Layer => "Katman",
TranslationKey::Filter => "Filtre",
TranslationKey::Select => "Seç",
TranslationKey::View => "Görünüm",
TranslationKey::Window => "Pencere",
TranslationKey::Help => "Yardım",
TranslationKey::Tools => "Araçlar",
TranslationKey::New => "Yeni...",
TranslationKey::Open => "Aç...",
TranslationKey::Save => "Kaydet",
TranslationKey::Export => "Dışa Aktar...",
TranslationKey::Quit => "Çıkış",
TranslationKey::Undo => "Geri Al",
TranslationKey::Redo => "İleri Al",
TranslationKey::Settings => "Ayarlar",
},
Language::English => match key {
TranslationKey::File => "File",
TranslationKey::Edit => "Edit",
TranslationKey::Image => "Image",
TranslationKey::Layer => "Layer",
TranslationKey::Filter => "Filter",
TranslationKey::Select => "Select",
TranslationKey::View => "View",
TranslationKey::Window => "Window",
TranslationKey::Help => "Help",
TranslationKey::Tools => "Tools",
TranslationKey::New => "New...",
TranslationKey::Open => "Open...",
TranslationKey::Save => "Save",
TranslationKey::Export => "Export...",
TranslationKey::Quit => "Quit",
TranslationKey::Undo => "Undo",
TranslationKey::Redo => "Redo",
TranslationKey::Settings => "Settings",
},
}
}