Generate translated desktop and metainfo files with xdgen
This commit is contained in:
parent
314f11ab89
commit
36633540c2
18 changed files with 94 additions and 45 deletions
38
Cargo.lock
generated
38
Cargo.lock
generated
|
|
@ -1471,6 +1471,7 @@ dependencies = [
|
|||
"tokio",
|
||||
"two-face",
|
||||
"unicode-segmentation",
|
||||
"xdgen",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -2539,6 +2540,16 @@ dependencies = [
|
|||
"xdg",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "freedesktop_entry_parser"
|
||||
version = "2.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fc6d3a3635983a889f065aa9ce760384713f23a9b4a04f696f86c39a5d7a6a5a"
|
||||
dependencies = [
|
||||
"indexmap 2.13.0",
|
||||
"nom 8.0.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "fsevent-sys"
|
||||
version = "4.1.0"
|
||||
|
|
@ -8969,6 +8980,18 @@ dependencies = [
|
|||
"unicase",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "xdgen"
|
||||
version = "0.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "25af88f104f06d5aeb80c77e5eb85e6f6f355f86f6e34307a14befd716efe4bf"
|
||||
dependencies = [
|
||||
"fluent",
|
||||
"freedesktop_entry_parser",
|
||||
"unic-langid",
|
||||
"xmltree",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "xkbcommon"
|
||||
version = "0.7.0"
|
||||
|
|
@ -9024,12 +9047,27 @@ dependencies = [
|
|||
"bytemuck",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "xml"
|
||||
version = "1.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b8aa498d22c9bbaf482329839bc5620c46be275a19a812e9a22a2b07529a642a"
|
||||
|
||||
[[package]]
|
||||
name = "xml-rs"
|
||||
version = "0.8.28"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3ae8337f8a065cfc972643663ea4279e04e7256de865aa66fe25cec5fb912d3f"
|
||||
|
||||
[[package]]
|
||||
name = "xmltree"
|
||||
version = "0.12.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cbc04313cab124e498ab1724e739720807b6dc405b9ed0edc5860164d2e4ff70"
|
||||
dependencies = [
|
||||
"xml",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "xmlwriter"
|
||||
version = "0.1.0"
|
||||
|
|
|
|||
|
|
@ -52,6 +52,9 @@ features = ["about", "multi-window", "tokio", "winit", "surface-message"]
|
|||
[target.'cfg(unix)'.dependencies]
|
||||
fork = "0.2"
|
||||
|
||||
[build-dependencies]
|
||||
xdgen = "0.1"
|
||||
|
||||
[features]
|
||||
default = ["dbus-config", "gvfs", "wgpu", "wayland"]
|
||||
dbus-config = ["libcosmic/dbus-config"]
|
||||
|
|
|
|||
24
build.rs
Normal file
24
build.rs
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
use std::{env, fs, path::PathBuf};
|
||||
use xdgen::{App, Context, FluentString};
|
||||
|
||||
fn main() {
|
||||
let id = "com.system76.CosmicEdit";
|
||||
let ctx = Context::new("i18n", env::var("CARGO_PKG_NAME").unwrap()).unwrap();
|
||||
let app = App::new(FluentString("cosmic-text-editor"))
|
||||
.comment(FluentString("comment"))
|
||||
.keywords(FluentString("keywords"));
|
||||
let output = PathBuf::from("target/xdgen");
|
||||
fs::create_dir_all(&output).unwrap();
|
||||
fs::write(
|
||||
output.join(format!("{}.desktop", id)),
|
||||
app.expand_desktop(format!("res/{}.desktop", id), &ctx)
|
||||
.unwrap(),
|
||||
)
|
||||
.unwrap();
|
||||
fs::write(
|
||||
output.join(format!("{}.metainfo.xml", id)),
|
||||
app.expand_metainfo(format!("res/{}.metainfo.xml", id), &ctx)
|
||||
.unwrap(),
|
||||
)
|
||||
.unwrap();
|
||||
}
|
||||
|
|
@ -1,4 +1,6 @@
|
|||
cosmic-text-editor = محرِّر نصوص COSMIC
|
||||
comment = محرِّر نصوص لسطح مكتب COSMIC
|
||||
keywords = نص;محرر;
|
||||
new-document = مستند جديد
|
||||
open-project = افتح مشروعًا
|
||||
todo = المهامّ
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
comment = Textový editor pro pracovní prostředí COSMIC
|
||||
keywords = Text;Editor;Poznámky;
|
||||
new-document = Nový dokument
|
||||
open-project = Otevřít projekt
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
cosmic-text-editor = COSMIC Text Editor
|
||||
comment = Text editor for the COSMIC desktop
|
||||
new-document = New document
|
||||
open-project = Open project
|
||||
todo = TODO
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
cosmic-text-editor = Editor de texto COSMIC
|
||||
comment = Editor de texto de escritorio COSMIC
|
||||
keywords = Texto;Editor;Notas;
|
||||
new-document = Nuevo documento
|
||||
open-project = Abrir proyecto
|
||||
todo = TODO
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
cosmic-text-editor = COSMIC Szövegszerkesztő
|
||||
comment = Szövegszerkesztő a COSMIC asztali környezethez
|
||||
keywords = szöveg;szerkesztő;
|
||||
new-document = Új dokumentum
|
||||
open-project = Projekt megnyitása
|
||||
todo = Teendők
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
cosmic-text-editor = COSMIC Text Editor
|
||||
comment = Editor di testo di COSMIC
|
||||
keywords = Testo;Editor;Note;Blocco;
|
||||
new-document = Nuovo documento
|
||||
open-project = Apri progetto
|
||||
todo = TODO
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
cosmic-text-editor = Edytor Tekstu COSMIC
|
||||
comment = Edytor tekstu pulpitu COSMIC
|
||||
keywords = Edytor;Tekstu;
|
||||
new-document = Nowy dokument
|
||||
open-project = Otwórz projekt
|
||||
todo = TODO
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
cosmic-text-editor = Editor de Texto COSMIC
|
||||
comment = Editor de texto do desktop COSMIC
|
||||
keywords = Texto;Editor;Notas;
|
||||
new-document = Novo documento
|
||||
open-project = Abrir projeto
|
||||
todo = TODO
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
cosmic-text-editor = Текстовый редактор COSMIC
|
||||
comment = Текстовый редактор для оболочки COSMIC
|
||||
new-document = Новый документ
|
||||
open-project = Открыть проект
|
||||
todo = TODO
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
cosmic-text-editor = Textový editor COSMIC
|
||||
comment = Textový editor pre pracovné prostredie COSMIC
|
||||
keywords = Text;Editor;Poznámky;
|
||||
new-document = Nový dokument
|
||||
open-project = Otvoriť projekt
|
||||
todo = Úloha
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
comment = Textredigerare för skrivbordsmiljön COSMIC
|
||||
keywords = Text;Editor;Redigerare;
|
||||
new-document = Nytt dokument
|
||||
open-project = Öppna projekt
|
||||
todo = TODO
|
||||
|
|
|
|||
4
justfile
4
justfile
|
|
@ -13,11 +13,11 @@ bin-src := cargo-target-dir / 'release' / name
|
|||
bin-dst := base-dir / 'bin' / name
|
||||
|
||||
desktop := APPID + '.desktop'
|
||||
desktop-src := 'res' / desktop
|
||||
desktop-src := 'target/xdgen' / desktop
|
||||
desktop-dst := clean(rootdir / prefix) / 'share' / 'applications' / desktop
|
||||
|
||||
metainfo := APPID + '.metainfo.xml'
|
||||
metainfo-src := 'res' / metainfo
|
||||
metainfo-src := 'target/xdgen' / metainfo
|
||||
metainfo-dst := clean(rootdir / prefix) / 'share' / 'metainfo' / metainfo
|
||||
|
||||
icons-src := 'res' / 'icons' / 'hicolor'
|
||||
|
|
|
|||
|
|
@ -1,18 +1,6 @@
|
|||
#TODO: more build-out, desktop actions, translations?
|
||||
[Desktop Entry]
|
||||
Name=COSMIC Text Editor
|
||||
Name[ar]=محرِّر نصوص COSMIC
|
||||
Name[cs]=Textový editor COSMIC
|
||||
Name[zh_CN]=COSMIC 文本编辑器
|
||||
Name[pl]=Edytor Tekstu COSMIC
|
||||
Name[pt_BR]=Editor de Texto
|
||||
Name[hu]=COSMIC Szövegszerkesztő
|
||||
Name[pt]=Editor de Texto
|
||||
Name[ru]=Текстовый редактор COSMIC
|
||||
Name[sk]=Textový editor COSMIC
|
||||
Name[sv]=COSMIC Textredigerare
|
||||
Name[es]=Editor de texto COSMIC
|
||||
Name[it]=Editor di testo COSMIC
|
||||
Comment=Text editor for the COSMIC desktop
|
||||
Exec=cosmic-edit %F
|
||||
Terminal=false
|
||||
Type=Application
|
||||
|
|
@ -20,13 +8,4 @@ StartupNotify=true
|
|||
MimeType=text/plain;
|
||||
Icon=com.system76.CosmicEdit
|
||||
Categories=COSMIC;Utility;TextEditor;
|
||||
Keywords=Text;Editor;
|
||||
Keywords[ar]=نص;محرر;
|
||||
Keywords[cs]=Text;Editor;Poznámky;
|
||||
Keywords[pl]=Edytor;Tekstu;
|
||||
Keywords[pt_BR]=Texto;Editor;Notas;
|
||||
Keywords[hu]=szöveg;szerkesztő;
|
||||
Keywords[sk]=Text;Editor;Poznámky;
|
||||
Keywords[sv]=Text;Editor;Redigerare;
|
||||
Keywords[es]=Texto;Editor;Notas;
|
||||
Keywords[it]=Testo;Editor;Note;Blocco;
|
||||
Keywords=Text;Editor;
|
||||
|
|
@ -9,27 +9,7 @@
|
|||
<url type="homepage">https://github.com/pop-os/cosmic-edit</url>
|
||||
<url type="bugtracker">https://github.com/pop-os/cosmic-edit</url>
|
||||
<name>COSMIC Text Editor</name>
|
||||
<name xml:lang="ar">محرِّر نصوص COSMIC</name>
|
||||
<name xml:lang="cs">Textový editor COSMIC</name>
|
||||
<name xml:lang="pl">Edytor tekstu COSMIC</name>
|
||||
<name xml:lang="hu">COSMIC Szövegszerkesztő</name>
|
||||
<name xml:lang="pt_BR">Editor de Texto</name>
|
||||
<name xml:lang="ru">Текстовый редактор COSMIC</name>
|
||||
<name xml:lang="sk">COSMIC Textový editor</name>
|
||||
<name xml:lang="es">Editor de texto</name>
|
||||
<name xml:lang="it">Editor di testo di COSMIC</name>
|
||||
<name xml:lang="sv">COSMIC Textredigerare</name>
|
||||
<summary>Text editor for the COSMIC desktop</summary>
|
||||
<summary xml:lang="ar">محرِّر نصوص لسطح مكتب COSMIC</summary>
|
||||
<summary xml:lang="cs">Textový editor pro pracovní prostředí COSMIC</summary>
|
||||
<summary xml:lang="pl">Edytor tekstu pulpitu COSMIC</summary>
|
||||
<summary xml:lang="hu">Szövegszerkesztő a COSMIC asztali környezethez</summary>
|
||||
<summary xml:lang="pt_BR">Editor de texto do desktop COSMIC</summary>
|
||||
<summary xml:lang="ru">Текстовый редактор для оболочки COSMIC</summary>
|
||||
<summary xml:lang="sk">Textový editor pre pracovné prostredie COSMIC</summary>
|
||||
<summary xml:lang="es">Editor de texto de escritorio COSMIC</summary>
|
||||
<summary xml:lang="it">Editor di testo di COSMIC</summary>
|
||||
<summary xml:lang="sv">Textredigerare för skrivbordsmiljön COSMIC</summary>
|
||||
<description>
|
||||
<p>Text editor that provides advanced features with high performance</p>
|
||||
<p xml:lang="ar">محرِّر نصوص يوفر ميزات متقدمة بأداء عالٍ</p>
|
||||
|
|
@ -89,6 +69,10 @@
|
|||
<li xml:lang="it">Gestione Git integrata</li>
|
||||
</ul>
|
||||
</description>
|
||||
<keywords>
|
||||
<keyword>Text</keyword>
|
||||
<keyword>Editor</keyword>
|
||||
</keywords>
|
||||
<launchable type="desktop-id">com.system76.CosmicEdit.desktop</launchable>
|
||||
<icon type="remote" height="256" width="256">https://raw.githubusercontent.com/pop-os/cosmic-edit/master/res/icons/hicolor/256x256/apps/com.system76.CosmicEdit.svg</icon>
|
||||
<screenshots>
|
||||
|
|
|
|||
|
|
@ -1451,6 +1451,7 @@ impl Application for App {
|
|||
.icon(icon::from_name(Self::APP_ID))
|
||||
.version(env!("CARGO_PKG_VERSION"))
|
||||
.author("System76")
|
||||
.comments(fl!("comment"))
|
||||
.license("GPL-3.0-only")
|
||||
.developers([("Jeremy Soller", "jeremy@system76.com")])
|
||||
.links([
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue