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
+8 -5
View File
@@ -108,7 +108,8 @@ component ChatMessage inherits Rectangle {
x: Theme.gutter;
width: parent.width - Theme.gutter - 16px;
height: parent.height;
text: "↳ \{root.m.reply-sender} \{root.m.reply-body}";
// Reply preview: {0} is the sender, {1} the start of the replied-to text.
text: @tr("↳ {0} {1}", root.m.reply-sender, root.m.reply-body);
color: Theme.text-muted;
font-size: 13px;
vertical-alignment: center;
@@ -175,7 +176,7 @@ component ChatMessage inherits Rectangle {
}
if root.m.edited: Text {
text: "(edited)";
text: @tr("(edited)");
color: Theme.text-faint;
font-size: 11px;
}
@@ -269,7 +270,8 @@ component RoomStart inherits Rectangle {
padding-top: 32px;
spacing: 6px;
Text {
text: "Welcome to #\{root.room-name}!";
// {} is the channel name; the leading "#" is the channel prefix.
text: @tr("Welcome to #{}!", root.room-name);
color: Theme.text-header;
font-size: 28px;
font-weight: 700;
@@ -277,7 +279,8 @@ component RoomStart inherits Rectangle {
}
Text {
text: "This is the start of the #\{root.room-name} channel.";
// {} is the channel name; the leading "#" is the channel prefix.
text: @tr("This is the start of the #{} channel.", root.room-name);
color: Theme.text-muted;
font-size: 15px;
wrap: word-wrap;
@@ -389,7 +392,7 @@ export component MessageList inherits Rectangle {
border-radius: 12px;
background: Theme.popup-bg;
Text {
text: "Loading history…";
text: @tr("Loading history…");
color: Theme.text-muted;
font-size: 12px;
horizontal-alignment: center;
+8 -8
View File
@@ -32,7 +32,7 @@ export component LoginScreen inherits Rectangle {
spacing: 6px;
Text {
text: "Welcome back!";
text: @tr("Welcome back!");
color: Theme.text-header;
font-size: 24px;
font-weight: 700;
@@ -40,7 +40,7 @@ export component LoginScreen inherits Rectangle {
}
Text {
text: "Sign in with your Matrix account";
text: @tr("Sign in with your Matrix account");
color: Theme.text-muted;
font-size: 15px;
horizontal-alignment: center;
@@ -51,14 +51,14 @@ export component LoginScreen inherits Rectangle {
}
Text {
text: "HOMESERVER";
text: @tr("HOMESERVER");
color: Theme.text-muted;
font-size: 12px;
font-weight: 700;
}
TextField {
placeholder: "matrix.org";
placeholder: @tr("matrix.org");
text <=> root.homeserver;
}
@@ -67,14 +67,14 @@ export component LoginScreen inherits Rectangle {
}
Text {
text: "USERNAME";
text: @tr("USERNAME");
color: Theme.text-muted;
font-size: 12px;
font-weight: 700;
}
TextField {
placeholder: "user (or @user:matrix.org)";
placeholder: @tr("user (or @user:matrix.org)");
text <=> root.username;
}
@@ -83,7 +83,7 @@ export component LoginScreen inherits Rectangle {
}
Text {
text: "PASSWORD";
text: @tr("PASSWORD");
color: Theme.text-muted;
font-size: 12px;
font-weight: 700;
@@ -112,7 +112,7 @@ export component LoginScreen inherits Rectangle {
border-radius: 4px;
background: root.busy ? Theme.accent-hover : (login-touch.has-hover ? Theme.accent-hover : Theme.accent);
Text {
text: root.busy ? "Signing in…" : "Log In";
text: root.busy ? @tr("Signing in…") : @tr("Log In");
color: white;
font-size: 16px;
font-weight: 600;
+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;