Browse Source

adding i18n support

master
Dan Ballard 11 months ago
parent
commit
901109409b

BIN
i18n/translation_de.qm View File


+ 232
- 0
i18n/translation_de.ts View File

@@ -0,0 +1,232 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1" language="de_DE">
<context>
<name>AddGroupPane</name>
<message>
<location filename="../qml/panes/AddGroupPane.qml" line="17"/>
<source>Create a new group</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/panes/AddGroupPane.qml" line="26"/>
<source>Server:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/panes/AddGroupPane.qml" line="36"/>
<source>Group name:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/panes/AddGroupPane.qml" line="42"/>
<source>my awesome group</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/panes/AddGroupPane.qml" line="46"/>
<source>create</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>BulletinOverlay</name>
<message>
<location filename="../qml/overlays/BulletinOverlay.qml" line="181"/>
<source>New Bulletin</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>GroupSettingsPane</name>
<message>
<location filename="../qml/panes/GroupSettingsPane.qml" line="30"/>
<source>Server:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/panes/GroupSettingsPane.qml" line="41"/>
<location filename="../qml/panes/GroupSettingsPane.qml" line="62"/>
<source>copy</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/panes/GroupSettingsPane.qml" line="51"/>
<source>Invitation:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/panes/GroupSettingsPane.qml" line="72"/>
<source>Group name:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/panes/GroupSettingsPane.qml" line="81"/>
<source>Save</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/panes/GroupSettingsPane.qml" line="90"/>
<source>Invite someone to the group:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/panes/GroupSettingsPane.qml" line="101"/>
<source>Invite</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/panes/GroupSettingsPane.qml" line="110"/>
<source>delete</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>ListOverlay</name>
<message>
<location filename="../qml/overlays/ListOverlay.qml" line="161"/>
<source>Add a New List Item</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>Message</name>
<message>
<location filename="../qml/widgets/Message.qml" line="144"/>
<source>Could not send this message: </source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/widgets/Message.qml" line="144"/>
<source>Acknowledged</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/widgets/Message.qml" line="144"/>
<source>Pending</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>MyProfile</name>
<message>
<location filename="../qml/widgets/MyProfile.qml" line="168"/>
<source>copy</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/widgets/MyProfile.qml" line="171"/>
<source>copied to clipboard!</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/widgets/MyProfile.qml" line="200"/>
<source>new group</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/widgets/MyProfile.qml" line="209"/>
<source>... paste an address here to add a contact ...</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>OverlayPane</name>
<message>
<location filename="../qml/panes/OverlayPane.qml" line="39"/>
<source>Do you want to accept the invitation to </source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/panes/OverlayPane.qml" line="43"/>
<source>Accept</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/panes/OverlayPane.qml" line="52"/>
<source>Reject</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/panes/OverlayPane.qml" line="66"/>
<source>Chat</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/panes/OverlayPane.qml" line="73"/>
<source>Lists</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/panes/OverlayPane.qml" line="80"/>
<source>Bulletins</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/panes/OverlayPane.qml" line="87"/>
<source>Puzzle Game</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>PeerSettingsPane</name>
<message>
<location filename="../qml/panes/PeerSettingsPane.qml" line="29"/>
<source>Address:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/panes/PeerSettingsPane.qml" line="40"/>
<source>copy</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/panes/PeerSettingsPane.qml" line="43"/>
<source>copied to clipboard!</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/panes/PeerSettingsPane.qml" line="50"/>
<source>Display name:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/panes/PeerSettingsPane.qml" line="59"/>
<source>Save</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/panes/PeerSettingsPane.qml" line="70"/>
<source>delete</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>SettingsPane</name>
<message>
<location filename="../qml/panes/SettingsPane.qml" line="16"/>
<source>Cwtch Settings</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/panes/SettingsPane.qml" line="26"/>
<source>Interface zoom (mostly affects text and button sizes):</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/panes/SettingsPane.qml" line="42"/>
<source>Large text</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/panes/SettingsPane.qml" line="47"/>
<source>Default size text (scale factor: </source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/panes/SettingsPane.qml" line="51"/>
<source>Small text</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>

BIN
i18n/translation_en.qm View File


+ 191
- 0
i18n/translation_en.ts View File

@@ -0,0 +1,191 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1" language="en_US">
<context>
<name>AddGroupPane</name>
<message>
<source>Create a new group</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Server:</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Group name:</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>my awesome group</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>create</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>BulletinOverlay</name>
<message>
<source>New Bulletin</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>GroupSettingsPane</name>
<message>
<source>Server:</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>copy</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Invitation:</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Group name:</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Save</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Invite someone to the group:</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Invite</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>delete</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>ListOverlay</name>
<message>
<source>Add a New List Item</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>Message</name>
<message>
<source>Could not send this message: </source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Acknowledged</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Pending</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>MyProfile</name>
<message>
<source>copy</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>copied to clipboard!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>new group</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>... paste an address here to add a contact ...</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>OverlayPane</name>
<message>
<source>Do you want to accept the invitation to </source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Accept</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Reject</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Chat</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Lists</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Bulletins</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Puzzle Game</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>PeerSettingsPane</name>
<message>
<source>Address:</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>copy</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>copied to clipboard!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Display name:</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Save</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>delete</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>SettingsPane</name>
<message>
<source>Cwtch Settings</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Interface zoom (mostly affects text and button sizes):</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Large text</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Default size text (scale factor: </source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Small text</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>

+ 4
- 0
main.go View File

@@ -57,6 +57,10 @@ func main() {
app := gui.NewQGuiApplication(len(os.Args), os.Args)
app.SetWindowIcon(gui.NewQIcon5(":/qml/images/cwtch-icon.png"))

var translator = core.NewQTranslator(nil)
translator.Load("translation_"+core.QLocale_System().Name(), ":/i18n/", "", "")
core.QCoreApplication_InstallTranslator(translator)

core.QCoreApplication_SetAttribute(core.Qt__AA_EnableHighDpiScaling, true)
quickcontrols2.QQuickStyle_SetStyle("Universe")
engine := qml.NewQQmlApplicationEngine(nil)

+ 35
- 0
qml.qrc View File

@@ -0,0 +1,35 @@
<RCC>
<qresource prefix="/">
<file>qml/overlays/BulletinOverlay.qml</file>
<file>qml/overlays/ChatOverlay.qml</file>
<file>qml/overlays/Game1Overlay.qml</file>
<file>qml/overlays/Game2Overlay.qml</file>
<file>qml/overlays/ListOverlay.qml</file>
<file>qml/main.qml</file>
<file>qml/panes/AddGroupPane.qml</file>
<file>qml/panes/GroupSettingsPane.qml</file>
<file>qml/panes/OverlayPane.qml</file>
<file>qml/panes/PeerSettingsPane.qml</file>
<file>qml/panes/SettingsPane.qml</file>
<file>qml/styles/CwtchComboBoxStyle.qml</file>
<file>qml/styles/CwtchExpandingButton.qml</file>
<file>qml/styles/CwtchTextAreaStyle.qml</file>
<file>qml/styles/CwtchTextFieldStyle.qml</file>
<file>qml/widgets/ContactList.qml</file>
<file>qml/widgets/ContactPicture.qml</file>
<file>qml/widgets/ContactRow.qml</file>
<file>qml/widgets/FontAwesome.qml</file>
<file>qml/widgets/InplaceEditText.qml</file>
<file>qml/widgets/Message.qml</file>
<file>qml/widgets/MyProfile.qml</file>
<file>qml/widgets/ScalingLabel.qml</file>
<file>qml/widgets/SimpleButton.qml</file>
<file>qml/widgets/StackToolbar.qml</file>
<file>qml/widgets/controls/Button.qml</file>
<file>qml/widgets/controls/Loader.qml</file>
<file>qml/widgets/controls/Text.qml</file>
<file>qml/widgets/controls/Variables.qml</file>
<file>i18n/translation_en.qm</file>
<file>i18n/translation_de.qm</file>
</qresource>
</RCC>

+ 5
- 5
qml/panes/AddGroupPane.qml View File

@@ -14,7 +14,7 @@ ColumnLayout { // settingsPane


StackToolbar {
text: "Create a new group"
text: qsTr("Create a new group")
aux.visible: false
}

@@ -23,7 +23,7 @@ ColumnLayout { // settingsPane
spacing: 5

ScalingLabel {
text: "Server:"
text: qsTr("Server:")
}

TextField {
@@ -33,17 +33,17 @@ ColumnLayout { // settingsPane
}

ScalingLabel{
text: "Group name:"
text: qsTr("Group name:")
}

TextField {
id: txtGroupName
style: CwtchTextFieldStyle{ width: 400 }
text: "my awesome group"
text: qsTr("my awesome group")
}

SimpleButton {
text: "create"
text: qsTr("create")

onClicked: {
gcd.createGroup(txtServer.text, txtGroupName.text)

+ 9
- 9
qml/panes/GroupSettingsPane.qml View File

@@ -27,7 +27,7 @@ ColumnLayout { // groupSettingsPane
spacing: 5

ScalingLabel {
text: "Server:"
text: qsTr("Server:")
}

TextField {
@@ -38,7 +38,7 @@ ColumnLayout { // groupSettingsPane

SimpleButton {
icon: "regular/clipboard"
text: "copy"
text: qsTr("copy")

onClicked: {
gcd.popup("copied to clipboard!")
@@ -48,7 +48,7 @@ ColumnLayout { // groupSettingsPane
}

ScalingLabel {
text: "Invitation:"
text: qsTr("Invitation:")
}

TextField {
@@ -59,7 +59,7 @@ ColumnLayout { // groupSettingsPane

SimpleButton {
icon: "regular/clipboard"
text: "copy"
text: qsTr("copy")

onClicked: {
gcd.popup("copied to clipboard!")
@@ -69,7 +69,7 @@ ColumnLayout { // groupSettingsPane
}

ScalingLabel{
text: "Group name:"
text: qsTr("Group name:")
}

TextField {
@@ -78,7 +78,7 @@ ColumnLayout { // groupSettingsPane
}

SimpleButton {
text: "Save"
text: qsTr("Save")

onClicked: {
gcd.saveGroupSettings(groupID, txtGroupName.text)
@@ -87,7 +87,7 @@ ColumnLayout { // groupSettingsPane
}
}

ScalingLabel { text: "Invite someone to the group:" }
ScalingLabel { text: qsTr("Invite someone to the group:") }

ComboBox {
id: cbInvite
@@ -98,7 +98,7 @@ ColumnLayout { // groupSettingsPane
}

SimpleButton {
text: "Invite"
text: qsTr("Invite")

onClicked: {
gcd.inviteToGroup(addrbook[cbInvite.currentIndex], groupID)
@@ -107,7 +107,7 @@ ColumnLayout { // groupSettingsPane

SimpleButton {
icon: "regular/trash-alt"
text: "delete"
text: qsTr("delete")

onClicked: {
gcd.leaveGroup(groupID)

+ 7
- 7
qml/panes/OverlayPane.qml View File

@@ -36,11 +36,11 @@ ColumnLayout {


Text {
text: "Do you want to accept the invitation to " + overlay.name + "?"
text: qsTr("Do you want to accept the invitation to ") + overlay.name + "?"
}

SimpleButton {
text: "Accept"
text: qsTr("Accept")
icon: "regular/heart"
onClicked: {
gcd.acceptGroup(gcd.currentOpenConversation)
@@ -49,7 +49,7 @@ ColumnLayout {
}

SimpleButton {
text: "Reject"
text: qsTr("Reject")
icon: "regular/trash-alt"
onClicked: {
gcd.leaveGroup(gcd.currentOpenConversation)
@@ -63,28 +63,28 @@ ColumnLayout {


SimpleButton {
text: "Chat"
text: qsTr("Chat")


onClicked: overlayStack.overlay = overlayStack.chatOverlay
}

SimpleButton {
text: "Lists"
text: qsTr("Lists")


onClicked: overlayStack.overlay = overlayStack.listOverlay
}

SimpleButton {
text: "Bulletins"
text: qsTr("Bulletins")


onClicked: overlayStack.overlay = overlayStack.bulletinOverlay
}

SimpleButton {
text: "Puzzle Game"
text: qsTr("Puzzle Game")


onClicked: overlayStack.overlay = overlayStack.game1Overlay

+ 6
- 6
qml/panes/PeerSettingsPane.qml View File

@@ -26,7 +26,7 @@ ColumnLayout { // peerSettingsPane
spacing: 5

ScalingLabel {
text: "Address:"
text: qsTr("Address:")
}

TextField {
@@ -37,17 +37,17 @@ ColumnLayout { // peerSettingsPane

SimpleButton {
icon: "regular/clipboard"
text: "copy"
text: qsTr("copy")

onClicked: {
gcd.popup("copied to clipboard!")
gcd.popup(qsTr("copied to clipboard!"))
txtOnion.selectAll()
txtOnion.copy()
}
}

ScalingLabel{
text: "Display name:"
text: qsTr("Display name:")
}

TextField {
@@ -56,7 +56,7 @@ ColumnLayout { // peerSettingsPane
}

SimpleButton {
text: "Save"
text: qsTr("Save")

onClicked: {
gcd.savePeerSettings(txtOnion.text, txtDisplayName.text)
@@ -67,7 +67,7 @@ ColumnLayout { // peerSettingsPane

SimpleButton {
icon: "regular/trash-alt"
text: "delete"
text: qsTr("delete")

onClicked: {
gcd.setAttribute(txtOnion.text, "deleted", "deleted")

+ 5
- 5
qml/panes/SettingsPane.qml View File

@@ -13,7 +13,7 @@ ColumnLayout { // settingsPane


StackToolbar {
text: "Cwtch Settings"
text: qsTr("Cwtch Settings")
aux.visible: false
}

@@ -23,7 +23,7 @@ ColumnLayout { // settingsPane

ScalingLabel {
Layout.maximumWidth: parent.width
text: "Interface zoom (mostly affects text and button sizes):"
text: qsTr("Interface zoom (mostly affects text and button sizes):")
}

Slider {
@@ -39,16 +39,16 @@ ColumnLayout { // settingsPane
}

ScalingLabel {
text: "Large text"
text: qsTr("Large text")
size: 20
}

ScalingLabel{
text: "Default size text (scale factor: " + zoomSlider.value + ")"
text: qsTr("Default size text (scale factor: ") + zoomSlider.value + ")"
}

ScalingLabel {
text: "Small text"
text: qsTr("Small text")
size: 8
}


+ 4
- 4
qml/widgets/MyProfile.qml View File

@@ -165,10 +165,10 @@ ColumnLayout {

SimpleButton { // COPY ONION ADDRESS BUTTON
icon: "regular/clipboard"
text: "copy"
text: qsTr("copy")

onClicked: {
gcd.popup("copied to clipboard!")
gcd.popup(qsTr("copied to clipboard!"))
txtHidden.text = nick.replace(" ", "~") + "~" + onion
txtHidden.selectAll()
txtHidden.copy()
@@ -197,7 +197,7 @@ ColumnLayout {

SimpleButton { // CREATE GROUP BUTTON
icon: "regular/clipboard"
text: "new group"
text: qsTr("new group")

onClicked: theStack.pane = theStack.addGroupPane
}
@@ -206,7 +206,7 @@ ColumnLayout {
TextField {
anchors.horizontalCenter: parent.horizontalCenter
style: CwtchTextFieldStyle{ width: 400 }
placeholderText: "... paste an address here to add a contact ..."
placeholderText: qsTr("... paste an address here to add a contact ...")
horizontalAlignment: TextInput.AlignHCenter

onTextChanged: {

+ 32
- 0
ui.pro View File

@@ -0,0 +1,32 @@
QT += quick

# The following define makes your compiler emit warnings if you use
# any feature of Qt which as been marked deprecated (the exact warnings
# depend on your compiler). Please consult the documentation of the
# deprecated API in order to know how to port your code away from it.
DEFINES += QT_DEPRECATED_WARNINGS

# You can also make your code fail to compile if you use deprecated APIs.
# In order to do so, uncomment the following line.
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0

SOURCES += \
main.go

RESOURCES += qml.qrc

TRANSLATIONS = i18n/translation_en.ts \
i18n/translation_de.ts

# Additional import path used to resolve QML modules in Qt Creator's code model
QML_IMPORT_PATH =

# Additional import path used to resolve QML modules just for Qt Quick Designer
QML_DESIGNER_IMPORT_PATH =

# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target


Loading…
Cancel
Save