pub fn localize<'args>(
        &'args self,
        key: &str,
        args: impl Into<Option<&'args FluentArgs<'args>>>,
    ) -> Option<ArcStr> {
        let args = args.into();
        let value = match self
            .current_bundle
            .get_message(key)
            .and_then(|msg| msg.value())
        {
            Some(v) => v,
            None => return None,
        };
        let mut errs = Vec::new();
        let result = self
            .current_bundle
            .format_pattern(key, value, args, &mut errs);
        for err in errs {
            warn!("localization error {:?}", err);
        }

        // fluent inserts bidi controls when interpolating, and they can
        // cause rendering issues; for now we just strip them.
        // https://www.w3.org/International/questions/qa-bidi-unicode-controls#basedirection
        const START_ISOLATE: char = '\u{2068}';
        const END_ISOLATE: char = '\u{2069}';
        if args.is_some() && result.chars().any(|c| c == START_ISOLATE) {
            Some(
                result
                    .chars()
                    .filter(|c| c != &START_ISOLATE && c != &END_ISOLATE)
                    .collect::<String>()
                    .into(),
            )
        } else {
            Some(result.into())
        }
    }
/// Fetch a localized string from the current bundle by key.
///
/// In general, this should not be used directly; [`LocalizedString`]
/// should be used for localization, and you should call
/// [`LocalizedString::resolve`] to update the string as required.
///
///[`LocalizedString`]: struct.LocalizedString.html
///[`LocalizedString::resolve`]: struct.LocalizedString.html#method.resolve
Fetch a localized string from the current bundle by key.
In general, this should not be used directly; [`LocalizedString`]
should be used for localization, and you should call
[`LocalizedString::resolve`] to update the string as required.


Fetch a localized string from the current bundle by key . In general this should not be used directly ; [ ` LocalizedString ` ] should be used for localization and you should call [ ` LocalizedString :: resolve ` ] to update the string as required .
pub fn localize<'args>(
        &'args self,
        key: &str,
        args: impl Into<Option<&'args FluentArgs<'args>>>,
    ) -> Option<ArcStr> {
        let args = args.into();
        let value = match self
            .current_bundle
            .get_message(key)
            .and_then(|msg| msg.value())
        {
            Some(v) => v,
            None => return None,
        };
        let mut errs = Vec::new();
        let result = self
            .current_bundle
            .format_pattern(key, value, args, &mut errs);
        for err in errs {
            warn!("localization error {:?}", err);
        }
        // fluent inserts bidi controls when interpolating, and they can
        // cause rendering issues; for now we just strip them.
        // https://www.w3.org/International/questions/qa-bidi-unicode-controls#basedirection
        const START_ISOLATE: char = '\u{2068}';
        const END_ISOLATE: char = '\u{2069}';
        if args.is_some() && result.chars().any(|c| c == START_ISOLATE) {
            Some(
                result
                    .chars()
                    .filter(|c| c != &START_ISOLATE && c != &END_ISOLATE)
                    .collect::<String>()
                    .into(),
            )
        } else {
            Some(result.into())
        }
    }
pub fn localize < ' args > ( & ' args self , key : & str , args : impl Into < Option < & ' args FluentArgs < ' args > > > , ) -> Option < ArcStr > { let args = args . into ( ) ; let value = match self . current_bundle . get_message ( key ) . and_then ( | msg | msg . value ( ) ) { Some ( v ) => v , None => return None , } ; let mut errs = Vec :: new ( ) ; let result = self . current_bundle . format_pattern ( key , value , args , & mut errs ) ; for err in errs { warn ! ( " " err ) ; } // fluent inserts bidi controls when interpolating, and they can // cause rendering issues; for now we just strip them. // https://www.w3.org/International/questions/qa-bidi-unicode-controls#basedirection const START_ISOLATE : char = '\u{2068}' ; const END_ISOLATE : char = '\u{2069}' ; if args . is_some ( ) && result . chars ( ) . any ( | c | c == START_ISOLATE ) { Some ( result . chars ( ) . filter ( | c | c != & START_ISOLATE && c != & END_ISOLATE ) . collect :: < String > ( ) . into ( ) , ) } else { Some ( result . into ( ) ) } }
Fetch a localized string from the current bundle by key.
Fetch a localized string from the current bundle by key .
&'args self
key
&str
args
impl Into<Option<&'args FluentArgs<'args>>>
&'args self
key
&str
args
impl Into<Option<&'args FluentArgs<'args>>>