pub struct KeywordTranslator {
pub target_locale: Locale,
/* private fields */
}Expand description
A keyword translator — maps canonical English keywords to a target locale’s keywords.
Fields§
§target_locale: LocaleThe target locale.
Implementations§
Source§impl KeywordTranslator
impl KeywordTranslator
Sourcepub fn for_locale(registry: &LocaleRegistry, target: Locale) -> Option<Self>
pub fn for_locale(registry: &LocaleRegistry, target: Locale) -> Option<Self>
Create a translator for the given target locale.
Sourcepub fn translate_keyword<'a>(&self, canonical: &'a str) -> &'a str
pub fn translate_keyword<'a>(&self, canonical: &'a str) -> &'a str
Translate a single canonical English keyword to the target locale.
Sourcepub fn translate_line(&self, line: &str) -> String
pub fn translate_line(&self, line: &str) -> String
Translate a line of VibeScript source, replacing keywords. This is a simple token-level substitution — it does not parse the line. Keywords inside strings or comments are NOT replaced.
Sourcepub fn translate_source(&self, source: &str) -> String
pub fn translate_source(&self, source: &str) -> String
Translate an entire source string, line by line.
Trait Implementations§
Source§impl Clone for KeywordTranslator
impl Clone for KeywordTranslator
Auto Trait Implementations§
impl Freeze for KeywordTranslator
impl RefUnwindSafe for KeywordTranslator
impl Send for KeywordTranslator
impl Sync for KeywordTranslator
impl Unpin for KeywordTranslator
impl UnsafeUnpin for KeywordTranslator
impl UnwindSafe for KeywordTranslator
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