From 4c2b0a189dbd7fff05b3838eb29e3c4187f58b5e Mon Sep 17 00:00:00 2001 From: wiiznokes <78230769+wiiznokes@users.noreply.github.com> Date: Wed, 29 May 2024 15:11:50 +0200 Subject: [PATCH] i18n --- i18n/en/cosmic_clipboard_manager.ftl | 4 ++++ i18n/fr/cosmic_clipboard_manager.ftl | 4 ++++ src/view.rs | 11 ++++++----- 3 files changed, 14 insertions(+), 5 deletions(-) create mode 100644 i18n/fr/cosmic_clipboard_manager.ftl diff --git a/i18n/en/cosmic_clipboard_manager.ftl b/i18n/en/cosmic_clipboard_manager.ftl index e69de29..e1fd7f4 100644 --- a/i18n/en/cosmic_clipboard_manager.ftl +++ b/i18n/en/cosmic_clipboard_manager.ftl @@ -0,0 +1,4 @@ +search_entries = Search +delete_entry = Delete +incognito = Incognito +clear_entries = Clear \ No newline at end of file diff --git a/i18n/fr/cosmic_clipboard_manager.ftl b/i18n/fr/cosmic_clipboard_manager.ftl new file mode 100644 index 0000000..8324837 --- /dev/null +++ b/i18n/fr/cosmic_clipboard_manager.ftl @@ -0,0 +1,4 @@ +search_entries = Rechercher +delete_entry = Supprimer +incognito = Incognito +clear_entries = Nettoyer \ No newline at end of file diff --git a/src/view.rs b/src/view.rs index f7f56c2..a647c6b 100644 --- a/src/view.rs +++ b/src/view.rs @@ -16,6 +16,7 @@ use crate::{ app::{AppState, ClipboardState}, config::Config, db::Data, + fl, message::AppMessage, my_widgets, utils::{formated_value, horizontal_padding}, @@ -26,7 +27,7 @@ pub fn quick_settings_view<'a>( config: &'a Config, ) -> Element<'a, AppMessage> { fn toogle_settings<'a>( - info: &'a str, + info: impl Into> + 'a, value: bool, f: impl Fn(bool) -> AppMessage + 'a, ) -> Element<'a, AppMessage> { @@ -42,11 +43,11 @@ pub fn quick_settings_view<'a>( .spacing(20) .padding(10) .push(toogle_settings( - "Incognito", + fl!("incognito"), config.private_mode, AppMessage::PrivateMode, )) - .push(widget::button::destructive("Clear").on_press(AppMessage::Clear)) + .push(widget::button::destructive(fl!("clear_entries")).on_press(AppMessage::Clear)) .into() } @@ -64,7 +65,7 @@ fn top_view(state: &AppState) -> Element { let mut padding = Padding::new(10f32); padding.bottom = 0f32; - let input = text_input::search_input("Search in last entries", state.db.query()) + let input = text_input::search_input(fl!("search_entries"), state.db.query()) .on_input(AppMessage::Search) .on_paste(AppMessage::Search) .on_clear(AppMessage::Search("".into())); @@ -155,7 +156,7 @@ fn entry(entry: &Data, is_focused: bool, more_action_expanded: bool) -> Element< if more_action_expanded { let overlay = Column::new() .push( - button("Delete") + button(text(fl!("delete_entry"))) .on_press(AppMessage::Delete(entry.clone())) .width(Length::Fill) .style(Button::Destructive),