Add a bundled german translation for the use-cases demo in the Rust build

This commit is contained in:
Simon Hausmann 2025-03-14 11:30:42 +01:00 committed by Simon Hausmann
parent 5cd2e92c79
commit c9bc5b0c16
9 changed files with 197 additions and 31 deletions

Binary file not shown.

View file

@ -0,0 +1,146 @@
# Copyright © SixtyFPS GmbH <info@slint.dev>
# SPDX-License-Identifier: MIT
msgid ""
msgstr ""
"Project-Id-Version: \n"
"POT-Creation-Date: 2025-03-14 10:15+0000\n"
"PO-Revision-Date: 2025-03-14 11:15+0100\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: de\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Generator: Poedit 3.5\n"
#: ui/views/dashboard_view.slint:11
msgctxt "WeatherViewAdapter"
msgid "May 6th 2023"
msgstr "6. Mai 2023"
#: ui/views/dashboard_view.slint:12
msgctxt "WeatherViewAdapter"
msgid "Very cloudy"
msgstr "Sehr bewölkt"
#: ui/views/dashboard_view.slint:15
msgctxt "WeatherViewAdapter"
msgid "Thu"
msgstr "Do"
#: ui/views/dashboard_view.slint:24
msgctxt "WeatherViewAdapter"
msgid "Fri"
msgstr "Fr"
#: ui/views/dashboard_view.slint:33
msgctxt "WeatherViewAdapter"
msgid "Sat"
msgstr "Sa"
#: ui/views/dashboard_view.slint:45
msgctxt "UsageViewAdapter"
msgid "Usage"
msgstr "Nutzung"
#: ui/views/dashboard_view.slint:49
msgctxt "UsageViewAdapter"
msgid "Daily"
msgstr "Täglich"
#: ui/views/dashboard_view.slint:50 ui/views/dashboard_view.slint:55
msgctxt "UsageViewAdapter"
msgid "kWh"
msgstr "kWh"
#: ui/views/dashboard_view.slint:54
msgctxt "UsageViewAdapter"
msgid "Weekly"
msgstr "Wöchentlich"
#: ui/views/dashboard_view.slint:91
msgctxt "DashboardView"
msgid "Dashboard"
msgstr "Übersicht"
#: ui/views/dashboard_view.slint:95
msgctxt "DashboardView"
msgid "Weather"
msgstr "Wetter"
#: ui/views/dashboard_view.slint:116
msgctxt "DashboardView"
msgid "Usage"
msgstr "Nutzung"
#: ui/views/header_view.slint:27
msgctxt "HeaderView"
msgid "Dark Mode"
msgstr "Dunkelmodus"
#: ui/views/mail_view.slint:17
msgctxt "MailSideBarViewAdapter"
msgid "Inbox"
msgstr "Eingang"
#: ui/views/mail_view.slint:18
msgctxt "MailSideBarViewAdapter"
msgid "Drafts"
msgstr "Entwürfe"
#: ui/views/mail_view.slint:19
msgctxt "MailSideBarViewAdapter"
msgid "Sent"
msgstr "Gesendet"
#: ui/views/mail_view.slint:21
msgctxt "MailSideBarViewAdapter"
msgid "Junk"
msgstr "Junk"
#: ui/views/mail_view.slint:25
msgctxt "MailSideBarViewAdapter"
msgid "Trash"
msgstr "Mülleimer"
#: ui/views/mail_view.slint:26
msgctxt "MailSideBarViewAdapter"
msgid "Archive"
msgstr "Archiv"
#: ui/views/mail_view.slint:30
msgctxt "MailSideBarViewAdapter"
msgid "Social"
msgstr "Soziales"
#: ui/views/mail_view.slint:31
msgctxt "MailSideBarViewAdapter"
msgid "Updates"
msgstr "Neuigkeiten"
#: ui/views/mail_view.slint:32
msgctxt "MailSideBarViewAdapter"
msgid "Forums"
msgstr "Foren"
#: ui/views/mail_view.slint:326
msgctxt "MailMessageView"
msgid "Mute this thread"
msgstr "Schalte diesen Thread stumm"
#: ui/views/mail_view.slint:331
msgctxt "MailMessageView"
msgid "Send"
msgstr "Senden"
#: ui/views/main_view.slint:27
msgctxt "MainView"
msgid "Mail"
msgstr "Post"
#: ui/views/main_view.slint:37
msgctxt "MainView"
msgid "Dashboard"
msgstr "Übersicht"

View file

@ -10,7 +10,9 @@ fn main() {
slint_build::compile_with_config(
"../ui/app.slint",
CompilerConfiguration::new().with_style(style),
CompilerConfiguration::new()
.with_style(style)
.with_bundled_translations(concat!(env!("CARGO_MANIFEST_DIR"), "/../lang/")),
)
.unwrap();
}

View file

@ -24,6 +24,12 @@ pub fn main() {
let app = app().unwrap();
virtual_keyboard::init(&app);
if let Err(slint::SelectBundledTranslationError::LanguageNotFound { .. }) =
slint::select_bundled_translation(option_env!("LANG").unwrap_or("en"))
{
slint::select_bundled_translation("en").unwrap();
}
app.run().unwrap();
}

View file

@ -8,11 +8,11 @@ import { Icons } from "../assets.slint";
export global WeatherViewAdapter {
in property <image> current-temperature-icon: Icons.cloud;
in property <string> current-temperature: "22°";
in property <string> current-day: "May 6th 2023";
in property <string> current-weather-description: "Very cloudy";
in property <string> current-day: @tr("May 6th 2023");
in property <string> current-weather-description: @tr("Very cloudy");
in property <[BarTileModel]> week-model: [
{
title: "Thu",
title: @tr("Thu"),
icon: Icons.cloud,
max: 21,
min: 18,
@ -21,7 +21,7 @@ export global WeatherViewAdapter {
unit: "°"
},
{
title: "Fri",
title: @tr("Fri"),
icon: Icons.cloud,
max: 20,
min: 17,
@ -30,7 +30,7 @@ export global WeatherViewAdapter {
unit: "°"
},
{
title: "Sat",
title: @tr("Sat"),
icon: Icons.cloud,
max: 18,
min: 15,
@ -42,17 +42,17 @@ export global WeatherViewAdapter {
}
export global UsageViewAdapter {
in property <string> title: "Usage";
in property <string> title: @tr("Usage");
in property <[Value]> overview-model: [
{
value: 16.41,
title: "Daily",
unit: "kWh",
title: @tr("Daily"),
unit: @tr("kWh"),
},
{
value: 15.23,
title: "Weekly",
unit: "kWh",
title: @tr("Weekly"),
unit: @tr("kWh"),
}
];
in property <[float]> model: [
@ -92,11 +92,11 @@ export component DashboardView {
TitleText {
horizontal-alignment: left;
text: "Dashboard";
text: @tr("Dashboard");
}
GroupBox {
title: "Weather";
title: @tr("Weather");
HorizontalLayout {
Tile {
@ -117,7 +117,7 @@ export component DashboardView {
}
GroupBox {
title: "Usage";
title: @tr("Usage");
Rectangle {
BarChart {

View file

@ -24,7 +24,7 @@ export component HeaderView {
Rectangle {}
Switch {
text: "Dark Mode";
text: @tr("Dark Mode");
checked: Palette.color-scheme == ColorScheme.dark;
toggled => {

View file

@ -14,22 +14,22 @@ export global MailSideBarViewAdapter {
out property <[string]> accounts: ["jon.doe@slint.dev", "jon.doe@my-mail.com", "jon.doe@gmail.com"];
out property <[NavigationListViewItem]> boxes: [
{ text: "Inbox", message: "128", icon: Icons.inbox },
{ text: "Drafts", message: "9", icon: Icons.document },
{ text: "Sent", icon: Icons.send },
{ text: @tr("Inbox"), message: "128", icon: Icons.inbox },
{ text: @tr("Drafts"), message: "9", icon: Icons.document },
{ text: @tr("Sent"), icon: Icons.send },
{
text: "Junk",
text: @tr("Junk"),
icon: Icons.junk,
message: "23",
},
{ text: "Trash", icon: Icons.trash },
{ text: "Archive", icon: Icons.archive }
{ text: @tr("Trash"), icon: Icons.trash },
{ text: @tr("Archive"), icon: Icons.archive }
];
out property <[NavigationListViewItem]> custom-boxes: [
{ text: "Social", message: "3972", icon: Icons.useres },
{ text: "Updates", message: "342", icon: Icons.updates },
{ text: "Forums", message: "128", icon: Icons.message }
{ text: @tr("Social"), message: "3972", icon: Icons.useres },
{ text: @tr("Updates"), message: "342", icon: Icons.updates },
{ text: @tr("Forums"), message: "128", icon: Icons.message }
];
in-out property <int> current-box;
in-out property <int> current-custom-box: -1;
@ -313,12 +313,12 @@ export component MailMessageView {
HorizontalLayout {
Switch {
text: "Mute this thread";
text: @tr("Mute this thread");
checked <=> MailMessageViewAdapter.mute-this-thread;
}
Button {
text: "Send";
text: @tr("Send");
primary: true;
enabled: text-edit.text != "";
@ -337,7 +337,7 @@ export component MailView {
HorizontalLayout {
spacing: 16px;
if !root.break-layout : MailSideBarView { }
if !root.break-layout: MailSideBarView { }
VerticalLayout {
spacing: 16px;
@ -350,7 +350,7 @@ export component MailView {
}
}
MailMessageView {}
MailMessageView { }
}
}
@ -360,4 +360,3 @@ export component MailView {
sidebar-height: DialogGlobal.window-height - root.absolute-position.y;
}
}

View file

@ -24,7 +24,7 @@ export component MainView {
HorizontalLayout {
TabWidget {
Tab {
title: "Mail";
title: @tr("Mail");
HorizontalBox {
MailView {
@ -34,7 +34,7 @@ export component MainView {
}
Tab {
title: "Dashboard";
title: @tr("Dashboard");
HorizontalBox {
DashboardView { }

View file

@ -0,0 +1,13 @@
#!/bin/sh
# Copyright © SixtyFPS GmbH <info@slint.dev>
# SPDX-License-Identifier: MIT
# Run the script, translate, run the script again
find . -type f -name *.slint | xargs cargo run -p slint-tr-extractor -- -d usecases -o usecases.pot
for po in lang/*/LC_MESSAGES
do msgmerge $po/usecases.po usecases.pot -o $po/usecases.po
msgfmt $po/usecases.po -o $po/usecases.mo
done