changeset 38:44d47c366e5f

move a number of translatable string from code into Messages.properties 2010-11-09 Omair Majid <omajid@redhat.com> * netx/net/sourceforge/jnlp/resources/Messages.properties: Add ButAllow, ButClose, ButCopy, ButMoreInformation, ButProceed, ButRun, AlwaysAllowAction, Continue, Field, From, Name, Publisher, Value, Version, SNoAssociatedCertificate, SAlwaysTrustPublisher, SHttpsUnverified, SNotAllSignedSummary, SNotAllSignedDetail, SNotAllSignedQuestion, SCertificateDetails, SIssuer, SSerial, SMD5Fingerprint, SSHA1Fingerprint, SSignature, SSignatureAlgorithm, SSubject, SValidity, CVCertificateViewer, CVDetails, CVIssuedTo, CVExport, CVImport, CVIssuedBy, IssuedTo, CVRemove, CVRemoveConfirmMessage,CVRemoveConfirmTitle, CVUser, CVSystem, KS, KSCerts, KSJsseCerts, KSCaCerts, KSJsseCaCerts, and KSClientCerts. * netx/net/sourceforge/jnlp/security/AccessWarningPane.java (addComponents): Use localized strings. * netx/net/sourceforge/jnlp/security/CertWarningPane.java (addComponents): Likewise. * netx/net/sourceforge/jnlp/security/CertsInfoPane.java (parseCert): Likewise. (addComponents): Likewise. * netx/net/sourceforge/jnlp/security/MoreInfoPane.java (addComponents): Likewise. * netx/net/sourceforge/jnlp/security/NotAllSignedWarningPane.java (addComponents): Likewise. * netx/net/sourceforge/jnlp/security/viewer/CertificatePane.java: Likewise. (addComponents): Likewise. (CertificateType.toString): Likewise. (RemoveButtonListener.actionPerformed): Likewise.
author Omair Majid <omajid@redhat.com>
date Wed, 10 Nov 2010 16:24:53 -0500
parents 3cac6a3232e6
children e82455c47f08
files ChangeLog netx/net/sourceforge/jnlp/resources/Messages.properties netx/net/sourceforge/jnlp/security/AccessWarningPane.java netx/net/sourceforge/jnlp/security/CertWarningPane.java netx/net/sourceforge/jnlp/security/CertsInfoPane.java netx/net/sourceforge/jnlp/security/KeyStores.java netx/net/sourceforge/jnlp/security/MoreInfoPane.java netx/net/sourceforge/jnlp/security/NotAllSignedWarningPane.java netx/net/sourceforge/jnlp/security/viewer/CertificatePane.java netx/net/sourceforge/jnlp/security/viewer/CertificateViewer.java
diffstat 10 files changed, 139 insertions(+), 52 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Wed Nov 10 16:20:51 2010 -0500
+++ b/ChangeLog	Wed Nov 10 16:24:53 2010 -0500
@@ -1,3 +1,34 @@
+2010-11-09  Omair Majid  <omajid@redhat.com>
+
+	* netx/net/sourceforge/jnlp/resources/Messages.properties: Add
+	ButAllow, ButClose, ButCopy, ButMoreInformation, ButProceed,
+	ButRun, AlwaysAllowAction, Continue, Field, From, Name, Publisher,
+	Value, Version, SNoAssociatedCertificate, SAlwaysTrustPublisher,
+	SHttpsUnverified, SNotAllSignedSummary, SNotAllSignedDetail,
+	SNotAllSignedQuestion, SCertificateDetails, SIssuer, SSerial,
+	SMD5Fingerprint, SSHA1Fingerprint, SSignature, SSignatureAlgorithm,
+	SSubject, SValidity, CVCertificateViewer, CVDetails, CVIssuedTo,
+	CVExport, CVImport, CVIssuedBy, IssuedTo, CVRemove,
+	CVRemoveConfirmMessage,CVRemoveConfirmTitle, CVUser, CVSystem,
+	KS, KSCerts, KSJsseCerts, KSCaCerts, KSJsseCaCerts, and
+	KSClientCerts.
+	* netx/net/sourceforge/jnlp/security/AccessWarningPane.java
+	(addComponents): Use localized strings.
+	* netx/net/sourceforge/jnlp/security/CertWarningPane.java
+	(addComponents): Likewise.
+	* netx/net/sourceforge/jnlp/security/CertsInfoPane.java
+	(parseCert): Likewise.
+	(addComponents): Likewise.
+	* netx/net/sourceforge/jnlp/security/MoreInfoPane.java
+	(addComponents): Likewise.
+	* netx/net/sourceforge/jnlp/security/NotAllSignedWarningPane.java
+	(addComponents): Likewise.
+	* netx/net/sourceforge/jnlp/security/viewer/CertificatePane.java:
+	Likewise.
+	(addComponents): Likewise.
+	(CertificateType.toString): Likewise.
+	(RemoveButtonListener.actionPerformed): Likewise. 
+
 2010-11-05  Omair Majid  <omajid@redhat.com>
 
 	* netx/net/sourceforge/jnlp/runtime/DeploymentConfiguration.java:
--- a/netx/net/sourceforge/jnlp/resources/Messages.properties	Wed Nov 10 16:20:51 2010 -0500
+++ b/netx/net/sourceforge/jnlp/resources/Messages.properties	Wed Nov 10 16:24:53 2010 -0500
@@ -3,10 +3,25 @@
 #
 # General
 NullParameter=Null parameter
-ButOk=OK
+ButAllow=Allow
+ButBrowse=Browse...
 ButCancel=\ Cancel\ 
-ButBrowse=Browse...
+ButClose=Close
+ButCopy=Copy to Clipboard
+ButMoreInformation=More Information...
+ButOk=OK
+ButProceed=Proceed
+ButRun=Run
 AFileOnTheMachine=a file on the machine
+AlwaysAllowAction=Always allow this action
+
+Continue=Do you want to continue?
+Field=Field
+From=From
+Name=Name
+Publisher=Publisher
+Value=Value
+Version=Version
 
 # LS - Severity
 LSMinor=Minor
@@ -166,6 +181,12 @@
 SClipboardWriteAccess=The application has requested write-only access to the system clipboard. Do you want to allow this action?
 SPrinterAccess=The application has requested printer access. Do you want to allow this action?
 SNetworkAccess=The application has requested permission to establish connections to {0}. Do you want to allow this action?
+SNoAssociatedCertificate=<no associated certificate>
+SAlwaysTrustPublisher=Always trust content from this publisher
+SHttpsUnverified=The website's certificate cannot be verified.
+SNotAllSignedSummary=Only parts of this application code are signed.
+SNotAllSignedDetail=This application contains both signed and unsigned code. While signed code is safe if you trust the provider, unsigned code may imply code outside of the trusted provider's control.
+SNotAllSignedQuestion=Do you wish to proceed and run this application anyway?
 
 # Security - used for the More Information dialog
 SBadKeyUsage=Resources contain entries whose signer certificate's KeyUsage extension doesn't allow code signing.
@@ -179,5 +200,35 @@
 STrustedCertificate=The digital signature was generated with a trusted certificate.
 SCNMisMatch=The expected hostname for this certificate is: "{0}"<BR>The address being connected to is: "{1}"
 SRunWithoutRestrictions=This application will be run without the security restrictions normally provided by java.
+SCertificateDetails=Certificate Details
 
+# Security - certificate information
+SIssuer=Issuer
+SSerial=Serial
+SMD5Fingerprint=MD5 Fingerprint
+SSHA1Fingerprint=SHA1 Fingerprint
+SSignature=Signature
+SSignatureAlgorithm=Signature Algorithm
+SSubject=Subject
+SValidity=Validity
 
+# Certificate Viewer
+CVCertificateViewer=Certificates
+CVDetails=Details
+CVExport=Export
+CVImport=Import
+CVIssuedBy=Issued By
+CVIssuedTo=Issued To
+CVRemove=Remove
+CVRemoveConfirmMessage=Are you sure you want to remove the selected certificate?
+CVRemoveConfirmTitle=Confirmation - Remove Certificate?
+CVUser=User
+CVSystem=System
+
+#KeyStores: see KeyStores.java
+KS=KeyStore
+KSCerts=Trusted Certificates
+KSJsseCerts=Trusted JSSE Certificates
+KSCaCerts=Trusted Root CA Certificates
+KSJsseCaCerts=Trusted JSSE Root CA Certificates,
+KSClientCerts=Client Authentication Certificates
\ No newline at end of file
--- a/netx/net/sourceforge/jnlp/security/AccessWarningPane.java	Wed Nov 10 16:20:51 2010 -0500
+++ b/netx/net/sourceforge/jnlp/security/AccessWarningPane.java	Wed Nov 10 16:24:53 2010 -0500
@@ -99,12 +99,12 @@
                 //We don't worry about exceptions when trying to fill in
                 //these strings -- we just want to fill in as many as possible.
                 try {
-                        name = file.getInformation().getTitle() != null ? file.getInformation().getTitle() : "<no associated certificate>";
+                        name = file.getInformation().getTitle() != null ? file.getInformation().getTitle() : R("SNoAssociatedCertificate");
                 } catch (Exception e) {
                 }
 
                 try {
-                        publisher = file.getInformation().getVendor() != null ? file.getInformation().getVendor() : "<no associated certificate>";
+                        publisher = file.getInformation().getVendor() != null ? file.getInformation().getVendor() : R("SNoAssociatedCertificate");
                 } catch (Exception e) {
                 }
 
@@ -161,14 +161,14 @@
                 topPanel.setBorder(BorderFactory.createEmptyBorder(10,10,10,10));
 
                 //application info
-                JLabel nameLabel = new JLabel("Name:   " + name);
+                JLabel nameLabel = new JLabel(R("Name") + ":   " + name);
                 nameLabel.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
-                JLabel publisherLabel = new JLabel("Publisher: " + publisher);
+                JLabel publisherLabel = new JLabel(R("Publisher") + ": " + publisher);
                 publisherLabel.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
-                JLabel fromLabel = new JLabel("From:   " + from);
+                JLabel fromLabel = new JLabel(R("From") + ":   " + from);
                 fromLabel.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
 
-                alwaysAllow = new JCheckBox("Always allow this action");
+                alwaysAllow = new JCheckBox(R("AlwaysAllowAction"));
                 alwaysAllow.setEnabled(false);
 
                 JPanel infoPanel = new JPanel(new GridLayout(4,1));
@@ -181,8 +181,8 @@
                 //run and cancel buttons
                 JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
 
-                JButton run = new JButton("Allow");
-                JButton cancel = new JButton("Cancel");
+                JButton run = new JButton(R("ButAllow"));
+                JButton cancel = new JButton(R("ButCancel"));
                 run.addActionListener(createSetValueListener(parent,0));
                 run.addActionListener(new CheckBoxListener());
                 cancel.addActionListener(createSetValueListener(parent, 1));
--- a/netx/net/sourceforge/jnlp/security/CertWarningPane.java	Wed Nov 10 16:20:51 2010 -0500
+++ b/netx/net/sourceforge/jnlp/security/CertWarningPane.java	Wed Nov 10 16:24:53 2010 -0500
@@ -131,8 +131,8 @@
                 String propertyName = "";
                 if (certVerifier instanceof HttpsCertVerifier)
                 {
-                  topLabelText = "The website's certificate cannot be verified. " +
-                                 "Do you want to continue?";
+                  topLabelText = R("SHttpsUnverified") + " " +
+                                 R("Continue");
                   propertyName = "OptionPane.warningIcon";
                 }
                 else
@@ -162,15 +162,14 @@
                 topPanel.setBorder(BorderFactory.createEmptyBorder(10,10,10,10));
 
                 //application info
-                JLabel nameLabel = new JLabel("Name:   " + name);
+                JLabel nameLabel = new JLabel(R("Name") + ":   " + name);
                 nameLabel.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
-                JLabel publisherLabel = new JLabel("Publisher: " + publisher);
+                JLabel publisherLabel = new JLabel(R("Publisher") + ": " + publisher);
                 publisherLabel.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
-                JLabel fromLabel = new JLabel("From:   " + from);
+                JLabel fromLabel = new JLabel(R("From") + ":   " + from);
                 fromLabel.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
 
-                alwaysTrust = new JCheckBox(
-                "Always trust content from this publisher");
+                alwaysTrust = new JCheckBox(R("SAlwaysTrustPublisher"));
                 alwaysTrust.setEnabled(true);
 
                 JPanel infoPanel = new JPanel(new GridLayout(4,1));
@@ -185,8 +184,8 @@
 
                 //run and cancel buttons
                 JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
-                JButton run = new JButton("Run");
-                JButton cancel = new JButton("Cancel");
+                JButton run = new JButton(R("ButRun"));
+                JButton cancel = new JButton(R("ButCancel"));
                 int buttonWidth = Math.max(run.getMinimumSize().width,
                         cancel.getMinimumSize().width);
                 int buttonHeight = run.getMinimumSize().height;
@@ -208,7 +207,7 @@
                 add(buttonPanel);
 
                 JLabel bottomLabel;
-                JButton moreInfo = new JButton("More information...");
+                JButton moreInfo = new JButton(R("ButMoreInformation"));
                 moreInfo.addActionListener(new MoreInfoButtonListener());
 
                 if (parent.getJarSigner().getRootInCacerts())
--- a/netx/net/sourceforge/jnlp/security/CertsInfoPane.java	Wed Nov 10 16:20:51 2010 -0500
+++ b/netx/net/sourceforge/jnlp/security/CertsInfoPane.java	Wed Nov 10 16:24:53 2010 -0500
@@ -37,6 +37,8 @@
 
 package net.sourceforge.jnlp.security;
 
+import static net.sourceforge.jnlp.runtime.Translator.R;
+
 import java.util.ArrayList;
 import java.util.Date;
 import java.security.cert.CertPath;
@@ -73,7 +75,7 @@
     private ListSelectionModel listSelectionModel;
     private ListSelectionModel tableSelectionModel;
     protected String[] certNames;
-    private String[] columnNames = { "Field", "Value" };
+    private String[] columnNames = { R("Field"), R("Value") };
         protected ArrayList<String[][]> certsData;
 
         public CertsInfoPane(SecurityWarningDialog x, CertVerifier certVerifier) {
@@ -163,15 +165,15 @@
                         //fail quietly
                 }
 
-        String[][] cert = { {"Version", version},
-                            {"Serial", serialNumber},
-                            {"Signature Algorithm", signatureAlg},
-                            {"Issuer", issuer},
-                            {"Validity", validity},
-                            {"Subject", subject},
-                            {"Signature", signature},
-                                                        {"MD5 Fingerprint", md5Hash},
-                                                        {"SHA1 Fingerprint", sha1Hash}
+        String[][] cert = { {R("Version"), version},
+                            {R("SSerial"), serialNumber},
+                            {R("SSignatureAlgorithm"), signatureAlg},
+                            {R("SIssuer"), issuer},
+                            {R("SValidity"), validity},
+                            {R("SSubject"), subject},
+                            {R("SSignature"), signature},
+                                                        {R("SMD5Fingerprint"), md5Hash},
+                                                        {R("SSHA1Fingerprint"), sha1Hash}
                                                         };
         return cert;
         }
@@ -223,8 +225,8 @@
                 mainPane.setResizeWeight(0.30);
 
                 JPanel buttonPane = new JPanel(new BorderLayout());
-                JButton close = new JButton("Close");
-                JButton copyToClipboard = new JButton("Copy to Clipboard");
+                JButton close = new JButton(R("ButClose"));
+                JButton copyToClipboard = new JButton(R("ButCopy"));
                 close.addActionListener(createSetValueListener(parent, 0));
                 copyToClipboard.addActionListener(new CopyToClipboardHandler());
                 buttonPane.add(close, BorderLayout.EAST);
--- a/netx/net/sourceforge/jnlp/security/KeyStores.java	Wed Nov 10 16:20:51 2010 -0500
+++ b/netx/net/sourceforge/jnlp/security/KeyStores.java	Wed Nov 10 16:24:53 2010 -0500
@@ -257,6 +257,8 @@
     public static final String toTranslatableString(Level level, Type type) {
         StringBuilder response = new StringBuilder();
 
+        response.append("KS");
+
         if (level != null) {
             String levelString = level.toString();
             response.append(levelString.substring(0, 1).toUpperCase());
--- a/netx/net/sourceforge/jnlp/security/MoreInfoPane.java	Wed Nov 10 16:20:51 2010 -0500
+++ b/netx/net/sourceforge/jnlp/security/MoreInfoPane.java	Wed Nov 10 16:24:53 2010 -0500
@@ -90,9 +90,9 @@
                 }
 
                 JPanel buttonsPanel = new JPanel(new BorderLayout());
-                JButton certDetails = new JButton("Certificate Details");
+                JButton certDetails = new JButton(R("SCertificateDetails"));
                 certDetails.addActionListener(new CertInfoButtonListener());
-                JButton close = new JButton("Close");
+                JButton close = new JButton(R("ButClose"));
                 close.addActionListener(createSetValueListener(parent, 0));
         buttonsPanel.add(certDetails, BorderLayout.WEST);
         buttonsPanel.add(close, BorderLayout.EAST);
--- a/netx/net/sourceforge/jnlp/security/NotAllSignedWarningPane.java	Wed Nov 10 16:20:51 2010 -0500
+++ b/netx/net/sourceforge/jnlp/security/NotAllSignedWarningPane.java	Wed Nov 10 16:24:53 2010 -0500
@@ -37,6 +37,8 @@
 
 package net.sourceforge.jnlp.security;
 
+import static net.sourceforge.jnlp.runtime.Translator.R;
+
 import java.awt.BorderLayout;
 import java.awt.Color;
 import java.awt.Dimension;
@@ -67,13 +69,9 @@
         private void addComponents() {
                 JNLPFile file = parent.getFile();
 
-                String topLabelText = "Only parts of this application code are signed.";
-                String infoLabelText = "This application contains both signed and" +
-                " unsigned code. While signed code is safe if you trust the " +
-                "provider, unsigned code may imply code outside of the trusted " +
-                "provider's control.";
-                String questionLabelText = "Do you wish to proceed and run this " +
-                "application anyway?";
+                String topLabelText = R("SNotAllSignedSummary");
+                String infoLabelText = R("SNotAllSignedDetail");
+                String questionLabelText = R("SNotAllSignedQuestion");
 
                 ImageIcon icon = new ImageIcon((new sun.misc.Launcher()).getClassLoader().getResource("net/sourceforge/jnlp/resources/warning.png"));
                 JLabel topLabel = new JLabel(htmlWrap(topLabelText), icon, SwingConstants.LEFT);
@@ -100,8 +98,8 @@
                 //run and cancel buttons
                 JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
 
-                JButton run = new JButton("Proceed");
-                JButton cancel = new JButton("Cancel");
+                JButton run = new JButton(R("ButProceed"));
+                JButton cancel = new JButton(R("ButCancel"));
                 run.addActionListener(createSetValueListener(parent,0));
                 cancel.addActionListener(createSetValueListener(parent, 1));
                 initialFocusComponent = cancel;
--- a/netx/net/sourceforge/jnlp/security/viewer/CertificatePane.java	Wed Nov 10 16:20:51 2010 -0500
+++ b/netx/net/sourceforge/jnlp/security/viewer/CertificatePane.java	Wed Nov 10 16:24:53 2010 -0500
@@ -37,6 +37,8 @@
 
 package net.sourceforge.jnlp.security.viewer;
 
+import static net.sourceforge.jnlp.runtime.Translator.R;
+
 import java.awt.BorderLayout;
 import java.awt.Dimension;
 import java.awt.FlowLayout;
@@ -88,7 +90,7 @@
          * "Issued To" and "Issued By" string pairs for certs.
          */
         private String[][] issuedToAndBy = null;
-        private final String[] columnNames = { "Issued To", "Issued By" };
+        private final String[] columnNames = { R("CVIssuedTo"), R("CVIssuedBy") };
 
         private final CertificateType[] certificateTypes = new CertificateType[] {
             new CertificateType(KeyStores.Type.CA_CERTS),
@@ -187,13 +189,13 @@
                 systemTablePane.setBorder(BorderFactory.createEmptyBorder(10,10,10,10));
 
                 tabbedPane = new JTabbedPane();
-                tabbedPane.addTab("User", userTablePane);
-                tabbedPane.addTab("System", systemTablePane);
+                tabbedPane.addTab(R("CVUser"), userTablePane);
+                tabbedPane.addTab(R("CVSystem"), systemTablePane);
                 tabbedPane.addChangeListener(new TabChangeListener());
 
                 JPanel buttonPanel = new JPanel(new FlowLayout());
 
-                String[] buttonNames = {"Import", "Export", "Remove", "Details"};
+                String[] buttonNames = {R("CVImport"), R("CVExport"), R("CVRemove"), R("CVDetails")};
                 char[] buttonMnemonics = {      KeyEvent.VK_I,
                                                                         KeyEvent.VK_E,
                                                                         KeyEvent.VK_M,
@@ -228,7 +230,7 @@
 
                 JPanel closePanel = new JPanel(new BorderLayout());
                 closePanel.setBorder(BorderFactory.createEmptyBorder(7,7,7,7));
-                JButton closeButton = new JButton("Close");
+                JButton closeButton = new JButton(R("ButClose"));
                 closeButton.addActionListener(new CloseButtonListener());
                 defaultFocusComponent = closeButton;
                 closePanel.add(closeButton, BorderLayout.EAST);
@@ -308,7 +310,7 @@
         }
 
         public String toString() {
-            return KeyStores.toTranslatableString(null, type);
+            return KeyStores.toDisplayableString(null, type);
         }
     }
 
@@ -430,8 +432,8 @@
                                 if (alias != null) {
 
                                         int i = JOptionPane.showConfirmDialog(parent,
-                                                        "Are you sure you want to remove the selected certificate?",
-                                                        "Confirmation - Remove Certificate?",
+                                                        R("CVRemoveConfirmMessage"),
+                                                        R("CVRemoveConfirmTitle"),
                                                         JOptionPane.YES_NO_OPTION);
                                         if (i == 0) {
                                                 keyStore.deleteEntry(alias);
--- a/netx/net/sourceforge/jnlp/security/viewer/CertificateViewer.java	Wed Nov 10 16:20:51 2010 -0500
+++ b/netx/net/sourceforge/jnlp/security/viewer/CertificateViewer.java	Wed Nov 10 16:24:53 2010 -0500
@@ -37,6 +37,8 @@
 
 package net.sourceforge.jnlp.security.viewer;
 
+import static net.sourceforge.jnlp.runtime.Translator.R;
+
 import java.awt.BorderLayout;
 import java.awt.Container;
 import java.awt.Dimension;
@@ -53,7 +55,7 @@
 public class CertificateViewer extends JDialog {
 
     private boolean initialized = false;
-    private static final String dialogTitle = "Certificates";
+    private static final String dialogTitle = R("CVCertificateViewer");
 
     CertificatePane panel;