externalize strings in chat server tab

pull/53/head
Zlatin Balevsky 2020-09-29 14:34:15 +01:00
parent 6e98d96bc1
commit 7f9ebe0850
No known key found for this signature in database
GPG Key ID: A72832072D525E41
4 changed files with 16 additions and 9 deletions

View File

@ -16,14 +16,14 @@ class ChatServerController {
@ControllerAction
void disconnect() {
switch(model.buttonText) {
case "Disconnect" :
model.buttonText = "Connect"
case "DISCONNECT" :
model.buttonText = "CONNECT"
mvcGroup.getChildrenGroups().each { k,v ->
v.controller.serverDisconnected()
}
model.core.eventBus.publish(new UIDisconnectChatEvent(host : model.host))
break
case "Connect" :
case "CONNECT" :
model.connect()
break
}

View File

@ -443,3 +443,9 @@ QUERY=Query
GENERATING_PREVIEW=Generating Preview
GENERATING_PREVIEW_FOR=Generating preview for {0}
PREVIEW_SEQUENTIAL_NOTICE=This download is not sequential, there may not be much to preview
## Chat server tab
CONNECT=Connect
DISCONNECT=Disconnect
LOCAL_SERVER=Local Server
CONNECTION_STATUS=Connection Status

View File

@ -30,7 +30,7 @@ class ChatServerModel {
Core core
@Observable boolean disconnectActionEnabled
@Observable String buttonText = "Disconnect"
@Observable String buttonText = "DISCONNECT"
@Observable ChatConnectionAttemptStatus status
@Observable boolean sayActionEnabled
@ -47,7 +47,7 @@ class ChatServerModel {
void connect() {
runInsideUIAsync {
buttonText = "Disconnect"
buttonText = "DISCONNECT"
}
core.eventBus.publish(new UIConnectChatEvent(host : host))
}

View File

@ -1,6 +1,7 @@
package com.muwire.gui
import griffon.core.artifact.GriffonView
import static com.muwire.gui.Translator.trans
import griffon.inject.MVCMember
import griffon.metadata.ArtifactProviderFor
import javax.swing.SwingConstants
@ -34,10 +35,10 @@ class ChatServerView {
gridLayout(rows : 1, cols : 3)
panel {}
panel {
button(text : bind {model.buttonText}, enabled : bind {model.disconnectActionEnabled}, disconnectAction)
button(text : bind {trans(model.buttonText)}, enabled : bind {model.disconnectActionEnabled}, disconnectAction)
}
panel {
label(text : "Connection Status ")
label(text : trans("CONNECTION_STATUS") + " ")
label(text : bind {model.status.toString()})
}
}
@ -59,7 +60,7 @@ class ChatServerView {
tabPanel = panel {
borderLayout()
panel (constraints : BorderLayout.CENTER) {
String text = model.host == model.core.me ? "Local Server" : model.host.getHumanReadableName()
String text = model.host == model.core.me ? trans("LOCAL_SERVER") : model.host.getHumanReadableName()
label(text : text)
}
button(icon : imageIcon("/close_tab.png"), preferredSize: [20, 20], constraints : BorderLayout.EAST,
@ -83,7 +84,7 @@ class ChatServerView {
if (model.host == model.core.me) {
mvcGroup.parentGroup.controller.stopChatServer()
}
else if (model.buttonText == "Disconnect")
else if (model.buttonText == "DISCONNECT")
controller.disconnect()
int index = parent.indexOfComponent(pane)
parent.removeTabAt(index)