pub struct SearchLabels {
pub button_text: String,
pub button_aria: String,
pub modal_aria: String,
pub input_placeholder: String,
pub input_aria: String,
pub footer_close: String,
pub footer_navigate: String,
pub footer_open: String,
pub no_results: String,
}Expand description
Localizable strings shown in the search widget UI.
All fields are plain text. They are HTML-escaped when substituted into
attributes/text and JS-escaped when substituted into the inline script
(for the “no results” message). Build a value with one of the bundled
constructors (SearchLabels::english, SearchLabels::french,
SearchLabels::for_locale) or construct your own for any locale.
Fields§
Visible text on the trigger button (e.g. “Search”).
aria-label of the trigger button.
modal_aria: Stringaria-label of the modal dialog.
input_placeholder: StringPlaceholder text inside the input field.
input_aria: Stringaria-label of the input field.
Footer hint text shown next to the Esc key.
Footer hint text shown next to the up/down arrow keys.
Footer hint text shown next to the Enter key.
no_results: StringMessage shown when a query has no matches. The literal {query}
is replaced with the typed query at runtime.
Implementations§
Source§impl SearchLabels
impl SearchLabels
Sourcepub fn english() -> Self
pub fn english() -> Self
English (default) labels.
§Examples
use ssg::search::SearchLabels;
let lbl = SearchLabels::english();
assert_eq!(lbl.button_text, "Search");Sourcepub fn french() -> Self
pub fn french() -> Self
French labels.
§Examples
use ssg::search::SearchLabels;
let lbl = SearchLabels::french();
assert_eq!(lbl.button_text, "Rechercher");Sourcepub fn for_locale(code: &str) -> Self
pub fn for_locale(code: &str) -> Self
Build labels for a known locale code (ISO 639-1, plus zh-tw).
Lookup is case-insensitive. Falls back to English if the code is not in the bundled table.
§Examples
use ssg::search::SearchLabels;
let de = SearchLabels::for_locale("de");
assert_eq!(de.button_text, "Suchen");
// Unknown locale ⇒ English fallback.
let xx = SearchLabels::for_locale("xx");
assert_eq!(xx.button_text, "Search");Trait Implementations§
Source§impl Clone for SearchLabels
impl Clone for SearchLabels
Source§fn clone(&self) -> SearchLabels
fn clone(&self) -> SearchLabels
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for SearchLabels
impl Debug for SearchLabels
Auto Trait Implementations§
impl Freeze for SearchLabels
impl RefUnwindSafe for SearchLabels
impl Send for SearchLabels
impl Sync for SearchLabels
impl Unpin for SearchLabels
impl UnsafeUnpin for SearchLabels
impl UnwindSafe for SearchLabels
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more