1
2
Fork 0
mirror of https://github.com/mat-1/azalea.git synced 2025-08-02 23:44:38 +00:00
azalea/azalea-language/src/lib.rs
Shayne Hartford fc88dabd95
Fix binary compilation (#53)
* Fix binary compilation

* Unnecessary reference
2023-01-05 14:31:25 -06:00

21 lines
478 B
Rust
Executable file

//! Translate Minecraft strings from their id.
use once_cell::sync::Lazy;
use std::collections::HashMap;
pub static STORAGE: Lazy<HashMap<String, String>> =
Lazy::new(|| serde_json::from_str(include_str!("en_us.json")).unwrap());
pub fn get(key: &str) -> Option<&str> {
STORAGE.get(key).map(|s| s.as_str())
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_get() {
assert_eq!(get("translation.test.none"), Some("Hello, world!"));
}
}