diff --git a/GreenshotImgurPlugin/ImgurPlugin.cs b/GreenshotImgurPlugin/ImgurPlugin.cs index 167b388ca..e75663756 100644 --- a/GreenshotImgurPlugin/ImgurPlugin.cs +++ b/GreenshotImgurPlugin/ImgurPlugin.cs @@ -72,14 +72,14 @@ namespace GreenshotImgurPlugin { ToolStripMenuItem itemPlugInRoot = new ToolStripMenuItem("Imgur"); itemPlugInRoot.Image = (Image)resources.GetObject("Imgur"); - historyMenuItem = new ToolStripMenuItem(Language.GetString("imgur", LangKey.imgur_history)); + historyMenuItem = new ToolStripMenuItem(Language.GetString("imgur", LangKey.history)); historyMenuItem.Tag = host; historyMenuItem.Click += delegate { ImgurHistory.ShowHistory(); }; itemPlugInRoot.DropDownItems.Add(historyMenuItem); - ToolStripMenuItem itemPlugInConfig = new ToolStripMenuItem(Language.GetString("imgur", LangKey.imgur_configure)); + ToolStripMenuItem itemPlugInConfig = new ToolStripMenuItem(Language.GetString("imgur", LangKey.configure)); itemPlugInConfig.Tag = host; itemPlugInConfig.Click += delegate { config.ShowConfigDialog(); diff --git a/GreenshotImgurPlugin/LanguageKeys.cs b/GreenshotImgurPlugin/LanguageKeys.cs index 59a88fe15..3367feb8c 100644 --- a/GreenshotImgurPlugin/LanguageKeys.cs +++ b/GreenshotImgurPlugin/LanguageKeys.cs @@ -36,7 +36,7 @@ namespace GreenshotImgurPlugin { clear_question, delete_title, use_page_link, - imgur_history, - imgur_configure + history, + configure } } diff --git a/GreenshotJiraPlugin/Forms/JiraForm.cs b/GreenshotJiraPlugin/Forms/JiraForm.cs index 16a2b1f46..3365f7cd4 100644 --- a/GreenshotJiraPlugin/Forms/JiraForm.cs +++ b/GreenshotJiraPlugin/Forms/JiraForm.cs @@ -32,7 +32,6 @@ namespace GreenshotJiraPlugin { private JiraConnector jiraConnector; private JiraIssue selectedIssue; private ListViewColumnSorter columnSorter; - private ILanguage language = Language.GetInstance(); private JiraConfiguration config = IniConfig.GetIniSection(); public JiraForm(JiraConnector jiraConnector) { @@ -51,16 +50,16 @@ namespace GreenshotJiraPlugin { jiraConnector.login(); } } catch (Exception e) { - MessageBox.Show(language.GetFormattedString(LangKey.login_error, e.Message)); + MessageBox.Show(Language.GetFormattedString("jira", LangKey.login_error, e.Message)); } uploadButton.Enabled = false; updateForm(); } private void initializeComponentText() { - this.label_jirafilter.Text = language.GetString(LangKey.label_jirafilter); - this.label_comment.Text = language.GetString(LangKey.label_comment); - this.label_filename.Text = language.GetString(LangKey.label_filename); + this.label_jirafilter.Text = Language.GetString("jira", LangKey.label_jirafilter); + this.label_comment.Text = Language.GetString("jira", LangKey.label_comment); + this.label_filename.Text = Language.GetString("jira", LangKey.label_filename); } private void updateForm() { @@ -127,7 +126,7 @@ namespace GreenshotJiraPlugin { private void jiraFilterBox_SelectedIndexChanged(object sender, EventArgs e) { if (jiraConnector.isLoggedIn) { - BackgroundForm backgroundForm = BackgroundForm.ShowAndWait(JiraPlugin.Instance.JiraPluginAttributes.Name, language.GetString(LangKey.communication_wait)); + BackgroundForm backgroundForm = BackgroundForm.ShowAndWait(JiraPlugin.Instance.JiraPluginAttributes.Name, Language.GetString("jira", LangKey.communication_wait)); try { uploadButton.Enabled = false; JiraFilter filter = (JiraFilter)jiraFilterBox.SelectedItem; @@ -141,7 +140,7 @@ namespace GreenshotJiraPlugin { jiraListView.Columns.Clear(); LangKey[] columns = { LangKey.column_id, LangKey.column_created, LangKey.column_assignee, LangKey.column_reporter, LangKey.column_summary }; foreach (LangKey column in columns) { - jiraListView.Columns.Add(language.GetString(column)); + jiraListView.Columns.Add(Language.GetString("jira", column)); } foreach (JiraIssue issue in issues) { ListViewItem item = new ListViewItem(issue.Key); @@ -161,8 +160,6 @@ namespace GreenshotJiraPlugin { } finally { backgroundForm.CloseDialog(); } - - } } diff --git a/GreenshotJiraPlugin/Forms/SettingsForm.cs b/GreenshotJiraPlugin/Forms/SettingsForm.cs index 264126e33..dccd5058e 100644 --- a/GreenshotJiraPlugin/Forms/SettingsForm.cs +++ b/GreenshotJiraPlugin/Forms/SettingsForm.cs @@ -28,7 +28,6 @@ namespace GreenshotJiraPlugin { /// public partial class SettingsForm : GreenshotPlugin.Controls.GreenshotForm { public SettingsForm(JiraConfiguration config) { - language = Language.GetInstance(); // // The InitializeComponent() call is required for Windows Forms designer support. // diff --git a/GreenshotJiraPlugin/GreenshotJiraPlugin.csproj b/GreenshotJiraPlugin/GreenshotJiraPlugin.csproj index 84f238bcc..ac9e88eb6 100644 --- a/GreenshotJiraPlugin/GreenshotJiraPlugin.csproj +++ b/GreenshotJiraPlugin/GreenshotJiraPlugin.csproj @@ -1,5 +1,5 @@  - + {19FEEF09-313F-43C7-819D-F1BCA782B08B} Debug @@ -53,12 +53,16 @@ - + + Form + JiraForm.cs - + + Form + SettingsForm.cs @@ -67,7 +71,6 @@ - @@ -99,8 +102,6 @@ - - Static diff --git a/GreenshotJiraPlugin/Jira.cs b/GreenshotJiraPlugin/Jira.cs index f33095f94..0de589518 100644 --- a/GreenshotJiraPlugin/Jira.cs +++ b/GreenshotJiraPlugin/Jira.cs @@ -102,7 +102,6 @@ namespace Jira { private const string AUTH_FAILED_EXCEPTION_NAME = "com.atlassian.jira.rpc.exception.RemoteAuthenticationException"; private static JiraConfiguration config = IniConfig.GetIniSection(); public const string DEFAULT_POSTFIX = "/rpc/soap/jirasoapservice-v2?wsdl"; - private ILanguage lang = Language.GetInstance(); private string credentials; private DateTime loggedInTime = DateTime.Now; private bool loggedIn; @@ -119,7 +118,7 @@ namespace Jira { this.url = config.Url; this.timeout = config.Timeout; if (!suppressBackgroundForm) { - BackgroundForm backgroundForm = BackgroundForm.ShowAndWait(JiraPlugin.Instance.JiraPluginAttributes.Name, lang.GetString(LangKey.communication_wait)); + BackgroundForm backgroundForm = BackgroundForm.ShowAndWait(JiraPlugin.Instance.JiraPluginAttributes.Name, Language.GetString("jira", LangKey.communication_wait)); try { jira = new JiraSoapServiceService(); } finally { @@ -143,7 +142,7 @@ namespace Jira { private bool doLogin(string user, string password, bool suppressBackgroundForm) { BackgroundForm backgroundForm = null; if (!suppressBackgroundForm) { - backgroundForm = BackgroundForm.ShowAndWait(JiraPlugin.Instance.JiraPluginAttributes.Name, lang.GetString(LangKey.communication_wait)); + backgroundForm = BackgroundForm.ShowAndWait(JiraPlugin.Instance.JiraPluginAttributes.Name, Language.GetString("jira", LangKey.communication_wait)); } try { LOG.DebugFormat("Loggin in"); diff --git a/GreenshotJiraPlugin/JiraDestination.cs b/GreenshotJiraPlugin/JiraDestination.cs index dcdde3c37..f1e73fd21 100644 --- a/GreenshotJiraPlugin/JiraDestination.cs +++ b/GreenshotJiraPlugin/JiraDestination.cs @@ -39,7 +39,6 @@ namespace GreenshotJiraPlugin { public class JiraDestination : AbstractDestination { private static log4net.ILog LOG = log4net.LogManager.GetLogger(typeof(JiraDestination)); private static JiraConfiguration config = IniConfig.GetIniSection(); - private ILanguage lang = Language.GetInstance(); private JiraPlugin jiraPlugin = null; private JiraIssue jira = null; @@ -61,9 +60,9 @@ namespace GreenshotJiraPlugin { public override string Description { get { if (jira == null) { - return lang.GetString(LangKey.upload_menu_item); + return Language.GetString("jira", LangKey.upload_menu_item); } else { - return lang.GetString(LangKey.upload_menu_item) + " - " + jira.Key + ": " + jira.Summary.Substring(0, Math.Min(20, jira.Summary.Length)); + return Language.GetString("jira", LangKey.upload_menu_item) + " - " + jira.Key + ": " + jira.Summary.Substring(0, Math.Min(20, jira.Summary.Length)); } } } @@ -110,18 +109,18 @@ namespace GreenshotJiraPlugin { // COPY stream to buffer buffer = stream.ToArray(); } - BackgroundForm backgroundForm = BackgroundForm.ShowAndWait(Description, lang.GetString(LangKey.communication_wait)); + BackgroundForm backgroundForm = BackgroundForm.ShowAndWait(Description, Language.GetString("jira", LangKey.communication_wait)); try { jiraPlugin.JiraConnector.addAttachment(jira.Key, filename, buffer); LOG.Debug("Uploaded to Jira."); backgroundForm.CloseDialog(); - MessageBox.Show(lang.GetString(LangKey.upload_success)); - surface.SendMessageEvent(this, SurfaceMessageTyp.Info, jiraPlugin.Host.CoreLanguage.GetFormattedString("exported_to", Description)); + MessageBox.Show(Language.GetString("jira", LangKey.upload_success)); + surface.SendMessageEvent(this, SurfaceMessageTyp.Info, Language.GetFormattedString("exported_to", Description)); surface.Modified = false; return true; } catch (Exception e) { backgroundForm.CloseDialog(); - MessageBox.Show(lang.GetString(LangKey.upload_failure) + " " + e.Message); + MessageBox.Show(Language.GetString("jira", LangKey.upload_failure) + " " + e.Message); } } else { JiraForm jiraForm = new JiraForm(jiraPlugin.JiraConnector); @@ -137,22 +136,21 @@ namespace GreenshotJiraPlugin { // COPY stream to buffer buffer = stream.ToArray(); } - BackgroundForm backgroundForm = BackgroundForm.ShowAndWait(Description, lang.GetString(LangKey.communication_wait)); + BackgroundForm backgroundForm = BackgroundForm.ShowAndWait(Description, Language.GetString("jira", LangKey.communication_wait)); try { jiraForm.upload(buffer); LOG.Debug("Uploaded to Jira."); backgroundForm.CloseDialog(); - MessageBox.Show(lang.GetString(LangKey.upload_success)); + MessageBox.Show(Language.GetString("jira", LangKey.upload_success)); surface.SendMessageEvent(this, SurfaceMessageTyp.Info, "Exported to Jira " + jiraForm.getJiraIssue().Key); surface.Modified = false; return true; } catch(Exception e) { backgroundForm.CloseDialog(); - MessageBox.Show(lang.GetString(LangKey.upload_failure) + " " + e.Message); + MessageBox.Show(Language.GetString("jira", LangKey.upload_failure) + " " + e.Message); } } } - } return false; } diff --git a/GreenshotJiraPlugin/JiraPlugin.cs b/GreenshotJiraPlugin/JiraPlugin.cs index 58edcf119..a1744e4dc 100644 --- a/GreenshotJiraPlugin/JiraPlugin.cs +++ b/GreenshotJiraPlugin/JiraPlugin.cs @@ -38,7 +38,6 @@ namespace GreenshotJiraPlugin { public class JiraPlugin : IGreenshotPlugin { private static readonly log4net.ILog LOG = log4net.LogManager.GetLogger(typeof(JiraPlugin)); private PluginAttribute jiraPluginAttributes; - private ILanguage lang = Language.GetInstance(); private IGreenshotHost host; private JiraConnector jiraConnector = null; private JiraConfiguration config = null; diff --git a/GreenshotJiraPlugin/Language.cs b/GreenshotJiraPlugin/Language.cs deleted file mode 100644 index b71947233..000000000 --- a/GreenshotJiraPlugin/Language.cs +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Greenshot - a free and open source screenshot tool - * Copyright (C) 2007-2012 Thomas Braun, Jens Klingen, Robin Krom - * - * For more information see: http://getgreenshot.org/ - * The Greenshot project is hosted on Sourceforge: http://sourceforge.net/projects/greenshot/ - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 1 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -using System; -using System.Threading; -using GreenshotPlugin.Core; - -namespace GreenshotJiraPlugin { - /// - /// Wrapper for the language container for the Jira plugin. - /// - public class Language : LanguageContainer, ILanguage { - private static ILanguage uniqueInstance; - private const string LANGUAGE_FILENAME_PATTERN = @"language_jiraplugin-*.xml"; - - public static ILanguage GetInstance() { - if(uniqueInstance == null) { - uniqueInstance = new LanguageContainer(LANGUAGE_FILENAME_PATTERN); - } - return uniqueInstance; - } - } -}