#[derive(Debug, Clone)]
pub struct SpectralLabels {
pub wavelength_axis: &'static str,
pub relative_power_axis: &'static str,
pub spd_title: &'static str,
pub cvg_title: &'static str,
pub hue_title: &'static str,
pub uv_a: &'static str,
pub visible: &'static str,
pub near_ir: &'static str,
pub blue: &'static str,
pub green: &'static str,
pub red: &'static str,
pub uv_thermal_hazard: &'static str,
pub uv_exposure_risk: &'static str,
pub high_thermal: &'static str,
pub watts_per_nm: &'static str,
pub relative: &'static str,
pub rf_label: &'static str,
pub rg_label: &'static str,
pub reference: &'static str,
pub test: &'static str,
pub energy_distribution: &'static str,
pub uv_percent: &'static str,
pub visible_percent: &'static str,
pub ir_percent: &'static str,
pub r_fr_ratio: &'static str,
}
impl Default for SpectralLabels {
fn default() -> Self {
Self::english()
}
}
impl SpectralLabels {
pub const fn english() -> Self {
Self {
wavelength_axis: "Wavelength (nm)",
relative_power_axis: "Relative Power",
spd_title: "Spectral Power Distribution",
cvg_title: "Color Vector Graphic",
hue_title: "Hue Bin Fidelity",
uv_a: "UV-A",
visible: "Visible",
near_ir: "Near-IR",
blue: "Blue",
green: "Green",
red: "Red",
uv_thermal_hazard: "UV + Thermal hazard",
uv_exposure_risk: "UV exposure risk",
high_thermal: "High thermal output",
watts_per_nm: "W/nm",
relative: "Relative",
rf_label: "Rf",
rg_label: "Rg",
reference: "Reference",
test: "Test",
energy_distribution: "Energy Distribution",
uv_percent: "UV",
visible_percent: "Visible",
ir_percent: "IR",
r_fr_ratio: "R:FR Ratio",
}
}
pub const fn german() -> Self {
Self {
wavelength_axis: "Wellenlänge (nm)",
relative_power_axis: "Relative Leistung",
spd_title: "Spektrale Leistungsverteilung",
cvg_title: "Farbvektorgrafik",
hue_title: "Farbton-Wiedergabe",
uv_a: "UV-A",
visible: "Sichtbar",
near_ir: "Nah-IR",
blue: "Blau",
green: "Grün",
red: "Rot",
uv_thermal_hazard: "UV + Wärme-Gefahr",
uv_exposure_risk: "UV-Expositionsrisiko",
high_thermal: "Hohe Wärmeabgabe",
watts_per_nm: "W/nm",
relative: "Relativ",
rf_label: "Rf",
rg_label: "Rg",
reference: "Referenz",
test: "Test",
energy_distribution: "Energieverteilung",
uv_percent: "UV",
visible_percent: "Sichtbar",
ir_percent: "IR",
r_fr_ratio: "R:FR Verhältnis",
}
}
pub const fn french() -> Self {
Self {
wavelength_axis: "Longueur d'onde (nm)",
relative_power_axis: "Puissance relative",
spd_title: "Distribution spectrale de puissance",
cvg_title: "Graphique vectoriel couleur",
hue_title: "Fidélité de teinte",
uv_a: "UV-A",
visible: "Visible",
near_ir: "Proche-IR",
blue: "Bleu",
green: "Vert",
red: "Rouge",
uv_thermal_hazard: "Risque UV + thermique",
uv_exposure_risk: "Risque d'exposition UV",
high_thermal: "Émission thermique élevée",
watts_per_nm: "W/nm",
relative: "Relatif",
rf_label: "Rf",
rg_label: "Rg",
reference: "Référence",
test: "Test",
energy_distribution: "Distribution d'énergie",
uv_percent: "UV",
visible_percent: "Visible",
ir_percent: "IR",
r_fr_ratio: "Ratio R:FR",
}
}
pub const fn chinese() -> Self {
Self {
wavelength_axis: "波长 (nm)",
relative_power_axis: "相对功率",
spd_title: "光谱功率分布",
cvg_title: "色向量图",
hue_title: "色调保真度",
uv_a: "UV-A",
visible: "可见光",
near_ir: "近红外",
blue: "蓝",
green: "绿",
red: "红",
uv_thermal_hazard: "UV + 热危害",
uv_exposure_risk: "UV暴露风险",
high_thermal: "高热输出",
watts_per_nm: "W/nm",
relative: "相对",
rf_label: "Rf",
rg_label: "Rg",
reference: "参考",
test: "测试",
energy_distribution: "能量分布",
uv_percent: "UV",
visible_percent: "可见光",
ir_percent: "红外",
r_fr_ratio: "红光:远红光比",
}
}
pub const fn japanese() -> Self {
Self {
wavelength_axis: "波長 (nm)",
relative_power_axis: "相対パワー",
spd_title: "分光分布",
cvg_title: "カラーベクトルグラフィック",
hue_title: "色相忠実度",
uv_a: "UV-A",
visible: "可視光",
near_ir: "近赤外",
blue: "青",
green: "緑",
red: "赤",
uv_thermal_hazard: "UV + 熱危険",
uv_exposure_risk: "UV曝露リスク",
high_thermal: "高熱出力",
watts_per_nm: "W/nm",
relative: "相対",
rf_label: "Rf",
rg_label: "Rg",
reference: "基準",
test: "テスト",
energy_distribution: "エネルギー分布",
uv_percent: "UV",
visible_percent: "可視光",
ir_percent: "赤外",
r_fr_ratio: "R:FR比",
}
}
pub const fn spanish() -> Self {
Self {
wavelength_axis: "Longitud de onda (nm)",
relative_power_axis: "Potencia relativa",
spd_title: "Distribución espectral de potencia",
cvg_title: "Gráfico de vector de color",
hue_title: "Fidelidad de tono",
uv_a: "UV-A",
visible: "Visible",
near_ir: "IR cercano",
blue: "Azul",
green: "Verde",
red: "Rojo",
uv_thermal_hazard: "Riesgo UV + térmico",
uv_exposure_risk: "Riesgo de exposición UV",
high_thermal: "Alta emisión térmica",
watts_per_nm: "W/nm",
relative: "Relativo",
rf_label: "Rf",
rg_label: "Rg",
reference: "Referencia",
test: "Prueba",
energy_distribution: "Distribución de energía",
uv_percent: "UV",
visible_percent: "Visible",
ir_percent: "IR",
r_fr_ratio: "Ratio R:FR",
}
}
pub fn for_language(code: &str) -> Self {
match code.to_lowercase().as_str() {
"de" => Self::german(),
"fr" => Self::french(),
"zh" => Self::chinese(),
"ja" => Self::japanese(),
"es" => Self::spanish(),
_ => Self::english(),
}
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_default_is_english() {
let labels = SpectralLabels::default();
assert_eq!(labels.spd_title, "Spectral Power Distribution");
assert_eq!(labels.uv_a, "UV-A");
}
#[test]
fn test_language_lookup() {
let german = SpectralLabels::for_language("de");
assert_eq!(german.visible, "Sichtbar");
let chinese = SpectralLabels::for_language("zh");
assert_eq!(chinese.visible, "可见光");
}
}