Skip to main content

Translations

Struct Translations 

Source
pub struct Translations { /* private fields */ }
Expand description

Provides translated text strings for UI elements.

This struct contains all UI text translations used in the search dialog, including placeholders, tooltips, and labels.

§Examples

use iced_code_editor::{Language, Translations};

let translations = Translations::new(Language::French);
assert_eq!(translations.search_placeholder(), "Rechercher...");

Implementations§

Source§

impl Translations

Source

pub fn new(language: Language) -> Self

Creates a new Translations instance with the specified language.

This sets the global rust-i18n locale to the specified language.

§Examples
use iced_code_editor::{Language, Translations};

let translations = Translations::new(Language::Spanish);
assert_eq!(translations.language(), Language::Spanish);
Source

pub const fn language(&self) -> Language

Returns the current language.

§Examples
use iced_code_editor::{Language, Translations};

let translations = Translations::new(Language::French);
assert_eq!(translations.language(), Language::French);
Source

pub fn set_language(&mut self, language: Language)

Sets the language for translations.

This updates the global rust-i18n locale.

§Examples
use iced_code_editor::{Language, Translations};

let mut translations = Translations::new(Language::English);
translations.set_language(Language::Spanish);
assert_eq!(translations.language(), Language::Spanish);
Source

pub fn search_placeholder(&self) -> String

Returns the placeholder text for the search input field.

§Examples
use iced_code_editor::{Language, Translations};

let en = Translations::new(Language::English);
assert_eq!(en.search_placeholder(), "Search...");

let fr = Translations::new(Language::French);
assert_eq!(fr.search_placeholder(), "Rechercher...");
Source

pub fn replace_placeholder(&self) -> String

Returns the placeholder text for the replace input field.

§Examples
use iced_code_editor::{Language, Translations};

let es = Translations::new(Language::Spanish);
assert_eq!(es.replace_placeholder(), "Reemplazar...");
Source

pub fn case_sensitive_label(&self) -> String

Returns the label text for the case sensitive checkbox.

§Examples
use iced_code_editor::{Language, Translations};

let fr = Translations::new(Language::French);
assert_eq!(fr.case_sensitive_label(), "Sensible à la casse");
Source

pub fn previous_match_tooltip(&self) -> String

Returns the tooltip text for the previous match button.

§Examples
use iced_code_editor::{Language, Translations};

let en = Translations::new(Language::English);
assert_eq!(en.previous_match_tooltip(), "Previous match (Shift+F3)");
Source

pub fn next_match_tooltip(&self) -> String

Returns the tooltip text for the next match button.

§Examples
use iced_code_editor::{Language, Translations};

let es = Translations::new(Language::Spanish);
assert_eq!(es.next_match_tooltip(), "Siguiente coincidencia (F3 / Enter)");
Source

pub fn close_search_tooltip(&self) -> String

Returns the tooltip text for the close search dialog button.

§Examples
use iced_code_editor::{Language, Translations};

let fr = Translations::new(Language::French);
assert_eq!(fr.close_search_tooltip(), "Fermer la recherche (Échap)");
Source

pub fn replace_current_tooltip(&self) -> String

Returns the tooltip text for the replace current match button.

§Examples
use iced_code_editor::{Language, Translations};

let en = Translations::new(Language::English);
assert_eq!(en.replace_current_tooltip(), "Replace current match");
Source

pub fn replace_all_tooltip(&self) -> String

Returns the tooltip text for the replace all matches button.

§Examples
use iced_code_editor::{Language, Translations};

let es = Translations::new(Language::Spanish);
assert_eq!(es.replace_all_tooltip(), "Reemplazar todo");
Source

pub fn context_menu_undo(&self) -> String

Returns the context-menu label for undo.

§Examples
use iced_code_editor::{Language, Translations};

let en = Translations::new(Language::English);
assert_eq!(en.context_menu_undo(), "Undo");

let fr = Translations::new(Language::French);
assert_eq!(fr.context_menu_undo(), "Annuler");
Source

pub fn context_menu_redo(&self) -> String

Returns the context-menu label for redo.

§Examples
use iced_code_editor::{Language, Translations};

let en = Translations::new(Language::English);
assert_eq!(en.context_menu_redo(), "Redo");

let fr = Translations::new(Language::French);
assert_eq!(fr.context_menu_redo(), "Rétablir");
Source

pub fn context_menu_cut(&self) -> String

Returns the context-menu label for cut.

§Examples
use iced_code_editor::{Language, Translations};

let en = Translations::new(Language::English);
assert_eq!(en.context_menu_cut(), "Cut");

let de = Translations::new(Language::German);
assert_eq!(de.context_menu_cut(), "Ausschneiden");
Source

pub fn context_menu_copy(&self) -> String

Returns the context-menu label for copy.

§Examples
use iced_code_editor::{Language, Translations};

let en = Translations::new(Language::English);
assert_eq!(en.context_menu_copy(), "Copy");

let it = Translations::new(Language::Italian);
assert_eq!(it.context_menu_copy(), "Copia");
Source

pub fn context_menu_paste(&self) -> String

Returns the context-menu label for paste.

§Examples
use iced_code_editor::{Language, Translations};

let en = Translations::new(Language::English);
assert_eq!(en.context_menu_paste(), "Paste");

let es = Translations::new(Language::Spanish);
assert_eq!(es.context_menu_paste(), "Pegar");
Source

pub fn context_menu_select_all(&self) -> String

Returns the context-menu label for select all.

§Examples
use iced_code_editor::{Language, Translations};

let en = Translations::new(Language::English);
assert_eq!(en.context_menu_select_all(), "Select All");

let fr = Translations::new(Language::French);
assert_eq!(fr.context_menu_select_all(), "Tout sélectionner");
Source

pub fn context_menu_reveal_in_finder(&self) -> String

Returns the macOS context-menu label for revealing a file.

Prefer Self::context_menu_reveal_in_file_manager, which picks the right one of the three platform wordings for you.

§Examples
use iced_code_editor::{Language, Translations};

let en = Translations::new(Language::English);
assert_eq!(en.context_menu_reveal_in_finder(), "Reveal in Finder");
Source

pub fn context_menu_reveal_in_file_explorer(&self) -> String

Returns the Windows context-menu label for revealing a file.

Prefer Self::context_menu_reveal_in_file_manager, which picks the right one of the three platform wordings for you.

§Examples
use iced_code_editor::{Language, Translations};

let en = Translations::new(Language::English);
assert_eq!(
    en.context_menu_reveal_in_file_explorer(),
    "Reveal in File Explorer"
);
Source

pub fn context_menu_open_containing_folder(&self) -> String

Returns the Linux context-menu label for opening a file’s parent folder.

Worded as “open the containing folder” rather than “reveal”, matching how Linux file managers describe the action.

§Examples
use iced_code_editor::{Language, Translations};

let en = Translations::new(Language::English);
assert_eq!(
    en.context_menu_open_containing_folder(),
    "Open Containing Folder"
);
Source

pub fn context_menu_reveal_in_file_manager(&self) -> String

Returns the platform-appropriate label for revealing a file.

Resolves to “Reveal in Finder” on macOS, “Reveal in File Explorer” on Windows, and “Open Containing Folder” elsewhere, so the menu matches the wording users already know from their own file manager.

§Examples
use iced_code_editor::{Language, Translations};

let en = Translations::new(Language::English);
let label = en.context_menu_reveal_in_file_manager();

// Whichever platform this runs on, it matches that platform's wording.
#[cfg(target_os = "macos")]
assert_eq!(label, en.context_menu_reveal_in_finder());
#[cfg(target_os = "windows")]
assert_eq!(label, en.context_menu_reveal_in_file_explorer());
#[cfg(not(any(target_os = "macos", target_os = "windows")))]
assert_eq!(label, en.context_menu_open_containing_folder());

Trait Implementations§

Source§

impl Clone for Translations

Source§

fn clone(&self) -> Translations

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for Translations

Source§

impl Debug for Translations

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Translations

Source§

fn default() -> Translations

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
Source§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
Source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
Source§

impl<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

Source§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

Source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync> ⓘ

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<State, Message> IntoBoot<State, Message> for State

Source§

fn into_boot(self) -> (State, Task<Message>)

Turns some type into the initial state of some Application.
Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> MaybeClone for T

Source§

impl<T> MaybeDebug for T

Source§

impl<T> MaybeSend for T
where T: Send,

Source§

impl<T> MaybeSync for T
where T: Sync,

Source§

impl<T> NoneValue for T
where T: Default,

Source§

type NoneType = T

Source§

fn null_value() -> T

The none-equivalent value.
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>

Source§

impl<T> WasmNotSend for T
where T: Send,

Source§

impl<T> WasmNotSendSync for T

Source§

impl<T> WasmNotSync for T
where T: Sync,

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more