Preparations for the language changes

git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@1783 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4
This commit is contained in:
RKrom 2012-04-17 14:16:10 +00:00
commit 53af559d22
44 changed files with 472 additions and 874 deletions

View file

@ -32,7 +32,6 @@ namespace Greenshot.Forms {
public partial class LanguageDialog : Form {
private static log4net.ILog LOG = log4net.LogManager.GetLogger(typeof(LanguageDialog));
private static LanguageDialog uniqueInstance;
private ILanguage language = Language.GetInstance(false);
private bool properOkPressed = false;
private LanguageDialog() {
@ -48,8 +47,6 @@ namespace Greenshot.Forms {
private void PreventFormClose(object sender, FormClosingEventArgs e) {
if(!properOkPressed) {
e.Cancel = true;
} else {
language.FreeResources();
}
}
@ -64,20 +61,20 @@ namespace Greenshot.Forms {
// Set datasource last to prevent problems
// See: http://www.codeproject.com/KB/database/scomlistcontrolbinding.aspx?fid=111644
this.comboBoxLanguage.DataSource = language.SupportedLanguages;
if (language.CurrentLanguage != null) {
LOG.DebugFormat("Selecting {0}", language.CurrentLanguage);
this.comboBoxLanguage.SelectedValue = language.CurrentLanguage;
this.comboBoxLanguage.DataSource = Language.SupportedLanguages;
if (Language.CurrentLanguage != null) {
LOG.DebugFormat("Selecting {0}", Language.CurrentLanguage);
this.comboBoxLanguage.SelectedValue = Language.CurrentLanguage;
} else {
this.comboBoxLanguage.SelectedValue = Thread.CurrentThread.CurrentUICulture.Name;
}
// Close again when there is only one language, this shows the form briefly!
// But the use-case is not so interesting, only happens once, to invest a lot of time here.
if (language.SupportedLanguages.Count == 1) {
this.comboBoxLanguage.SelectedValue = language.SupportedLanguages[0].Ietf;
LanguageContainer.SetGlobalLanguage(SelectedLanguage);
if (Language.SupportedLanguages.Count == 1) {
this.comboBoxLanguage.SelectedValue = Language.SupportedLanguages[0].Ietf;
Language.CurrentLanguage = SelectedLanguage;
properOkPressed = true;
this.Close();
}
@ -86,7 +83,7 @@ namespace Greenshot.Forms {
void BtnOKClick(object sender, EventArgs e) {
properOkPressed = true;
// Fix for Bug #3431100
LanguageContainer.SetGlobalLanguage(SelectedLanguage);
Language.CurrentLanguage = SelectedLanguage;
this.Close();
}