use std::{borrow::Cow, collections::HashMap}; #[derive(Debug, Clone, Copy)] pub enum Language { English, } pub fn tr<'a>(lang: Language, key: &str, args: &[(&str, &str)]) -> Cow<'a, str> { let source_str = include_str!("../../locale/en.ini"); let tr_map = source_str .lines() .filter_map(|line| { let (key, value) = line.split_once("=")?; Some((key.trim(), value.trim())) }) .collect::>(); match tr_map.get(key) { Some(value) => Cow::Borrowed(value), None => Cow::Owned(format!("TR[{key}]")), } }