add basic model and interface

This commit is contained in:
marlon-erler
2024-07-07 22:11:18 +02:00
parent ae3f01ab01
commit cb2b407d30
21 changed files with 1153 additions and 139 deletions
+36 -9
View File
@@ -1,19 +1,46 @@
import * as React from "bloatless-react";
import { currentAddress, primaryChannel } from "./model";
const englishTranslations = {
// general
setInput: "Set",
connectionStatus: "Connection status",
connectedTo: React.createProxyState(
[currentAddress],
() => `Connected to ${currentAddress}`
),
disconnected: "Disconnected",
// settings
settings: "Settings",
connection: "Connection",
communication: "Communication",
encryption: "Encryption",
serverAddress: "Server Address",
serverAddressPlaceholder: "ws://192.168.0.69:3000",
connectToServer: "Connect",
primaryChannel: "Primary channel",
channelPlaceholder: "my-channel",
addSecondaryChannel: "Add secondary channel",
removeSecondaryChannel: "Remove secondary channel",
newSecondaryChannelPlaceholder: "Add secondary channel",
encryptionKey: "Encryption key",
encryptionKeyPlaceholder: "1jg028ej40d",
showEncryptionKey: "Show encryption key",
yourName: "Your Name",
yourNamePlaceholder: "Jane Doe",
// messages
messages: "Messages"
messages: "Messages",
composerPlaceholder: "Type a message...",
sendMessage: "Send"
};
const translations = {
const allTranslations = {
en: englishTranslations,
};
export function getText(key: keyof typeof englishTranslations): string {
const language = navigator.language.substring(0, 2);
if (translations[language]) {
return translations[language][key];
}
return translations.en[key];
}
const language = navigator.language.substring(0, 2);
export const translation: typeof englishTranslations =
allTranslations[language] ?? allTranslations.en;