new: setup translations

This commit is contained in:
2026-10-09 17:52:48 -04:00
parent 23a44aa210
commit ffe0a54cbd
13 changed files with 507 additions and 96 deletions
+20 -14
View File
@@ -15,7 +15,7 @@ import { MemberList } from "components/member-list.slint";
export { Screen, ServerItem, ChannelItem, MessageItem, MemberItem, ChannelKind, MessageKind, ReactionItem } from "types.slint";
export component MainWindow inherits Window {
title: "Tofu";
title: @tr("Tofu");
min-width: 900px;
min-height: 520px;
preferred-width: 1280px;
@@ -42,7 +42,7 @@ export component MainWindow inherits Window {
in property <[MessageItem]> messages;
in property <[MemberItem]> members;
in property <string> sidebar-title: "Direct Messages";
in property <string> sidebar-title: @tr("Direct Messages");
in property <string> room-name;
in property <string> room-topic;
in property <bool> room-is-dm;
@@ -81,7 +81,7 @@ export component MainWindow inherits Window {
if root.screen == Screen.loading: Rectangle {
background: Theme.rail-bg;
Text {
text: "Tofu";
text: @tr("Tofu");
color: Theme.text-muted;
font-size: 32px;
font-weight: 700;
@@ -115,12 +115,13 @@ export component MainWindow inherits Window {
root.select-server(id);
}
add-server => {
root.not-implemented("Create / join a space");
root.not-implemented(@tr("Create / join a space"));
}
}
ChannelList {
title: root.sidebar-title;
// Heading of the sidebar in the Home view, which lists direct messages.
title: root.selected-server-id == "" ? @tr("Direct Messages") : root.sidebar-title;
is-home: root.selected-server-id == "";
channels: root.channels;
selected-id: root.selected-room-id;
@@ -129,7 +130,7 @@ export component MainWindow inherits Window {
root.select-room(id);
}
open-server-menu => {
root.not-implemented("Space settings");
root.not-implemented(@tr("Space settings"));
}
}
}
@@ -147,6 +148,7 @@ export component MainWindow inherits Window {
// Right: chat
VerticalLayout {
width: root.width - Theme.rail-width - Theme.sidebar-width;
ChatHeader {
room-name: root.room-name;
topic: root.room-topic;
@@ -154,18 +156,21 @@ export component MainWindow inherits Window {
encrypted: root.room-encrypted;
show-members <=> root.show-members;
open-threads => {
root.not-implemented("Threads");
root.not-implemented(@tr("Threads"));
}
open-pins => {
root.not-implemented("Pinned messages");
root.not-implemented(@tr("Pinned messages"));
}
open-search => {
root.not-implemented("Search");
root.not-implemented(@tr("Search"));
}
}
HorizontalLayout {
Rectangle {
vertical-stretch: 1;
VerticalLayout {
width: parent.width - (root.show-members ? Theme.member-width : 0px);
height: parent.height;
MessageList {
messages: root.messages;
room-name: root.room-name;
@@ -198,8 +203,8 @@ export component MainWindow inherits Window {
text-to-set: root.composer-text;
text-nonce: root.composer-text-nonce;
focus-nonce: root.composer-focus-nonce;
placeholder: root.room-is-dm ? "Message @\{root.room-name}" : "Message #\{root.room-name}";
banner: root.editing-id != "" ? "Editing message" : (root.reply-to-id != "" ? "Replying to \{root.reply-to-name}" : "");
placeholder: root.room-is-dm ? @tr("Message @{}", root.room-name) : @tr("Message #{}", root.room-name);
banner: root.editing-id != "" ? @tr("Editing message") : (root.reply-to-id != "" ? @tr("Replying to {}", root.reply-to-name) : "");
editing: root.editing-id != "";
typing-text: root.typing-text;
submit(text) => {
@@ -221,19 +226,20 @@ export component MainWindow inherits Window {
root.typing();
}
attach => {
root.not-implemented("File uploads");
root.not-implemented(@tr("File uploads"));
}
}
}
if root.show-members: MemberList {
x: parent.width - self.width;
height: parent.height;
members: root.members;
}
}
}
}
// Transient banner for errors and "coming soon" notices.
if root.toast != "": Rectangle {
width: min(480px, parent.width - 32px);
height: 40px;