Framework for embedding localizations into Rust types
//! Example showing how to localize paths

use camino::Utf8PathBuf;
use icu_locale::{Locale, locale};
use l10n_embed::Localize;

const DEFAULT_LOCALE: Locale = locale!("en-US");

fn main() -> 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)
    println!(
        "Current directory: {}",
        current_directory.localize_for(&DEFAULT_LOCALE)
    );
    println!(
        "Current directory (UTF-8): {}",
        current_directory_utf8.localize_for(&DEFAULT_LOCALE)
    );

    Ok(())
}