// Map, wardley map editor for linux // Copyright (C) 2026 Rubén Beltrán del Río // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . use crate::tr; use wmap_renderer::StageType; /// All available stage types for rendering Wardley Maps. /// Order determines dropdown menu order. pub const ALL_STAGE_TYPES: &[StageType] = &[ StageType::Activities, StageType::Practice, StageType::Data, StageType::Knowledge, StageType::Ubiquity, StageType::Certainty, StageType::PublicationTypes, StageType::Market, StageType::KnowledgeManagement, StageType::MarketPerception, StageType::UserPerception, StageType::PerceptionInIndustry, StageType::FocusOfValue, StageType::Understanding, StageType::Comparison, StageType::Failure, StageType::MarketAction, StageType::Efficiency, StageType::DecisionDrivers, StageType::Behavior, ]; pub trait LocalizedStageType { fn localized_name(&self) -> String; fn localized_i(&self) -> String; fn localized_ii(&self) -> String; fn localized_iii(&self) -> String; fn localized_iv(&self) -> String; fn to_localized(&self) -> StageType; } impl LocalizedStageType for StageType { fn localized_name(&self) -> String { match self { StageType::Activities => tr!("stage.activities.name"), StageType::Practice => tr!("stage.practice.name"), StageType::Data => tr!("stage.data.name"), StageType::Knowledge => tr!("stages.knowledge.name"), StageType::Ubiquity => tr!("stages.ubiquity.name"), StageType::Certainty => tr!("stages.certainty.name"), StageType::PublicationTypes => tr!("stages.publication_types.name"), StageType::Market => tr!("stages.market.name"), StageType::KnowledgeManagement => tr!("stages.knowledge_management.name"), StageType::MarketPerception => tr!("stages.market_perception.name"), StageType::UserPerception => tr!("stages.user_perception.name"), StageType::PerceptionInIndustry => tr!("stages.perception_in_industry.name"), StageType::FocusOfValue => tr!("stages.focus_of_value.name"), StageType::Understanding => tr!("stages.understanding.name"), StageType::Comparison => tr!("stages.comparison.name"), StageType::Failure => tr!("stages.failure.name"), StageType::MarketAction => tr!("stages.market_action.name"), StageType::Efficiency => tr!("stages.efficiency.name"), StageType::DecisionDrivers => tr!("stages.decision_drivers.name"), StageType::Behavior => tr!("stages.behavior.name"), StageType::Cynefin => tr!("stages.cynefin.name"), StageType::EvolutionStage => tr!("stages.evolution_stage.name"), StageType::Custom { name, i: _, ii: _, iii: _, iv: _, } => name.clone(), } } fn localized_i(&self) -> String { match self { StageType::Activities => tr!("stage.activities.i"), StageType::Practice => tr!("stage.practice.i"), StageType::Data => tr!("stage.data.i"), StageType::Knowledge => tr!("stages.knowledge.i"), StageType::Ubiquity => tr!("stages.ubiquity.i"), StageType::Certainty => tr!("stages.certainty.i"), StageType::PublicationTypes => tr!("stages.publication_types.i"), StageType::Market => tr!("stages.market.i"), StageType::KnowledgeManagement => tr!("stages.knowledge_management.i"), StageType::MarketPerception => tr!("stages.market_perception.i"), StageType::UserPerception => tr!("stages.user_perception.i"), StageType::PerceptionInIndustry => tr!("stages.perception_in_industry.i"), StageType::FocusOfValue => tr!("stages.focus_of_value.i"), StageType::Understanding => tr!("stages.understanding.i"), StageType::Comparison => tr!("stages.comparison.i"), StageType::Failure => tr!("stages.failure.i"), StageType::MarketAction => tr!("stages.market_action.i"), StageType::Efficiency => tr!("stages.efficiency.i"), StageType::DecisionDrivers => tr!("stages.decision_drivers.i"), StageType::Behavior => tr!("stages.behavior.i"), StageType::Cynefin => tr!("stages.cynefin.i"), StageType::EvolutionStage => tr!("stages.evolution_stage.i"), StageType::Custom { name: _, i, ii: _, iii: _, iv: _, } => i.clone(), } } fn localized_ii(&self) -> String { match self { StageType::Activities => tr!("stage.activities.ii"), StageType::Practice => tr!("stage.practice.ii"), StageType::Data => tr!("stage.data.ii"), StageType::Knowledge => tr!("stages.knowledge.ii"), StageType::Ubiquity => tr!("stages.ubiquity.ii"), StageType::Certainty => tr!("stages.certainty.ii"), StageType::PublicationTypes => tr!("stages.publication_types.ii"), StageType::Market => tr!("stages.market.ii"), StageType::KnowledgeManagement => tr!("stages.knowledge_management.ii"), StageType::MarketPerception => tr!("stages.market_perception.ii"), StageType::UserPerception => tr!("stages.user_perception.ii"), StageType::PerceptionInIndustry => tr!("stages.perception_in_industry.ii"), StageType::FocusOfValue => tr!("stages.focus_of_value.ii"), StageType::Understanding => tr!("stages.understanding.ii"), StageType::Comparison => tr!("stages.comparison.ii"), StageType::Failure => tr!("stages.failure.ii"), StageType::MarketAction => tr!("stages.market_action.ii"), StageType::Efficiency => tr!("stages.efficiency.ii"), StageType::DecisionDrivers => tr!("stages.decision_drivers.ii"), StageType::Behavior => tr!("stages.behavior.ii"), StageType::Cynefin => tr!("stages.cynefin.ii"), StageType::EvolutionStage => tr!("stages.evolution_stage.ii"), StageType::Custom { name: _, i: _, ii, iii: _, iv: _, } => ii.clone(), } } fn localized_iii(&self) -> String { match self { StageType::Activities => tr!("stage.activities.iii"), StageType::Practice => tr!("stage.practice.iii"), StageType::Data => tr!("stage.data.iii"), StageType::Knowledge => tr!("stages.knowledge.iii"), StageType::Ubiquity => tr!("stages.ubiquity.iii"), StageType::Certainty => tr!("stages.certainty.iii"), StageType::PublicationTypes => tr!("stages.publication_types.iii"), StageType::Market => tr!("stages.market.iii"), StageType::KnowledgeManagement => tr!("stages.knowledge_management.iii"), StageType::MarketPerception => tr!("stages.market_perception.iii"), StageType::UserPerception => tr!("stages.user_perception.iii"), StageType::PerceptionInIndustry => tr!("stages.perception_in_industry.iii"), StageType::FocusOfValue => tr!("stages.focus_of_value.iii"), StageType::Understanding => tr!("stages.understanding.iii"), StageType::Comparison => tr!("stages.comparison.iii"), StageType::Failure => tr!("stages.failure.iii"), StageType::MarketAction => tr!("stages.market_action.iii"), StageType::Efficiency => tr!("stages.efficiency.iii"), StageType::DecisionDrivers => tr!("stages.decision_drivers.iii"), StageType::Behavior => tr!("stages.behavior.iii"), StageType::Cynefin => tr!("stages.cynefin.iii"), StageType::EvolutionStage => tr!("stages.evolution_stage.iii"), StageType::Custom { name: _, i: _, ii: _, iii, iv: _, } => iii.clone(), } } fn localized_iv(&self) -> String { match self { StageType::Activities => tr!("stage.activities.iv"), StageType::Practice => tr!("stage.practice.iv"), StageType::Data => tr!("stage.data.iv"), StageType::Knowledge => tr!("stages.knowledge.iv"), StageType::Ubiquity => tr!("stages.ubiquity.iv"), StageType::Certainty => tr!("stages.certainty.iv"), StageType::PublicationTypes => tr!("stages.publication_types.iv"), StageType::Market => tr!("stages.market.iv"), StageType::KnowledgeManagement => tr!("stages.knowledge_management.iv"), StageType::MarketPerception => tr!("stages.market_perception.iv"), StageType::UserPerception => tr!("stages.user_perception.iv"), StageType::PerceptionInIndustry => tr!("stages.perception_in_industry.iv"), StageType::FocusOfValue => tr!("stages.focus_of_value.iv"), StageType::Understanding => tr!("stages.understanding.iv"), StageType::Comparison => tr!("stages.comparison.iv"), StageType::Failure => tr!("stages.failure.iv"), StageType::MarketAction => tr!("stages.market_action.iv"), StageType::Efficiency => tr!("stages.efficiency.iv"), StageType::DecisionDrivers => tr!("stages.decision_drivers.iv"), StageType::Behavior => tr!("stages.behavior.iv"), StageType::Cynefin => tr!("stages.cynefin.iv"), StageType::EvolutionStage => tr!("stages.evolution_stage.iv"), StageType::Custom { name: _, i: _, ii: _, iii: _, iv, } => iv.clone(), } } fn to_localized(&self) -> StageType { StageType::Custom { name: self.localized_name(), i: self.localized_i(), ii: self.localized_ii(), iii: self.localized_iii(), iv: self.localized_iv(), } } }