use std::collections::HashMap; use versioning::Version; pub const VERSION: Version = Version::new(0, 1, 1); pub struct Locale { pub language: String, pub region: String, pub time_zone: String, } pub struct TranslationFile { pub strings: HashMap, } impl TranslationFile { pub fn new() -> Self { panic!("Translations are not yet supported"); } pub fn translate(&self, key: &str) -> Result { let maybe_translated_string = self.strings.get(key); use crate::TranslationError::*; match maybe_translated_string { Some(translated_string) => Ok(translated_string.to_string()), None => Err(NoTranslationFound), } } } pub enum TranslationError { NoTranslationFound, }