fn available_languages(
        language_loader: &'_ dyn LanguageLoader,
    ) -> Result<Vec<unic_langid::LanguageIdentifier>, I18nEmbedError> {
        use std::path::{Component, Path};

        let mut language_strings: Vec<String> = Self::iter()
            .map(|filename_cow| filename_cow.to_string())
            .filter_map(|filename| {
                let path: &Path = Path::new(&filename);

                let components: Vec<Component> = path.components().collect();

                let locale: Option<String> = match components.get(0) {
                    Some(language_component) => match language_component {
                        Component::Normal(s) => {
                            Some(s.to_str().expect("path should be valid utf-8").to_string())
                        }
                        _ => None,
                    },
                    _ => None,
                };

                let language_file_name: Option<String> = components
                    .get(1)
                    .map(|component| match component {
                        Component::Normal(s) => {
                            Some(s.to_str().expect("path should be valid utf-8").to_string())
                        }
                        _ => None,
                    })
                    .flatten();

                match language_file_name {
                    Some(language_file_name) => {
                        debug!(
                            "Searching for available languages, found language file: \"{0}\"",
                            &filename
                        );
                        if language_file_name == language_loader.language_file_name() {
                            locale
                        } else {
                            None
                        }
                    }
                    None => None,
                }
            })
            .collect();

        language_strings.insert(0, language_loader.src_locale().to_string());

        language_strings
            .into_iter()
            .map(|language: String| {
                language
                    .parse()
                    .map_err(|err| I18nEmbedError::ErrorParsingLocale(language, err))
            })
            .collect()
    }
/// Calculate the embedded languages available to be selected for
/// the module requested by the provided [LanguageLoader](LanguageLoader).
Calculate the embedded languages available to be selected for
the module requested by the provided [LanguageLoader](LanguageLoader).
Calculate the embedded languages available to be selected for the module requested by the provided [ LanguageLoader ] ( LanguageLoader ) .
fn available_languages(
        language_loader: &'_ dyn LanguageLoader,
    ) -> Result<Vec<unic_langid::LanguageIdentifier>, I18nEmbedError> {
        use std::path::{Component, Path};
        let mut language_strings: Vec<String> = Self::iter()
            .map(|filename_cow| filename_cow.to_string())
            .filter_map(|filename| {
                let path: &Path = Path::new(&filename);
                let components: Vec<Component> = path.components().collect();
                let locale: Option<String> = match components.get(0) {
                    Some(language_component) => match language_component {
                        Component::Normal(s) => {
                            Some(s.to_str().expect("path should be valid utf-8").to_string())
                        }
                        _ => None,
                    },
                    _ => None,
                };
                let language_file_name: Option<String> = components
                    .get(1)
                    .map(|component| match component {
                        Component::Normal(s) => {
                            Some(s.to_str().expect("path should be valid utf-8").to_string())
                        }
                        _ => None,
                    })
                    .flatten();
                match language_file_name {
                    Some(language_file_name) => {
                        debug!(
                            "Searching for available languages, found language file: \"{0}\"",
                            &filename
                        );
                        if language_file_name == language_loader.language_file_name() {
                            locale
                        } else {
                            None
                        }
                    }
                    None => None,
                }
            })
            .collect();
        language_strings.insert(0, language_loader.src_locale().to_string());
        language_strings
            .into_iter()
            .map(|language: String| {
                language
                    .parse()
                    .map_err(|err| I18nEmbedError::ErrorParsingLocale(language, err))
            })
            .collect()
    }
fn available_languages ( language_loader : & ' _ dyn LanguageLoader , ) -> Result < Vec < unic_langid :: LanguageIdentifier > , I18nEmbedError > { use std :: path :: { Component , Path } ; let mut language_strings : Vec < String > = Self :: iter ( ) . map ( | filename_cow | filename_cow . to_string ( ) ) . filter_map ( | filename | { let path : & Path = Path :: new ( & filename ) ; let components : Vec < Component > = path . components ( ) . collect ( ) ; let locale : Option < String > = match components . get ( 0 ) { Some ( language_component ) => match language_component { Component :: Normal ( s ) => { Some ( s . to_str ( ) . expect ( " " ) . to_string ( ) ) } _ => None , } , _ => None , } ; let language_file_name : Option < String > = components . get ( 1 ) . map ( | component | match component { Component :: Normal ( s ) => { Some ( s . to_str ( ) . expect ( " " ) . to_string ( ) ) } _ => None , } ) . flatten ( ) ; match language_file_name { Some ( language_file_name ) => { debug ! ( " \" \" " filename ) ; if language_file_name == language_loader . language_file_name ( ) { locale } else { None } } None => None , } } ) . collect ( ) ; language_strings . insert ( 0 , language_loader . src_locale ( ) . to_string ( ) ) ; language_strings . into_iter ( ) . map ( | language : String | { language . parse ( ) . map_err ( | err | I18nEmbedError :: ErrorParsingLocale ( language , err ) ) } ) . collect ( ) }
Calculate the embedded languages available to be selected for
the module requested by the provided [LanguageLoader](LanguageLoader).
Calculate the embedded languages available to be selected for the module requested by the provided [ LanguageLoader ] ( LanguageLoader ) .
language_loader
&'_ dyn LanguageLoader
language_loader
&'_ dyn LanguageLoader