Skip to content

Commit

Permalink
i18n
Browse files Browse the repository at this point in the history
  • Loading branch information
wiiznokes committed May 29, 2024
1 parent 852fbc1 commit 4c2b0a1
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
4 changes: 4 additions & 0 deletions i18n/en/cosmic_clipboard_manager.ftl
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
search_entries = Search
delete_entry = Delete
incognito = Incognito
clear_entries = Clear
4 changes: 4 additions & 0 deletions i18n/fr/cosmic_clipboard_manager.ftl
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
search_entries = Rechercher
delete_entry = Supprimer
incognito = Incognito
clear_entries = Nettoyer
11 changes: 6 additions & 5 deletions src/view.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ use crate::{
app::{AppState, ClipboardState},
config::Config,
db::Data,
fl,
message::AppMessage,
my_widgets,
utils::{formated_value, horizontal_padding},
Expand All @@ -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<Cow<'a, str>> + 'a,
value: bool,
f: impl Fn(bool) -> AppMessage + 'a,
) -> Element<'a, AppMessage> {
Expand All @@ -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()
}

Expand All @@ -64,7 +65,7 @@ fn top_view(state: &AppState) -> Element<AppMessage> {
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()));
Expand Down Expand Up @@ -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),
Expand Down

0 comments on commit 4c2b0a1

Please sign in to comment.