externalize strings in Browse dialog

pull/53/head
Zlatin Balevsky 2020-09-29 13:24:14 +01:00
parent 9b0dbd0ea9
commit f07f245e59
No known key found for this signature in database
GPG Key ID: A72832072D525E41
2 changed files with 20 additions and 16 deletions

View File

@ -390,3 +390,6 @@ DISMISS=Dismiss
## Add comment frame ## Add comment frame
ADD_COMMENT_MULTIPLE=Add comment to multiple files ADD_COMMENT_MULTIPLE=Add comment to multiple files
ADD_COMMENT_SINGLE=Add comment to {0} ADD_COMMENT_SINGLE=Add comment to {0}
## Browse dialog

View File

@ -1,6 +1,7 @@
package com.muwire.gui package com.muwire.gui
import griffon.core.artifact.GriffonView import griffon.core.artifact.GriffonView
import static com.muwire.gui.Translator.trans
import griffon.inject.MVCMember import griffon.inject.MVCMember
import griffon.metadata.ArtifactProviderFor import griffon.metadata.ArtifactProviderFor
import net.i2p.data.Base64 import net.i2p.data.Base64
@ -50,27 +51,27 @@ class BrowseView {
p = builder.panel { p = builder.panel {
borderLayout() borderLayout()
panel (constraints : BorderLayout.NORTH) { panel (constraints : BorderLayout.NORTH) {
label(text: "Status:") label(text: trans("STATUS") + ":")
label(text: bind {model.status.toString()}) label(text: bind {model.status.toString()})
label(text : bind {model.totalResults == 0 ? "" : Math.round(model.resultCount * 100 / model.totalResults)+ "%"}) label(text : bind {model.totalResults == 0 ? "" : Math.round(model.resultCount * 100 / model.totalResults)+ "%"})
} }
scrollPane (constraints : BorderLayout.CENTER){ scrollPane (constraints : BorderLayout.CENTER){
resultsTable = table(autoCreateRowSorter : true, rowHeight : rowHeight) { resultsTable = table(autoCreateRowSorter : true, rowHeight : rowHeight) {
tableModel(list : model.results) { tableModel(list : model.results) {
closureColumn(header: "Name", preferredWidth: 350, type: String, read : {row -> row.name.replace('<','_')}) closureColumn(header: trans("NAME"), preferredWidth: 350, type: String, read : {row -> row.name.replace('<','_')})
closureColumn(header: "Size", preferredWidth: 20, type: Long, read : {row -> row.size}) closureColumn(header: trans("SIZE"), preferredWidth: 20, type: Long, read : {row -> row.size})
closureColumn(header: "Comments", preferredWidth: 20, type: Boolean, read : {row -> row.comment != null}) closureColumn(header: trans("COMMENTS"), preferredWidth: 20, type: Boolean, read : {row -> row.comment != null})
closureColumn(header: "Certificates", preferredWidth: 20, type: Integer, read : {row -> row.certificates}) closureColumn(header: trans("CERTIFICATES"), preferredWidth: 20, type: Integer, read : {row -> row.certificates})
} }
} }
} }
panel (constraints : BorderLayout.SOUTH) { panel (constraints : BorderLayout.SOUTH) {
button(text : "Download", enabled : bind {model.downloadActionEnabled}, downloadAction) button(text : trans("DOWNLOAD"), enabled : bind {model.downloadActionEnabled}, downloadAction)
button(text : "View Comment", enabled : bind{model.viewCommentActionEnabled}, viewCommentAction) button(text : trans("VIEW_COMMENT"), enabled : bind{model.viewCommentActionEnabled}, viewCommentAction)
button(text : "View Certificates", enabled : bind{model.viewCertificatesActionEnabled}, viewCertificatesAction) button(text : trans("VIEW_CERTIFICATES"), enabled : bind{model.viewCertificatesActionEnabled}, viewCertificatesAction)
button(text : "Chat", enabled : bind {model.chatActionEnabled}, chatAction) button(text : trans("CHAT"), enabled : bind {model.chatActionEnabled}, chatAction)
button(text : "Dismiss", dismissAction) button(text : trans("DISMISS"), dismissAction)
label(text : "Download sequentially") label(text : trans("DOWNLOAD_SEQUENTIALLY"))
sequentialDownloadCheckbox = checkBox() sequentialDownloadCheckbox = checkBox()
} }
} }
@ -133,22 +134,22 @@ class BrowseView {
private void showMenu(MouseEvent e) { private void showMenu(MouseEvent e) {
JPopupMenu menu = new JPopupMenu() JPopupMenu menu = new JPopupMenu()
if (model.downloadActionEnabled) { if (model.downloadActionEnabled) {
JMenuItem download = new JMenuItem("Download") JMenuItem download = new JMenuItem(trans("DOWNLOAD"))
download.addActionListener({controller.download()}) download.addActionListener({controller.download()})
menu.add(download) menu.add(download)
} }
if (model.viewCommentActionEnabled) { if (model.viewCommentActionEnabled) {
JMenuItem viewComment = new JMenuItem("View Comment") JMenuItem viewComment = new JMenuItem(trans("VIEW_COMMENT"))
viewComment.addActionListener({controller.viewComment()}) viewComment.addActionListener({controller.viewComment()})
menu.add(viewComment) menu.add(viewComment)
} }
if (model.viewCertificatesActionEnabled) { if (model.viewCertificatesActionEnabled) {
JMenuItem viewCertificates = new JMenuItem("View Certificates") JMenuItem viewCertificates = new JMenuItem(trans("VIEW_CERTIFICATES"))
viewCertificates.addActionListener({controller.viewCertificates()}) viewCertificates.addActionListener({controller.viewCertificates()})
menu.add(viewCertificates) menu.add(viewCertificates)
} }
JMenuItem copyHash = new JMenuItem("Copy Hash To Clipboard") JMenuItem copyHash = new JMenuItem(trans("COPY_HASH_TO_CLIPBOARD"))
copyHash.addActionListener({ copyHash.addActionListener({
List<UIResultEvent> results = selectedResults() List<UIResultEvent> results = selectedResults()
def hash = "" def hash = ""
@ -162,7 +163,7 @@ class BrowseView {
}) })
menu.add(copyHash) menu.add(copyHash)
JMenuItem copyName = new JMenuItem("Copy Name To Clipboard") JMenuItem copyName = new JMenuItem(trans("COPY_NAME_TO_CLIPBOARD"))
copyName.addActionListener({ copyName.addActionListener({
List<UIResultEvent> results = selectedResults() List<UIResultEvent> results = selectedResults()
def name = "" def name = ""