[−][src]Struct pseudolocalize::Pseudolocalizer
A configurable struct which can pseudolocalize strings.
Methods
impl<'a> Pseudolocalizer<'a>
[src]
pub fn new() -> Self
[src]
Create a default Pseudolocalizer
.
pub fn transform(&self, string: &str) -> String
[src]
Transform a string into a pseudolocalized string
according to the Pseudolocalizer
's configuration.
pub fn with_extension_string(self, extension: &'a str) -> Self
[src]
Set the extension string, i.e. the string used to increase the length of pseudolocalized strings (if the extension value is positive).
pub fn with_increase_percentage(self, increase: u32) -> Self
[src]
Set the increase rate of a string in percent.
Pseudolocalized strings shall contain the extension string (which may be cropped or repeated) so that the overall string gets larger.
For example an increase of 27% means that pseudolocalized strings shall be 1.27 times longer than the original string (not accounting for the prefix and suffix).
Please note that a naïve method is used to compute the length
(based on the number of char
s) and thus, the increase rate
may not be exact.
pub fn with_prefix(self, prefix: &'a str) -> Self
[src]
Set the prefix, i.e. the string with which pseudolocalized strings shall start.
pub fn with_suffix(self, suffix: &'a str) -> Self
[src]
Set the suffix, i.e. the string with which pseudolocalized strings shall end.
pub fn with_transform_function(
self,
transform_function: fn(_: &str) -> String
) -> Self
[src]
self,
transform_function: fn(_: &str) -> String
) -> Self
Set the transform function which can transform an input string into a string with similar-looking characters.
pub fn prefix(&self) -> &str
[src]
Get the string slice with which pseudolocalized strings shall start.
pub fn suffix(&self) -> &str
[src]
Get the string slice with which pseudolocalized strings shall end.
pub fn transform_function(&self) -> &fn(s: &str) -> String
[src]
Get the function used for pseudolocalizing strings.
Auto Trait Implementations
impl<'a> Send for Pseudolocalizer<'a>
impl<'a> Sync for Pseudolocalizer<'a>
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,