diff options
Diffstat (limited to 'src/stages.rs')
| -rw-r--r-- | src/stages.rs | 159 |
1 files changed, 159 insertions, 0 deletions
diff --git a/src/stages.rs b/src/stages.rs index fba86b3..8de8f89 100644 --- a/src/stages.rs +++ b/src/stages.rs @@ -15,6 +15,7 @@ // along with this program. If not, see <http://www.gnu.org/licenses/>. use wmap_renderer::StageType; +use crate::tr; /// All available stage types for rendering Wardley Maps. /// Order determines dropdown menu order. @@ -40,3 +41,161 @@ pub const ALL_STAGE_TYPES: &[StageType] = &[ 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.to_string() + } + } + 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.to_string() + } + } + 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.to_string() + } + } + 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.to_string() + } + } + 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.to_string() + } + } + + 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() + } + } +} |