change translation

This commit is contained in:
ochibani 2023-12-03 04:49:46 +02:00
parent ae3a6a7cbc
commit 32b388c0cb
No known key found for this signature in database
GPG Key ID: 2C6B61CE0C704ED4
14 changed files with 1280 additions and 273 deletions

1011
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -23,3 +23,5 @@ dark-light = "1.0.0"
async-std = {version = "1.12.0", features = ["attributes"]} async-std = {version = "1.12.0", features = ["attributes"]}
gstreamer = "0.20.5" gstreamer = "0.20.5"
zbus = "3.12.0" zbus = "3.12.0"
i18n-embed = { version = "0.14.1", features = ["gettext-system", "desktop-requester"]}
rust-embed = "8"

4
build.rs Normal file
View File

@ -0,0 +1,4 @@
fn main() {
// Rebuild if i18n files change
println!("cargo:rerun-if-changed=i18n")
}

14
i18n.toml Normal file
View File

@ -0,0 +1,14 @@
# (Required) The language identifier of the language used in the
# source code for gettext system, and the primary fallback language
# (for which all strings must be present) when using the fluent
# system.
fallback_language = "en-US"
# Use the gettext localization system.
[gettext]
# (Required) The languages that the software will be translated into.
target_languages = ["ar"]
# (Required) Path to the output directory, relative to `i18n.toml` of
# the crate being localized.
output_dir = "i18n"

122
i18n/po/ar/blue_recorder.po Normal file
View File

@ -0,0 +1,122 @@
# Arabic translations for blue-recorder package.
# Copyright (C) 2023 THE blue-recorder'S COPYRIGHT HOLDER
# This file is distributed under the same license as the blue-recorder package.
# chibani <11yzyv86j@relay.firefox.com>, 2023.
#
msgid ""
msgstr ""
"Project-Id-Version: blue-recorder 0.2.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-12-03 01:42+0000\n"
"PO-Revision-Date: 2023-12-03 01:47+0200\n"
"Last-Translator: chibani <11yzyv86j@relay.firefox.com>\n"
"Language-Team: Arabic <(nothing)>\n"
"Language: ar\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: src/ffmpeg_interface.rs:71
msgid "File already exist. Do you want to overwrite it?"
msgstr ""
#: src/main.rs:117 src/main.rs:593
msgid "Blue Recorder"
msgstr ""
#: src/main.rs:119 src/main.rs:449
msgid "Area Chooser"
msgstr ""
#: src/main.rs:134
msgid "Not supported in Wayland"
msgstr ""
#. Entries
#: src/main.rs:138
msgid "Default filename:"
msgstr ""
#: src/main.rs:139
msgid "Default command:"
msgstr ""
#. CheckBox
#: src/main.rs:144
msgid "MP4 (MPEG-4 Part 14)"
msgstr ""
#: src/main.rs:147
msgid "MKV (Matroska multimedia container format)"
msgstr ""
#: src/main.rs:149
msgid "WEBM (Open Web Media File)"
msgstr ""
#: src/main.rs:150
msgid "GIF (Graphics Interchange Format)"
msgstr ""
#: src/main.rs:151
msgid "AVI (Audio Video Interleaved)"
msgstr ""
#: src/main.rs:152
msgid "WMV (Windows Media Video)"
msgstr ""
#: src/main.rs:153
msgid "NUT (NUT Recording Format)"
msgstr ""
#: src/main.rs:184
msgid "Default PulseAudio Input Source"
msgstr ""
#. Switchs
#: src/main.rs:191
msgid "Record Video"
msgstr ""
#: src/main.rs:192
msgid "Record Audio"
msgstr ""
#: src/main.rs:193
msgid "Show Mouse"
msgstr ""
#: src/main.rs:194
msgid "Follow Mouse"
msgstr ""
#: src/main.rs:195
msgid "Auto Hide"
msgstr ""
#. Labels
#: src/main.rs:356
msgid "Run Command After Recording:"
msgstr ""
#: src/main.rs:357
msgid "Frames:"
msgstr ""
#: src/main.rs:358
msgid "Delay:"
msgstr ""
#: src/main.rs:359
msgid "Audio Input Source:"
msgstr ""
#: src/main.rs:599
msgid "A simple screen recorder for Linux desktop. Supports Wayland & Xorg."
msgstr ""
#. Translators: Replace "translator-credits" with your names, one name per line
#: src/main.rs:614
msgid "translator-credits"
msgstr ""

123
i18n/pot/blue_recorder.pot Normal file
View File

@ -0,0 +1,123 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE blue-recorder'S COPYRIGHT HOLDER
# This file is distributed under the same license as the blue-recorder package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: blue-recorder 0.2.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-12-03 02:43+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: src/ffmpeg_interface.rs:71
msgid "File already exist. Do you want to overwrite it?"
msgstr ""
#: src/main.rs:117 src/main.rs:593
msgid "Blue Recorder"
msgstr ""
#: src/main.rs:119 src/main.rs:449
msgid "Area Chooser"
msgstr ""
#: src/main.rs:134
msgid "Not supported in Wayland"
msgstr ""
#. Entries
#: src/main.rs:138
msgid "Default filename:"
msgstr ""
#: src/main.rs:139
msgid "Default command:"
msgstr ""
#. CheckBox
#: src/main.rs:144
msgid "MP4 (MPEG-4 Part 14)"
msgstr ""
#: src/main.rs:147
msgid "MKV (Matroska multimedia container format)"
msgstr ""
#: src/main.rs:149
msgid "WEBM (Open Web Media File)"
msgstr ""
#: src/main.rs:150
msgid "GIF (Graphics Interchange Format)"
msgstr ""
#: src/main.rs:151
msgid "AVI (Audio Video Interleaved)"
msgstr ""
#: src/main.rs:152
msgid "WMV (Windows Media Video)"
msgstr ""
#: src/main.rs:153
msgid "NUT (NUT Recording Format)"
msgstr ""
#: src/main.rs:184
msgid "Default PulseAudio Input Source"
msgstr ""
#. Switchs
#: src/main.rs:191
msgid "Record Video"
msgstr ""
#: src/main.rs:192
msgid "Record Audio"
msgstr ""
#: src/main.rs:193
msgid "Show Mouse"
msgstr ""
#: src/main.rs:194
msgid "Follow Mouse"
msgstr ""
#: src/main.rs:195
msgid "Auto Hide"
msgstr ""
#. Labels
#: src/main.rs:356
msgid "Run Command After Recording:"
msgstr ""
#: src/main.rs:357
msgid "Frames:"
msgstr ""
#: src/main.rs:358
msgid "Delay:"
msgstr ""
#: src/main.rs:359
msgid "Audio Input Source:"
msgstr ""
#: src/main.rs:599
msgid "A simple screen recorder for Linux desktop. Supports Wayland & Xorg."
msgstr ""
#. Translators: Replace "translator-credits" with your names, one name per line
#: src/main.rs:614
msgid "translator-credits"
msgstr ""

View File

@ -0,0 +1,18 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE blue-recorder'S COPYRIGHT HOLDER
# This file is distributed under the same license as the blue-recorder package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: blue-recorder 0.2.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-12-03 02:43+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"

View File

@ -0,0 +1,18 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE blue-recorder'S COPYRIGHT HOLDER
# This file is distributed under the same license as the blue-recorder package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: blue-recorder 0.2.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-12-03 02:43+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"

View File

@ -0,0 +1,22 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE blue-recorder'S COPYRIGHT HOLDER
# This file is distributed under the same license as the blue-recorder package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: blue-recorder 0.2.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-12-03 02:43+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: ./src/ffmpeg_interface.rs:71
msgid "File already exist. Do you want to overwrite it?"
msgstr ""

123
i18n/pot/src/main.pot Normal file
View File

@ -0,0 +1,123 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE blue-recorder'S COPYRIGHT HOLDER
# This file is distributed under the same license as the blue-recorder package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: blue-recorder 0.2.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-12-03 02:43+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: ./src/ffmpeg_interface.rs:71
msgid "File already exist. Do you want to overwrite it?"
msgstr ""
#: ./src/main.rs:117 ./src/main.rs:593
msgid "Blue Recorder"
msgstr ""
#: ./src/main.rs:119 ./src/main.rs:449
msgid "Area Chooser"
msgstr ""
#: ./src/main.rs:134
msgid "Not supported in Wayland"
msgstr ""
#. Entries
#: ./src/main.rs:138
msgid "Default filename:"
msgstr ""
#: ./src/main.rs:139
msgid "Default command:"
msgstr ""
#. CheckBox
#: ./src/main.rs:144
msgid "MP4 (MPEG-4 Part 14)"
msgstr ""
#: ./src/main.rs:147
msgid "MKV (Matroska multimedia container format)"
msgstr ""
#: ./src/main.rs:149
msgid "WEBM (Open Web Media File)"
msgstr ""
#: ./src/main.rs:150
msgid "GIF (Graphics Interchange Format)"
msgstr ""
#: ./src/main.rs:151
msgid "AVI (Audio Video Interleaved)"
msgstr ""
#: ./src/main.rs:152
msgid "WMV (Windows Media Video)"
msgstr ""
#: ./src/main.rs:153
msgid "NUT (NUT Recording Format)"
msgstr ""
#: ./src/main.rs:184
msgid "Default PulseAudio Input Source"
msgstr ""
#. Switchs
#: ./src/main.rs:191
msgid "Record Video"
msgstr ""
#: ./src/main.rs:192
msgid "Record Audio"
msgstr ""
#: ./src/main.rs:193
msgid "Show Mouse"
msgstr ""
#: ./src/main.rs:194
msgid "Follow Mouse"
msgstr ""
#: ./src/main.rs:195
msgid "Auto Hide"
msgstr ""
#. Labels
#: ./src/main.rs:356
msgid "Run Command After Recording:"
msgstr ""
#: ./src/main.rs:357
msgid "Frames:"
msgstr ""
#: ./src/main.rs:358
msgid "Delay:"
msgstr ""
#: ./src/main.rs:359
msgid "Audio Input Source:"
msgstr ""
#: ./src/main.rs:599
msgid "A simple screen recorder for Linux desktop. Supports Wayland & Xorg."
msgstr ""
#. Translators: Replace "translator-credits" with your names, one name per line
#: ./src/main.rs:614
msgid "translator-credits"
msgstr ""

18
i18n/pot/src/timer.pot Normal file
View File

@ -0,0 +1,18 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE blue-recorder'S COPYRIGHT HOLDER
# This file is distributed under the same license as the blue-recorder package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: blue-recorder 0.2.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-12-03 02:43+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"

18
i18n/pot/src/utils.pot Normal file
View File

@ -0,0 +1,18 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE blue-recorder'S COPYRIGHT HOLDER
# This file is distributed under the same license as the blue-recorder package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: blue-recorder 0.2.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-12-03 02:43+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"

View File

@ -0,0 +1,18 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE blue-recorder'S COPYRIGHT HOLDER
# This file is distributed under the same license as the blue-recorder package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: blue-recorder 0.2.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-12-03 02:43+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"

View File

@ -10,7 +10,8 @@ mod wayland_record;
mod utils; mod utils;
use ffmpeg_interface::Ffmpeg; use ffmpeg_interface::Ffmpeg;
use gettextrs::{bindtextdomain, gettext, setlocale, textdomain, LocaleCategory}; use i18n_embed::{DesktopLanguageRequester, gettext::gettext_language_loader};
use gettextrs::gettext;
use gtk::glib; use gtk::glib;
use gtk::prelude::*; use gtk::prelude::*;
use gtk::{ use gtk::{
@ -19,6 +20,7 @@ use gtk::{
ToggleButton, Window, ToggleButton, Window,
}; };
use utils::is_wayland; use utils::is_wayland;
use rust_embed::RustEmbed;
use std::cell::RefCell; use std::cell::RefCell;
use std::ops::Add; use std::ops::Add;
use std::path::Path; use std::path::Path;
@ -27,6 +29,11 @@ use std::rc::Rc;
use timer::{recording_delay, start_timer, stop_timer}; use timer::{recording_delay, start_timer, stop_timer};
use wayland_record::WaylandRecorder; use wayland_record::WaylandRecorder;
#[derive(RustEmbed)]
// path to the compiled localization resources,
// as determined by i18n.toml settings
#[folder = "i18n/mo"]
struct Localizations;
#[async_std::main] #[async_std::main]
async fn main() { async fn main() {
@ -43,23 +50,26 @@ pub fn build_ui(application: &Application) {
let builder: Builder = Builder::from_string(ui_src.as_str()); let builder: Builder = Builder::from_string(ui_src.as_str());
// Translate // Translate
let mut po_path_abs = { let language_loader = gettext_language_loader!();
let mut current_exec_dir = std::env::current_exe().unwrap(); let requested_languages = DesktopLanguageRequester::requested_languages();
current_exec_dir.pop(); let _result = i18n_embed::select(
current_exec_dir &language_loader, &Localizations, &requested_languages);
} //let mut po_path_abs = {
.join(Path::new("po")); //let mut current_exec_dir = std::env::current_exe().unwrap();
//current_exec_dir.pop();
//current_exec_dir
//}
//.join(Path::new("po"));
if !po_path_abs.exists() { //if !po_path_abs.exists() {
po_path_abs = std::fs::canonicalize(Path::new( //po_path_abs = std::fs::canonicalize(Path::new(&String::from("po")),
&std::env::var("PO_DIR").unwrap_or_else(|_| String::from("po")), //)
)) //.unwrap();
.unwrap(); //}
}
setlocale(LocaleCategory::LcAll, ""); //setlocale(LocaleCategory::LcAll, "");
bindtextdomain("blue-recorder", po_path_abs.to_str().unwrap()).unwrap(); //bindtextdomain("blue-recorder", po_path_abs.to_str().unwrap()).unwrap();
textdomain("blue-recorder").unwrap(); //textdomain("blue-recorder").unwrap();
// Config initialize // Config initialize
config_management::initialize(); config_management::initialize();