usecrate::{assets::{localisation::locale_hashmap, OnceCell},
MapLoader,};/// The function creates a `OnceCell` named `RES` that can hold an instance of `MapLoader`. The `OnceCell` is used to ensure that the `MapLoader` instance is created only once and subsequent calls to `locales` return the same instance.
pubfnlocales()->&'static MapLoader{// Create a new `OnceCell` that can hold a `MapLoader` instance.
staticRES:OnceCell<MapLoader>=OnceCell::new();// Retrieve the `MapLoader` instance from the `OnceCell`, or create a new one if it has not been initialised yet.
RES.get_or_init(||MapLoader::new(locale_hashmap()))}#[cfg(test)]modtests{usesuper::*;#[test]fnstatic_loader(){usecrate::map_loader::get::GetText;let loader =locales();let msg = loader.get("map-name","key-name");dbg!(&msg);}}