//! Example showing how to localize paths
usecamino::Utf8PathBuf;useicu_locale::locale;usel10n_embed::{Context, Localize};fnmain()->Result<(), std::io::Error>{// Create some paths
let current_directory =std::env::current_dir()?;let current_directory_utf8 =Utf8PathBuf::from_path_buf(current_directory.clone()).unwrap();// Localize these paths, which just prints the path as a string (lossily if using std::path)
let directories:[(&str,Box<dyn Localize>);2]=[("Current directory",Box::new(current_directory)),("Current directory (UTF-8)",Box::new(current_directory_utf8),),];let context =Context::new(locale!("en-US"),true);letmut buffer =String::new();for(name, directory)in directories {
buffer.clear();
directory.localize(&context,&mut buffer);println!("{name}: {buffer}");}Ok(())}