1
0
Fork 0
mirror of synced 2024-05-09 23:12:29 +12:00
czkawka/krokiet/src/connect_translation.rs
Rafał Mikrut 378fa1fd6e
Excluded extensions and krokiet new features (#1184)
* AVC

* Import split

* Default thread size

* Hen

* Allowed extensions

* Perf

* Connect

* Excluded

* Zmiany

* Optimization

* 4.10

* At once

* Included

* Chang

* VD

* VD

* Hashes

* Wersja

* SD

* Up

* Up

* 2024

* Dup

* Slint files

* Added  select

* Selections

* Fix

* LTO

* Actions

* Added popup delete

* AB

* V4

* Release

* LTO

* Basic moving

* Commonsy

* Moving probably works

* Popup move
2024-02-14 17:45:25 +01:00

25 lines
730 B
Rust

use std::collections::HashMap;
use slint::{ComponentHandle, Model};
use crate::localizer_krokiet::LANGUAGE_LOADER_GUI;
use crate::{Callabler, MainWindow};
pub fn connect_translations(app: &MainWindow) {
app.global::<Callabler>().on_translate(move |text_to_translate, args| {
let text_to_translate = text_to_translate.to_string();
let mut arguments = HashMap::new();
args.iter().for_each(|(key, value)| {
arguments.insert(key.to_string(), value.to_string());
});
if arguments.is_empty() {
LANGUAGE_LOADER_GUI.get(&text_to_translate)
} else {
LANGUAGE_LOADER_GUI.get_args(&text_to_translate, arguments)
}
.into()
});
}