i18n
This commit is contained in:
parent
0f0ee85d1a
commit
b2f81b1a73
4 changed files with 339 additions and 3 deletions
18
src/main.rs
18
src/main.rs
|
|
@ -1,3 +1,6 @@
|
|||
// Copyright 2023 System76 <info@system76.com>
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
|
||||
#![allow(clippy::single_match)]
|
||||
|
||||
use cctk::{
|
||||
|
|
@ -39,6 +42,7 @@ use cosmic::{
|
|||
use cosmic_comp_config::{workspace::WorkspaceAmount, CosmicCompConfig};
|
||||
use cosmic_config::{cosmic_config_derive::CosmicConfigEntry, CosmicConfigEntry};
|
||||
use cosmic_config::{ConfigGet, ConfigSet};
|
||||
use i18n_embed::DesktopLanguageRequester;
|
||||
use once_cell::sync::Lazy;
|
||||
use std::{
|
||||
collections::{HashMap, HashSet},
|
||||
|
|
@ -48,10 +52,14 @@ use std::{
|
|||
};
|
||||
|
||||
mod desktop_info;
|
||||
#[macro_use]
|
||||
mod localize;
|
||||
mod view;
|
||||
mod wayland;
|
||||
mod widgets;
|
||||
|
||||
struct CosmicWorkspacesConfig {}
|
||||
|
||||
// Include `pid` in mime. Want to drag between our surfaces, but not another
|
||||
// process, if we use Wayland object ids.
|
||||
static WORKSPACE_MIME: Lazy<String> =
|
||||
|
|
@ -714,8 +722,18 @@ impl Application for App {
|
|||
}
|
||||
}
|
||||
|
||||
fn init_localizer() {
|
||||
let localizer = crate::localize::localizer();
|
||||
let requested_languages = DesktopLanguageRequester::requested_languages();
|
||||
|
||||
if let Err(why) = localizer.select(&requested_languages) {
|
||||
log::error!("error while loading fluent localizations: {}", why);
|
||||
}
|
||||
}
|
||||
|
||||
pub fn main() -> iced::Result {
|
||||
env_logger::init();
|
||||
init_localizer();
|
||||
|
||||
cosmic::app::run_single_instance::<App>(
|
||||
cosmic::app::Settings::default()
|
||||
|
|
|
|||
|
|
@ -156,7 +156,7 @@ fn workspaces_sidebar<'a>(
|
|||
let new_workspace_button = widget::button(
|
||||
widget::container(row![
|
||||
widget::icon::from_name("list-add-symbolic").symbolic(true),
|
||||
widget::text("New Workspace")
|
||||
widget::text(fl!("new-workspace"))
|
||||
])
|
||||
.width(iced::Length::Fill)
|
||||
.align_x(iced::alignment::Horizontal::Center),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue