diff --git a/assets.go b/assets.go index dca5958..8e47329 100644 --- a/assets.go +++ b/assets.go @@ -134,287 +134,63 @@ var mucPersistentBytes []byte //go:embed assets/muc_temporary.png var mucTemporaryBytes []byte -func init() { - - loader := gdkpixbuf.NewPixbufLoader() - - loader.Write(defaultAvatarBytes) - loader.Close() - clientAssets["DefaultAvatar"] = gdk.NewTextureForPixbuf(loader.Pixbuf()) - - loader = gdkpixbuf.NewPixbufLoader() - - loader.Write(failedBytes) - loader.Close() - - clientAssets["FailedAvatar"] = gdk.NewTextureForPixbuf(loader.Pixbuf()) - - loader = gdkpixbuf.NewPixbufLoader() - - loader.Write(ownerMedalBytes) - loader.Close() - - clientAssets["owner"] = gdk.NewTextureForPixbuf(loader.Pixbuf()) - - loader = gdkpixbuf.NewPixbufLoader() - - loader.Write(cancelBytes) - loader.Close() - - clientAssets["cancel"] = gdk.NewTextureForPixbuf(loader.Pixbuf()) - - loader = gdkpixbuf.NewPixbufLoader() - - loader.Write(tagBytes) - loader.Close() - - clientAssets["tag"] = gdk.NewTextureForPixbuf(loader.Pixbuf()) - - loader = gdkpixbuf.NewPixbufLoader() - - loader.Write(adminMedalBytes) - loader.Close() - - clientAssets["admin"] = gdk.NewTextureForPixbuf(loader.Pixbuf()) - - loader = gdkpixbuf.NewPixbufLoader() - - loader.Write(memberMedalBytes) - loader.Close() - - clientAssets["member"] = gdk.NewTextureForPixbuf(loader.Pixbuf()) - - loader = gdkpixbuf.NewPixbufLoader() - - loader.Write(noneMedalBytes) - loader.Close() - - clientAssets["none"] = gdk.NewTextureForPixbuf(loader.Pixbuf()) - - loader = gdkpixbuf.NewPixbufLoader() - - loader.Write(outcastMedalBytes) - loader.Close() - - clientAssets["outcast"] = gdk.NewTextureForPixbuf(loader.Pixbuf()) - - loader = gdkpixbuf.NewPixbufLoader() - - loader.Write(logoDisabledBytes) - loader.Close() - - clientAssets["disabled_logo"] = gdk.NewTextureForPixbuf(loader.Pixbuf()) - - loader = gdkpixbuf.NewPixbufLoader() - - loader.Write(groupBytes) - loader.Close() - - clientAssets["group"] = gdk.NewTextureForPixbuf(loader.Pixbuf()) - - loader = gdkpixbuf.NewPixbufLoader() - - loader.Write(doorInBytes) - loader.Close() - - clientAssets["door_in"] = gdk.NewTextureForPixbuf(loader.Pixbuf()) - - loader = gdkpixbuf.NewPixbufLoader() - - loader.Write(doorOutBytes) - loader.Close() - - clientAssets["door_out"] = gdk.NewTextureForPixbuf(loader.Pixbuf()) - - loader = gdkpixbuf.NewPixbufLoader() - - loader.Write(largeGroupBytes) - loader.Close() - - clientAssets["large_group"] = gdk.NewTextureForPixbuf(loader.Pixbuf()) - - loader = gdkpixbuf.NewPixbufLoader() - - loader.Write(worldBytes) - loader.Close() - - clientAssets["world"] = gdk.NewTextureForPixbuf(loader.Pixbuf()) - - loader = gdkpixbuf.NewPixbufLoader() - - loader.Write(disconnectBytes) - loader.Close() - - clientAssets["disconnect"] = gdk.NewTextureForPixbuf(loader.Pixbuf()) - - loader = gdkpixbuf.NewPixbufLoader() - - loader.Write(barBytes) - loader.Close() - - clientAssets["chart_bar"] = gdk.NewTextureForPixbuf(loader.Pixbuf()) - - loader = gdkpixbuf.NewPixbufLoader() - - loader.Write(barLaggyBytes) - loader.Close() - - clientAssets["chart_bar_laggy"] = gdk.NewTextureForPixbuf(loader.Pixbuf()) - - loader = gdkpixbuf.NewPixbufLoader() - - loader.Write(okBytes) - loader.Close() - - clientAssets["ok"] = gdk.NewTextureForPixbuf(loader.Pixbuf()) - - loader = gdkpixbuf.NewPixbufLoader() - - loader.Write(hourglassBytes) - loader.Close() - - clientAssets["hourglass"] = gdk.NewTextureForPixbuf(loader.Pixbuf()) - - loader = gdkpixbuf.NewPixbufLoader() - - loader.Write(connectBytes) - loader.Close() - - clientAssets["connect"] = gdk.NewTextureForPixbuf(loader.Pixbuf()) - - loader = gdkpixbuf.NewPixbufLoader() - - loader.Write(commentBytes) - loader.Close() - - clientAssets["comment"] = gdk.NewTextureForPixbuf(loader.Pixbuf()) - - loader = gdkpixbuf.NewPixbufLoader() - - loader.Write(informationBytes) - loader.Close() - - clientAssets["information"] = gdk.NewTextureForPixbuf(loader.Pixbuf()) - - loader = gdkpixbuf.NewPixbufLoader() - - loader.Write(sABytes) - loader.Close() - - clientAssets["status_away"] = gdk.NewTextureForPixbuf(loader.Pixbuf()) - - loader = gdkpixbuf.NewPixbufLoader() - - loader.Write(sBBytes) - loader.Close() - - clientAssets["status_dnd"] = gdk.NewTextureForPixbuf(loader.Pixbuf()) - - loader = gdkpixbuf.NewPixbufLoader() - - loader.Write(sCBytes) - loader.Close() - - clientAssets["status_chat"] = gdk.NewTextureForPixbuf(loader.Pixbuf()) - - loader = gdkpixbuf.NewPixbufLoader() - - loader.Write(xaBytes) - loader.Close() - - clientAssets["status_xa"] = gdk.NewTextureForPixbuf(loader.Pixbuf()) - - loader = gdkpixbuf.NewPixbufLoader() - - loader.Write(sOBytes) - loader.Close() - - clientAssets["status_"] = gdk.NewTextureForPixbuf(loader.Pixbuf()) - - loader = gdkpixbuf.NewPixbufLoader() - - loader.Write(carBytes) - loader.Close() - - clientAssets["car"] = gdk.NewTextureForPixbuf(loader.Pixbuf()) - - loader = gdkpixbuf.NewPixbufLoader() - - loader.Write(carHighBytes) - loader.Close() - - clientAssets["car_high"] = gdk.NewTextureForPixbuf(loader.Pixbuf()) - - loader = gdkpixbuf.NewPixbufLoader() - - loader.Write(mucOpenBytes) - loader.Close() - - clientAssets["muc_open"] = gdk.NewTextureForPixbuf(loader.Pixbuf()) - - loader = gdkpixbuf.NewPixbufLoader() - loader.Write(mucMembersOnlyBytes) - loader.Close() - - clientAssets["muc_membersonly"] = gdk.NewTextureForPixbuf(loader.Pixbuf()) - - loader = gdkpixbuf.NewPixbufLoader() - loader.Write(mucPasswordProtectedBytes) - loader.Close() - - clientAssets["muc_passwordprotected"] = gdk.NewTextureForPixbuf(loader.Pixbuf()) - - loader = gdkpixbuf.NewPixbufLoader() - loader.Write(mucUnsecuredBytes) - loader.Close() - - clientAssets["muc_unsecured"] = gdk.NewTextureForPixbuf(loader.Pixbuf()) - - loader = gdkpixbuf.NewPixbufLoader() - loader.Write(mucHiddenBytes) - loader.Close() - - clientAssets["muc_hidden"] = gdk.NewTextureForPixbuf(loader.Pixbuf()) - - loader = gdkpixbuf.NewPixbufLoader() - loader.Write(mucPublicBytes) - loader.Close() - - clientAssets["muc_public"] = gdk.NewTextureForPixbuf(loader.Pixbuf()) - - loader = gdkpixbuf.NewPixbufLoader() - loader.Write(mucUnmoderatedBytes) - loader.Close() - - clientAssets["muc_unmoderated"] = gdk.NewTextureForPixbuf(loader.Pixbuf()) - - loader = gdkpixbuf.NewPixbufLoader() - loader.Write(mucModeratedBytes) - loader.Close() - - clientAssets["muc_moderated"] = gdk.NewTextureForPixbuf(loader.Pixbuf()) - - loader = gdkpixbuf.NewPixbufLoader() - loader.Write(mucNonAnonymousBytes) - loader.Close() - - clientAssets["muc_nonanonymous"] = gdk.NewTextureForPixbuf(loader.Pixbuf()) - - loader = gdkpixbuf.NewPixbufLoader() - loader.Write(mucSemiAnonymousBytes) - loader.Close() - - clientAssets["muc_semianonymous"] = gdk.NewTextureForPixbuf(loader.Pixbuf()) - - loader = gdkpixbuf.NewPixbufLoader() - loader.Write(mucPersistentBytes) - loader.Close() - - clientAssets["muc_persistent"] = gdk.NewTextureForPixbuf(loader.Pixbuf()) - - loader = gdkpixbuf.NewPixbufLoader() - loader.Write(mucTemporaryBytes) - loader.Close() - - clientAssets["muc_temporary"] = gdk.NewTextureForPixbuf(loader.Pixbuf()) +//go:embed assets/moderate.png +var moderateBytes []byte + +func loadAsset(key string, data []byte) { + loader := gdkpixbuf.NewPixbufLoader() + loader.Write(data) + loader.Close() + clientAssets[key] = gdk.NewTextureForPixbuf(loader.Pixbuf()) } + + +func init() { + for key, data := range map[string][]byte{ + "DefaultAvatar": defaultAvatarBytes, + "FailedAvatar": failedBytes, + "owner": ownerMedalBytes, + "admin": adminMedalBytes, + "member": memberMedalBytes, + "none": noneMedalBytes, + "outcast": outcastMedalBytes, + "cancel": cancelBytes, + "tag": tagBytes, + "disabled_logo": logoDisabledBytes, + "group": groupBytes, + "door_in": doorInBytes, + "door_out": doorOutBytes, + "large_group": largeGroupBytes, + "world": worldBytes, + "disconnect": disconnectBytes, + "chart_bar": barBytes, + "chart_bar_laggy": barLaggyBytes, + "ok": okBytes, + "hourglass": hourglassBytes, + "connect": connectBytes, + "comment": commentBytes, + "information": informationBytes, + "status_away": sABytes, + "status_dnd": sBBytes, + "status_chat": sCBytes, + "status_xa": xaBytes, + "status_": sOBytes, + "car": carBytes, + "car_high": carHighBytes, + "muc_open": mucOpenBytes, + "muc_membersonly": mucMembersOnlyBytes, + "muc_passwordprotected": mucPasswordProtectedBytes, + "muc_unsecured": mucUnsecuredBytes, + "muc_hidden": mucHiddenBytes, + "muc_public": mucPublicBytes, + "muc_unmoderated": mucUnmoderatedBytes, + "muc_moderated": mucModeratedBytes, + "muc_nonanonymous": mucNonAnonymousBytes, + "muc_semianonymous": mucSemiAnonymousBytes, + "muc_persistent": mucPersistentBytes, + "muc_temporary": mucTemporaryBytes, + "moderate": moderateBytes, + } { + loadAsset(key, data) + } +} \ No newline at end of file diff --git a/assets/moderate.png b/assets/moderate.png new file mode 100644 index 0000000..1be3797 Binary files /dev/null and b/assets/moderate.png differ diff --git a/gtk-helpers.go b/gtk-helpers.go index 04d07be..e0db50a 100644 --- a/gtk-helpers.go +++ b/gtk-helpers.go @@ -40,7 +40,7 @@ func createTab(jid string, isMuc bool, name string) bool { newTab.msgs.SetShowSeparators(true) newTab.name = name - newTab.msgs.Append(gtk.NewButtonWithLabel("Get past messages...")) + newTab.msgs.Append(gtk.NewButtonWithLabel(loadedLocale["getPastMessages"])) tabs.Store(jid, newTab) return true } @@ -68,12 +68,12 @@ func switchToTab(jid string, w *gtk.Window) { return } mm := ma.Members - gen := gtk.NewBox(gtk.OrientationVertical, 0) + gen := gtk.NewBox(gtk.OrientationVertical, 10) i := 0 rangeOrdered(&mm, (func(k, v any) bool { i++ - userbox := gtk.NewBox(gtk.OrientationHorizontal, 0) + userbox := gtk.NewBox(gtk.OrientationHorizontal, 2) u := v.(stanza.Presence) var mu MucUser @@ -99,7 +99,7 @@ func switchToTab(jid string, w *gtk.Window) { nick_label.SetOpacity(0.5) } - userbox.SetTooltipText(fmt.Sprintf("%s\n%s\n%s\nClick for more information", u.From, mu.MucUserItem.Role, mu.MucUserItem.Affiliation)) + userbox.SetTooltipText(fmt.Sprintf("%s\n%s\n%s\n%s", u.From, mu.MucUserItem.Role, mu.MucUserItem.Affiliation, loadedLocale["clickForMoreInfo"])) userbox.Append(nick_label) var hats Hats @@ -159,10 +159,10 @@ func switchToTab(jid string, w *gtk.Window) { popover.SetParent(userbox) rc_box := gtk.NewBox(gtk.OrientationVertical, 0) - bb := gtk.NewButtonWithLabel("Ban") - kb := gtk.NewButtonWithLabel("Kick") - ab := gtk.NewButtonWithLabel("Set affil") - rb := gtk.NewButtonWithLabel("Set role") + bb := gtk.NewButtonWithLabel(loadedLocale["ban"]) + kb := gtk.NewButtonWithLabel(loadedLocale["kick"]) + ab := gtk.NewButtonWithLabel(loadedLocale["setAffil"]) + rb := gtk.NewButtonWithLabel(loadedLocale["setRole"]) kb.ConnectClicked(func() { client.SendRaw(fmt.Sprintf(` @@ -207,12 +207,12 @@ func switchToTab(jid string, w *gtk.Window) { win.SetResizable(false) box := gtk.NewBox(gtk.OrientationVertical, 0) - box.Append(gtk.NewLabel("Set " + JidMustParse(u.From).Resource + "'s affiliation")) + box.Append(gtk.NewLabel(loadedLocale["setAffilDescPartOne"] + JidMustParse(u.From).Resource + loadedLocale["setAffilDescPartTwo"])) the_entry := gtk.NewEntry() the_entry.SetText(mu.MucUserItem.Affiliation) - submit := gtk.NewButtonWithLabel("Submit") + submit := gtk.NewButtonWithLabel(loadedLocale["submit"]) submit.ConnectClicked(func() { client.SendRaw(fmt.Sprintf(` - `, clientroot.Session.BindJid, current, JidMustParse(clientroot.Session.BindJid).Bare())) + `, clientroot.Session.BindJid, current, JidMustParse(clientroot.Session.BindJid).Bare(), loadedLocale["userRequested"])) } } win.SetVisible(false) @@ -702,7 +700,7 @@ func activate(app *gtk.Application) { if mu.MucUserItem.JID != "" { if JidMustParse(mu.MucUserItem.JID).Bare() == JidMustParse(clientroot.Session.BindJid).Bare() { if mu.MucUserItem.Affiliation != "owner" { - box.Append(gtk.NewLabel("You are not an owner of this MUC and thus will most likely not be able to delete it")) + box.Append(gtk.NewLabel(loadedLocale["destroyMUCNotOwnerWarning"])) } // return false } @@ -728,10 +726,10 @@ func activate(app *gtk.Application) { joinAction := gio.NewSimpleAction("join", nil) joinAction.ConnectActivate(func(p *glib.Variant) { - box := gtk.NewBox(gtk.OrientationVertical, 0) - jid_box := gtk.NewBox(gtk.OrientationHorizontal, 0) - nick_box := gtk.NewBox(gtk.OrientationHorizontal, 0) - disco_box := gtk.NewBox(gtk.OrientationHorizontal, 0) + box := gtk.NewBox(gtk.OrientationVertical, 10) + jid_box := gtk.NewBox(gtk.OrientationHorizontal, 10) + nick_box := gtk.NewBox(gtk.OrientationHorizontal, 10) + disco_box := gtk.NewBox(gtk.OrientationHorizontal, 10) jid_entry := gtk.NewEntry() nick_entry := gtk.NewEntry() @@ -745,28 +743,28 @@ func activate(app *gtk.Application) { nick_entry.SetText(loadedConfig.Nick) - jid_box.Append(gtk.NewLabel("MUC JID:")) + jid_box.Append(gtk.NewLabel(loadedLocale["joinMUCJIDEntry"])) jid_box.Append(jid_entry) - nick_box.Append(gtk.NewLabel("Nick:")) + nick_box.Append(gtk.NewLabel(loadedLocale["joinMUCNickEntry"])) nick_box.Append(nick_entry) disco_check.SetActive(true) - disco_box.Append(gtk.NewLabel("Check MUC features before joining")) + disco_box.Append(gtk.NewLabel(loadedLocale["joinMUCDiscoCheck"])) disco_box.Append(disco_check) - disco_box.SetTooltipText("If you are creating a MUC through this window then turn this off") + disco_box.SetTooltipText(loadedLocale["joinMUCDiscoCheckTooltip"]) box.Append(jid_box) box.Append(nick_box) box.Append(disco_box) - btn := gtk.NewButtonWithLabel("Submit") + btn := gtk.NewButtonWithLabel(loadedLocale["submit"]) btn.SetVAlign(gtk.AlignBaseline) box.Append(btn) win := gtk.NewWindow() - win.SetTitle("Join MUC") + win.SetTitle(loadedLocale["joinMUCMenu"]) win.SetDefaultSize(400, 1) win.SetResizable(false) win.SetChild(box) @@ -829,11 +827,12 @@ func activate(app *gtk.Application) { password_protected := false password := "" warning_win := gtk.NewWindow() - warning_win.SetTitle(fmt.Sprintf("Joining %s", res.Identity[0].Name)) - warning_win.SetDefaultSize(400, 400) + warning_win.SetTitle(fmt.Sprintf("%s%s", loadedLocale["joinPreviewTitle"], res.Identity[0].Name)) + warning_win.SetDefaultSize(400, 1) warning_win.SetResizable(false) - buttons := gtk.NewBox(gtk.OrientationHorizontal, 0) + buttons := gtk.NewBox(gtk.OrientationHorizontal, 10) + join_button := gtk.NewButtonWithLabel("Join") join_button.ConnectClicked(func() { warning_win.SetVisible(false) @@ -841,13 +840,12 @@ func activate(app *gtk.Application) { allowed = false password_win := gtk.NewWindow() - password_win.SetTitle("Password required") + password_win.SetTitle(loadedLocale["joinPasswordRequired"]) password_win.SetDefaultSize(400, 1) password_win.SetResizable(false) - box := gtk.NewBox(gtk.OrientationVertical, 0) - en := gtk.NewEntry() - en.SetPlaceholderText("Password") - submit := gtk.NewButtonWithLabel("Submit") + box := gtk.NewBox(gtk.OrientationVertical, 10) + en := gtk.NewPasswordEntry() + submit := gtk.NewButtonWithLabel(loadedLocale["submit"]) submit.ConnectClicked(func() { password = en.Text() jm(res.Identity[0].Name, password) @@ -862,79 +860,62 @@ func activate(app *gtk.Application) { jm(res.Identity[0].Name, password) }) - cancel_button := gtk.NewButtonWithLabel("Cancel") + cancel_button := gtk.NewButtonWithLabel(loadedLocale["cancel"]) cancel_button.ConnectClicked(func() { warning_win.SetVisible(false) }) + join_button.SetHExpand(true) + cancel_button.SetHExpand(true) + buttons.Append(join_button) buttons.Append(cancel_button) - warning_box := gtk.NewBox(gtk.OrientationVertical, 0) + warning_box := gtk.NewBox(gtk.OrientationVertical, 10) header := gtk.NewLabel(res.Identity[0].Name) warning_box.Append(header) + addFeature := func(icon string, description string) { + box := gtk.NewBox(gtk.OrientationHorizontal, 10) + box.Append(gtk.NewImageFromPaintable(clientAssets[icon])) + box.Append(gtk.NewLabel(description)) + warning_box.Append(box) + } + + for _, feature := range features { switch feature.Var { case "muc_passwordprotected": password_protected = true - box := gtk.NewBox(gtk.OrientationHorizontal, 0) - box.Append(gtk.NewImageFromPaintable(clientAssets["muc_passwordprotected"])) - box.Append(gtk.NewLabel("This MUC is password-protected")) - warning_box.Append(box) + addFeature("muc_passwordprotected", loadedLocale["muc_passwordprotected_description"]) case "muc_unsecured": - box := gtk.NewBox(gtk.OrientationHorizontal, 0) - box.Append(gtk.NewImageFromPaintable(clientAssets["muc_unsecured"])) - box.Append(gtk.NewLabel("This MUC does not require a password")) - warning_box.Append(box) + addFeature("muc_unsecured", loadedLocale["muc_unsecured_description"]) case "muc_membersonly": - box := gtk.NewBox(gtk.OrientationHorizontal, 0) - box.Append(gtk.NewImageFromPaintable(clientAssets["muc_membersonly"])) - box.Append(gtk.NewLabel("Only members can join this MUC")) - warning_box.Append(box) + addFeature("muc_membersonly", loadedLocale["muc_membersonly_description"]) case "muc_open": - box := gtk.NewBox(gtk.OrientationHorizontal, 0) - box.Append(gtk.NewImageFromPaintable(clientAssets["muc_open"])) - box.Append(gtk.NewLabel("Anyone can join this MUC")) - warning_box.Append(box) + addFeature("muc_open", loadedLocale["muc_open_description"]) case "muc_moderated": - box := gtk.NewBox(gtk.OrientationHorizontal, 0) - box.Append(gtk.NewImageFromPaintable(clientAssets["muc_moderated"])) - box.Append(gtk.NewLabel("Only members can speak in this MUC")) - warning_box.Append(box) + addFeature("muc_moderated", loadedLocale["muc_moderated_description"]) case "muc_unmoderated": - box := gtk.NewBox(gtk.OrientationHorizontal, 0) - box.Append(gtk.NewImageFromPaintable(clientAssets["muc_unmoderated"])) - box.Append(gtk.NewLabel("Anyone can speak in this MUC")) - warning_box.Append(box) + addFeature("muc_unmoderated", loadedLocale["muc_unmoderated_description"]) case "muc_nonanonymous": - box := gtk.NewBox(gtk.OrientationHorizontal, 0) - box.Append(gtk.NewImageFromPaintable(clientAssets["muc_nonanonymous"])) - box.Append(gtk.NewLabel("This MUC is non-anonymous, your JID will be visible to other users")) - warning_box.Append(box) + addFeature("muc_nonanonymous", loadedLocale["muc_nonanonymous_description"]) case "muc_semianonymous": - box := gtk.NewBox(gtk.OrientationHorizontal, 0) - box.Append(gtk.NewImageFromPaintable(clientAssets["muc_semianonymous"])) - box.Append(gtk.NewLabel("This MUC is semi-anonymous, only moderators will see your full JID")) - warning_box.Append(box) + addFeature("muc_semianonymous", loadedLocale["muc_semianonymous_description"]) case "muc_persistent": - box := gtk.NewBox(gtk.OrientationHorizontal, 0) - box.Append(gtk.NewImageFromPaintable(clientAssets["muc_persistent"])) - box.Append(gtk.NewLabel("This MUC is persistent, it will not be deleted when the last user leaves")) - warning_box.Append(box) + addFeature("muc_persistent", loadedLocale["muc_persistent_description"]) case "muc_temporary": - box := gtk.NewBox(gtk.OrientationHorizontal, 0) - box.Append(gtk.NewImageFromPaintable(clientAssets["muc_temporary"])) - box.Append(gtk.NewLabel("This MUC is temporary, it will be deleted when the last user leaves")) - warning_box.Append(box) + addFeature("muc_temporary", loadedLocale["muc_temporary_description"]) case "muc_public": - box := gtk.NewBox(gtk.OrientationHorizontal, 0) - box.Append(gtk.NewImageFromPaintable(clientAssets["muc_public"])) - box.Append(gtk.NewLabel("This MUC can be found in directories and search engines")) - warning_box.Append(box) + addFeature("muc_public", loadedLocale["muc_public_description"]) case "muc_hidden": - box := gtk.NewBox(gtk.OrientationHorizontal, 0) - box.Append(gtk.NewImageFromPaintable(clientAssets["muc_hidden"])) - box.Append(gtk.NewLabel("This MUC is hidden and cannot be found in directories or search engines")) - warning_box.Append(box) + addFeature("muc_hidden", loadedLocale["muc_hidden_description"]) + case "urn:xmpp:mam:0": + addFeature("ok", loadedLocale["urn:xmpp:mam_description"]) + case "urn:xmpp:message-moderate:0": + addFeature("moderate", loadedLocale["urn:xmpp:message-moderate_description"]) + /* + default: + addFeature("comment", feature.Var) + */ } } @@ -944,9 +925,9 @@ func activate(app *gtk.Application) { } else { allowed = false if result.Error != nil { - showErrorDialog(fmt.Errorf("Failed to get disco info: %s - %s", result.Error.Reason, result.Error.Text)) + showErrorDialog(fmt.Errorf("%s: %s - %s", loadedLocale["discoFail"], result.Error.Reason, result.Error.Text)) } else { - showErrorDialog(fmt.Errorf("Failed to get disco info")) + showErrorDialog(fmt.Errorf(loadedLocale["discoFail"])) } } } @@ -995,7 +976,7 @@ func activate(app *gtk.Application) { cBox := gtk.NewBox(gtk.OrientationHorizontal, 0) connectionIcon = gtk.NewImageFromPaintable((clientAssets["disconnect"])) connectionIcon.AddCSSClass("icon") - connectionStatus = gtk.NewLabel("Disconnected") + connectionStatus = gtk.NewLabel(loadedLocale["disconnected"]) cBox.Append(connectionIcon) cBox.Append(connectionStatus) @@ -1022,13 +1003,13 @@ func activate(app *gtk.Application) { statBar.Append(mBox) pBox := gtk.NewBox(gtk.OrientationHorizontal, 0) - pBox.SetTooltipText("Ping between you and your XMPP server\nRight-click to see graph") + pBox.SetTooltipText(loadedLocale["pingBarTooltip"]) gesture := gtk.NewGestureClick() gesture.SetButton(3) gesture.Connect("pressed", func() { opt := charts.NewLineChartOptionWithData(pingTimes) opt.Title = charts.TitleOption{ - Text: "Server latency", + Text: loadedLocale["pingGraphTitle"], } /* opt.XAxis.Labels = []string{ @@ -1037,7 +1018,7 @@ func activate(app *gtk.Application) { }*/ opt.Legend = charts.LegendOption{ SeriesNames: []string{ - "Ping (ms)", + loadedLocale["pingGraphYAxis"], }, } @@ -1064,7 +1045,7 @@ func activate(app *gtk.Application) { i := gtk.NewPictureForPaintable(gdk.NewTextureForPixbuf(loader.Pixbuf())) win := gtk.NewWindow() win.SetDefaultSize(600, 400) - win.SetTitle("Server latency") + win.SetTitle(loadedLocale["pingGraphTitle"]) box := gtk.NewBox(gtk.OrientationVertical, 0) box.Append(i) win.SetChild(box) @@ -1085,7 +1066,7 @@ func activate(app *gtk.Application) { sStatus = gtk.NewLabel("-") sBox.Append(sIcon) sBox.Append(sStatus) - sStatus.SetTooltipText("Throughput of your XMPP connection in KB/s") + sStatus.SetTooltipText(loadedLocale["throughputTooltip"]) statBar.Append(sBox) scrollerStatBar := gtk.NewScrolledWindow() @@ -1118,11 +1099,11 @@ func activate(app *gtk.Application) { entry_box := gtk.NewBox(gtk.OrientationHorizontal, 0) oob_en := gtk.NewEntry() - oob_en.SetPlaceholderText("Embed URL") + oob_en.SetPlaceholderText("URL") message_en = gtk.NewEntry() - message_en.SetPlaceholderText("Say something, what else are you gonna do here?") - b := gtk.NewButtonWithLabel("Send") + message_en.SetPlaceholderText(loadedLocale["messageEntryPlaceholder"]) + b := gtk.NewButtonWithLabel(loadedLocale["send"]) sendtxt := func() { t := message_en.Text()