diff options
author | Sasa Zivkov <sasa.zivkov@sap.com> | 2010-05-19 16:59:28 +0200 |
---|---|---|
committer | Shawn O. Pearce <spearce@spearce.org> | 2010-05-19 14:37:16 -0700 |
commit | f3d8a8ecad614906a2c4ec0077cdb24129da6c6d (patch) | |
tree | 34d041692beff0f392c27869f49b76c0fc2053e6 /org.eclipse.jgit.ui/src | |
parent | 2e961989e42b1fe7e8bd9eaa7a3d2e88a0d1d001 (diff) | |
download | jgit-f3d8a8ecad614906a2c4ec0077cdb24129da6c6d.tar.gz 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/src')
4 files changed, 78 insertions, 8 deletions
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; +} |