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 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());
Source§

impl Translations

Source

pub fn search_placeholder(&self) -> String

Returns the placeholder text for the search input field.

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

assert_eq!(Translations::new(Language::English).search_placeholder(), "Search...");
Source

pub fn replace_placeholder(&self) -> String

Returns the placeholder text for the replace input field.

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

assert_eq!(Translations::new(Language::English).replace_placeholder(), "Replace...");
Source

pub fn select_all_matches_tooltip(&self) -> String

Tooltip for converting search results to selections.

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

assert_eq!(Translations::new(Language::English).select_all_matches_tooltip(), "Select All Matches");
Source

pub fn whole_word_tooltip(&self) -> String

Tooltip for whole-word search.

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

assert_eq!(Translations::new(Language::English).whole_word_tooltip(), "Match Whole Words");
Source

pub fn regex_tooltip(&self) -> String

Tooltip for regular expression search.

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

assert_eq!(Translations::new(Language::English).regex_tooltip(), "Use Regular Expressions");
Source

pub fn multiline_tooltip(&self) -> String

Tooltip for multiline input.

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

assert_eq!(Translations::new(Language::English).multiline_tooltip(), "Expand / Collapse Multiline Input");
Source

pub fn toggle_replace_tooltip(&self) -> String

Tooltip for toggling replacement controls.

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

assert_eq!(Translations::new(Language::English).toggle_replace_tooltip(), "Show / Hide Replace");
Source

pub fn case_sensitive_label(&self) -> String

Returns the label text for the case sensitive checkbox.

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

assert_eq!(Translations::new(Language::English).case_sensitive_label(), "Case sensitive");
Source

pub fn previous_match_tooltip(&self) -> String

Returns the tooltip text for the previous match button.

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

assert_eq!(Translations::new(Language::English).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};

assert_eq!(Translations::new(Language::English).next_match_tooltip(), "Next match (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};

assert_eq!(Translations::new(Language::English).close_search_tooltip(), "Close search dialog (Esc)");
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};

assert_eq!(Translations::new(Language::English).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};

assert_eq!(Translations::new(Language::English).replace_all_tooltip(), "Replace all matches");
Source

pub fn context_menu_undo(&self) -> String

Returns the context-menu label for undo.

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

assert_eq!(Translations::new(Language::English).context_menu_undo(), "Undo");
Source

pub fn context_menu_redo(&self) -> String

Returns the context-menu label for redo.

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

assert_eq!(Translations::new(Language::English).context_menu_redo(), "Redo");
Source

pub fn context_menu_cut(&self) -> String

Returns the context-menu label for cut.

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

assert_eq!(Translations::new(Language::English).context_menu_cut(), "Cut");
Source

pub fn context_menu_copy(&self) -> String

Returns the context-menu label for copy.

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

assert_eq!(Translations::new(Language::English).context_menu_copy(), "Copy");
Source

pub fn context_menu_paste(&self) -> String

Returns the context-menu label for paste.

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

assert_eq!(Translations::new(Language::English).context_menu_paste(), "Paste");
Source

pub fn context_menu_select_all(&self) -> String

Returns the context-menu label for select all.

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

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

pub fn context_menu_reveal_in_finder(&self) -> String

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

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

assert_eq!(Translations::new(Language::English).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.

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

assert_eq!(Translations::new(Language::English).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.

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

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

pub fn command_palette_placeholder(&self) -> String

Returns the command-palette label for the filter input’s placeholder.

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

assert_eq!(Translations::new(Language::English).command_palette_placeholder(), "Type a command...");
Source

pub fn command_palette_no_results(&self) -> String

Returns the command-palette label for the empty-result message.

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

assert_eq!(Translations::new(Language::English).command_palette_no_results(), "No matching command");
Source

pub fn command_palette_save(&self) -> String

Returns the command-palette label for saving the document.

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

assert_eq!(Translations::new(Language::English).command_palette_save(), "Save");
Source

pub fn command_palette_toggle_comment(&self) -> String

Returns the command-palette label for toggling the line comment.

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

assert_eq!(Translations::new(Language::English).command_palette_toggle_comment(), "Toggle Line Comment");
Source

pub fn command_palette_move_line_up(&self) -> String

Returns the command-palette label for moving the current line up.

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

assert_eq!(Translations::new(Language::English).command_palette_move_line_up(), "Move Line Up");
Source

pub fn command_palette_move_line_down(&self) -> String

Returns the command-palette label for moving the current line down.

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

assert_eq!(Translations::new(Language::English).command_palette_move_line_down(), "Move Line Down");
Source

pub fn command_palette_duplicate_line_up(&self) -> String

Returns the command-palette label for duplicating the current line above.

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

assert_eq!(Translations::new(Language::English).command_palette_duplicate_line_up(), "Duplicate Line Up");
Source

pub fn command_palette_duplicate_line_down(&self) -> String

Returns the command-palette label for duplicating the current line below.

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

assert_eq!(Translations::new(Language::English).command_palette_duplicate_line_down(), "Duplicate Line Down");
Source

pub fn command_palette_goto_line(&self) -> String

Returns the command-palette label for jumping to a line.

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

assert_eq!(Translations::new(Language::English).command_palette_goto_line(), "Go to Line");
Source

pub fn command_palette_add_cursor_above(&self) -> String

Returns the command-palette label for adding a cursor on the line above.

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

assert_eq!(Translations::new(Language::English).command_palette_add_cursor_above(), "Add Cursor Above");
Source

pub fn command_palette_add_cursor_below(&self) -> String

Returns the command-palette label for adding a cursor on the line below.

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

assert_eq!(Translations::new(Language::English).command_palette_add_cursor_below(), "Add Cursor Below");
Source

pub fn command_palette_select_next_occurrence(&self) -> String

Returns the command-palette label for selecting the next occurrence.

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

assert_eq!(Translations::new(Language::English).command_palette_select_next_occurrence(), "Select Next Occurrence");
Source

pub fn command_palette_toggle_vim_mode(&self) -> String

Returns the command-palette label for toggling Vim mode.

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

assert_eq!(Translations::new(Language::English).command_palette_toggle_vim_mode(), "Toggle Vim Mode");
Source

pub fn command_palette_find(&self) -> String

Returns the command-palette label for opening the search dialog.

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

assert_eq!(Translations::new(Language::English).command_palette_find(), "Find");
Source

pub fn command_palette_replace(&self) -> String

Returns the command-palette label for opening the search-and-replace dialog.

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

assert_eq!(Translations::new(Language::English).command_palette_replace(), "Replace");
Source

pub fn command_palette_fold_at_cursor(&self) -> String

Returns the command-palette label for folding the block at the cursor.

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

assert_eq!(Translations::new(Language::English).command_palette_fold_at_cursor(), "Toggle Fold at Cursor");
Source

pub fn command_palette_fold_all(&self) -> String

Returns the command-palette label for folding every block.

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

assert_eq!(Translations::new(Language::English).command_palette_fold_all(), "Fold All");
Source

pub fn command_palette_unfold_all(&self) -> String

Returns the command-palette label for unfolding every block.

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

assert_eq!(Translations::new(Language::English).command_palette_unfold_all(), "Unfold All");
Source

pub fn command_palette_status_on(&self) -> String

Returns the command-palette badge shown on an enabled toggle command.

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

assert_eq!(Translations::new(Language::English).command_palette_status_on(), "On");
Source

pub fn command_palette_status_off(&self) -> String

Returns the command-palette badge shown on a disabled toggle command.

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

assert_eq!(Translations::new(Language::English).command_palette_status_off(), "Off");

Trait Implementations§

Source§

impl Clone for Translations

Source§

fn clone(&self) -> Self

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() -> Self

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> 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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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 = !

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

fn try_from(value: U) -> Result<T, !>

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