Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSasa Zivkov2010-05-19 14:59:28 +0000
committerShawn O. Pearce2010-05-19 21:37:16 +0000
commitf3d8a8ecad614906a2c4ec0077cdb24129da6c6d (patch)
tree34d041692beff0f392c27869f49b76c0fc2053e6 /org.eclipse.jgit.ui
parent2e961989e42b1fe7e8bd9eaa7a3d2e88a0d1d001 (diff)
downloadjgit-f3d8a8ecad614906a2c4ec0077cdb24129da6c6d.tar.gz
jgit-f3d8a8ecad614906a2c4ec0077cdb24129da6c6d.tar.xz
jgit-f3d8a8ecad614906a2c4ec0077cdb24129da6c6d.zip
Externalize strings from JGit
The strings are externalized into the root resource bundles. The resource bundles are stored under the new "resources" source folder to get proper maven build. Strings from tests are, in general, not externalized. Only in cases where it was necessary to make the test pass the strings were externalized. This was typically necessary in cases where e.getMessage() was used in assert and the exception message was slightly changed due to reuse of the externalized strings. Change-Id: Ic0f29c80b9a54fcec8320d8539a3e112852a1f7b Signed-off-by: Sasa Zivkov <sasa.zivkov@sap.com>
Diffstat (limited to 'org.eclipse.jgit.ui')
-rw-r--r--org.eclipse.jgit.ui/.classpath1
-rw-r--r--org.eclipse.jgit.ui/META-INF/MANIFEST.MF1
-rw-r--r--org.eclipse.jgit.ui/pom.xml3
-rw-r--r--org.eclipse.jgit.ui/resources/org/eclipse/jgit/awtui/UIText.properties8
-rw-r--r--org.eclipse.jgit.ui/src/org/eclipse/jgit/awtui/AwtAuthenticator.java9
-rw-r--r--org.eclipse.jgit.ui/src/org/eclipse/jgit/awtui/AwtSshSessionFactory.java2
-rw-r--r--org.eclipse.jgit.ui/src/org/eclipse/jgit/awtui/CommitGraphPane.java6
-rw-r--r--org.eclipse.jgit.ui/src/org/eclipse/jgit/awtui/UIText.java69
8 files changed, 91 insertions, 8 deletions
diff --git a/org.eclipse.jgit.ui/.classpath b/org.eclipse.jgit.ui/.classpath
index 64c5e31b7a..b3d21cc667 100644
--- a/org.eclipse.jgit.ui/.classpath
+++ b/org.eclipse.jgit.ui/.classpath
@@ -3,5 +3,6 @@
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
+ <classpathentry kind="src" path="resources"/>
<classpathentry kind="output" path="bin"/>
</classpath>
diff --git a/org.eclipse.jgit.ui/META-INF/MANIFEST.MF b/org.eclipse.jgit.ui/META-INF/MANIFEST.MF
index b496cd08dd..fe2f476b2e 100644
--- a/org.eclipse.jgit.ui/META-INF/MANIFEST.MF
+++ b/org.eclipse.jgit.ui/META-INF/MANIFEST.MF
@@ -8,6 +8,7 @@ Bundle-Vendor: %provider_name
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Export-Package: org.eclipse.jgit.awtui;version="0.8.0"
Import-Package: org.eclipse.jgit.lib;version="[0.8.0,0.9.0)",
+ org.eclipse.jgit.nls;version="[0.8.0,0.9.0)",
org.eclipse.jgit.revplot;version="[0.8.0,0.9.0)",
org.eclipse.jgit.revwalk;version="[0.8.0,0.9.0)",
org.eclipse.jgit.transport;version="[0.8.0,0.9.0)",
diff --git a/org.eclipse.jgit.ui/pom.xml b/org.eclipse.jgit.ui/pom.xml
index 8c452b0a9e..3d96fd1113 100644
--- a/org.eclipse.jgit.ui/pom.xml
+++ b/org.eclipse.jgit.ui/pom.xml
@@ -84,6 +84,9 @@
<include>plugin.properties</include>
</includes>
</resource>
+ <resource>
+ <directory>resources/</directory>
+ </resource>
</resources>
<plugins>
diff --git a/org.eclipse.jgit.ui/resources/org/eclipse/jgit/awtui/UIText.properties b/org.eclipse.jgit.ui/resources/org/eclipse/jgit/awtui/UIText.properties
new file mode 100644
index 0000000000..0bc5a7acbc
--- /dev/null
+++ b/org.eclipse.jgit.ui/resources/org/eclipse/jgit/awtui/UIText.properties
@@ -0,0 +1,8 @@
+authenticationRequired=Authentication Required
+author=Author
+date=Date
+enterUsernameAndPasswordFor=Enter username and password for
+mustBeSpecialTableModel=Must be special table model.
+password=Password:
+username=Username:
+warning=Warning
diff --git a/org.eclipse.jgit.ui/src/org/eclipse/jgit/awtui/AwtAuthenticator.java b/org.eclipse.jgit.ui/src/org/eclipse/jgit/awtui/AwtAuthenticator.java
index 1d2f9d765c..6728d616da 100644
--- a/org.eclipse.jgit.ui/src/org/eclipse/jgit/awtui/AwtAuthenticator.java
+++ b/org.eclipse.jgit.ui/src/org/eclipse/jgit/awtui/AwtAuthenticator.java
@@ -74,7 +74,8 @@ public class AwtAuthenticator extends CachedAuthenticator {
panel.setLayout(new GridBagLayout());
final StringBuilder instruction = new StringBuilder();
- instruction.append("Enter username and password for ");
+ instruction.append(UIText.get().enterUsernameAndPasswordFor);
+ instruction.append(" ");
if (getRequestorType() == RequestorType.PROXY) {
instruction.append(getRequestorType());
instruction.append(" ");
@@ -101,7 +102,7 @@ public class AwtAuthenticator extends CachedAuthenticator {
gbc.fill = GridBagConstraints.NONE;
gbc.gridx = 0;
gbc.weightx = 1;
- panel.add(new JLabel("Username:"), gbc);
+ panel.add(new JLabel(UIText.get().username), gbc);
gbc.gridx = 1;
gbc.fill = GridBagConstraints.HORIZONTAL;
@@ -116,7 +117,7 @@ public class AwtAuthenticator extends CachedAuthenticator {
gbc.fill = GridBagConstraints.NONE;
gbc.gridx = 0;
gbc.weightx = 1;
- panel.add(new JLabel("Password:"), gbc);
+ panel.add(new JLabel(UIText.get().password), gbc);
gbc.gridx = 1;
gbc.fill = GridBagConstraints.HORIZONTAL;
@@ -126,7 +127,7 @@ public class AwtAuthenticator extends CachedAuthenticator {
gbc.gridy++;
if (JOptionPane.showConfirmDialog(null, panel,
- "Authentication Required", JOptionPane.OK_CANCEL_OPTION,
+ UIText.get().authenticationRequired, JOptionPane.OK_CANCEL_OPTION,
JOptionPane.QUESTION_MESSAGE) == JOptionPane.OK_OPTION) {
return new PasswordAuthentication(username.getText(), password
.getPassword());
diff --git a/org.eclipse.jgit.ui/src/org/eclipse/jgit/awtui/AwtSshSessionFactory.java b/org.eclipse.jgit.ui/src/org/eclipse/jgit/awtui/AwtSshSessionFactory.java
index f6710854b4..f0de7ceb70 100644
--- a/org.eclipse.jgit.ui/src/org/eclipse/jgit/awtui/AwtSshSessionFactory.java
+++ b/org.eclipse.jgit.ui/src/org/eclipse/jgit/awtui/AwtSshSessionFactory.java
@@ -96,7 +96,7 @@ public class AwtSshSessionFactory extends SshConfigSessionFactory {
}
public boolean promptYesNo(final String msg) {
- return JOptionPane.showConfirmDialog(null, msg, "Warning",
+ return JOptionPane.showConfirmDialog(null, msg, UIText.get().warning,
JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION;
}
diff --git a/org.eclipse.jgit.ui/src/org/eclipse/jgit/awtui/CommitGraphPane.java b/org.eclipse.jgit.ui/src/org/eclipse/jgit/awtui/CommitGraphPane.java
index da68c81953..effe6e5756 100644
--- a/org.eclipse.jgit.ui/src/org/eclipse/jgit/awtui/CommitGraphPane.java
+++ b/org.eclipse.jgit.ui/src/org/eclipse/jgit/awtui/CommitGraphPane.java
@@ -112,7 +112,7 @@ public class CommitGraphPane extends JTable {
@Override
public void setModel(final TableModel dataModel) {
if (dataModel != null && !(dataModel instanceof CommitTableModel))
- throw new ClassCastException("Must be special table model.");
+ throw new ClassCastException(UIText.get().mustBeSpecialTableModel);
super.setModel(dataModel);
}
@@ -130,8 +130,8 @@ public class CommitGraphPane extends JTable {
final TableColumn date = cols.getColumn(2);
graph.setHeaderValue("");
- author.setHeaderValue("Author");
- date.setHeaderValue("Date");
+ author.setHeaderValue(UIText.get().author);
+ date.setHeaderValue(UIText.get().date);
graph.setCellRenderer(new GraphCellRender());
author.setCellRenderer(new NameCellRender());
diff --git a/org.eclipse.jgit.ui/src/org/eclipse/jgit/awtui/UIText.java b/org.eclipse.jgit.ui/src/org/eclipse/jgit/awtui/UIText.java
new file mode 100644
index 0000000000..e1acbcd16e
--- /dev/null
+++ b/org.eclipse.jgit.ui/src/org/eclipse/jgit/awtui/UIText.java
@@ -0,0 +1,69 @@
+/*
+ * Copyright (C) 2010, Sasa Zivkov <sasa.zivkov@sap.com>
+ * and other copyright owners as documented in the project's IP log.
+ *
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Distribution License v1.0 which
+ * accompanies this distribution, is reproduced below, and is
+ * available at http://www.eclipse.org/org/documents/edl-v10.php
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or
+ * without modification, are permitted provided that the following
+ * conditions are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ *
+ * - Neither the name of the Eclipse Foundation, Inc. nor the
+ * names of its contributors may be used to endorse or promote
+ * products derived from this software without specific prior
+ * written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package org.eclipse.jgit.awtui;
+
+import org.eclipse.jgit.nls.NLS;
+import org.eclipse.jgit.nls.TranslationBundle;
+
+/**
+ * Translation bundle for JGit UI
+ */
+public class UIText extends TranslationBundle {
+
+ /**
+ * @return an instance of this translation bundle
+ */
+ public static UIText get() {
+ return NLS.getBundleFor(UIText.class);
+ }
+
+ /***/ public String authenticationRequired;
+ /***/ public String author;
+ /***/ public String date;
+ /***/ public String enterUsernameAndPasswordFor;
+ /***/ public String mustBeSpecialTableModel;
+ /***/ public String password;
+ /***/ public String username;
+ /***/ public String warning;
+}

Back to the top