69 lines
2.1 KiB
C#
69 lines
2.1 KiB
C#
using Deckungsbeitrag.AA_Forms;
|
|
using Deckungsbeitrag.AA_Klassen;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Data;
|
|
using System.Drawing;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Windows.Forms;
|
|
|
|
namespace Deckungsbeitrag.UserControls
|
|
{
|
|
public partial class UCSprache : UserControl
|
|
{
|
|
private List<string> GbText = new List<string>();
|
|
public event EventHandler CloseFormFromUC;
|
|
|
|
public UCSprache()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
private void UCSprache_Load(object sender, EventArgs e)
|
|
{
|
|
this.comboBoxSprachen.SelectedIndexChanged -= ComboBoxSprachen_SelectedIndexChanged;
|
|
LoadCultures();
|
|
this.comboBoxSprachen.SelectedIndexChanged += ComboBoxSprachen_SelectedIndexChanged;
|
|
foreach (string s in GbText) { this.labelText.Text += s + " / "; }
|
|
}
|
|
private void LoadCultures()
|
|
{
|
|
var cultures = new[]
|
|
{
|
|
new { Code = "de-DE", Name = "Deutsch" },
|
|
new { Code = "en-US", Name = "English (United States) -> Englisch" },
|
|
new { Code = "bs-BA", Name = "Bosanski (Bosna) -> Bosnisch" },
|
|
new { Code = "bg-BG", Name = "български (България) -> Bulgarisch" },
|
|
new { Code = "tr-TR", Name = "Türkçe (Türkiye) -> Türkisch" }
|
|
};
|
|
|
|
foreach (var c in cultures)
|
|
{
|
|
TranslationService.CurrentLanguage = c.Code.Substring(0, 2);
|
|
GbText.Add(TranslationService.T("SpracheWaehlen"));
|
|
}
|
|
|
|
comboBoxSprachen.DataSource = cultures;
|
|
comboBoxSprachen.DisplayMember = "Name";
|
|
comboBoxSprachen.ValueMember = "Code";
|
|
|
|
this.comboBoxSprachen.SelectedValue = Program._settings.Culture;
|
|
}
|
|
private void ComboBoxSprachen_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
TranslationService.SetLanguage(this.comboBoxSprachen.SelectedValue.ToString());
|
|
}
|
|
|
|
private void ButtonOK_Click(object sender, EventArgs e)
|
|
{
|
|
Program._settings.Culture = this.comboBoxSprachen.SelectedValue.ToString();
|
|
Program._settings.Save();
|
|
|
|
CloseFormFromUC?.Invoke(this, EventArgs.Empty);
|
|
}
|
|
}
|
|
}
|