diff --git a/I18N Commander/UI WinForms/Components/Translation.Designer.cs b/I18N Commander/UI WinForms/Components/Translation.Designer.cs index f5878d2..dc5cb15 100644 --- a/I18N Commander/UI WinForms/Components/Translation.Designer.cs +++ b/I18N Commander/UI WinForms/Components/Translation.Designer.cs @@ -87,7 +87,7 @@ this.buttonDeepL.Name = "buttonDeepL"; this.buttonDeepL.Size = new System.Drawing.Size(60, 60); this.buttonDeepL.TabIndex = 2; - this.toolTip.SetToolTip(this.buttonDeepL, "Auto-generate this text by using DeepL"); + this.toolTip.SetToolTip(this.buttonDeepL, "Auto-generate this text by using DeepL sourced by the source culture."); this.buttonDeepL.UseVisualStyleBackColor = true; // // toolTip diff --git a/I18N Commander/UI WinForms/Components/Translation.cs b/I18N Commander/UI WinForms/Components/Translation.cs index 6bd5590..8536f08 100644 --- a/I18N Commander/UI WinForms/Components/Translation.cs +++ b/I18N Commander/UI WinForms/Components/Translation.cs @@ -1,6 +1,7 @@ using System.Timers; using DataModel.Database; using Processor; +using UI_WinForms.Resources; using Timer = System.Timers.Timer; namespace UI_WinForms.Components; @@ -10,8 +11,9 @@ public sealed partial class Translation : UserControl private readonly string culture = "en-US"; private readonly Timer saveTimer; - private int currentTranslationId = -1; private bool isLoading = false; + private int currentTranslationId = -1; + private bool isDeepLSourceCulture = false; public Translation() { @@ -19,11 +21,11 @@ public sealed partial class Translation : UserControl this.Dock = DockStyle.Top; } - public Translation(string cultureCode) + public Translation(AppSettings.CultureInfo cultureInfo) { this.InitializeComponent(); - this.culture = cultureCode; - this.labelHead.Text = $"Culture: {cultureCode}"; + this.culture = cultureInfo.Code; + this.labelHead.Text = $"Culture: {cultureInfo.Code}"; this.Dock = DockStyle.Top; this.saveTimer = new Timer { @@ -32,12 +34,20 @@ public sealed partial class Translation : UserControl AutoReset = false, // runs only once }; this.saveTimer.Elapsed += this.SaveChanges; - this.Load += async (sender, args) => await this.LateSetup(); + this.Load += async (sender, args) => await this.LateSetup(cultureInfo); } - private async Task LateSetup() + private async Task LateSetup(AppSettings.CultureInfo cultureInfo) { + this.isDeepLSourceCulture = await AppSettings.GetDeepLSourceCultureIndex() == cultureInfo.Index; this.buttonDeepL.Visible = await AppSettings.GetDeepLMode() != SettingDeepLMode.DISABLED; + this.buttonDeepL.Image = this.isDeepLSourceCulture ? Icons.icons8_trigger_1__svg : Icons.deepl_logo_icon_170284; + + if (this.isDeepLSourceCulture) + { + this.labelHead.Text = $"Culture: {cultureInfo.Code} (DeepL source culture)"; + this.toolTip.SetToolTip(this.buttonDeepL, "Replaces all other translations by DeepL translations using this culture as source culture.\nWarning: already translated texts will be replaced as well."); + } } private async void SaveChanges(object? sender, ElapsedEventArgs e) diff --git a/I18N Commander/UI WinForms/Components/Translations.cs b/I18N Commander/UI WinForms/Components/Translations.cs index 5d8e7fc..40b2a59 100644 --- a/I18N Commander/UI WinForms/Components/Translations.cs +++ b/I18N Commander/UI WinForms/Components/Translations.cs @@ -46,7 +46,7 @@ public partial class Translations : UserControl await foreach (var cultureInfo in DesiredOrder()) { - var translationComponent = new Translation(cultureInfo.Code); + var translationComponent = new Translation(cultureInfo); this.translationComponents.Add(cultureInfo.Code, translationComponent); this.panelTranslations.Controls.Add(translationComponent); } diff --git a/I18N Commander/UI WinForms/Resources/Icons.Designer.cs b/I18N Commander/UI WinForms/Resources/Icons.Designer.cs index 3110d9e..cedf6c1 100644 --- a/I18N Commander/UI WinForms/Resources/Icons.Designer.cs +++ b/I18N Commander/UI WinForms/Resources/Icons.Designer.cs @@ -319,5 +319,15 @@ namespace UI_WinForms.Resources { return ((System.Drawing.Bitmap)(obj)); } } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap icons8_trigger_1__svg { + get { + object obj = ResourceManager.GetObject("icons8_trigger_1__svg", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } } } diff --git a/I18N Commander/UI WinForms/Resources/Icons.resx b/I18N Commander/UI WinForms/Resources/Icons.resx index 2273449..9cfa843 100644 --- a/I18N Commander/UI WinForms/Resources/Icons.resx +++ b/I18N Commander/UI WinForms/Resources/Icons.resx @@ -196,4 +196,7 @@ icons8-trash-can-512.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + icons8-trigger(1).svg.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + \ No newline at end of file diff --git a/I18N Commander/UI WinForms/Resources/icons8-trigger(1).svg.png b/I18N Commander/UI WinForms/Resources/icons8-trigger(1).svg.png new file mode 100644 index 0000000..d0e5863 Binary files /dev/null and b/I18N Commander/UI WinForms/Resources/icons8-trigger(1).svg.png differ