feat: add i18n support for libcosmic widgets
This commit is contained in:
parent
ea349aca82
commit
066999586b
9 changed files with 110 additions and 15 deletions
|
|
@ -1,6 +1,6 @@
|
|||
use {
|
||||
crate::{
|
||||
Element,
|
||||
Element, fl,
|
||||
iced::{Alignment, Length},
|
||||
widget::{self, horizontal_space},
|
||||
},
|
||||
|
|
@ -116,7 +116,7 @@ pub fn about<'a, Message: Clone + 'static>(
|
|||
space_xxs, space_m, ..
|
||||
} = crate::theme::spacing();
|
||||
|
||||
let section = |list: &'a Vec<(String, String)>, title: &'a str| {
|
||||
let section = |list: &'a Vec<(String, String)>, title: String| {
|
||||
(!list.is_empty()).then_some({
|
||||
let items: Vec<Element<Message>> =
|
||||
list.iter()
|
||||
|
|
@ -150,15 +150,15 @@ pub fn about<'a, Message: Clone + 'static>(
|
|||
});
|
||||
let author = about.author.as_ref().map(widget::text::body);
|
||||
let version = about.version.as_ref().map(widget::button::standard);
|
||||
let links_section = section(&about.links, "Links");
|
||||
let developers_section = section(&about.developers, "Developers");
|
||||
let designers_section = section(&about.designers, "Designers");
|
||||
let artists_section = section(&about.artists, "Artists");
|
||||
let translators_section = section(&about.translators, "Translators");
|
||||
let documenters_section = section(&about.documenters, "Documenters");
|
||||
let links_section = section(&about.links, fl!("links"));
|
||||
let developers_section = section(&about.developers, fl!("developers"));
|
||||
let designers_section = section(&about.designers, fl!("designers"));
|
||||
let artists_section = section(&about.artists, fl!("artists"));
|
||||
let translators_section = section(&about.translators, fl!("translators"));
|
||||
let documenters_section = section(&about.documenters, fl!("documenters"));
|
||||
let license = about.license.as_ref().map(|license| {
|
||||
let url = about.get_license_url();
|
||||
widget::settings::section().title("License").add(
|
||||
widget::settings::section().title(fl!("license")).add(
|
||||
widget::button::custom(
|
||||
widget::row()
|
||||
.push(widget::text(license))
|
||||
|
|
|
|||
|
|
@ -1,12 +1,10 @@
|
|||
// Copyright 2023 System76 <info@system76.com>
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
use std::borrow::Cow;
|
||||
|
||||
use crate::widget::{LayerContainer, button, column, container, icon, row, scrollable, text};
|
||||
use crate::{Apply, Element, Renderer, Theme};
|
||||
|
||||
use super::overlay::Overlay;
|
||||
use crate::widget::{LayerContainer, button, column, container, icon, row, scrollable, text};
|
||||
use crate::{Apply, Element, Renderer, Theme, fl};
|
||||
use std::borrow::Cow;
|
||||
|
||||
use iced_core::Alignment;
|
||||
use iced_core::event::{self, Event};
|
||||
|
|
@ -86,7 +84,7 @@ impl<'a, Message: Clone + 'static> ContextDrawer<'a, Message> {
|
|||
)
|
||||
.push_maybe(title)
|
||||
.push(
|
||||
button::text("Close")
|
||||
button::text(fl!("close"))
|
||||
.trailing_icon(icon::from_name("go-next-symbolic"))
|
||||
.on_press(on_close)
|
||||
.apply(container)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue