pub struct HtmlTranslation<'a>(/* private fields */);Expand description
A Translation written as HTML, from Translation::html: the text as is, every value escaped.
askama writes it without escaping (it implements
askama::filters::HtmlSafe with the html feature), so
{{ i18n.t("terms").arg("name", user.name).html() }} keeps the
translation’s markup while user.name stays text.
§Examples
static LOCALES: ocre::i18n::Locales =
LazyLock::new(|| ocre::i18n::Catalog::load(&[("en", "en:\n note: \"<em>%{text}</em>\"\n")]));
let html = LOCALES.locale("en").t("note").arg("text", "a & b").html();
assert_eq!(html.to_string(), "<em>a & b</em>");Trait Implementations§
Source§impl<'a> Clone for HtmlTranslation<'a>
impl<'a> Clone for HtmlTranslation<'a>
Source§fn clone(&self) -> HtmlTranslation<'a>
fn clone(&self) -> HtmlTranslation<'a>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<'a> Debug for HtmlTranslation<'a>
impl<'a> Debug for HtmlTranslation<'a>
Source§impl Display for HtmlTranslation<'_>
impl Display for HtmlTranslation<'_>
impl HtmlSafe for HtmlTranslation<'_>
Available on crate feature
html only.Auto Trait Implementations§
impl<'a> Freeze for HtmlTranslation<'a>
impl<'a> RefUnwindSafe for HtmlTranslation<'a>
impl<'a> Send for HtmlTranslation<'a>
impl<'a> Sync for HtmlTranslation<'a>
impl<'a> Unpin for HtmlTranslation<'a>
impl<'a> UnsafeUnpin for HtmlTranslation<'a>
impl<'a> UnwindSafe for HtmlTranslation<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more