From fd0e79eb4e7125235a281d057f750ea18aa23938 Mon Sep 17 00:00:00 2001 From: Zlatin Balevsky Date: Tue, 29 Sep 2020 16:23:59 +0100 Subject: [PATCH] externalize enum names --- gui/griffon-app/i18n/messages.properties | 15 +++++++++++++++ .../views/com/muwire/gui/BrowseView.groovy | 2 +- .../views/com/muwire/gui/ChatServerView.groovy | 2 +- .../com/muwire/gui/FetchCertificatesView.groovy | 2 +- .../views/com/muwire/gui/MainFrameView.groovy | 4 ++-- 5 files changed, 20 insertions(+), 5 deletions(-) diff --git a/gui/griffon-app/i18n/messages.properties b/gui/griffon-app/i18n/messages.properties index 94fbeaa6..0992ded0 100644 --- a/gui/griffon-app/i18n/messages.properties +++ b/gui/griffon-app/i18n/messages.properties @@ -485,3 +485,18 @@ SIGN_TEXT=Sign Text ENTER_TEXT_TO_SIGN=Enter text to be signed SIGN=Sign COPY_TO_CLIPBOARD=Copy To Clipboard + +## Enums +CONNECTING=Connecting +HASHLIST=Hash List +FAILED=Failed +HOPELESS=Hopeless +CANCELLED=Cancelled +PAUSED=Paused +FINISHED=Finished +FETCHING=Fetching +DONE=Done +SUCCESSFUL=Successful +REJECTED=Rejected +DISCONNECTED=Disconnected +IDLE=Idle diff --git a/gui/griffon-app/views/com/muwire/gui/BrowseView.groovy b/gui/griffon-app/views/com/muwire/gui/BrowseView.groovy index f237a1ba..2169d449 100644 --- a/gui/griffon-app/views/com/muwire/gui/BrowseView.groovy +++ b/gui/griffon-app/views/com/muwire/gui/BrowseView.groovy @@ -52,7 +52,7 @@ class BrowseView { borderLayout() panel (constraints : BorderLayout.NORTH) { label(text: trans("STATUS") + ":") - label(text: bind {model.status.toString()}) + label(text: bind {trans(model.status.name())}) label(text : bind {model.totalResults == 0 ? "" : Math.round(model.resultCount * 100 / model.totalResults)+ "%"}) } scrollPane (constraints : BorderLayout.CENTER){ diff --git a/gui/griffon-app/views/com/muwire/gui/ChatServerView.groovy b/gui/griffon-app/views/com/muwire/gui/ChatServerView.groovy index 46eaf5ad..f743f7d6 100644 --- a/gui/griffon-app/views/com/muwire/gui/ChatServerView.groovy +++ b/gui/griffon-app/views/com/muwire/gui/ChatServerView.groovy @@ -39,7 +39,7 @@ class ChatServerView { } panel { label(text : trans("CONNECTION_STATUS") + " ") - label(text : bind {model.status.toString()}) + label(text : bind {trans(model.status.name())}) } } } diff --git a/gui/griffon-app/views/com/muwire/gui/FetchCertificatesView.groovy b/gui/griffon-app/views/com/muwire/gui/FetchCertificatesView.groovy index 0b46bad5..51619741 100644 --- a/gui/griffon-app/views/com/muwire/gui/FetchCertificatesView.groovy +++ b/gui/griffon-app/views/com/muwire/gui/FetchCertificatesView.groovy @@ -46,7 +46,7 @@ class FetchCertificatesView { borderLayout() panel(constraints : BorderLayout.NORTH) { label(text : trans("STATUS") + ":") - label(text : bind {model.status.toString()}) + label(text : bind {trans(model.status.name())}) label(text : bind {model.certificateCount == 0 ? "" : Math.round(model.certificateCount * 100 / model.totalCertificates)+"%"}) } scrollPane(constraints : BorderLayout.CENTER) { diff --git a/gui/griffon-app/views/com/muwire/gui/MainFrameView.groovy b/gui/griffon-app/views/com/muwire/gui/MainFrameView.groovy index df8114d2..0db05d20 100644 --- a/gui/griffon-app/views/com/muwire/gui/MainFrameView.groovy +++ b/gui/griffon-app/views/com/muwire/gui/MainFrameView.groovy @@ -219,7 +219,7 @@ class MainFrameView { downloadsTable = table(id : "downloads-table", autoCreateRowSorter : true, rowHeight : rowHeight) { tableModel(list: model.downloads) { closureColumn(header: trans("NAME"), preferredWidth: 300, type: String, read : {row -> row.downloader.file.getName()}) - closureColumn(header: trans("STATUS"), preferredWidth: 50, type: String, read : {row -> row.downloader.getCurrentState().toString()}) + closureColumn(header: trans("STATUS"), preferredWidth: 50, type: String, read : {row -> trans(row.downloader.getCurrentState().name())}) closureColumn(header: trans("PROGRESS"), preferredWidth: 70, type: Downloader, read: { row -> row.downloader }) closureColumn(header: trans("SPEED"), preferredWidth: 50, type:String, read :{row -> DataHelper.formatSize2Decimal(row.downloader.speed(), false) + trans("B_SEC") @@ -462,7 +462,7 @@ class MainFrameView { closureColumn(header : trans("PUBLISHER"), preferredWidth: 350, type : String, read : {it.getPublisher().getHumanReadableName()}) closureColumn(header : trans("FILES"), preferredWidth: 10, type : Integer, read : {model.core.feedManager.getFeedItems(it.getPublisher()).size()}) closureColumn(header : trans("LAST_UPDATED"), type : Long, read : {it.getLastUpdated()}) - closureColumn(header : trans("STATUS"), preferredWidth: 10, type : String, read : {it.getStatus().toString()}) + closureColumn(header : trans("STATUS"), preferredWidth: 10, type : String, read : {trans(it.getStatus().name())}) } } }