From 2cb2b4bc3e7ab6c19d159da0e9b1868ef899986c Mon Sep 17 00:00:00 2001 From: Ariel Rorabaugh Date: Sat, 28 Jun 2025 20:09:03 -0400 Subject: [PATCH 01/25] Remove Winforms dependency. Split L10NSharp into two parts to separate out the portion that does not require use of Windows Forms from the portion that does. Additionally, remove System.Drawing dependency from the Windows Forms independent portion. --- src/L10NSharp/ILocalizationManager.cs | 1 - src/L10NSharp/ILocalizationManagerInternal.cs | 12 +- src/L10NSharp/LocalizationManager.cs | 47 +- src/L10NSharp/LocalizationManagerInternal.cs | 55 +- src/L10NSharp/UI/L10NExtender.cs | 5 +- src/L10NSharp/UI/LocalizeItemDlg.cs | 7 +- src/L10NSharp/{UI => }/Utils.cs | 39 +- .../ILocalizationManagerInternalWinforms.cs | 28 + .../LocalizationManagerInternalWinforms.cs | 217 ++++++ .../LocalizationManagerWinforms.cs | 84 +++ src/L10NSharp/WindowsForms/UtilsWinforms.cs | 43 ++ .../XliffLocalizationManagerWinforms.cs | 625 ++++++++++++++++++ .../XLiffUtils/XliffLocalizationManager.cs | 546 +-------------- .../ILocalizableComponentTests.cs | 3 +- .../LocalizationManagerTestsBase.cs | 9 +- .../LocalizationManagerXliffTests.cs | 2 +- src/L10NSharpTests/UtilsTests.cs | 14 +- src/SampleApp/Form1.Designer.cs | 115 ++-- src/SampleApp/Form1.cs | 7 - src/SampleApp/Form1.resx | 3 + src/SampleApp/Program.cs | 2 - 21 files changed, 1116 insertions(+), 748 deletions(-) rename src/L10NSharp/{UI => }/Utils.cs (77%) create mode 100644 src/L10NSharp/WindowsForms/ILocalizationManagerInternalWinforms.cs create mode 100644 src/L10NSharp/WindowsForms/LocalizationManagerInternalWinforms.cs create mode 100644 src/L10NSharp/WindowsForms/LocalizationManagerWinforms.cs create mode 100644 src/L10NSharp/WindowsForms/UtilsWinforms.cs create mode 100644 src/L10NSharp/WindowsForms/XLiffUtils/XliffLocalizationManagerWinforms.cs diff --git a/src/L10NSharp/ILocalizationManager.cs b/src/L10NSharp/ILocalizationManager.cs index ddc5899..85c82d0 100644 --- a/src/L10NSharp/ILocalizationManager.cs +++ b/src/L10NSharp/ILocalizationManager.cs @@ -91,7 +91,6 @@ public interface ILocalizationManager: IDisposable void RefreshToolTips(); void PrepareToCustomizeLocalizations(); - void ShowLocalizationDialogBox(bool runInReadonlyMode, IWin32Window owner = null); /// ------------------------------------------------------------------------------------ /// diff --git a/src/L10NSharp/ILocalizationManagerInternal.cs b/src/L10NSharp/ILocalizationManagerInternal.cs index 713c386..305b739 100644 --- a/src/L10NSharp/ILocalizationManagerInternal.cs +++ b/src/L10NSharp/ILocalizationManagerInternal.cs @@ -1,31 +1,23 @@ // Copyright © 2019-2025 SIL Global // This software is licensed under the MIT License (http://opensource.org/licenses/MIT) -using System; using System.Collections.Generic; using System.ComponentModel; -using System.Drawing; -using System.Windows.Forms; +//using System.Drawing; namespace L10NSharp { internal interface ILocalizationManagerInternal: ILocalizationManager { Dictionary ComponentCache { get; } - Dictionary ToolTipCtrls { get; } Dictionary> LocalizableComponents { get; } - Icon ApplicationIcon { get; set; } + //Icon ApplicationIcon { get; set; } void ApplyLocalization(IComponent component); void ApplyLocalizationsToILocalizableComponent(LocalizingInfo locInfo); void ReapplyLocalizationsToAllComponents(); - void RegisterComponentForLocalizing(IComponent component, string id, string defaultText, - string defaultTooltip, string defaultShortcutKeys, string comment); - void RegisterComponentForLocalizing(LocalizingInfo info, - Action successAction); - string GetStringFromStringCache(string uiLangId, string id); void SaveIfDirty(ICollection langIdsToForceCreate); diff --git a/src/L10NSharp/LocalizationManager.cs b/src/L10NSharp/LocalizationManager.cs index 3f335da..5e348fb 100644 --- a/src/L10NSharp/LocalizationManager.cs +++ b/src/L10NSharp/LocalizationManager.cs @@ -5,14 +5,11 @@ using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; -using System.Drawing; using System.Globalization; using System.IO; using System.Reflection; using System.Threading; -using System.Windows.Forms; using L10NSharp.TMXUtils; -using L10NSharp.UI; using L10NSharp.XLiffUtils; namespace L10NSharp @@ -99,7 +96,7 @@ public static class LocalizationManager public static ILocalizationManager Create(TranslationMemory kind, string desiredUiLangId, string appId, string appName, string appVersion, string directoryOfInstalledFiles, string relativeSettingPathForLocalizationFolder, - Icon applicationIcon, string emailForSubmissions, params string[] namespaceBeginnings) + string emailForSubmissions, params string[] namespaceBeginnings) { if (kind != TranslationMemory.XLiff) { @@ -111,7 +108,7 @@ public static ILocalizationManager Create(TranslationMemory kind, string desired return Create(desiredUiLangId, appId, appName, appVersion, directoryOfInstalledFiles, relativeSettingPathForLocalizationFolder, - applicationIcon, emailForSubmissions, + emailForSubmissions, namespaceBeginnings); } @@ -160,7 +157,7 @@ public static ILocalizationManager Create(TranslationMemory kind, string desired public static ILocalizationManager Create(TranslationMemory kind, string desiredUiLangId, string appId, string appName, string appVersion, string directoryOfInstalledFiles, string relativeSettingPathForLocalizationFolder, - Icon applicationIcon, string emailForSubmissions, + string emailForSubmissions, IEnumerable additionalLocalizationMethods, params string[] namespaceBeginnings) { @@ -172,7 +169,7 @@ public static ILocalizationManager Create(TranslationMemory kind, string desired } return Create(desiredUiLangId, appId, appName, appVersion, directoryOfInstalledFiles, - relativeSettingPathForLocalizationFolder, applicationIcon, emailForSubmissions, + relativeSettingPathForLocalizationFolder, emailForSubmissions, namespaceBeginnings, additionalLocalizationMethods); } @@ -219,7 +216,7 @@ public static ILocalizationManager Create(TranslationMemory kind, string desired public static ILocalizationManager Create(string desiredUiLangId, string appId, string appName, string appVersion, string directoryOfInstalledFiles, string relativeSettingPathForLocalizationFolder, - Icon applicationIcon, string emailForSubmissions, + string emailForSubmissions, string[] namespaceBeginnings, IEnumerable additionalLocalizationMethods = null) { @@ -227,7 +224,7 @@ public static ILocalizationManager Create(string desiredUiLangId, EmailForSubmissions = emailForSubmissions; return LocalizationManagerInternal.CreateXliff(desiredUiLangId, appId, appName, appVersion, directoryOfInstalledFiles, - relativeSettingPathForLocalizationFolder, applicationIcon, + relativeSettingPathForLocalizationFolder, additionalLocalizationMethods, namespaceBeginnings); } @@ -446,28 +443,6 @@ public static int StringCount(string lang) } } - public static void ShowLocalizationDialogBox(IComponent component) - { - switch (TranslationMemoryKind) - { - default: - case TranslationMemory.XLiff: - LocalizationManagerInternal.ShowLocalizationDialogBox(component); - break; - } - } - - public static void ShowLocalizationDialogBox(string id) - { - switch (TranslationMemoryKind) - { - default: - case TranslationMemory.XLiff: - LocalizationManagerInternal.ShowLocalizationDialogBox(id); - break; - } - } - /// ------------------------------------------------------------------------------------ /// /// Gets or sets the list of languages (by id) used to fallback to when looking for a @@ -761,16 +736,6 @@ public static void ReapplyLocalizationsToAllObjects(string localizationManagerId } } - public static string GetLocalizedToolTipForControl(Control ctrl) - { - switch (TranslationMemoryKind) - { - default: - case TranslationMemory.XLiff: - return LocalizationManagerInternal.GetLocalizedToolTipForControl(ctrl); - } - } - /// /// Merge the existing English l10n file into newly collected data and write the /// result to the temp directory. diff --git a/src/L10NSharp/LocalizationManagerInternal.cs b/src/L10NSharp/LocalizationManagerInternal.cs index c55f85c..0f8578f 100644 --- a/src/L10NSharp/LocalizationManagerInternal.cs +++ b/src/L10NSharp/LocalizationManagerInternal.cs @@ -6,12 +6,12 @@ using System.Collections.Generic; using System.ComponentModel; using System.Drawing; + +//using System.Drawing; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; -using System.Windows.Forms; -using L10NSharp.UI; using L10NSharp.XLiffUtils; // ReSharper disable StaticMemberInGenericType - these static fields are parameter-independent @@ -43,16 +43,25 @@ internal static class LocalizationManagerInternal internal static object LazyLoadLock = new object(); /// - /// Function to choose a fallback language during construction. Overridable by unit tests. + /// Function to choose a fallback language. Uses LocalizationManager's default. Overridable by unit tests. /// - internal static Func ChooseFallbackLanguage = (desiredUiLangId, icon) => + internal static string ChooseFallbackLanguage() + { + return LocalizationManager.kDefaultLang; + } + + /*internal static Func ChooseFallbackLanguage = () => + { + return LocalizationManager.kDefaultLang; + };*/ + /*internal static Func ChooseFallbackLanguage = (desiredUiLangId, icon) => { using (var dlg = new LanguageChoosingDialog(L10NCultureInfo.GetCultureInfo(desiredUiLangId), icon)) { dlg.ShowDialog(); return dlg.SelectedLanguage; } - }; + };*/ private static readonly Dictionary> s_loadedManagers = new Dictionary>(); @@ -60,7 +69,7 @@ internal static class LocalizationManagerInternal #region Static methods for creating a LocalizationManagerInternal private static ILocalizationManager Create(string desiredUiLangId, string appId, string appName, string relativeSettingPathForLocalizationFolder, - Icon applicationIcon, Func> createMethod) + Func> createMethod) { if (string.IsNullOrEmpty(relativeSettingPathForLocalizationFolder)) relativeSettingPathForLocalizationFolder = appName; @@ -78,7 +87,7 @@ private static ILocalizationManager Create(string desiredUiLangId, string appId, PreviouslyLoadedManagers.Remove(appId); } - lm.ApplicationIcon = applicationIcon; + //lm.ApplicationIcon = applicationIcon; if (string.IsNullOrEmpty(desiredUiLangId)) { @@ -87,7 +96,7 @@ private static ILocalizationManager Create(string desiredUiLangId, string appId, if (!IsDesiredUiCultureAvailable(desiredUiLangId)) { - desiredUiLangId = ChooseFallbackLanguage(desiredUiLangId, applicationIcon); + desiredUiLangId = ChooseFallbackLanguage(); } LocalizationManager.SetUILanguage(desiredUiLangId, false); @@ -97,7 +106,7 @@ private static ILocalizationManager Create(string desiredUiLangId, string appId, return lm; } - private static bool IsDesiredUiCultureAvailable(string desiredUiLangId) + public static bool IsDesiredUiCultureAvailable(string desiredUiLangId) { if (IsLocalizationAvailable(desiredUiLangId)) return true; @@ -154,7 +163,6 @@ private static bool IsDesiredUiCultureAvailable(string desiredUiLangId) public static ILocalizationManager CreateXliff(string desiredUiLangId, string appId, string appName, string appVersion, string directoryOfInstalledXliffFiles, string relativeSettingPathForLocalizationFolder, - Icon applicationIcon, IEnumerable additionalLocalizationMethods, params string[] namespaceBeginnings) { @@ -166,7 +174,7 @@ public static ILocalizationManager CreateXliff(string desiredUiLangId, string ap appId = Path.GetFileNameWithoutExtension(appId); return Create(desiredUiLangId, appId, appName, - relativeSettingPathForLocalizationFolder, applicationIcon, + relativeSettingPathForLocalizationFolder, directoryOfWritableXliffFiles => (ILocalizationManagerInternal) new XliffLocalizationManager(appId, origExeExtension, appName, appVersion, directoryOfInstalledXliffFiles, @@ -189,23 +197,6 @@ internal static void RemoveManager(string id) } } - internal static void ShowLocalizationDialogBox(IComponent component, - IWin32Window owner = null) - { - if (owner == null) - owner = (component as Control)?.FindForm(); - TipDialog.ShowAltShiftClickTip(owner); - LocalizeItemDlg.ShowDialog(GetLocalizationManagerForComponent(component), - component, false, owner); - } - - public static void ShowLocalizationDialogBox(string id, IWin32Window owner = null) - { - TipDialog.ShowAltShiftClickTip(owner); - LocalizeItemDlg.ShowDialog(GetLocalizationManagerForString(id), - id, false, owner); - } - /// ------------------------------------------------------------------------------------ internal static ILocalizationManagerInternal GetLocalizationManagerForComponent( IComponent component) @@ -769,7 +760,7 @@ public static string GetString(string stringId, string englishText, string comme public static string GetString(string stringId, string englishText, string comment, string englishToolTipText, string englishShortcutKey, IComponent component) { - if (component != null) + /*if (component != null) { var lm = GetLocalizationManagerForComponent(component) ?? GetLocalizationManagerForString(stringId); @@ -781,7 +772,7 @@ public static string GetString(string stringId, string englishText, string comme return lm.GetLocalizedString(stringId, englishText); } - } + }*/ return GetStringFromAnyLocalizationManager(stringId) ?? LocalizationManager.StripOffLocalizationInfoFromText(englishText); @@ -817,7 +808,7 @@ public static string GetString(string stringId, string englishText, string comme return stringFromAnyLocalizationManager; } - /// ------------------------------------------------------------------------------------ + /*/// ------------------------------------------------------------------------------------ public static string GetLocalizedToolTipForControl(Control ctrl) { var lm = GetLocalizationManagerForComponent(ctrl); @@ -842,7 +833,7 @@ internal static Control GetRealTopLevelControl(Control ctrl) parentControl = parentControl.Parent; return parentControl; - } + }*/ /// /// Merge the existing English translation file into newly collected data and write the result to the temp diff --git a/src/L10NSharp/UI/L10NExtender.cs b/src/L10NSharp/UI/L10NExtender.cs index bbdbd17..32e7386 100644 --- a/src/L10NSharp/UI/L10NExtender.cs +++ b/src/L10NSharp/UI/L10NExtender.cs @@ -21,6 +21,7 @@ using System.Diagnostics; using System.Linq; using System.Windows.Forms; +using L10NSharp.WindowsForms; namespace L10NSharp.UI { @@ -38,7 +39,7 @@ public class L10NSharpExtender : Component, IExtenderProvider, ISupportInitializ private Container components = null; #pragma warning restore CS0414 private Dictionary m_extendedCtrls; - private ILocalizationManagerInternal _manager; + private ILocalizationManagerInternalWinforms _manager; private string _locManagerId; //private string _idPrefixForThisForm=""; private bool _okayToLocalizeControls = false; @@ -88,7 +89,7 @@ public string LocalizationManagerId _locManagerId = value; if (value != null && !DesignMode && LocalizationManager.LoadedManagers.ContainsKey(_locManagerId)) { - _manager = LocalizationManager.LoadedManagers[_locManagerId]; + _manager = LocalizationManagerWinforms.LoadedManagers[_locManagerId]; LocalizeControls(); } } diff --git a/src/L10NSharp/UI/LocalizeItemDlg.cs b/src/L10NSharp/UI/LocalizeItemDlg.cs index 7dd2c1f..b0a4957 100644 --- a/src/L10NSharp/UI/LocalizeItemDlg.cs +++ b/src/L10NSharp/UI/LocalizeItemDlg.cs @@ -7,6 +7,7 @@ using System.Text; using System.Windows.Forms; using L10NSharp.Properties; +using L10NSharp.WindowsForms; namespace L10NSharp.UI { @@ -258,13 +259,13 @@ private void ResetSingleItemView() /// ------------------------------------------------------------------------------------ private void UpdateSingleItemView() { - Utils.SetWindowRedraw(this, false, false); + UtilsWinforms.SetWindowRedraw(this, false, false); ResetSingleItemView(); if (_viewModel.CurrentNode == null || _viewModel.CurrentNode.Id == null) { - Utils.SetWindowRedraw(this, true, true); + UtilsWinforms.SetWindowRedraw(this, true, true); return; } @@ -306,7 +307,7 @@ private void UpdateSingleItemView() _colSourceText.DefaultCellStyle.Font = fnt; _colTargetText.DefaultCellStyle.Font = fnt; - Utils.SetWindowRedraw(this, true, true); + UtilsWinforms.SetWindowRedraw(this, true, true); } /// ------------------------------------------------------------------------------------ diff --git a/src/L10NSharp/UI/Utils.cs b/src/L10NSharp/Utils.cs similarity index 77% rename from src/L10NSharp/UI/Utils.cs rename to src/L10NSharp/Utils.cs index 9515bc0..e6216d3 100644 --- a/src/L10NSharp/UI/Utils.cs +++ b/src/L10NSharp/Utils.cs @@ -1,9 +1,8 @@ using System; using System.Reflection; using System.Runtime.InteropServices; -using System.Windows.Forms; -namespace L10NSharp.UI +namespace L10NSharp { /// ---------------------------------------------------------------------------------------- internal static class Utils @@ -36,42 +35,6 @@ public static void SendMessage(IntPtr hWnd, int msg, int wParam, int lParam) } } - - private const int WM_SETREDRAW = 0xB; - - /// ------------------------------------------------------------------------------------ - /// - /// Turns window redrawing on or off. After turning on, the window will be invalidated. - /// - /// ------------------------------------------------------------------------------------ - public static void SetWindowRedraw(Control ctrl, bool turnOn) - { - SetWindowRedraw(ctrl, turnOn, true); - } - - /// ------------------------------------------------------------------------------------ - public static void SetWindowRedraw(Control ctrl, bool turnOn, - bool invalidateAfterTurningOn) - { - if (ctrl != null && !ctrl.IsDisposed && ctrl.IsHandleCreated) - { - if (IsMono) - { - if (turnOn) - ctrl.ResumeLayout(invalidateAfterTurningOn); - else - ctrl.SuspendLayout(); - } - else - { - SendMessage(ctrl.Handle, WM_SETREDRAW, (turnOn ? 1 : 0), 0); - } - - if (turnOn && invalidateAfterTurningOn) - ctrl.Invalidate(true); - } - } - /// ------------------------------------------------------------------------------------ /// /// Asks whether the specified property on the specified binding exists. diff --git a/src/L10NSharp/WindowsForms/ILocalizationManagerInternalWinforms.cs b/src/L10NSharp/WindowsForms/ILocalizationManagerInternalWinforms.cs new file mode 100644 index 0000000..022e9e4 --- /dev/null +++ b/src/L10NSharp/WindowsForms/ILocalizationManagerInternalWinforms.cs @@ -0,0 +1,28 @@ +// Copyright © 2019-2025 SIL Global +// This software is licensed under the MIT License (http://opensource.org/licenses/MIT) + +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Drawing; +using System.Windows.Forms; + +namespace L10NSharp.WindowsForms +{ + internal interface ILocalizationManagerInternalWinforms: ILocalizationManagerInternal + { + Dictionary ToolTipCtrls { get; } + Icon ApplicationIcon { get; set; } + + void RegisterComponentForLocalizing(IComponent component, string id, string defaultText, + string defaultTooltip, string defaultShortcutKeys, string comment); + void RegisterComponentForLocalizing(LocalizingInfo info, + Action successAction); + + } + + internal interface ILocalizationManagerInternalWinforms : ILocalizationManagerInternalWinforms, ILocalizationManagerInternal + { + + } +} diff --git a/src/L10NSharp/WindowsForms/LocalizationManagerInternalWinforms.cs b/src/L10NSharp/WindowsForms/LocalizationManagerInternalWinforms.cs new file mode 100644 index 0000000..c2205ec --- /dev/null +++ b/src/L10NSharp/WindowsForms/LocalizationManagerInternalWinforms.cs @@ -0,0 +1,217 @@ +// Copyright © 2022-2025 SIL Global +// This software is licensed under the MIT License (http://opensource.org/licenses/MIT) + +using System; +using System.Collections.Concurrent; +using System.Collections.Generic; +using System.ComponentModel; +using System.Drawing; +using System.Globalization; +using System.IO; +using System.Linq; +using System.Reflection; +using System.Windows.Forms; +using L10NSharp.WindowsForms.XLiffUtils; +// ReSharper disable StaticMemberInGenericType - these static fields are parameter-independent + +namespace L10NSharp.WindowsForms +{ + internal static class LocalizationManagerInternalWinforms + { + private static readonly Dictionary> s_loadedManagers = + new Dictionary>(); + internal static Dictionary> LoadedManagers => s_loadedManagers; + + private static HashSet PreviouslyLoadedManagers = new HashSet(); + internal static void RemoveManager(string id) + { + if (LoadedManagers.ContainsKey(id)) + { + LoadedManagers.Remove(id); + PreviouslyLoadedManagers.Add(id); + } + } + + #region Static methods for creating a LocalizationManagerInternal + private static ILocalizationManager Create(string desiredUiLangId, string appId, + string appName, string relativeSettingPathForLocalizationFolder, + Icon applicationIcon, Func> createMethod) + { + if (string.IsNullOrEmpty(relativeSettingPathForLocalizationFolder)) + relativeSettingPathForLocalizationFolder = appName; + else if (Path.IsPathRooted(relativeSettingPathForLocalizationFolder)) + throw new ArgumentException(@"Relative (non-rooted) path expected", nameof(relativeSettingPathForLocalizationFolder)); + + var directoryOfWritableTranslationFiles = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), + relativeSettingPathForLocalizationFolder, "localizations"); + + if (!LoadedManagers.TryGetValue(appId, out var lm)) + { + lm = createMethod(directoryOfWritableTranslationFiles); + + LoadedManagers[appId] = lm; + PreviouslyLoadedManagers.Remove(appId); + } + + lm.ApplicationIcon = applicationIcon; + + if (string.IsNullOrEmpty(desiredUiLangId)) + { + desiredUiLangId = CultureInfo.CurrentUICulture.TwoLetterISOLanguageName; + } + + if (!LocalizationManagerInternal.IsDesiredUiCultureAvailable(desiredUiLangId)) + { + desiredUiLangId = LocalizationManagerInternal.ChooseFallbackLanguage(); + } + + LocalizationManager.SetUILanguage(desiredUiLangId, false); + + LocalizationManager.EnableClickingOnControlToBringUpLocalizationDialog = true; + + return lm; + } + /// ------------------------------------------------------------------------------------ + /// + /// Creates a new instance of a localization manager for the specified application id. + /// If a localization manager has already been created for the specified id, then + /// that is returned. + /// + /// The language code of the desired UI language. If + /// there are no translations for that ID, a message is displayed and the UI language + /// falls back to the default. + /// The application Id (e.g. 'Pa' for Phonology Assistant). + /// This should be a unique name that identifies the manager for an assembly or + /// application. May include an optional file extension, which will be stripped off but + /// used to correctly set the "original" attribute when persisting an XLIFF file. The + /// base portion must still be unique (i.e., it is not valid to create a LM for + /// "Blah.exe" and another for "Blah.dll"). + /// The application's name. This will appear to the user + /// in the localization dialog box as a parent item in the tree. + /// + /// The full folder path of the original Xliff files + /// installed with the application. + /// The path, relative to + /// %appdata%, where your application stores user settings (e.g., "SIL\SayMore"). + /// A folder named "localizations" will be created there. + /// + /// MethodInfo objects representing + /// additional methods that should be regarded as calls to get localizations. If the method + /// is named "Localize", the extractor will attempt to parse its signature as an extension + /// method with the parameters (this string s, string separateId="", string comment=""). + /// Otherwise, it will be treated like a L10nSharp GetString method if its signature + /// matches one of the following: (string stringId, string englishText), + /// (string stringId, string englishText, string comment), or + /// (string stringId, string englishText, string comment, string englishToolTipText, + /// string englishShortcutKey, IComponent component). + /// A list of namespace beginnings indicating + /// what types to scan for localized string calls. For example, to only scan + /// types found in Pa.exe and assuming all types in that assembly begin with + /// 'Pa', then this value would only contain the string 'Pa'. + /// ------------------------------------------------------------------------------------ + public static ILocalizationManager CreateXliff(string desiredUiLangId, string appId, + string appName, string appVersion, string directoryOfInstalledXliffFiles, + string relativeSettingPathForLocalizationFolder, + Icon applicationIcon, + IEnumerable additionalLocalizationMethods, + params string[] namespaceBeginnings) + { + if (string.IsNullOrWhiteSpace(appId)) + throw new ArgumentNullException(nameof(appId)); + var origExeExtension = Path.GetExtension(appId); + if (origExeExtension == string.Empty) + origExeExtension = ".dll"; + appId = Path.GetFileNameWithoutExtension(appId); + + return Create(desiredUiLangId, appId, appName, + relativeSettingPathForLocalizationFolder, applicationIcon, + directoryOfWritableXliffFiles => + (ILocalizationManagerInternalWinforms)new XliffLocalizationManagerWinforms(appId, origExeExtension, appName, + appVersion, directoryOfInstalledXliffFiles, + directoryOfWritableXliffFiles, directoryOfWritableXliffFiles, + additionalLocalizationMethods, + namespaceBeginnings)); + } + + /// ------------------------------------------------------------------------------------ + internal static ILocalizationManagerInternalWinforms GetLocalizationManagerForComponent( + IComponent component) + { + return LoadedManagers.Values.FirstOrDefault(lm => lm.ComponentCache.ContainsKey(component)); + } + + /// ------------------------------------------------------------------------------------ + internal static ILocalizationManagerInternalWinforms GetLocalizationManagerForString(string id) + { + return LoadedManagers.Values.FirstOrDefault( + lm => lm.StringCache.GetString(LocalizationManager.UILanguageId, id) != null); + } + + #endregion + /// ------------------------------------------------------------------------------------ + public static string GetLocalizedToolTipForControl(Control ctrl) + { + var lm = LocalizationManagerInternalWinforms.GetLocalizationManagerForComponent(ctrl); + var topCtrl = GetRealTopLevelControl(ctrl); + if (topCtrl == null || lm == null) + return null; + + return lm.ToolTipCtrls.TryGetValue(topCtrl, out var ttctrl) ? ttctrl.GetToolTip(ctrl) + : null; + } + + /// ------------------------------------------------------------------------------------ + /// + /// Gets the real top level control (using the control's TopLevelControl property + /// seems to return null until the control is on a form). + /// + /// ------------------------------------------------------------------------------------ + internal static Control GetRealTopLevelControl(Control ctrl) + { + var parentControl = ctrl; + while (parentControl.Parent != null) + parentControl = parentControl.Parent; + + return parentControl; + } + + /// + /// Merge the existing English translation file into newly collected data and write the result to the temp + /// directory. + /// + public static void MergeExistingEnglishTranslationFileIntoNew(string installedStringFileFolder, + string appId) + { + if (!LoadedManagers.TryGetValue(appId, out var lm)) + return; + if (!lm.StringCache.TryGetDocument("en", out var newDoc)) + return; + var oldDocPath = Path.Combine(installedStringFileFolder, + LocalizationManager.GetTranslationFileNameForLanguage(appId, "en")); + + lm.MergeTranslationDocuments(appId, newDoc, oldDocPath); + } + + public static string GetString(string stringId, string englishText, string comment, string englishToolTipText, + string englishShortcutKey, IComponent component) + { + if (component != null) + { + var lm = GetLocalizationManagerForComponent(component) ?? + GetLocalizationManagerForString(stringId); + + if (lm != null) + { + lm.RegisterComponentForLocalizing(component, stringId, englishText, + englishToolTipText, englishShortcutKey, comment); + + return lm.GetLocalizedString(stringId, englishText); + } + } + + return LocalizationManagerInternal.GetStringFromAnyLocalizationManager(stringId) ?? + LocalizationManager.StripOffLocalizationInfoFromText(englishText); + } + + } +} diff --git a/src/L10NSharp/WindowsForms/LocalizationManagerWinforms.cs b/src/L10NSharp/WindowsForms/LocalizationManagerWinforms.cs new file mode 100644 index 0000000..7595615 --- /dev/null +++ b/src/L10NSharp/WindowsForms/LocalizationManagerWinforms.cs @@ -0,0 +1,84 @@ +// Copyright © 2022-2025 SIL Global +// This software is licensed under the MIT License (http://opensource.org/licenses/MIT) + +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Diagnostics; +using System.Drawing; +using System.Globalization; +using System.IO; +using System.Reflection; +using System.Threading; +using System.Windows.Forms; +using L10NSharp.TMXUtils; +using L10NSharp.UI; +using L10NSharp.XLiffUtils; + +namespace L10NSharp.WindowsForms +{ + public static class LocalizationManagerWinforms + { + + public static string GetLocalizedToolTipForControl(Control ctrl) + { + switch (LocalizationManager.TranslationMemoryKind) + { + default: + case TranslationMemory.XLiff: + return LocalizationManagerInternalWinforms.GetLocalizedToolTipForControl(ctrl); + } + } + + /// ------------------------------------------------------------------------------------ + internal static Dictionary LoadedManagers + { + get + { + switch (LocalizationManager.TranslationMemoryKind) + { + default: + case TranslationMemory.XLiff: + { + var loadedManagers = new Dictionary(); + foreach (var keyValuePair in LocalizationManagerInternalWinforms.LoadedManagers) + { + loadedManagers.Add(keyValuePair.Key, keyValuePair.Value); + } + + return loadedManagers; + } + } + } + } + + internal static void ClearLoadedManagers() + { + switch (LocalizationManager.TranslationMemoryKind) + { + default: + case TranslationMemory.XLiff: + LocalizationManagerInternal.LoadedManagers.Clear(); + break; + } + } + + /// + /// True (default) to throw if we try to get a string from a particular manager + /// and it has been disposed. When false, we will instead just return the English string, + /// or if none, the ID. This is useful in some apps (e.g., Bloom) which may + /// accidentally request a localized string during shutdown after disposing of + /// the localization managers. + /// + public static bool ThrowIfManagerDisposed = true; + + /// + /// True (default) to throw if we try to get a localized string before creating any localization managers. + /// This is to prevent an invalid state where language IDs get mapped incorrectly at the beginning and + /// then never get updated which can cause us to fail to return properly localized strings when requested (see BL-13245). + /// The fix is to ensure that a LocalizationManager is created before calling any localization methods. + /// Or, to maintain prior behavior, set this to false. + /// + public static bool StrictInitializationMode = true; + } +} diff --git a/src/L10NSharp/WindowsForms/UtilsWinforms.cs b/src/L10NSharp/WindowsForms/UtilsWinforms.cs new file mode 100644 index 0000000..872c326 --- /dev/null +++ b/src/L10NSharp/WindowsForms/UtilsWinforms.cs @@ -0,0 +1,43 @@ +using System.Windows.Forms; + +namespace L10NSharp.WindowsForms +{ + /// ---------------------------------------------------------------------------------------- + internal static class UtilsWinforms + { + private const int WM_SETREDRAW = 0xB; + + /// ------------------------------------------------------------------------------------ + /// + /// Turns window redrawing on or off. After turning on, the window will be invalidated. + /// + /// ------------------------------------------------------------------------------------ + public static void SetWindowRedraw(Control ctrl, bool turnOn) + { + SetWindowRedraw(ctrl, turnOn, true); + } + + /// ------------------------------------------------------------------------------------ + public static void SetWindowRedraw(Control ctrl, bool turnOn, + bool invalidateAfterTurningOn) + { + if (ctrl != null && !ctrl.IsDisposed && ctrl.IsHandleCreated) + { + if (Utils.IsMono) + { + if (turnOn) + ctrl.ResumeLayout(invalidateAfterTurningOn); + else + ctrl.SuspendLayout(); + } + else + { + Utils.SendMessage(ctrl.Handle, WM_SETREDRAW, (turnOn ? 1 : 0), 0); + } + + if (turnOn && invalidateAfterTurningOn) + ctrl.Invalidate(true); + } + } + } +} diff --git a/src/L10NSharp/WindowsForms/XLiffUtils/XliffLocalizationManagerWinforms.cs b/src/L10NSharp/WindowsForms/XLiffUtils/XliffLocalizationManagerWinforms.cs new file mode 100644 index 0000000..50dd247 --- /dev/null +++ b/src/L10NSharp/WindowsForms/XLiffUtils/XliffLocalizationManagerWinforms.cs @@ -0,0 +1,625 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Diagnostics; +using System.Drawing; +using System.IO; +using System.Linq; +using System.Reflection; +using System.Security; +using System.Security.Permissions; +using System.Text.RegularExpressions; +using System.Windows.Forms; +using System.Xml.Linq; +using L10NSharp.UI; +using L10NSharp.XLiffUtils; + +namespace L10NSharp.WindowsForms.XLiffUtils +{ + /// ---------------------------------------------------------------------------------------- + internal class XliffLocalizationManagerWinforms : XliffLocalizationManager, ILocalizationManagerInternalWinforms + { + /// ------------------------------------------------------------------------------------ + private static Icon _applicationIcon; + public Dictionary ToolTipCtrls { get; } + + #region XliffLocalizationManager construction/disposal + /// ------------------------------------------------------------------------------------ + internal XliffLocalizationManagerWinforms(string appId, string origExtension, string appName, + string appVersion, string directoryOfInstalledXliffFiles, + string directoryForGeneratedDefaultXliffFile, string directoryOfUserModifiedXliffFiles, + IEnumerable additionalLocalizationMethods, + params string[] namespaceBeginnings) : base(appId, appName ?? appId, appVersion) + { + ToolTipCtrls = new Dictionary(); + } + + /// Sometimes, on Linux, there is an empty DefaultStringFile. This causes problems. + private bool DefaultStringFileExistsAndHasContents() + { + return File.Exists(DefaultStringFilePath) && !string.IsNullOrWhiteSpace(File.ReadAllText(DefaultStringFilePath)); + } + + /// ------------------------------------------------------------------------------------ + /*public void Dispose() + { + LocalizationManagerInternal.RemoveManager(Id); + }*/ + + #endregion + + #region Methods for caching and localizing objects. + /// + /// Adds the specified component to the localization manager's cache of objects to be + /// localized and then applies localizations for the current UI language. + /// + /// ------------------------------------------------------------------------------------ + public void RegisterComponentForLocalizing(IComponent component, string id, string + defaultText, string defaultTooltip, string defaultShortcutKeys, string comment) + { + RegisterComponentForLocalizing(new LocalizingInfo(component, id) + { + Text = defaultText, + ToolTipText = defaultTooltip, + ShortcutKeys = defaultShortcutKeys, + Comment = comment + }, null); + } + + public void RegisterComponentForLocalizing(LocalizingInfo info, + Action successAction) + { + var component = info.Component; + var id = info.Id; + if (component == null || string.IsNullOrWhiteSpace(id)) + return; + + try + { + + // This if/else used to be more concise but sometimes there were occasions + // adding an item the first time using ComponentCache[component] = id would throw an + // index outside the bounds of the array exception. I have no clue why nor + // can I reliably reproduce the error nor do I know if this change will solve + // the problem. Hopefully it will, but my guess is the same underlying code + // will be called. + if (ComponentCache.ContainsKey(component)) + ComponentCache[component] = id; //somehow, we sometimes see "Msg: Index was outside the bounds of the array." + else + { + var lm = LocalizationManagerInternalWinforms.GetLocalizationManagerForString(id); + if (lm != null && lm != this) + { + lm.RegisterComponentForLocalizing(info, successAction); + return; + } + if (component is ILocalizableComponent) + ComponentCache.Add(component, id); + else + { + // If this is the first time this object has passed this way, then + // prepare it to be available for end-user localization. + PrepareComponentForRuntimeLocalization(component); + ComponentCache.Add(component, id); + // Make it available for the config dialog to localize. + StringCache.UpdateLocalizedInfo(info); + } + } + + successAction?.Invoke(this, info); + } + catch (Exception) + { +#if DEBUG + throw; // if you hit this ( Index was outside the bounds of the array) try to figure out why. What is the hash (?) value for the component? +#endif + } + } + + /// ------------------------------------------------------------------------------------ + /// + /// Prepares the specified component for runtime localization by subscribing to a + /// mouse down event that will monitor whether or not to show the localization + /// dialog box. + /// + /// ------------------------------------------------------------------------------------ + private void PrepareComponentForRuntimeLocalization(IComponent component) + { + var toolStripItem = component as ToolStripItem; + if (toolStripItem != null) + { + toolStripItem.MouseDown += HandleToolStripItemMouseDown; + toolStripItem.Disposed += HandleToolStripItemDisposed; + return; + } + + // For component that are part of an owning parent control that needs to + // do some special handling when the user wants to localize, we need + // the parent to subscribe to the mouse event, but we don't want to + // subscribe once per column/page, so we first unsubscribe and then + // subscribe. It's a little ugly, but there doesn't seem to be a better way: + // http://stackoverflow.com/questions/399648/preventing-same-event-handler-assignment-multiple-times + + var ctrl = component as Control; + if (ctrl != null) + { + ctrl.Disposed += HandleControlDisposed; + + TabPage tpg = ctrl as TabPage; + if (tpg != null && tpg.Parent is TabControl) + { + tpg.Parent.MouseDown -= HandleControlMouseDown; + tpg.Parent.MouseDown += HandleControlMouseDown; + tpg.Parent.Disposed -= HandleControlDisposed; + tpg.Parent.Disposed += HandleControlDisposed; + tpg.Disposed += HandleTabPageDisposed; + return; + } + + ctrl.MouseDown += HandleControlMouseDown; + return; + } + + var columnHeader = component as ColumnHeader; + if (columnHeader != null && columnHeader.ListView != null) + { + columnHeader.ListView.Disposed -= HandleListViewDisposed; + columnHeader.ListView.Disposed += HandleListViewDisposed; + columnHeader.ListView.ColumnClick -= HandleListViewColumnHeaderClicked; + columnHeader.ListView.ColumnClick += HandleListViewColumnHeaderClicked; + columnHeader.Disposed += HandleListViewColumnDisposed; + } + + var dataGridViewColumn = component as DataGridViewColumn; + if (dataGridViewColumn != null && dataGridViewColumn.DataGridView != null) + { + dataGridViewColumn.DataGridView.CellMouseDown -= HandleDataGridViewCellMouseDown; + dataGridViewColumn.DataGridView.CellMouseDown += HandleDataGridViewCellMouseDown; + dataGridViewColumn.DataGridView.Disposed -= HandleDataGridViewDisposed; + dataGridViewColumn.DataGridView.Disposed += HandleDataGridViewDisposed; + dataGridViewColumn.Disposed += HandleColumnDisposed; + } + } + #endregion + + #region Methods for showing localization dialog box + /// ------------------------------------------------------------------------------------ + public void ShowLocalizationDialogBox(bool runInReadonlyMode, IWin32Window owner = null) + { + LocalizeItemDlg.ShowDialog(this, "", runInReadonlyMode, owner); + } + + /// ------------------------------------------------------------------------------------ + public static void ShowLocalizationDialogBox(IComponent component, + IWin32Window owner = null) + { + if (owner == null) + owner = (component as Control)?.FindForm(); + TipDialog.ShowAltShiftClickTip(owner); + LocalizeItemDlg.ShowDialog(LocalizationManagerInternal.GetLocalizationManagerForComponent(component), + component, false, owner); + } + + /// ------------------------------------------------------------------------------------ + public static void ShowLocalizationDialogBox(string id, IWin32Window owner = null) + { + TipDialog.ShowAltShiftClickTip(owner); + LocalizeItemDlg.ShowDialog(LocalizationManagerInternal.GetLocalizationManagerForString(id), id, false, owner); + } + + #endregion + + #region Non static methods for getting localized strings + /// ------------------------------------------------------------------------------------ + private Keys GetShortCutKeyFromStringCache(string uiLangId, string id) + { + var realLangId = LocalizationManagerInternal.MapToExistingLanguageIfPossible(uiLangId); + return StringCache.GetShortcutKeys(realLangId, id); + } + + #endregion + + #region Methods that apply localizations to an object. + /// ------------------------------------------------------------------------------------ + /// + /// Recreates the tooltip control and updates the tooltip text for each object having + /// a tooltip. This is necessary sometimes when controls get moved from form to form + /// during runtime. + /// + /// ------------------------------------------------------------------------------------ + public new void RefreshToolTips() + { + foreach (var toolTipCtrl in ToolTipCtrls.Values) + toolTipCtrl.Dispose(); + + ToolTipCtrls.Clear(); + + // This used to be a for-each, but on rare occasions, a "Collection was + // modified; enumeration operation may not execute" exception would be + // thrown. This should solve the problem. + var controls = ComponentCache.Where(x => x.Key is Control).ToArray(); + foreach (var ctrl in controls) + { + var toolTipText = GetTooltipFromStringCache(UILanguageId, ctrl.Value); + if (!string.IsNullOrEmpty(toolTipText)) //JH: hoping to speed this up a bit + ApplyLocalizedToolTipToControl((Control)ctrl.Key, toolTipText); + } + } + + /// ------------------------------------------------------------------------------------ + /// + /// Initializes the specified component. + /// + /// ------------------------------------------------------------------------------------ + public new void ApplyLocalization(IComponent component) + { + if (component == null) + return; + + if (!ComponentCache.TryGetValue(component, out var id)) + return; + + if (component is ILocalizableComponent locComponent) + { + if (LocalizableComponents.TryGetValue(locComponent, out var idToLocInfo)) + { + ApplyLocalizationsToLocalizableComponent(locComponent, idToLocInfo); + return; + } + } + + if (ApplyLocalizationsToControl(component as Control, id)) + return; + + if (ApplyLocalizationsToToolStripItem(component as ToolStripItem, id)) + return; + + if (ApplyLocalizationsToListViewColumnHeader(component as ColumnHeader, id)) + return; + + ApplyLocalizationsToDataGridViewColumn(component as DataGridViewColumn, id); + } + + /// ------------------------------------------------------------------------------------ + /// + /// Initializes the specified control. + /// + /// ------------------------------------------------------------------------------------ + private bool ApplyLocalizationsToControl(Control ctrl, string id) + { + if (ctrl == null) + return false; + + var text = GetStringFromStringCache(UILanguageId, id); + var toolTipText = GetTooltipFromStringCache(UILanguageId, id); + + if (text != null && string.CompareOrdinal(ctrl.Text, text) != 0) + ctrl.Text = text; + + ApplyLocalizedToolTipToControl(ctrl, toolTipText); + return true; + } + + /// ------------------------------------------------------------------------------------ + private void ApplyLocalizedToolTipToControl(Control ctrl, string toolTipText) + { + var topCtrl = LocalizationManagerInternalWinforms.GetRealTopLevelControl(ctrl); + if (topCtrl == null) + return; + + // Check if the control's top level control has a reference to a tooltip. If + // it does, then use that tooltip for assigning tooltip text to the control. + // Otherwise, create a new tooltip and reference it using the control's top + // level control. + if (!ToolTipCtrls.TryGetValue(topCtrl, out var ttCtrl)) + { + if (string.IsNullOrEmpty(toolTipText)) + return; + + ttCtrl = new ToolTip(); + ToolTipCtrls[topCtrl] = ttCtrl; + topCtrl.ParentChanged += HandleToolTipRefChanged; + topCtrl.HandleDestroyed += HandleToolTipRefDestroyed; + } + + ttCtrl.SetToolTip(ctrl, toolTipText); + } + + /// ------------------------------------------------------------------------------------ + /// + /// Handles the case when a tooltip instance was created and assigned to a top level + /// control that has now been added to another control, thus making the other control + /// top level instead. Therefore, we need to make sure the tooltip is reassigned to + /// the new top level control. + /// + /// ------------------------------------------------------------------------------------ + private void HandleToolTipRefChanged(object sender, EventArgs e) + { + var oldTopCtrl = sender as Control; + var newTopCtrl = LocalizationManagerInternalWinforms.GetRealTopLevelControl(oldTopCtrl); + if (oldTopCtrl == null || newTopCtrl == null) + return; + + oldTopCtrl.ParentChanged -= HandleToolTipRefChanged; + newTopCtrl.ParentChanged += HandleToolTipRefChanged; + RefreshToolTips(); + } + + /// ------------------------------------------------------------------------------------ + /// + /// Handles removing tooltip controls from the global tool tip collection for top level + /// controls that are destroyed and have controls on them using tool tip controls from + /// that collection. + /// + /// ------------------------------------------------------------------------------------ + private void HandleToolTipRefDestroyed(object sender, EventArgs e) + { + if (!(sender is Control topCtrl)) + return; + + topCtrl.ParentChanged -= HandleToolTipRefChanged; + topCtrl.HandleDestroyed -= HandleToolTipRefDestroyed; + + if (ToolTipCtrls.TryGetValue(topCtrl, out var ttCtrl)) + ttCtrl.Dispose(); + + ToolTipCtrls.Remove(topCtrl); + } + + /// ------------------------------------------------------------------------------------ + private bool ApplyLocalizationsToToolStripItem(ToolStripItem item, string id) + { + if (item == null) + return false; + + var text = GetStringFromStringCache(UILanguageId, id); + var toolTipText = GetTooltipFromStringCache(UILanguageId, id); + item.Text = text ?? LocalizationManager.StripOffLocalizationInfoFromText(item.Text); + item.ToolTipText = toolTipText ?? LocalizationManager.StripOffLocalizationInfoFromText(item.ToolTipText); + + var shortcutKeys = GetShortCutKeyFromStringCache(UILanguageId, id); + if (item is ToolStripMenuItem menuItem && shortcutKeys != Keys.None) + menuItem.ShortcutKeys = shortcutKeys; + + return true; + } + + /// ------------------------------------------------------------------------------------ + private bool ApplyLocalizationsToListViewColumnHeader(ColumnHeader hdr, string id) + { + if (hdr == null) + return false; + + var text = GetStringFromStringCache(UILanguageId, id); + hdr.Text = text ?? LocalizationManager.StripOffLocalizationInfoFromText(hdr.Text); + return true; + } + + /// ------------------------------------------------------------------------------------ + private bool ApplyLocalizationsToDataGridViewColumn(DataGridViewColumn col, string id) + { + if (col == null) + return false; + + var text = GetStringFromStringCache(UILanguageId, id); + col.HeaderText = text ?? LocalizationManager.StripOffLocalizationInfoFromText(col.HeaderText); + col.ToolTipText = GetTooltipFromStringCache(UILanguageId, id); + return true; + } + + #endregion + + #region Mouse down, handle destroyed, and dispose handlers + /// ------------------------------------------------------------------------------------ + /// + /// Handles Ctrl-Shift-Click on ToolStripItems; + /// + /// ------------------------------------------------------------------------------------ + internal void HandleToolStripItemMouseDown(object sender, MouseEventArgs e) + { + if (!DoHandleMouseDown) + return; + + // Make sure all drop-downs are closed that are in the + // chain of menu items for this item. + Form owningForm = null; + if (sender is ToolStripDropDownItem tsddi) + { + owningForm = tsddi.Owner?.FindForm(); + while (tsddi != null) + { + tsddi.DropDown.Close(); + + if (tsddi.Owner is ContextMenuStrip menuStrip) + menuStrip.Close(); + + tsddi = tsddi.OwnerItem as ToolStripDropDownItem; + } + } + + LocalizeItemDlg.ShowDialog(this, (IComponent)sender, false, + owningForm); + } + + private static bool DoHandleMouseDown => + LocalizationManager.EnableClickingOnControlToBringUpLocalizationDialog && + Control.ModifierKeys == (Keys.Alt | Keys.Shift); + + public Icon ApplicationIcon + { + get => _applicationIcon; + set => _applicationIcon = value; + } + + /// ------------------------------------------------------------------------------------ + /// + /// Handles the tool strip item disposed. + /// + /// ------------------------------------------------------------------------------------ + private void HandleToolStripItemDisposed(object sender, EventArgs e) + { + if (sender is ToolStripItem item) + { + item.MouseDown -= HandleToolStripItemMouseDown; + item.Disposed -= HandleToolStripItemDisposed; + + ComponentCache.Remove(item); + } + } + + /// ------------------------------------------------------------------------------------ + /// + /// Handles Alt-Shift-Click on controls. + /// + /// ------------------------------------------------------------------------------------ + internal void HandleControlMouseDown(object sender, MouseEventArgs e) + { + if (!DoHandleMouseDown) + return; + + var ctrl = sender as Control; + + if (ctrl is TabControl tabControl) + { + for (int i = 0; i < tabControl.TabPages.Count; i++) + { + if (tabControl.GetTabRect(i).Contains(e.Location)) + { + ctrl = tabControl.TabPages[i]; + break; + } + } + } + + var lm = LocalizationManagerInternal.GetLocalizationManagerForComponent(ctrl); + + LocalizationManager.OnLaunchingLocalizationDialog(lm); + LocalizeItemDlg.ShowDialog(lm, ctrl, false, ctrl?.FindForm()); + LocalizationManager.OnClosingLocalizationDialog(lm); + } + + /// ------------------------------------------------------------------------------------ + /// + /// When controls get destroyed, do a little clean-up. + /// + /// ------------------------------------------------------------------------------------ + internal void HandleControlDisposed(object sender, EventArgs e) + { + var ctrl = sender as Control; + if (ctrl == null) + return; + + ctrl.Disposed -= HandleControlDisposed; + ctrl.MouseDown -= HandleControlMouseDown; + + ComponentCache.Remove(ctrl); + } + + /// ------------------------------------------------------------------------------------ + /// + /// When a TabPage gets disposed, remove reference to it from the object cache. + /// + /// ------------------------------------------------------------------------------------ + internal void HandleTabPageDisposed(object sender, EventArgs e) + { + if (!(sender is TabPage tabPage)) + return; + + tabPage.Disposed -= HandleTabPageDisposed; + ComponentCache.Remove(tabPage); + } + + /// ------------------------------------------------------------------------------------ + /// + /// When DataGridView controls get disposed, do a little clean-up. + /// + /// ------------------------------------------------------------------------------------ + internal void HandleDataGridViewDisposed(object sender, EventArgs e) + { + if (!(sender is DataGridView grid)) + return; + + grid.Disposed -= HandleControlDisposed; + grid.CellMouseDown -= HandleDataGridViewCellMouseDown; + + ComponentCache.Remove(grid); + } + + /// ------------------------------------------------------------------------------------ + /// + /// Handles ListView column header clicks. Unfortunately, even if the localization + /// dialog box is shown, this click on the header will not get eaten (like it does + /// for other controls). Therefore, if clicking on the column header sorts the column, + /// that sorting will take place after the dialog box is closed. + /// + /// ------------------------------------------------------------------------------------ + internal void HandleListViewColumnHeaderClicked(object sender, ColumnClickEventArgs e) + { + if (!DoHandleMouseDown) + return; + + if (sender is ListView lv && ComponentCache.ContainsKey(lv.Columns[e.Column])) + LocalizeItemDlg.ShowDialog(this, lv.Columns[e.Column], false, + lv.FindForm()); + } + + /// ------------------------------------------------------------------------------------ + /// + /// When ListView controls get disposed, do a little clean-up. + /// + /// ------------------------------------------------------------------------------------ + internal void HandleListViewDisposed(object sender, EventArgs e) + { + if (!(sender is ListView lv)) + return; + + lv.Disposed -= HandleListViewDisposed; + lv.ColumnClick -= HandleListViewColumnHeaderClicked; + } + + /// ------------------------------------------------------------------------------------ + /// + /// When ListView ColumnHeader controls get disposed, remove the reference to it from the + /// object cache. + /// + /// ------------------------------------------------------------------------------------ + internal void HandleListViewColumnDisposed(object sender, EventArgs e) + { + if (!(sender is ColumnHeader column)) + return; + + column.Disposed -= HandleListViewColumnDisposed; + ComponentCache.Remove(column); + } + + /// ------------------------------------------------------------------------------------ + internal void HandleDataGridViewCellMouseDown(object sender, DataGridViewCellMouseEventArgs e) + { + if (!DoHandleMouseDown) + return; + + if (sender is DataGridView grid && e.RowIndex < 0 && + ComponentCache.ContainsKey(grid.Columns[e.ColumnIndex])) + { + LocalizeItemDlg.ShowDialog(this, grid.Columns[e.ColumnIndex], false, + grid.FindForm()); + } + } + + /// ------------------------------------------------------------------------------------ + /// + /// When DataGridViewColumn controls get disposed, remove the reference to it from the + /// object cache. + /// + /// ------------------------------------------------------------------------------------ + internal void HandleColumnDisposed(object sender, EventArgs e) + { + if (!(sender is DataGridViewColumn column)) + return; + + column.Disposed -= HandleColumnDisposed; + ComponentCache.Remove(column); + } + #endregion + } +} diff --git a/src/L10NSharp/XLiffUtils/XliffLocalizationManager.cs b/src/L10NSharp/XLiffUtils/XliffLocalizationManager.cs index 867ee6d..4bf0172 100644 --- a/src/L10NSharp/XLiffUtils/XliffLocalizationManager.cs +++ b/src/L10NSharp/XLiffUtils/XliffLocalizationManager.cs @@ -2,14 +2,13 @@ using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; -using System.Drawing; +//using System.Drawing; using System.IO; using System.Linq; using System.Reflection; using System.Security; using System.Security.Permissions; using System.Text.RegularExpressions; -using System.Windows.Forms; using System.Xml.Linq; using L10NSharp.UI; @@ -20,8 +19,6 @@ internal class XliffLocalizationManager : ILocalizationManagerInternal ComponentCache { get; } - public Dictionary ToolTipCtrls { get; } + //public Dictionary ToolTipCtrls { get; } public Dictionary> LocalizableComponents { get; } #region Static methods @@ -131,7 +128,7 @@ internal XliffLocalizationManager(string appId, string origExtension, string app } ComponentCache = new Dictionary(); - ToolTipCtrls = new Dictionary(); + //ToolTipCtrls = new Dictionary(); StringCache = new XliffLocalizedStringCache(this); LocalizableComponents = new Dictionary>(); @@ -284,33 +281,6 @@ public void Dispose() #endregion - #region Methods for showing localization dialog box - /// ------------------------------------------------------------------------------------ - public void ShowLocalizationDialogBox(bool runInReadonlyMode, IWin32Window owner = null) - { - LocalizeItemDlg.ShowDialog(this, "", runInReadonlyMode, owner); - } - - /// ------------------------------------------------------------------------------------ - public static void ShowLocalizationDialogBox(IComponent component, - IWin32Window owner = null) - { - if (owner == null) - owner = (component as Control)?.FindForm(); - TipDialog.ShowAltShiftClickTip(owner); - LocalizeItemDlg.ShowDialog(LocalizationManagerInternal.GetLocalizationManagerForComponent(component), - component, false, owner); - } - - /// ------------------------------------------------------------------------------------ - public static void ShowLocalizationDialogBox(string id, IWin32Window owner = null) - { - TipDialog.ShowAltShiftClickTip(owner); - LocalizeItemDlg.ShowDialog(LocalizationManagerInternal.GetLocalizationManagerForString(id), id, false, owner); - } - - #endregion - #region Public Properties /// ------------------------------------------------------------------------------------ /// @@ -454,139 +424,6 @@ public IEnumerable FilenamesToAddToCache #endregion #region Methods for caching and localizing objects. - /// ------------------------------------------------------------------------------------ - /// - /// Adds the specified component to the localization manager's cache of objects to be - /// localized and then applies localizations for the current UI language. - /// - /// ------------------------------------------------------------------------------------ - public void RegisterComponentForLocalizing(IComponent component, string id, string - defaultText, string defaultTooltip, string defaultShortcutKeys, string comment) - { - RegisterComponentForLocalizing(new LocalizingInfo(component, id) - { - Text = defaultText, - ToolTipText = defaultTooltip, - ShortcutKeys = defaultShortcutKeys, - Comment = comment - }, null); - } - - public void RegisterComponentForLocalizing(LocalizingInfo info, - Action successAction) - { - var component = info.Component; - var id = info.Id; - if (component == null || string.IsNullOrWhiteSpace(id)) - return; - - try - { - - // This if/else used to be more concise but sometimes there were occasions - // adding an item the first time using ComponentCache[component] = id would throw an - // index outside the bounds of the array exception. I have no clue why nor - // can I reliably reproduce the error nor do I know if this change will solve - // the problem. Hopefully it will, but my guess is the same underlying code - // will be called. - if (ComponentCache.ContainsKey(component)) - ComponentCache[component] = id; //somehow, we sometimes see "Msg: Index was outside the bounds of the array." - else - { - var lm = LocalizationManagerInternal.GetLocalizationManagerForString(id); - if (lm != null && lm != this) - { - lm.RegisterComponentForLocalizing(info, successAction); - return; - } - if (component is ILocalizableComponent) - ComponentCache.Add(component, id); - else - { - // If this is the first time this object has passed this way, then - // prepare it to be available for end-user localization. - PrepareComponentForRuntimeLocalization(component); - ComponentCache.Add(component, id); - // Make it available for the config dialog to localize. - StringCache.UpdateLocalizedInfo(info); - } - } - - successAction?.Invoke(this, info); - } - catch (Exception) - { -#if DEBUG - throw; // if you hit this ( Index was outside the bounds of the array) try to figure out why. What is the hash (?) value for the component? -#endif - } - } - - /// ------------------------------------------------------------------------------------ - /// - /// Prepares the specified component for runtime localization by subscribing to a - /// mouse down event that will monitor whether or not to show the localization - /// dialog box. - /// - /// ------------------------------------------------------------------------------------ - private void PrepareComponentForRuntimeLocalization(IComponent component) - { - var toolStripItem = component as ToolStripItem; - if (toolStripItem != null) - { - toolStripItem.MouseDown += HandleToolStripItemMouseDown; - toolStripItem.Disposed += HandleToolStripItemDisposed; - return; - } - - // For component that are part of an owning parent control that needs to - // do some special handling when the user wants to localize, we need - // the parent to subscribe to the mouse event, but we don't want to - // subscribe once per column/page, so we first unsubscribe and then - // subscribe. It's a little ugly, but there doesn't seem to be a better way: - // http://stackoverflow.com/questions/399648/preventing-same-event-handler-assignment-multiple-times - - var ctrl = component as Control; - if (ctrl != null) - { - ctrl.Disposed += HandleControlDisposed; - - TabPage tpg = ctrl as TabPage; - if (tpg != null && tpg.Parent is TabControl) - { - tpg.Parent.MouseDown -= HandleControlMouseDown; - tpg.Parent.MouseDown += HandleControlMouseDown; - tpg.Parent.Disposed -= HandleControlDisposed; - tpg.Parent.Disposed += HandleControlDisposed; - tpg.Disposed += HandleTabPageDisposed; - return; - } - - ctrl.MouseDown += HandleControlMouseDown; - return; - } - - var columnHeader = component as ColumnHeader; - if (columnHeader != null && columnHeader.ListView != null) - { - columnHeader.ListView.Disposed -= HandleListViewDisposed; - columnHeader.ListView.Disposed += HandleListViewDisposed; - columnHeader.ListView.ColumnClick -= HandleListViewColumnHeaderClicked; - columnHeader.ListView.ColumnClick += HandleListViewColumnHeaderClicked; - columnHeader.Disposed += HandleListViewColumnDisposed; - } - - var dataGridViewColumn = component as DataGridViewColumn; - if (dataGridViewColumn != null && dataGridViewColumn.DataGridView != null) - { - dataGridViewColumn.DataGridView.CellMouseDown -= HandleDataGridViewCellMouseDown; - dataGridViewColumn.DataGridView.CellMouseDown += HandleDataGridViewCellMouseDown; - dataGridViewColumn.DataGridView.Disposed -= HandleDataGridViewDisposed; - dataGridViewColumn.DataGridView.Disposed += HandleDataGridViewDisposed; - dataGridViewColumn.Disposed += HandleColumnDisposed; - } - } - /// ------------------------------------------------------------------------------------ public void SaveIfDirty(ICollection langIdsToForceCreate) { @@ -598,7 +435,7 @@ public void SaveIfDirty(ICollection langIdsToForceCreate) { CanCustomizeLocalizations = false; if (langIdsToForceCreate != null && langIdsToForceCreate.Any()) - MessageBox.Show(e.Message, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Warning); + throw new IOException(e.Message); } } @@ -721,18 +558,18 @@ public string GetStringFromStringCache(string uiLangId, string id) } /// ------------------------------------------------------------------------------------ - private string GetTooltipFromStringCache(string uiLangId, string id) + protected string GetTooltipFromStringCache(string uiLangId, string id) { var realLangId = LocalizationManagerInternal.MapToExistingLanguageIfPossible(uiLangId); return StringCache.GetToolTipText(realLangId, id); } /// ------------------------------------------------------------------------------------ - private Keys GetShortCutKeyFromStringCache(string uiLangId, string id) + /*private Keys GetShortCutKeyFromStringCache(string uiLangId, string id) { var realLangId = LocalizationManagerInternal.MapToExistingLanguageIfPossible(uiLangId); return StringCache.GetShortcutKeys(realLangId, id); - } + }*/ #endregion @@ -789,21 +626,7 @@ public void ReapplyLocalizationsToAllComponents() /// ------------------------------------------------------------------------------------ public void RefreshToolTips() { - foreach (var toolTipCtrl in ToolTipCtrls.Values) - toolTipCtrl.Dispose(); - - ToolTipCtrls.Clear(); - - // This used to be a for-each, but on rare occasions, a "Collection was - // modified; enumeration operation may not execute" exception would be - // thrown. This should solve the problem. - var controls = ComponentCache.Where(x => x.Key is Control).ToArray(); - foreach (var ctrl in controls) - { - var toolTipText = GetTooltipFromStringCache(UILanguageId, ctrl.Value); - if (!string.IsNullOrEmpty(toolTipText)) //JH: hoping to speed this up a bit - ApplyLocalizedToolTipToControl((Control)ctrl.Key, toolTipText); - } + // Do nothing because we know we won't be dealing with tooltips outside of Winforms. } /// ------------------------------------------------------------------------------------ @@ -827,17 +650,6 @@ public void ApplyLocalization(IComponent component) return; } } - - if (ApplyLocalizationsToControl(component as Control, id)) - return; - - if (ApplyLocalizationsToToolStripItem(component as ToolStripItem, id)) - return; - - if (ApplyLocalizationsToListViewColumnHeader(component as ColumnHeader, id)) - return; - - ApplyLocalizationsToDataGridViewColumn(component as DataGridViewColumn, id); } /// ------------------------------------------------------------------------------------ @@ -859,348 +671,8 @@ internal void ApplyLocalizationsToLocalizableComponent( } } - /// ------------------------------------------------------------------------------------ - /// - /// Initializes the specified control. - /// - /// ------------------------------------------------------------------------------------ - private bool ApplyLocalizationsToControl(Control ctrl, string id) - { - if (ctrl == null) - return false; - - var text = GetStringFromStringCache(UILanguageId, id); - var toolTipText = GetTooltipFromStringCache(UILanguageId, id); - - if (text != null && string.CompareOrdinal(ctrl.Text, text) != 0) - ctrl.Text = text; - - ApplyLocalizedToolTipToControl(ctrl, toolTipText); - return true; - } - - /// ------------------------------------------------------------------------------------ - private void ApplyLocalizedToolTipToControl(Control ctrl, string toolTipText) - { - var topCtrl = LocalizationManagerInternal.GetRealTopLevelControl(ctrl); - if (topCtrl == null) - return; - - // Check if the control's top level control has a reference to a tooltip. If - // it does, then use that tooltip for assigning tooltip text to the control. - // Otherwise, create a new tooltip and reference it using the control's top - // level control. - if (!ToolTipCtrls.TryGetValue(topCtrl, out var ttCtrl)) - { - if (string.IsNullOrEmpty(toolTipText)) - return; - - ttCtrl = new ToolTip(); - ToolTipCtrls[topCtrl] = ttCtrl; - topCtrl.ParentChanged += HandleToolTipRefChanged; - topCtrl.HandleDestroyed += HandleToolTipRefDestroyed; - } - - ttCtrl.SetToolTip(ctrl, toolTipText); - } - - /// ------------------------------------------------------------------------------------ - /// - /// Handles the case when a tooltip instance was created and assigned to a top level - /// control that has now been added to another control, thus making the other control - /// top level instead. Therefore, we need to make sure the tooltip is reassigned to - /// the new top level control. - /// - /// ------------------------------------------------------------------------------------ - private void HandleToolTipRefChanged(object sender, EventArgs e) - { - var oldTopCtrl = sender as Control; - var newTopCtrl = LocalizationManagerInternal.GetRealTopLevelControl(oldTopCtrl); - if (oldTopCtrl == null || newTopCtrl == null) - return; - - oldTopCtrl.ParentChanged -= HandleToolTipRefChanged; - newTopCtrl.ParentChanged += HandleToolTipRefChanged; - RefreshToolTips(); - } - - /// ------------------------------------------------------------------------------------ - /// - /// Handles removing tooltip controls from the global tool tip collection for top level - /// controls that are destroyed and have controls on them using tool tip controls from - /// that collection. - /// - /// ------------------------------------------------------------------------------------ - private void HandleToolTipRefDestroyed(object sender, EventArgs e) - { - if (!(sender is Control topCtrl)) - return; - - topCtrl.ParentChanged -= HandleToolTipRefChanged; - topCtrl.HandleDestroyed -= HandleToolTipRefDestroyed; - - if (ToolTipCtrls.TryGetValue(topCtrl, out var ttCtrl)) - ttCtrl.Dispose(); - - ToolTipCtrls.Remove(topCtrl); - } - - private static string UILanguageId => LocalizationManager.UILanguageId; - - /// ------------------------------------------------------------------------------------ - private bool ApplyLocalizationsToToolStripItem(ToolStripItem item, string id) - { - if (item == null) - return false; - - var text = GetStringFromStringCache(UILanguageId, id); - var toolTipText = GetTooltipFromStringCache(UILanguageId, id); - item.Text = text ?? LocalizationManager.StripOffLocalizationInfoFromText(item.Text); - item.ToolTipText = toolTipText ?? LocalizationManager.StripOffLocalizationInfoFromText(item.ToolTipText); - - var shortcutKeys = GetShortCutKeyFromStringCache(UILanguageId, id); - if (item is ToolStripMenuItem menuItem && shortcutKeys != Keys.None) - menuItem.ShortcutKeys = shortcutKeys; - - return true; - } - - /// ------------------------------------------------------------------------------------ - private bool ApplyLocalizationsToListViewColumnHeader(ColumnHeader hdr, string id) - { - if (hdr == null) - return false; - - var text = GetStringFromStringCache(UILanguageId, id); - hdr.Text = text ?? LocalizationManager.StripOffLocalizationInfoFromText(hdr.Text); - return true; - } - - /// ------------------------------------------------------------------------------------ - private bool ApplyLocalizationsToDataGridViewColumn(DataGridViewColumn col, string id) - { - if (col == null) - return false; - - var text = GetStringFromStringCache(UILanguageId, id); - col.HeaderText = text ?? LocalizationManager.StripOffLocalizationInfoFromText(col.HeaderText); - col.ToolTipText = GetTooltipFromStringCache(UILanguageId, id); - return true; - } - - #endregion - - #region Mouse down, handle destroyed, and dispose handlers - /// ------------------------------------------------------------------------------------ - /// - /// Handles Ctrl-Shift-Click on ToolStripItems; - /// - /// ------------------------------------------------------------------------------------ - internal void HandleToolStripItemMouseDown(object sender, MouseEventArgs e) - { - if (!DoHandleMouseDown) - return; - - // Make sure all drop-downs are closed that are in the - // chain of menu items for this item. - Form owningForm = null; - if (sender is ToolStripDropDownItem tsddi) - { - owningForm = tsddi.Owner?.FindForm(); - while (tsddi != null) - { - tsddi.DropDown.Close(); - - if (tsddi.Owner is ContextMenuStrip menuStrip) - menuStrip.Close(); - - tsddi = tsddi.OwnerItem as ToolStripDropDownItem; - } - } - - LocalizeItemDlg.ShowDialog(this, (IComponent)sender, false, - owningForm); - } - - private static bool DoHandleMouseDown => - LocalizationManager.EnableClickingOnControlToBringUpLocalizationDialog && - Control.ModifierKeys == (Keys.Alt | Keys.Shift); + protected static string UILanguageId => LocalizationManager.UILanguageId; - public Icon ApplicationIcon - { - get => _applicationIcon; - set => _applicationIcon = value; - } - - /// ------------------------------------------------------------------------------------ - /// - /// Handles the tool strip item disposed. - /// - /// ------------------------------------------------------------------------------------ - private void HandleToolStripItemDisposed(object sender, EventArgs e) - { - if (sender is ToolStripItem item) - { - item.MouseDown -= HandleToolStripItemMouseDown; - item.Disposed -= HandleToolStripItemDisposed; - - ComponentCache.Remove(item); - } - } - - /// ------------------------------------------------------------------------------------ - /// - /// Handles Alt-Shift-Click on controls. - /// - /// ------------------------------------------------------------------------------------ - internal void HandleControlMouseDown(object sender, MouseEventArgs e) - { - if (!DoHandleMouseDown) - return; - - var ctrl = sender as Control; - - if (ctrl is TabControl tabControl) - { - for (int i = 0; i < tabControl.TabPages.Count; i++) - { - if (tabControl.GetTabRect(i).Contains(e.Location)) - { - ctrl = tabControl.TabPages[i]; - break; - } - } - } - - var lm = LocalizationManagerInternal.GetLocalizationManagerForComponent(ctrl); - - LocalizationManager.OnLaunchingLocalizationDialog(lm); - LocalizeItemDlg.ShowDialog(lm, ctrl, false, ctrl?.FindForm()); - LocalizationManager.OnClosingLocalizationDialog(lm); - } - - /// ------------------------------------------------------------------------------------ - /// - /// When controls get destroyed, do a little clean-up. - /// - /// ------------------------------------------------------------------------------------ - internal void HandleControlDisposed(object sender, EventArgs e) - { - var ctrl = sender as Control; - if (ctrl == null) - return; - - ctrl.Disposed -= HandleControlDisposed; - ctrl.MouseDown -= HandleControlMouseDown; - - ComponentCache.Remove(ctrl); - } - - /// ------------------------------------------------------------------------------------ - /// - /// When a TabPage gets disposed, remove reference to it from the object cache. - /// - /// ------------------------------------------------------------------------------------ - internal void HandleTabPageDisposed(object sender, EventArgs e) - { - if (!(sender is TabPage tabPage)) - return; - - tabPage.Disposed -= HandleTabPageDisposed; - ComponentCache.Remove(tabPage); - } - - /// ------------------------------------------------------------------------------------ - /// - /// When DataGridView controls get disposed, do a little clean-up. - /// - /// ------------------------------------------------------------------------------------ - internal void HandleDataGridViewDisposed(object sender, EventArgs e) - { - if (!(sender is DataGridView grid)) - return; - - grid.Disposed -= HandleControlDisposed; - grid.CellMouseDown -= HandleDataGridViewCellMouseDown; - - ComponentCache.Remove(grid); - } - - /// ------------------------------------------------------------------------------------ - /// - /// Handles ListView column header clicks. Unfortunately, even if the localization - /// dialog box is shown, this click on the header will not get eaten (like it does - /// for other controls). Therefore, if clicking on the column header sorts the column, - /// that sorting will take place after the dialog box is closed. - /// - /// ------------------------------------------------------------------------------------ - internal void HandleListViewColumnHeaderClicked(object sender, ColumnClickEventArgs e) - { - if (!DoHandleMouseDown) - return; - - if (sender is ListView lv && ComponentCache.ContainsKey(lv.Columns[e.Column])) - LocalizeItemDlg.ShowDialog(this, lv.Columns[e.Column], false, - lv.FindForm()); - } - - /// ------------------------------------------------------------------------------------ - /// - /// When ListView controls get disposed, do a little clean-up. - /// - /// ------------------------------------------------------------------------------------ - internal void HandleListViewDisposed(object sender, EventArgs e) - { - if (!(sender is ListView lv)) - return; - - lv.Disposed -= HandleListViewDisposed; - lv.ColumnClick -= HandleListViewColumnHeaderClicked; - } - - /// ------------------------------------------------------------------------------------ - /// - /// When ListView ColumnHeader controls get disposed, remove the reference to it from the - /// object cache. - /// - /// ------------------------------------------------------------------------------------ - internal void HandleListViewColumnDisposed(object sender, EventArgs e) - { - if (!(sender is ColumnHeader column)) - return; - - column.Disposed -= HandleListViewColumnDisposed; - ComponentCache.Remove(column); - } - - /// ------------------------------------------------------------------------------------ - internal void HandleDataGridViewCellMouseDown(object sender, DataGridViewCellMouseEventArgs e) - { - if (!DoHandleMouseDown) - return; - - if (sender is DataGridView grid && e.RowIndex < 0 && - ComponentCache.ContainsKey(grid.Columns[e.ColumnIndex])) - { - LocalizeItemDlg.ShowDialog(this, grid.Columns[e.ColumnIndex], false, - grid.FindForm()); - } - } - - /// ------------------------------------------------------------------------------------ - /// - /// When DataGridViewColumn controls get disposed, remove the reference to it from the - /// object cache. - /// - /// ------------------------------------------------------------------------------------ - internal void HandleColumnDisposed(object sender, EventArgs e) - { - if (!(sender is DataGridViewColumn column)) - return; - - column.Disposed -= HandleColumnDisposed; - ComponentCache.Remove(column); - } #endregion /// ------------------------------------------------------------------------------------ diff --git a/src/L10NSharpTests/ILocalizableComponentTests.cs b/src/L10NSharpTests/ILocalizableComponentTests.cs index 4ec6df3..96c441d 100644 --- a/src/L10NSharpTests/ILocalizableComponentTests.cs +++ b/src/L10NSharpTests/ILocalizableComponentTests.cs @@ -4,6 +4,7 @@ using L10NSharp.UI; using L10NSharp.XLiffUtils; using NUnit.Framework; +//using L10NSharp.WindowsForms; namespace L10NSharp.Tests { @@ -30,7 +31,7 @@ protected void TestSetup(string installedTranslationDir) var dir = Path.GetDirectoryName(new Uri(Assembly.GetExecutingAssembly().CodeBase).LocalPath); m_manager = LocalizationManager.Create("en", "Test", "Test", "1.0", Path.Combine(dir, installedTranslationDir), - "", null, "", new string[] { }) + "", "", new string[] { }) as ILocalizationManagerInternal; m_translationPath = m_manager.GetPathForLanguage("en", true); m_extender = new L10NSharpExtender { LocalizationManagerId = "Test" }; diff --git a/src/L10NSharpTests/LocalizationManagerTestsBase.cs b/src/L10NSharpTests/LocalizationManagerTestsBase.cs index 4dab434..ba9bb73 100644 --- a/src/L10NSharpTests/LocalizationManagerTestsBase.cs +++ b/src/L10NSharpTests/LocalizationManagerTestsBase.cs @@ -987,10 +987,9 @@ public void TestMappingLanguageCodesToAvailable_FindsSpecificGivenGeneric() var installedFolder = Path.Combine(folder.Path, "installed"); AddEnglishTranslation(installedFolder, null); AddChineseOfChinaTranslation(installedFolder); - LocalizationManagerInternal.ChooseFallbackLanguage = (langTag, icon) => - throw new NotImplementedException($"{langTag} shouldn't have stumped us"); + LocalizationManagerInternal.ChooseFallbackLanguage(); var manager = LocalizationManager.Create("zh", AppId, AppName, AppVersion, installedFolder, - $"Temp/{Path.GetFileName(folder.Path)}/user", null, null, new string[] { }); + $"Temp/{Path.GetFileName(folder.Path)}/user", null, new string[] { }); LocalizationManagerInternal.LoadedManagers[AppId] = (ILocalizationManagerInternal)manager; var langs = LocalizationManager.GetAvailableLocalizedLanguages(); @@ -1008,7 +1007,7 @@ public void TestMappingLanguageCodesToAvailable_FindsSpecificGivenGeneric() } } - [Test] + /*[Test] public void TestMappingLanguageCodesToAvailable_AmbiguousOptions_PromptsUser([Values("zh-CN", "zh-TW")] string choice) { LocalizationManager.SetUILanguage("en", true); @@ -1043,6 +1042,6 @@ public void TestMappingLanguageCodesToAvailable_AmbiguousOptions_PromptsUser([Va Assert.That(LocalizationManager.GetIsStringAvailableForLangId("theId", "zh-TW"), Is.True, "zh-TW should find zh-TW"); Assert.That(LocalizationManager.GetIsStringAvailableForLangId("theId", "en"), Is.True, "en should find en"); } - } + }*/ } } diff --git a/src/L10NSharpTests/LocalizationManagerXliffTests.cs b/src/L10NSharpTests/LocalizationManagerXliffTests.cs index 30718f4..b8b9791 100644 --- a/src/L10NSharpTests/LocalizationManagerXliffTests.cs +++ b/src/L10NSharpTests/LocalizationManagerXliffTests.cs @@ -40,7 +40,7 @@ public void Create_PreferredUiLanguageIsGenericVariant_CreatesLocalizationManage LocalizationManager.ClearLoadedManagers(); var dir = Path.GetDirectoryName(new Uri(Assembly.GetExecutingAssembly().CodeBase).LocalPath); var lm = LocalizationManager.Create(genericLocaleId, "Test", "Test", "1.0", - Path.Combine(dir, "../../../src/L10NSharpTests/TestXliff2"), "", null, "", + Path.Combine(dir, "../../../src/L10NSharpTests/TestXliff2"), "", "", new string[] {}); Assert.AreEqual($"Protección de configuraciones ({genericLocaleId})...", lm.GetLocalizedString("SettingsProtection.LauncherButtonLabel", "don't use this")); diff --git a/src/L10NSharpTests/UtilsTests.cs b/src/L10NSharpTests/UtilsTests.cs index 481d933..761534a 100644 --- a/src/L10NSharpTests/UtilsTests.cs +++ b/src/L10NSharpTests/UtilsTests.cs @@ -10,37 +10,37 @@ public class UtilsTests [Test] public void TypeDoesNotHaveUnexpectedProperty() { - Assert.IsFalse(UI.Utils.HasProperty(typeof(String), "nonsense")); + Assert.IsFalse(Utils.HasProperty(typeof(String), "nonsense")); } [Test] public void InstanceDoesNotHaveUnexpectedProperty() { - Assert.IsFalse(UI.Utils.HasProperty("", "nonsense")); + Assert.IsFalse(Utils.HasProperty("", "nonsense")); } [Test] public void InstanceHasExpectedProperty() { - Assert.IsTrue(UI.Utils.HasProperty("", "Length")); + Assert.IsTrue(Utils.HasProperty("", "Length")); } [Test] public void TypeHasExpectedProperty() { - Assert.IsTrue(UI.Utils.HasProperty(typeof(int), "MaxValue")); + Assert.IsTrue(Utils.HasProperty(typeof(int), "MaxValue")); } [Test] public void GetPropertyOnExistingMethod_Works() { - Assert.AreEqual(3, UI.Utils.GetProperty("abc", "Length")); + Assert.AreEqual(3, Utils.GetProperty("abc", "Length")); } [Test] public void GetPropertyOnMissingMethod_ReturnsNull() { - Assert.IsNull(UI.Utils.GetProperty("abc", "nonsence")); + Assert.IsNull(Utils.GetProperty("abc", "nonsence")); } /// @@ -50,7 +50,7 @@ public void GetPropertyOnMissingMethod_ReturnsNull() public void GetShortcutKeysOnToolStripButton_ReturnsNull() { var button = new ToolStripButton(); - Assert.IsNull(UI.Utils.GetProperty(button, "ShortcutKeys")); + Assert.IsNull(Utils.GetProperty(button, "ShortcutKeys")); } } } diff --git a/src/SampleApp/Form1.Designer.cs b/src/SampleApp/Form1.Designer.cs index ef8b6f6..f099907 100644 --- a/src/SampleApp/Form1.Designer.cs +++ b/src/SampleApp/Form1.Designer.cs @@ -37,60 +37,62 @@ private void InitializeComponent() this.label1 = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label(); this.uiLanguageComboBox1 = new L10NSharp.UI.UILanguageComboBox(); - this.linkLabel1 = new System.Windows.Forms.LinkLabel(); this.columnHeader1 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.columnHeader2 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.dataGridView1 = new System.Windows.Forms.DataGridView(); - this.listView1 = new System.Windows.Forms.ListView(); this.Column1 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.listView1 = new System.Windows.Forms.ListView(); ((System.ComponentModel.ISupportInitialize)(this.localizationExtender1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit(); this.SuspendLayout(); - // + // // localizationExtender1 - // + // this.localizationExtender1.LocalizationManagerId = "SampleApp"; this.localizationExtender1.PrefixForNewItems = "TheSampleForm"; - // + // // _getDynamicStringButton - // + // this.localizationExtender1.SetLocalizableToolTip(this._getDynamicStringButton, null); this.localizationExtender1.SetLocalizationComment(this._getDynamicStringButton, null); this.localizationExtender1.SetLocalizingId(this._getDynamicStringButton, "TheSampleForm.button1"); - this._getDynamicStringButton.Location = new System.Drawing.Point(38, 161); + this._getDynamicStringButton.Location = new System.Drawing.Point(51, 198); + this._getDynamicStringButton.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this._getDynamicStringButton.Name = "_getDynamicStringButton"; - this._getDynamicStringButton.Size = new System.Drawing.Size(126, 23); + this._getDynamicStringButton.Size = new System.Drawing.Size(168, 28); this._getDynamicStringButton.TabIndex = 0; this._getDynamicStringButton.Text = "Get Name Dynamically"; this._getDynamicStringButton.UseVisualStyleBackColor = true; this._getDynamicStringButton.Click += new System.EventHandler(this.button1_Click); - // + // // label1 - // + // this.label1.AutoSize = true; this.localizationExtender1.SetLocalizableToolTip(this.label1, null); this.localizationExtender1.SetLocalizationComment(this.label1, null); this.localizationExtender1.SetLocalizingId(this.label1, "TheSampleForm.ASubHeading.Label"); - this.label1.Location = new System.Drawing.Point(40, 212); + this.label1.Location = new System.Drawing.Point(53, 261); + this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(73, 13); + this.label1.Size = new System.Drawing.Size(89, 16); this.label1.TabIndex = 1; this.label1.Text = "A Static Label"; - // + // // label2 - // + // this.label2.AutoSize = true; this.localizationExtender1.SetLocalizableToolTip(this.label2, null); this.localizationExtender1.SetLocalizationComment(this.label2, null); this.localizationExtender1.SetLocalizingId(this.label2, "TheSampleForm.label2"); - this.label2.Location = new System.Drawing.Point(73, 111); + this.label2.Location = new System.Drawing.Point(97, 137); + this.label2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(202, 13); + this.label2.Size = new System.Drawing.Size(249, 16); this.label2.TabIndex = 2; - this.label2.Text = "or Alt+Shift Click on items to localize them"; - // + this.label2.Text = "Alt+Shift Click on items to localize them"; + // // uiLanguageComboBox1 - // + // this.uiLanguageComboBox1.DisplayMember = "NativeName"; this.uiLanguageComboBox1.DropDownHeight = 200; this.uiLanguageComboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; @@ -99,83 +101,74 @@ private void InitializeComponent() this.uiLanguageComboBox1.IntegralHeight = false; this.localizationExtender1.SetLocalizableToolTip(this.uiLanguageComboBox1, null); this.localizationExtender1.SetLocalizationComment(this.uiLanguageComboBox1, null); - this.localizationExtender1.SetLocalizationPriority(this.uiLanguageComboBox1, LocalizationPriority.NotLocalizable); + this.localizationExtender1.SetLocalizationPriority(this.uiLanguageComboBox1, L10NSharp.LocalizationPriority.NotLocalizable); this.localizationExtender1.SetLocalizingId(this.uiLanguageComboBox1, "uiLanguageComboBox1.uiLanguageComboBox1"); - this.uiLanguageComboBox1.Location = new System.Drawing.Point(40, 41); + this.uiLanguageComboBox1.Location = new System.Drawing.Point(53, 50); + this.uiLanguageComboBox1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.uiLanguageComboBox1.Name = "uiLanguageComboBox1"; this.uiLanguageComboBox1.ShowOnlyLanguagesHavingLocalizations = true; - this.uiLanguageComboBox1.Size = new System.Drawing.Size(121, 23); + this.uiLanguageComboBox1.Size = new System.Drawing.Size(160, 28); this.uiLanguageComboBox1.TabIndex = 3; this.uiLanguageComboBox1.SelectedIndexChanged += new System.EventHandler(this.uiLanguageComboBox1_SelectedIndexChanged); - // - // linkLabel1 - // - this.linkLabel1.AutoSize = true; - this.localizationExtender1.SetLocalizableToolTip(this.linkLabel1, null); - this.localizationExtender1.SetLocalizationComment(this.linkLabel1, null); - this.localizationExtender1.SetLocalizingId(this.linkLabel1, "TheSampleForm.linkLabel1"); - this.linkLabel1.Location = new System.Drawing.Point(40, 88); - this.linkLabel1.Name = "linkLabel1"; - this.linkLabel1.Size = new System.Drawing.Size(124, 13); - this.linkLabel1.TabIndex = 4; - this.linkLabel1.TabStop = true; - this.linkLabel1.Text = "Open Translation Dialog,"; - this.linkLabel1.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabel1_LinkClicked); - // + // // columnHeader1 - // + // this.localizationExtender1.SetLocalizableToolTip(this.columnHeader1, null); this.localizationExtender1.SetLocalizationComment(this.columnHeader1, null); this.localizationExtender1.SetLocalizingId(this.columnHeader1, "TheSampleForm.columnHeader1"); this.columnHeader1.Text = "One"; - // + // // columnHeader2 - // + // this.localizationExtender1.SetLocalizableToolTip(this.columnHeader2, null); this.localizationExtender1.SetLocalizationComment(this.columnHeader2, null); this.localizationExtender1.SetLocalizingId(this.columnHeader2, "TheSampleForm.columnHeader2"); this.columnHeader2.Text = "Two"; - // + // // dataGridView1 - // + // this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.dataGridView1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { this.Column1}); this.localizationExtender1.SetLocalizableToolTip(this.dataGridView1, null); this.localizationExtender1.SetLocalizationComment(this.dataGridView1, null); this.localizationExtender1.SetLocalizingId(this.dataGridView1, "TheSampleForm.dataGridView1"); - this.dataGridView1.Location = new System.Drawing.Point(40, 377); + this.dataGridView1.Location = new System.Drawing.Point(53, 464); + this.dataGridView1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.dataGridView1.Name = "dataGridView1"; - this.dataGridView1.Size = new System.Drawing.Size(446, 73); + this.dataGridView1.RowHeadersWidth = 51; + this.dataGridView1.Size = new System.Drawing.Size(595, 90); this.dataGridView1.TabIndex = 6; - // + // + // Column1 + // + this.Column1.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; + this.Column1.HeaderText = "_L10N_:TheSampleForm.SampleDataGridView.ColumnHeadings.FirstColumn!First"; + this.Column1.MinimumWidth = 6; + this.Column1.Name = "Column1"; + this.Column1.ToolTipText = "My tooltip"; + // // listView1 - // + // this.listView1.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { this.columnHeader1, this.columnHeader2}); - this.listView1.Location = new System.Drawing.Point(40, 256); + this.listView1.HideSelection = false; + this.listView1.Location = new System.Drawing.Point(53, 315); + this.listView1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.listView1.Name = "listView1"; - this.listView1.Size = new System.Drawing.Size(338, 97); + this.listView1.Size = new System.Drawing.Size(449, 118); this.listView1.TabIndex = 5; this.listView1.UseCompatibleStateImageBehavior = false; this.listView1.View = System.Windows.Forms.View.Details; - // - // Column1 - // - this.Column1.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; - this.Column1.HeaderText = "_L10N_:TheSampleForm.SampleDataGridView.ColumnHeadings.FirstColumn!First"; - this.Column1.Name = "Column1"; - this.Column1.ToolTipText = "My tooltip"; - // + // // Form1 - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + // + this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(559, 462); + this.ClientSize = new System.Drawing.Size(745, 569); this.Controls.Add(this.dataGridView1); this.Controls.Add(this.listView1); - this.Controls.Add(this.linkLabel1); this.Controls.Add(this.uiLanguageComboBox1); this.Controls.Add(this.label2); this.Controls.Add(this.label1); @@ -183,6 +176,7 @@ private void InitializeComponent() this.localizationExtender1.SetLocalizableToolTip(this, null); this.localizationExtender1.SetLocalizationComment(this, null); this.localizationExtender1.SetLocalizingId(this, "Form1.WindowTitle"); + this.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.MaximizeBox = false; this.MinimizeBox = false; this.Name = "Form1"; @@ -202,7 +196,6 @@ private void InitializeComponent() private System.Windows.Forms.Label label1; private System.Windows.Forms.Label label2; private L10NSharp.UI.UILanguageComboBox uiLanguageComboBox1; - private System.Windows.Forms.LinkLabel linkLabel1; private System.Windows.Forms.ListView listView1; private System.Windows.Forms.ColumnHeader columnHeader1; private System.Windows.Forms.ColumnHeader columnHeader2; diff --git a/src/SampleApp/Form1.cs b/src/SampleApp/Form1.cs index c68aaca..068a4f9 100644 --- a/src/SampleApp/Form1.cs +++ b/src/SampleApp/Form1.cs @@ -28,13 +28,6 @@ private void uiLanguageComboBox1_SelectedIndexChanged(object sender, EventArgs e UpdateDynamicLabel(); } - private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) - { - LocalizationManager.ShowLocalizationDialogBox(this); - uiLanguageComboBox1.RefreshList(); - UpdateDynamicLabel(); - } - //This demonstrates how to handle strings that aren't hard-coded, so can't be discovered //by the runtime code scanner. Instead, we ue this GetDynamicString. //Note that L10NSharp.LocalizationManager.CollectUpNewStringsDiscoveredDynamically = false diff --git a/src/SampleApp/Form1.resx b/src/SampleApp/Form1.resx index 19e46eb..bebfe93 100644 --- a/src/SampleApp/Form1.resx +++ b/src/SampleApp/Form1.resx @@ -123,4 +123,7 @@ True + + True + \ No newline at end of file diff --git a/src/SampleApp/Program.cs b/src/SampleApp/Program.cs index 05a9c0d..20167d0 100644 --- a/src/SampleApp/Program.cs +++ b/src/SampleApp/Program.cs @@ -86,7 +86,6 @@ private static void SetUpLocalization(bool useAdditionalMethodInfo, bool useTmx) "SampleApp.exe", "SampleApp", Application.ProductVersion, directoryOfInstalledLocFiles, "MyCompany/L10NSharpSample", - Resources.Icon, //replace with your icon "sampleappLocalizations@nowhere.com", new[] { "SampleApp" }, typeof(Program) @@ -99,7 +98,6 @@ private static void SetUpLocalization(bool useAdditionalMethodInfo, bool useTmx) "SampleApp.exe", "SampleApp", Application.ProductVersion, directoryOfInstalledLocFiles, "MyCompany/L10NSharpSample", - Resources.Icon, //replace with your icon "sampleappLocalizations@nowhere.com", new[] { "SampleApp" }); } From 675a025eb0d79a4755fdb4983c251a65dee7babb Mon Sep 17 00:00:00 2001 From: Ariel Rorabaugh Date: Tue, 15 Jul 2025 18:08:29 -0400 Subject: [PATCH 02/25] Move UI code into WindowsForms/UI --- src/L10NSharp/ILocalizationManagerInternal.cs | 2 - src/L10NSharp/ILocalizedStringCache.cs | 7 +- src/L10NSharp/L10NSharp.csproj | 56 +++ src/L10NSharp/LocalizationManagerInternal.cs | 3 - src/L10NSharp/LocalizingInfo.cs | 216 +---------- .../ILocalizableComponent.cs | 4 +- .../ILocalizationManagerInternalWinforms.cs | 7 +- .../ILocalizedStringCacheWinforms.cs | 16 + .../LocalizationManagerWinforms.cs | 10 - .../WindowsForms/LocalizingInfoWinforms.cs | 346 ++++++++++++++++++ .../{ => WindowsForms}/UI/ColorHelper.cs | 2 +- .../UI/CustomDropDownComboBox.Designer.cs | 2 +- .../UI/CustomDropDownComboBox.cs | 2 +- .../UI/CustomDropDownComboBox.resx | 0 .../UI/DontShowThisAgainButton.Designer.cs | 2 +- .../UI/DontShowThisAgainButton.cs | 2 +- ...EditSourceBeforeTranslatingDlg.Designer.cs | 4 +- .../UI/EditSourceBeforeTranslatingDlg.cs | 2 +- .../UI/EditSourceBeforeTranslatingDlg.resx | 0 .../UI/FallbackLanguagesDlg.cs | 2 +- .../UI/FallbackLanguagesDlgBase.Designer.cs | 4 +- .../UI/FallbackLanguagesDlgBase.cs | 2 +- .../UI/FallbackLanguagesDlgBase.resx | 0 .../UI/Grid/LmButtonCell.cs | 2 +- .../UI/Grid/LmButtonColumn.cs | 2 +- .../{ => WindowsForms}/UI/Grid/LmGrid.cs | 2 +- .../UI/HowToDistributeDialog.Designer.cs | 2 +- .../UI/HowToDistributeDialog.cs | 2 +- .../UI/HowToDistributeDialog.resx | 0 .../UI/InitializationProgressDlg.cs | 2 +- .../InitializationProgressDlgBase.Designer.cs | 2 +- .../UI/InitializationProgressDlgBase.cs | 2 +- .../UI/InitializationProgressDlgBase.resx | 0 .../{ => WindowsForms}/UI/L10NExtender.cs | 15 +- .../{ => WindowsForms}/UI/L10NExtender.resx | 0 .../UI/LanguageChoosingDialog.Designer.cs | 4 +- .../UI/LanguageChoosingDialog.cs | 2 +- .../UI/LanguageChoosingDialog.resx | 0 .../UI/LanguageChoosingDialogViewModel.cs | 2 +- .../LanguageChoosingSimpleDialog.Designer.cs | 6 +- .../UI/LanguageChoosingSimpleDialog.cs | 2 +- .../UI/LanguageChoosingSimpleDialog.resx | 0 .../{ => WindowsForms}/UI/LocTreeNode.cs | 10 +- .../UI/LocalizeItemDlg.Designer.cs | 16 +- .../{ => WindowsForms}/UI/LocalizeItemDlg.cs | 8 +- .../UI/LocalizeItemDlg.resx | 0 .../UI/LocalizeItemDlgViewModel.cs | 16 +- .../{ => WindowsForms}/UI/NodeComparer.cs | 3 +- .../{ => WindowsForms}/UI/PaintingHelper.cs | 2 +- .../{ => WindowsForms}/UI/PopupControl.cs | 2 +- .../UI/PopupControl.designer.cs | 2 +- .../{ => WindowsForms}/UI/PopupControl.resx | 0 .../UI/ShortcutKeysDropDown.cs | 2 +- .../UI/ShortcutKeysEditor.Designer.cs | 2 +- .../UI/ShortcutKeysEditor.cs | 2 +- .../UI/ShortcutKeysEditor.resx | 0 .../{ => WindowsForms}/UI/TipDialog.cs | 2 +- .../UI/TipDialog.designer.cs | 2 +- .../{ => WindowsForms}/UI/TipDialog.resx | 0 .../UI/UILanguageComboBox.cs | 2 +- .../UI/UILanguageListBox.cs | 2 +- .../{ => WindowsForms}/UI/XButton.cs | 2 +- .../XliffLocalizationManagerWinforms.cs | 65 +++- .../XliffLocalizedStringCacheWinforms.cs | 116 ++++++ src/L10NSharp/XLiffUtils/XLiffBody.cs | 1 - .../XLiffUtils/XliffLocalizationManager.cs | 43 +-- .../XLiffUtils/XliffLocalizedStringCache.cs | 66 +--- .../XLiffUtils/XliffTransUnitUpdater.cs | 1 - .../ILocalizableComponentTests.cs | 2 +- .../LanguageChoosingDialogViewModelTests.cs | 2 +- .../LocalizationExtenderTests.cs | 2 +- .../MockLocalizableComponent.cs | 3 +- src/SampleApp/Form1.Designer.cs | 8 +- 73 files changed, 697 insertions(+), 425 deletions(-) rename src/L10NSharp/{ => WindowsForms}/ILocalizableComponent.cs (94%) create mode 100644 src/L10NSharp/WindowsForms/ILocalizedStringCacheWinforms.cs create mode 100644 src/L10NSharp/WindowsForms/LocalizingInfoWinforms.cs rename src/L10NSharp/{ => WindowsForms}/UI/ColorHelper.cs (98%) rename src/L10NSharp/{ => WindowsForms}/UI/CustomDropDownComboBox.Designer.cs (98%) rename src/L10NSharp/{ => WindowsForms}/UI/CustomDropDownComboBox.cs (99%) rename src/L10NSharp/{ => WindowsForms}/UI/CustomDropDownComboBox.resx (100%) rename src/L10NSharp/{ => WindowsForms}/UI/DontShowThisAgainButton.Designer.cs (96%) rename src/L10NSharp/{ => WindowsForms}/UI/DontShowThisAgainButton.cs (98%) rename src/L10NSharp/{ => WindowsForms}/UI/EditSourceBeforeTranslatingDlg.Designer.cs (99%) rename src/L10NSharp/{ => WindowsForms}/UI/EditSourceBeforeTranslatingDlg.cs (97%) rename src/L10NSharp/{ => WindowsForms}/UI/EditSourceBeforeTranslatingDlg.resx (100%) rename src/L10NSharp/{ => WindowsForms}/UI/FallbackLanguagesDlg.cs (96%) rename src/L10NSharp/{ => WindowsForms}/UI/FallbackLanguagesDlgBase.Designer.cs (98%) rename src/L10NSharp/{ => WindowsForms}/UI/FallbackLanguagesDlgBase.cs (99%) rename src/L10NSharp/{ => WindowsForms}/UI/FallbackLanguagesDlgBase.resx (100%) rename src/L10NSharp/{ => WindowsForms}/UI/Grid/LmButtonCell.cs (99%) rename src/L10NSharp/{ => WindowsForms}/UI/Grid/LmButtonColumn.cs (99%) rename src/L10NSharp/{ => WindowsForms}/UI/Grid/LmGrid.cs (99%) rename src/L10NSharp/{ => WindowsForms}/UI/HowToDistributeDialog.Designer.cs (99%) rename src/L10NSharp/{ => WindowsForms}/UI/HowToDistributeDialog.cs (98%) rename src/L10NSharp/{ => WindowsForms}/UI/HowToDistributeDialog.resx (100%) rename src/L10NSharp/{ => WindowsForms}/UI/InitializationProgressDlg.cs (98%) rename src/L10NSharp/{ => WindowsForms}/UI/InitializationProgressDlgBase.Designer.cs (99%) rename src/L10NSharp/{ => WindowsForms}/UI/InitializationProgressDlgBase.cs (98%) rename src/L10NSharp/{ => WindowsForms}/UI/InitializationProgressDlgBase.resx (100%) rename src/L10NSharp/{ => WindowsForms}/UI/L10NExtender.cs (97%) rename src/L10NSharp/{ => WindowsForms}/UI/L10NExtender.resx (100%) rename src/L10NSharp/{ => WindowsForms}/UI/LanguageChoosingDialog.Designer.cs (97%) rename src/L10NSharp/{ => WindowsForms}/UI/LanguageChoosingDialog.cs (96%) rename src/L10NSharp/{ => WindowsForms}/UI/LanguageChoosingDialog.resx (100%) rename src/L10NSharp/{ => WindowsForms}/UI/LanguageChoosingDialogViewModel.cs (99%) rename src/L10NSharp/{ => WindowsForms}/UI/LanguageChoosingSimpleDialog.Designer.cs (93%) rename src/L10NSharp/{ => WindowsForms}/UI/LanguageChoosingSimpleDialog.cs (95%) rename src/L10NSharp/{ => WindowsForms}/UI/LanguageChoosingSimpleDialog.resx (100%) rename src/L10NSharp/{ => WindowsForms}/UI/LocTreeNode.cs (87%) rename src/L10NSharp/{ => WindowsForms}/UI/LocalizeItemDlg.Designer.cs (99%) rename src/L10NSharp/{ => WindowsForms}/UI/LocalizeItemDlg.cs (99%) rename src/L10NSharp/{ => WindowsForms}/UI/LocalizeItemDlg.resx (100%) rename src/L10NSharp/{ => WindowsForms}/UI/LocalizeItemDlgViewModel.cs (97%) rename src/L10NSharp/{ => WindowsForms}/UI/NodeComparer.cs (97%) rename src/L10NSharp/{ => WindowsForms}/UI/PaintingHelper.cs (99%) rename src/L10NSharp/{ => WindowsForms}/UI/PopupControl.cs (99%) rename src/L10NSharp/{ => WindowsForms}/UI/PopupControl.designer.cs (95%) rename src/L10NSharp/{ => WindowsForms}/UI/PopupControl.resx (100%) rename src/L10NSharp/{ => WindowsForms}/UI/ShortcutKeysDropDown.cs (98%) rename src/L10NSharp/{ => WindowsForms}/UI/ShortcutKeysEditor.Designer.cs (99%) rename src/L10NSharp/{ => WindowsForms}/UI/ShortcutKeysEditor.cs (99%) rename src/L10NSharp/{ => WindowsForms}/UI/ShortcutKeysEditor.resx (100%) rename src/L10NSharp/{ => WindowsForms}/UI/TipDialog.cs (98%) rename src/L10NSharp/{ => WindowsForms}/UI/TipDialog.designer.cs (99%) rename src/L10NSharp/{ => WindowsForms}/UI/TipDialog.resx (100%) rename src/L10NSharp/{ => WindowsForms}/UI/UILanguageComboBox.cs (98%) rename src/L10NSharp/{ => WindowsForms}/UI/UILanguageListBox.cs (98%) rename src/L10NSharp/{ => WindowsForms}/UI/XButton.cs (99%) create mode 100644 src/L10NSharp/WindowsForms/XLiffUtils/XliffLocalizedStringCacheWinforms.cs diff --git a/src/L10NSharp/ILocalizationManagerInternal.cs b/src/L10NSharp/ILocalizationManagerInternal.cs index 305b739..a39789b 100644 --- a/src/L10NSharp/ILocalizationManagerInternal.cs +++ b/src/L10NSharp/ILocalizationManagerInternal.cs @@ -10,8 +10,6 @@ namespace L10NSharp internal interface ILocalizationManagerInternal: ILocalizationManager { Dictionary ComponentCache { get; } - Dictionary> LocalizableComponents { get; } - //Icon ApplicationIcon { get; set; } void ApplyLocalization(IComponent component); void ApplyLocalizationsToILocalizableComponent(LocalizingInfo locInfo); diff --git a/src/L10NSharp/ILocalizedStringCache.cs b/src/L10NSharp/ILocalizedStringCache.cs index 0892f52..969a89a 100644 --- a/src/L10NSharp/ILocalizedStringCache.cs +++ b/src/L10NSharp/ILocalizedStringCache.cs @@ -2,8 +2,8 @@ // // This software is licensed under the MIT License (http://opensource.org/licenses/MIT) using System.Collections.Generic; -using System.Windows.Forms; -using L10NSharp.UI; +//using System.Windows.Forms; +//using L10NSharp.WindowsForms.UI; using L10NSharp.XLiffUtils; namespace L10NSharp @@ -12,18 +12,15 @@ internal interface ILocalizedStringCache { bool TryGetDocument(string langId, out T doc); IEnumerable AvailableLangKeys { get; } - List> LeafNodeList { get; } string GetString(string langId, string id); string GetString(string langId, string id, bool formatForDisplay); string GetToolTipText(string langId, string id); string GetToolTipText(string langId, string id, bool formatForDisplay); - Keys GetShortcutKeys(string langId, string id); string GetShortcutKeysText(string langId, string id); string GetComment(string id); string GetValueForExactLangAndId(string langId, string id, bool formatForDisplay); void UpdateLocalizedInfo(LocalizingInfo locInfo); - void LoadGroupNodes(TreeNodeCollection topCollection); int NumberApproved(string lang); int NumberTranslated(string lang); diff --git a/src/L10NSharp/L10NSharp.csproj b/src/L10NSharp/L10NSharp.csproj index 39ca4a5..3ae1bfb 100644 --- a/src/L10NSharp/L10NSharp.csproj +++ b/src/L10NSharp/L10NSharp.csproj @@ -20,4 +20,60 @@ + + + UserControl + + + Component + + + Form + + + + Form + + + Component + + + Form + + + Form + + + Form + + + Component + + + Form + + + Form + + + Form + + + UserControl + + + + + Form + + + Component + + + Component + + + Component + + diff --git a/src/L10NSharp/LocalizationManagerInternal.cs b/src/L10NSharp/LocalizationManagerInternal.cs index 0f8578f..b29e938 100644 --- a/src/L10NSharp/LocalizationManagerInternal.cs +++ b/src/L10NSharp/LocalizationManagerInternal.cs @@ -5,9 +5,6 @@ using System.Collections.Concurrent; using System.Collections.Generic; using System.ComponentModel; -using System.Drawing; - -//using System.Drawing; using System.Globalization; using System.IO; using System.Linq; diff --git a/src/L10NSharp/LocalizingInfo.cs b/src/L10NSharp/LocalizingInfo.cs index d151758..ad81ea1 100644 --- a/src/L10NSharp/LocalizingInfo.cs +++ b/src/L10NSharp/LocalizingInfo.cs @@ -1,7 +1,5 @@ using System; using System.ComponentModel; -using System.Windows.Forms; -using L10NSharp.UI; namespace L10NSharp { @@ -120,17 +118,7 @@ public LocalizingInfo(IComponent component, bool initTextFromObj) { _component = component; Priority = LocalizationPriority.Medium; - Category = GetCategory(_component); UpdateFields = UpdateFields.All; - if (initTextFromObj) - UpdateTextFromObject(); - } - - public void UpdateTextFromObject() - { - Text = LocalizationManager.StripOffLocalizationInfoFromText(_component is DataGridViewColumn - ? ((DataGridViewColumn) _component).HeaderText - : Utils.GetProperty(_component, "Text") as string); } /// ------------------------------------------------------------------------------------ @@ -158,97 +146,6 @@ public LocalizingInfo(string id) #endregion #region Methods for initializing the localization id. - - internal void CreateIdIfMissing(string prefixForId) - { - if (prefixForId == null) - prefixForId = ""; - if (string.IsNullOrEmpty(_id)) - _id = MakeId(_component, idPrefixFromFormExtender: prefixForId); - } - - /// ------------------------------------------------------------------------------------ - /// - /// Sets the id. - /// - /// ------------------------------------------------------------------------------------ - internal static string MakeId(IComponent component, string idPrefixFromFormExtender = "") - { - if (idPrefixFromFormExtender == null) - idPrefixFromFormExtender = ""; - - idPrefixFromFormExtender = idPrefixFromFormExtender.Trim('.', ' '); - if (idPrefixFromFormExtender.Length > 0) - idPrefixFromFormExtender = idPrefixFromFormExtender + "."; - - if (component is Form) - { - Form frm = (Form)component; - return (frm.Site != null && frm.Site.DesignMode ? frm.Site.Name : frm.Name) + ".WindowTitle"; - } - - if (component is Control) - return idPrefixFromFormExtender+MakeIdForCtrl(component as Control); - - if (component is ColumnHeader) - return idPrefixFromFormExtender + MakeIdForColumnHeader((ColumnHeader)component); - - if (component is DataGridViewColumn) - return idPrefixFromFormExtender + MakeIdForDataGridViewColumn((DataGridViewColumn)component); - - if (component is ToolStripItem) - { - string formName = OwningFormName(component as ToolStripItem); - return idPrefixFromFormExtender + (formName ?? "Miscellaneous") + "." + ((ToolStripItem)component).Name; - } - - return null; - } - - /// ------------------------------------------------------------------------------------ - /// - /// Sets the id for CTRL. - /// - /// ------------------------------------------------------------------------------------ - private static string MakeIdForCtrl(Control ctrl) - { - if (ctrl == null) - return null; - - if (ctrl.Text.StartsWith(LocalizationManager.kL10NPrefix)) - return GetIdFromText(ctrl.Text); - - string prefix = GetIdPrefix(ctrl); - if (string.IsNullOrEmpty(prefix)) - return ctrl.Name; - - //return (string.IsNullOrEmpty(prefix) ? string.Empty : prefix + "." + ctrl.Name); - return prefix.Trim(new char[] { '.' }) + "." + ctrl.Name.Trim(new char[] { '.' }); - } - - /// ------------------------------------------------------------------------------------ - /// - /// Makes an id for a column header. - /// - /// ------------------------------------------------------------------------------------ - private static string MakeIdForColumnHeader(ColumnHeader hdr) - { - return (hdr == null ? null : GetIdFromText(hdr.Name)); - } - - /// ------------------------------------------------------------------------------------ - /// - /// Makes an id for a DataGridView column. - /// Note that in order to have a DataGridViewColumn header be localizable, one must create the HeaderText - /// in the following format: _L10N_:{ID}!{EnglishName} - /// - /// ------------------------------------------------------------------------------------ - private static string MakeIdForDataGridViewColumn(DataGridViewColumn col) - { - return (col == null || !col.HeaderText.StartsWith(LocalizationManager.kL10NPrefix) ? - null : GetIdFromText(col.HeaderText)); - } - /// ------------------------------------------------------------------------------------ public static string GetIdFromText(string text) { @@ -261,95 +158,6 @@ public static string GetIdFromText(string text) return (i < 0 ? text : text.Substring(0, i)); } - /// ------------------------------------------------------------------------------------ - /// - /// Tries to get the name of the form that hosts the specified control. That name is - /// used as the prefix for a localization id. - /// - /// ------------------------------------------------------------------------------------ - private static string GetIdPrefix(Control control) - { - if (control == null) - return "Miscellaneous"; - if (control.Parent == null) - return ""; - - while (control.Parent != null && - !control.Parent.GetType().FullName.StartsWith("System.Windows.Forms.Design")) - { - control = control.Parent; - } - - - return (control.Site != null && control.Site.DesignMode ? control.Site.Name : control.Name); - } - - /// ------------------------------------------------------------------------------------ - /// - /// Gets the name of the form to which the specified ToolStripItem belongs. - /// - /// ------------------------------------------------------------------------------------ - private static string OwningFormName(ToolStripItem tsItem) - { - if (tsItem != null) - { - var item = tsItem; - while (item.OwnerItem != null) - item = item.OwnerItem; - - if (item.Owner != null) - { - var frm = item.Owner.FindForm(); - if (frm != null) - return (frm.Site != null && frm.Site.DesignMode ? frm.Site.Name : frm.Name); - } - } - - return string.Empty; - } - - #endregion - - #region Method for initializinig the category - /// ------------------------------------------------------------------------------------ - /// - /// Returns the localization category for the specified IComponent object. - /// - /// ------------------------------------------------------------------------------------ - private static LocalizationCategory GetCategory(IComponent component) - { - if (component is ILocalizableComponent) - return LocalizationCategory.LocalizableComponent; - if (component is ToolStripMenuItem) - return LocalizationCategory.MenuItem; - if (component is ToolStripItem) - return LocalizationCategory.ToolbarOrStatusBarItem; - if (component is Button) - return LocalizationCategory.Button; - if (component is TextBox) - return LocalizationCategory.TextBox; - if (component is LinkLabel) - return LocalizationCategory.LinkLabel; - if (component is Label) - return LocalizationCategory.Label; - if (component is ComboBox) - return LocalizationCategory.ComboBox; - if (component is RadioButton) - return LocalizationCategory.RadioButton; - if (component is CheckBox) - return LocalizationCategory.CheckBox; - if (component is Form) - return LocalizationCategory.WindowOrDialog; - if (component is TabPage) - return LocalizationCategory.TabPage; - if (component is ColumnHeader) - return LocalizationCategory.ListViewColumnHeading; - if (component is DataGridViewColumn) - return LocalizationCategory.ListViewColumnHeading; - - return LocalizationCategory.Other; - } - #endregion #region Properties @@ -376,7 +184,7 @@ public string Id get { if (string.IsNullOrEmpty(_id)) - _id = MakeId(_component); + _id = null; return _id; } @@ -405,8 +213,6 @@ internal IComponent Component set { _component = value; - if (_component != null && string.IsNullOrEmpty(_id)) - Id = MakeId(_component); } } @@ -483,25 +289,7 @@ public LocalizationCategory Category /// Gets or sets the shortcutKeys. /// /// ------------------------------------------------------------------------------------ - public string ShortcutKeys - { - get - { - if (_shortcutKeys == null && _component != null) - { - object keysobj = Utils.GetProperty(_component, "ShortcutKeys"); - if (keysobj != null && keysobj.GetType() == typeof(Keys)) - { - Keys keys = (Keys)keysobj; - _shortcutKeys = (keys == Keys.None ? - string.Empty : ShortcutKeysEditor.KeysToString(keys)); - } - } - - return _shortcutKeys; - } - set { _shortcutKeys = (value == Keys.None.ToString() ? string.Empty : value); } - } + public string ShortcutKeys; /// ------------------------------------------------------------------------------------ /// diff --git a/src/L10NSharp/ILocalizableComponent.cs b/src/L10NSharp/WindowsForms/ILocalizableComponent.cs similarity index 94% rename from src/L10NSharp/ILocalizableComponent.cs rename to src/L10NSharp/WindowsForms/ILocalizableComponent.cs index 74234b7..444cb90 100644 --- a/src/L10NSharp/ILocalizableComponent.cs +++ b/src/L10NSharp/WindowsForms/ILocalizableComponent.cs @@ -1,7 +1,7 @@ using System.Collections.Generic; -using L10NSharp.UI; +using L10NSharp.WindowsForms.UI; -namespace L10NSharp +namespace L10NSharp.WindowsForms { /// /// This interface allows a control to be localized by L10NSharp. It can be used to enable diff --git a/src/L10NSharp/WindowsForms/ILocalizationManagerInternalWinforms.cs b/src/L10NSharp/WindowsForms/ILocalizationManagerInternalWinforms.cs index 022e9e4..9ca6a04 100644 --- a/src/L10NSharp/WindowsForms/ILocalizationManagerInternalWinforms.cs +++ b/src/L10NSharp/WindowsForms/ILocalizationManagerInternalWinforms.cs @@ -12,17 +12,18 @@ namespace L10NSharp.WindowsForms internal interface ILocalizationManagerInternalWinforms: ILocalizationManagerInternal { Dictionary ToolTipCtrls { get; } + Dictionary> LocalizableComponents { get; } Icon ApplicationIcon { get; set; } void RegisterComponentForLocalizing(IComponent component, string id, string defaultText, string defaultTooltip, string defaultShortcutKeys, string comment); - void RegisterComponentForLocalizing(LocalizingInfo info, - Action successAction); + void RegisterComponentForLocalizing(LocalizingInfoWinforms info, + Action successAction); } internal interface ILocalizationManagerInternalWinforms : ILocalizationManagerInternalWinforms, ILocalizationManagerInternal { - + new ILocalizedStringCacheWinforms StringCache { get; } } } diff --git a/src/L10NSharp/WindowsForms/ILocalizedStringCacheWinforms.cs b/src/L10NSharp/WindowsForms/ILocalizedStringCacheWinforms.cs new file mode 100644 index 0000000..b4220fd --- /dev/null +++ b/src/L10NSharp/WindowsForms/ILocalizedStringCacheWinforms.cs @@ -0,0 +1,16 @@ +// // Copyright © 2019-2025 SIL Global +// // This software is licensed under the MIT License (http://opensource.org/licenses/MIT) + +using System.Collections.Generic; +using System.Windows.Forms; +using L10NSharp.WindowsForms.UI; + +namespace L10NSharp.WindowsForms +{ + internal interface ILocalizedStringCacheWinforms:ILocalizedStringCache + { + List> LeafNodeList { get; } + Keys GetShortcutKeys(string langId, string id); + void LoadGroupNodes(TreeNodeCollection topCollection); + } +} diff --git a/src/L10NSharp/WindowsForms/LocalizationManagerWinforms.cs b/src/L10NSharp/WindowsForms/LocalizationManagerWinforms.cs index 7595615..dc4219f 100644 --- a/src/L10NSharp/WindowsForms/LocalizationManagerWinforms.cs +++ b/src/L10NSharp/WindowsForms/LocalizationManagerWinforms.cs @@ -1,18 +1,8 @@ // Copyright © 2022-2025 SIL Global // This software is licensed under the MIT License (http://opensource.org/licenses/MIT) -using System; using System.Collections.Generic; -using System.ComponentModel; -using System.Diagnostics; -using System.Drawing; -using System.Globalization; -using System.IO; -using System.Reflection; -using System.Threading; using System.Windows.Forms; -using L10NSharp.TMXUtils; -using L10NSharp.UI; using L10NSharp.XLiffUtils; namespace L10NSharp.WindowsForms diff --git a/src/L10NSharp/WindowsForms/LocalizingInfoWinforms.cs b/src/L10NSharp/WindowsForms/LocalizingInfoWinforms.cs new file mode 100644 index 0000000..cd2aba0 --- /dev/null +++ b/src/L10NSharp/WindowsForms/LocalizingInfoWinforms.cs @@ -0,0 +1,346 @@ +using System; +using System.ComponentModel; +using System.Windows.Forms; +using L10NSharp.WindowsForms.UI; + +namespace L10NSharp.WindowsForms +{ + /// ---------------------------------------------------------------------------------------- + /// + /// This class is used to keep track of all the localization information (i.e. extended + /// properties of the LocalizationExtender) for a single object extended by the + /// LocalizationExtender. The type of object is either a Control or ToolStripItem and + /// the information kept track of is the text, tooltip, shortcut keys, localization + /// priority, comment and localization category. + /// + /// ---------------------------------------------------------------------------------------- + public class LocalizingInfoWinforms : LocalizingInfo + { + private IComponent _component; + private string _id; + private string _text; + private string _shortcutKeys; + private string _comment; + private LocalizationCategory _category = LocalizationCategory.Unspecified; + + #region Constructors + /// ------------------------------------------------------------------------------------ + /// + /// Initializes a new instance of the class. + /// + /// ------------------------------------------------------------------------------------ + public LocalizingInfoWinforms(IComponent component, bool initTextFromObj) : base(component, initTextFromObj) + { + Category = GetCategory(_component); + if (initTextFromObj) + UpdateTextFromObject(); + } + + public void UpdateTextFromObject() + { + Text = LocalizationManager.StripOffLocalizationInfoFromText(_component is DataGridViewColumn + ? ((DataGridViewColumn) _component).HeaderText + : Utils.GetProperty(_component, "Text") as string); + } + + /// ------------------------------------------------------------------------------------ + /// + /// Initializes a new instance of the class. + /// + /// ------------------------------------------------------------------------------------ + public LocalizingInfoWinforms(IComponent component, string id) : this(component, true) + { + Id = id; + } + + /// ------------------------------------------------------------------------------------ + /// + /// Initializes a new instance of the class. + /// + /// ------------------------------------------------------------------------------------ + public LocalizingInfoWinforms(string id) : base(id) + { + } + + #endregion + + #region Methods for initializing the localization id. + + internal void CreateIdIfMissing(string prefixForId) + { + if (prefixForId == null) + prefixForId = ""; + if (string.IsNullOrEmpty(_id)) + _id = MakeId(_component, idPrefixFromFormExtender: prefixForId); + } + + /// ------------------------------------------------------------------------------------ + /// + /// Sets the id. + /// + /// ------------------------------------------------------------------------------------ + internal static string MakeId(IComponent component, string idPrefixFromFormExtender = "") + { + if (idPrefixFromFormExtender == null) + idPrefixFromFormExtender = ""; + + idPrefixFromFormExtender = idPrefixFromFormExtender.Trim('.', ' '); + if (idPrefixFromFormExtender.Length > 0) + idPrefixFromFormExtender = idPrefixFromFormExtender + "."; + + if (component is Form) + { + Form frm = (Form)component; + return (frm.Site != null && frm.Site.DesignMode ? frm.Site.Name : frm.Name) + ".WindowTitle"; + } + + if (component is Control) + return idPrefixFromFormExtender+MakeIdForCtrl(component as Control); + + if (component is ColumnHeader) + return idPrefixFromFormExtender + MakeIdForColumnHeader((ColumnHeader)component); + + if (component is DataGridViewColumn) + return idPrefixFromFormExtender + MakeIdForDataGridViewColumn((DataGridViewColumn)component); + + if (component is ToolStripItem) + { + string formName = OwningFormName(component as ToolStripItem); + return idPrefixFromFormExtender + (formName ?? "Miscellaneous") + "." + ((ToolStripItem)component).Name; + } + + return null; + } + + /// ------------------------------------------------------------------------------------ + /// + /// Sets the id for CTRL. + /// + /// ------------------------------------------------------------------------------------ + private static string MakeIdForCtrl(Control ctrl) + { + if (ctrl == null) + return null; + + if (ctrl.Text.StartsWith(LocalizationManager.kL10NPrefix)) + return GetIdFromText(ctrl.Text); + + string prefix = GetIdPrefix(ctrl); + if (string.IsNullOrEmpty(prefix)) + return ctrl.Name; + + //return (string.IsNullOrEmpty(prefix) ? string.Empty : prefix + "." + ctrl.Name); + return prefix.Trim(new char[] { '.' }) + "." + ctrl.Name.Trim(new char[] { '.' }); + } + + /// ------------------------------------------------------------------------------------ + /// + /// Makes an id for a column header. + /// + /// ------------------------------------------------------------------------------------ + private static string MakeIdForColumnHeader(ColumnHeader hdr) + { + return (hdr == null ? null : GetIdFromText(hdr.Name)); + } + + /// ------------------------------------------------------------------------------------ + /// + /// Makes an id for a DataGridView column. + /// Note that in order to have a DataGridViewColumn header be localizable, one must create the HeaderText + /// in the following format: _L10N_:{ID}!{EnglishName} + /// + /// ------------------------------------------------------------------------------------ + private static string MakeIdForDataGridViewColumn(DataGridViewColumn col) + { + return (col == null || !col.HeaderText.StartsWith(LocalizationManager.kL10NPrefix) ? + null : GetIdFromText(col.HeaderText)); + } + + /*/// ------------------------------------------------------------------------------------ + public static string GetIdFromText(string text) + { + if (text.StartsWith(LocalizationManager.kL10NPrefix)) + text = text.Substring(LocalizationManager.kL10NPrefix.Length); + + int i = text.IndexOf("!", StringComparison.Ordinal); + //review: this is what David had, but I don't understand it (and the unit test fails with it) + //return (i < 0 ? string.Empty : text.Substring(0, i)); + return (i < 0 ? text : text.Substring(0, i)); + }*/ + + /// ------------------------------------------------------------------------------------ + /// + /// Tries to get the name of the form that hosts the specified control. That name is + /// used as the prefix for a localization id. + /// + /// ------------------------------------------------------------------------------------ + private static string GetIdPrefix(Control control) + { + if (control == null) + return "Miscellaneous"; + if (control.Parent == null) + return ""; + + while (control.Parent != null && + !control.Parent.GetType().FullName.StartsWith("System.Windows.Forms.Design")) + { + control = control.Parent; + } + + + return (control.Site != null && control.Site.DesignMode ? control.Site.Name : control.Name); + } + + /// ------------------------------------------------------------------------------------ + /// + /// Gets the name of the form to which the specified ToolStripItem belongs. + /// + /// ------------------------------------------------------------------------------------ + private static string OwningFormName(ToolStripItem tsItem) + { + if (tsItem != null) + { + var item = tsItem; + while (item.OwnerItem != null) + item = item.OwnerItem; + + if (item.Owner != null) + { + var frm = item.Owner.FindForm(); + if (frm != null) + return (frm.Site != null && frm.Site.DesignMode ? frm.Site.Name : frm.Name); + } + } + + return string.Empty; + } + + #endregion + + #region Method for initializing the category + /// ------------------------------------------------------------------------------------ + /// + /// Returns the localization category for the specified IComponent object. + /// + /// ------------------------------------------------------------------------------------ + private static LocalizationCategory GetCategory(IComponent component) + { + if (component is ILocalizableComponent) + return LocalizationCategory.LocalizableComponent; + if (component is ToolStripMenuItem) + return LocalizationCategory.MenuItem; + if (component is ToolStripItem) + return LocalizationCategory.ToolbarOrStatusBarItem; + if (component is Button) + return LocalizationCategory.Button; + if (component is TextBox) + return LocalizationCategory.TextBox; + if (component is LinkLabel) + return LocalizationCategory.LinkLabel; + if (component is Label) + return LocalizationCategory.Label; + if (component is ComboBox) + return LocalizationCategory.ComboBox; + if (component is RadioButton) + return LocalizationCategory.RadioButton; + if (component is CheckBox) + return LocalizationCategory.CheckBox; + if (component is Form) + return LocalizationCategory.WindowOrDialog; + if (component is TabPage) + return LocalizationCategory.TabPage; + if (component is ColumnHeader) + return LocalizationCategory.ListViewColumnHeading; + if (component is DataGridViewColumn) + return LocalizationCategory.ListViewColumnHeading; + + return LocalizationCategory.Other; + } + + #endregion + + #region Properties + /// ------------------------------------------------------------------------------------ + public bool IsEmpty + { + get + { + return + ((_text ?? string.Empty).Trim() == string.Empty && + (ToolTipText ?? string.Empty).Trim() == string.Empty && + (_shortcutKeys ?? string.Empty).Trim() == string.Empty && + (_comment ?? string.Empty).Trim() == string.Empty); + } + } + + /// ------------------------------------------------------------------------------------ + /// + /// Gets or sets the id. + /// + /// ------------------------------------------------------------------------------------ + public new string Id + { + get + { + if (string.IsNullOrEmpty(_id)) + _id = MakeId(_component); + + return _id; + } + set + { + _id = value; + if (string.IsNullOrEmpty(_id)) + { + Priority = LocalizationPriority.NotLocalizable; + } + else + { + _id = _id.Trim().Replace("..", ".");//it happens... + } + } + } + + /// ------------------------------------------------------------------------------------ + /// + /// Gets the component. + /// + /// ------------------------------------------------------------------------------------ + internal new IComponent Component + { + get { return _component; } + set + { + _component = value; + if (_component != null && string.IsNullOrEmpty(_id)) + Id = MakeId(_component); + } + } + + /// ------------------------------------------------------------------------------------ + /// + /// Gets or sets the shortcutKeys. + /// + /// ------------------------------------------------------------------------------------ + public new string ShortcutKeys + { + get + { + if (_shortcutKeys == null && _component != null) + { + object keysobj = Utils.GetProperty(_component, "ShortcutKeys"); + if (keysobj != null && keysobj.GetType() == typeof(Keys)) + { + Keys keys = (Keys)keysobj; + _shortcutKeys = (keys == Keys.None ? + string.Empty : ShortcutKeysEditor.KeysToString(keys)); + } + } + + return _shortcutKeys; + } + set { _shortcutKeys = (value == Keys.None.ToString() ? string.Empty : value); } + } + #endregion + } +} diff --git a/src/L10NSharp/UI/ColorHelper.cs b/src/L10NSharp/WindowsForms/UI/ColorHelper.cs similarity index 98% rename from src/L10NSharp/UI/ColorHelper.cs rename to src/L10NSharp/WindowsForms/UI/ColorHelper.cs index 4574a23..f503822 100644 --- a/src/L10NSharp/UI/ColorHelper.cs +++ b/src/L10NSharp/WindowsForms/UI/ColorHelper.cs @@ -1,6 +1,6 @@ using System.Drawing; -namespace L10NSharp.UI +namespace L10NSharp.WindowsForms.UI { internal static class ColorHelper { diff --git a/src/L10NSharp/UI/CustomDropDownComboBox.Designer.cs b/src/L10NSharp/WindowsForms/UI/CustomDropDownComboBox.Designer.cs similarity index 98% rename from src/L10NSharp/UI/CustomDropDownComboBox.Designer.cs rename to src/L10NSharp/WindowsForms/UI/CustomDropDownComboBox.Designer.cs index e05f9b4..66c8193 100644 --- a/src/L10NSharp/UI/CustomDropDownComboBox.Designer.cs +++ b/src/L10NSharp/WindowsForms/UI/CustomDropDownComboBox.Designer.cs @@ -1,4 +1,4 @@ -namespace L10NSharp.UI +namespace L10NSharp.WindowsForms.UI { partial class CustomDropDownComboBox { diff --git a/src/L10NSharp/UI/CustomDropDownComboBox.cs b/src/L10NSharp/WindowsForms/UI/CustomDropDownComboBox.cs similarity index 99% rename from src/L10NSharp/UI/CustomDropDownComboBox.cs rename to src/L10NSharp/WindowsForms/UI/CustomDropDownComboBox.cs index d2136f3..0260b56 100644 --- a/src/L10NSharp/UI/CustomDropDownComboBox.cs +++ b/src/L10NSharp/WindowsForms/UI/CustomDropDownComboBox.cs @@ -3,7 +3,7 @@ using System.Windows.Forms; using System.Windows.Forms.VisualStyles; -namespace L10NSharp.UI +namespace L10NSharp.WindowsForms.UI { /// ---------------------------------------------------------------------------------------- internal partial class CustomDropDownComboBox : UserControl diff --git a/src/L10NSharp/UI/CustomDropDownComboBox.resx b/src/L10NSharp/WindowsForms/UI/CustomDropDownComboBox.resx similarity index 100% rename from src/L10NSharp/UI/CustomDropDownComboBox.resx rename to src/L10NSharp/WindowsForms/UI/CustomDropDownComboBox.resx diff --git a/src/L10NSharp/UI/DontShowThisAgainButton.Designer.cs b/src/L10NSharp/WindowsForms/UI/DontShowThisAgainButton.Designer.cs similarity index 96% rename from src/L10NSharp/UI/DontShowThisAgainButton.Designer.cs rename to src/L10NSharp/WindowsForms/UI/DontShowThisAgainButton.Designer.cs index b0e82d6..b0ebe21 100644 --- a/src/L10NSharp/UI/DontShowThisAgainButton.Designer.cs +++ b/src/L10NSharp/WindowsForms/UI/DontShowThisAgainButton.Designer.cs @@ -1,4 +1,4 @@ -namespace L10NSharp +namespace L10NSharp.WindowsForms.UI { partial class DontShowThisAgainButton { diff --git a/src/L10NSharp/UI/DontShowThisAgainButton.cs b/src/L10NSharp/WindowsForms/UI/DontShowThisAgainButton.cs similarity index 98% rename from src/L10NSharp/UI/DontShowThisAgainButton.cs rename to src/L10NSharp/WindowsForms/UI/DontShowThisAgainButton.cs index a027399..e46273b 100644 --- a/src/L10NSharp/UI/DontShowThisAgainButton.cs +++ b/src/L10NSharp/WindowsForms/UI/DontShowThisAgainButton.cs @@ -7,7 +7,7 @@ using System.Windows.Forms; using L10NSharp.Properties; -namespace L10NSharp +namespace L10NSharp.WindowsForms.UI { public partial class DontShowThisAgainButton : CheckBox { diff --git a/src/L10NSharp/UI/EditSourceBeforeTranslatingDlg.Designer.cs b/src/L10NSharp/WindowsForms/UI/EditSourceBeforeTranslatingDlg.Designer.cs similarity index 99% rename from src/L10NSharp/UI/EditSourceBeforeTranslatingDlg.Designer.cs rename to src/L10NSharp/WindowsForms/UI/EditSourceBeforeTranslatingDlg.Designer.cs index 624a8f5..2994637 100644 --- a/src/L10NSharp/UI/EditSourceBeforeTranslatingDlg.Designer.cs +++ b/src/L10NSharp/WindowsForms/UI/EditSourceBeforeTranslatingDlg.Designer.cs @@ -1,4 +1,4 @@ -namespace L10NSharp.UI +namespace L10NSharp.WindowsForms.UI { partial class EditSourceBeforeTranslatingDlg { @@ -206,4 +206,4 @@ private void InitializeComponent() private System.Windows.Forms.Label _labelDescription; private System.Windows.Forms.Button _buttonCopyAndClose; } -} \ No newline at end of file +} diff --git a/src/L10NSharp/UI/EditSourceBeforeTranslatingDlg.cs b/src/L10NSharp/WindowsForms/UI/EditSourceBeforeTranslatingDlg.cs similarity index 97% rename from src/L10NSharp/UI/EditSourceBeforeTranslatingDlg.cs rename to src/L10NSharp/WindowsForms/UI/EditSourceBeforeTranslatingDlg.cs index 243aadf..fdbc58a 100644 --- a/src/L10NSharp/UI/EditSourceBeforeTranslatingDlg.cs +++ b/src/L10NSharp/WindowsForms/UI/EditSourceBeforeTranslatingDlg.cs @@ -4,7 +4,7 @@ using System.Windows.Forms; using L10NSharp.Translators; -namespace L10NSharp.UI +namespace L10NSharp.WindowsForms.UI { public partial class EditSourceBeforeTranslatingDlg : Form { diff --git a/src/L10NSharp/UI/EditSourceBeforeTranslatingDlg.resx b/src/L10NSharp/WindowsForms/UI/EditSourceBeforeTranslatingDlg.resx similarity index 100% rename from src/L10NSharp/UI/EditSourceBeforeTranslatingDlg.resx rename to src/L10NSharp/WindowsForms/UI/EditSourceBeforeTranslatingDlg.resx diff --git a/src/L10NSharp/UI/FallbackLanguagesDlg.cs b/src/L10NSharp/WindowsForms/UI/FallbackLanguagesDlg.cs similarity index 96% rename from src/L10NSharp/UI/FallbackLanguagesDlg.cs rename to src/L10NSharp/WindowsForms/UI/FallbackLanguagesDlg.cs index 1deca74..372054a 100644 --- a/src/L10NSharp/UI/FallbackLanguagesDlg.cs +++ b/src/L10NSharp/WindowsForms/UI/FallbackLanguagesDlg.cs @@ -6,7 +6,7 @@ using System.Threading.Tasks; using System.Windows.Forms; -namespace L10NSharp.UI +namespace L10NSharp.WindowsForms.UI { public class FallbackLanguagesDlg : FallbackLanguagesDlgBase { diff --git a/src/L10NSharp/UI/FallbackLanguagesDlgBase.Designer.cs b/src/L10NSharp/WindowsForms/UI/FallbackLanguagesDlgBase.Designer.cs similarity index 98% rename from src/L10NSharp/UI/FallbackLanguagesDlgBase.Designer.cs rename to src/L10NSharp/WindowsForms/UI/FallbackLanguagesDlgBase.Designer.cs index 8f1dcc7..2b00e9a 100644 --- a/src/L10NSharp/UI/FallbackLanguagesDlgBase.Designer.cs +++ b/src/L10NSharp/WindowsForms/UI/FallbackLanguagesDlgBase.Designer.cs @@ -1,4 +1,4 @@ -namespace L10NSharp.UI +namespace L10NSharp.WindowsForms.UI { partial class FallbackLanguagesDlgBase { @@ -112,7 +112,7 @@ private void InitializeComponent() // // _buttonAdd // - this._buttonAdd.Image = global::L10NSharp.Properties.Resources.Move; + this._buttonAdd.Image = global::L10NSharp.Properties.Resources.Move; this._buttonAdd.ImageAlign = System.Drawing.ContentAlignment.MiddleRight; this._buttonAdd.Location = new System.Drawing.Point(188, 123); this._buttonAdd.Name = "_buttonAdd"; diff --git a/src/L10NSharp/UI/FallbackLanguagesDlgBase.cs b/src/L10NSharp/WindowsForms/UI/FallbackLanguagesDlgBase.cs similarity index 99% rename from src/L10NSharp/UI/FallbackLanguagesDlgBase.cs rename to src/L10NSharp/WindowsForms/UI/FallbackLanguagesDlgBase.cs index 9cf9bc0..1026020 100644 --- a/src/L10NSharp/UI/FallbackLanguagesDlgBase.cs +++ b/src/L10NSharp/WindowsForms/UI/FallbackLanguagesDlgBase.cs @@ -4,7 +4,7 @@ using System.Globalization; using System.Windows.Forms; -namespace L10NSharp.UI +namespace L10NSharp.WindowsForms.UI { /// ------------------------------------------------------------------------------------ public partial class FallbackLanguagesDlgBase : Form diff --git a/src/L10NSharp/UI/FallbackLanguagesDlgBase.resx b/src/L10NSharp/WindowsForms/UI/FallbackLanguagesDlgBase.resx similarity index 100% rename from src/L10NSharp/UI/FallbackLanguagesDlgBase.resx rename to src/L10NSharp/WindowsForms/UI/FallbackLanguagesDlgBase.resx diff --git a/src/L10NSharp/UI/Grid/LmButtonCell.cs b/src/L10NSharp/WindowsForms/UI/Grid/LmButtonCell.cs similarity index 99% rename from src/L10NSharp/UI/Grid/LmButtonCell.cs rename to src/L10NSharp/WindowsForms/UI/Grid/LmButtonCell.cs index d277a8a..d498c4d 100644 --- a/src/L10NSharp/UI/Grid/LmButtonCell.cs +++ b/src/L10NSharp/WindowsForms/UI/Grid/LmButtonCell.cs @@ -3,7 +3,7 @@ using System.Windows.Forms; using System.Windows.Forms.VisualStyles; -namespace L10NSharp.UI +namespace L10NSharp.WindowsForms.UI { #region LmButtonCell class /// ---------------------------------------------------------------------------------------- diff --git a/src/L10NSharp/UI/Grid/LmButtonColumn.cs b/src/L10NSharp/WindowsForms/UI/Grid/LmButtonColumn.cs similarity index 99% rename from src/L10NSharp/UI/Grid/LmButtonColumn.cs rename to src/L10NSharp/WindowsForms/UI/Grid/LmButtonColumn.cs index d70374a..fc8277f 100644 --- a/src/L10NSharp/UI/Grid/LmButtonColumn.cs +++ b/src/L10NSharp/WindowsForms/UI/Grid/LmButtonColumn.cs @@ -2,7 +2,7 @@ using System.Drawing; using System.Windows.Forms; -namespace L10NSharp.UI +namespace L10NSharp.WindowsForms.UI { /// ---------------------------------------------------------------------------------------- public class LmButtonColumn : DataGridViewColumn diff --git a/src/L10NSharp/UI/Grid/LmGrid.cs b/src/L10NSharp/WindowsForms/UI/Grid/LmGrid.cs similarity index 99% rename from src/L10NSharp/UI/Grid/LmGrid.cs rename to src/L10NSharp/WindowsForms/UI/Grid/LmGrid.cs index 8a01a97..01cd0cc 100644 --- a/src/L10NSharp/UI/Grid/LmGrid.cs +++ b/src/L10NSharp/WindowsForms/UI/Grid/LmGrid.cs @@ -7,7 +7,7 @@ using System.Windows.Forms; using System.Windows.Forms.VisualStyles; -namespace L10NSharp.UI +namespace L10NSharp.WindowsForms.UI { /// ---------------------------------------------------------------------------------------- public class LmGrid : DataGridView diff --git a/src/L10NSharp/UI/HowToDistributeDialog.Designer.cs b/src/L10NSharp/WindowsForms/UI/HowToDistributeDialog.Designer.cs similarity index 99% rename from src/L10NSharp/UI/HowToDistributeDialog.Designer.cs rename to src/L10NSharp/WindowsForms/UI/HowToDistributeDialog.Designer.cs index eaa1811..b6ba830 100644 --- a/src/L10NSharp/UI/HowToDistributeDialog.Designer.cs +++ b/src/L10NSharp/WindowsForms/UI/HowToDistributeDialog.Designer.cs @@ -1,4 +1,4 @@ -namespace L10NSharp.UI +namespace L10NSharp.WindowsForms.UI { partial class HowToDistributeDialog { diff --git a/src/L10NSharp/UI/HowToDistributeDialog.cs b/src/L10NSharp/WindowsForms/UI/HowToDistributeDialog.cs similarity index 98% rename from src/L10NSharp/UI/HowToDistributeDialog.cs rename to src/L10NSharp/WindowsForms/UI/HowToDistributeDialog.cs index 0c42ff8..a7e2937 100644 --- a/src/L10NSharp/UI/HowToDistributeDialog.cs +++ b/src/L10NSharp/WindowsForms/UI/HowToDistributeDialog.cs @@ -4,7 +4,7 @@ using System.Linq; using System.Windows.Forms; -namespace L10NSharp.UI +namespace L10NSharp.WindowsForms.UI { public partial class HowToDistributeDialog : Form { diff --git a/src/L10NSharp/UI/HowToDistributeDialog.resx b/src/L10NSharp/WindowsForms/UI/HowToDistributeDialog.resx similarity index 100% rename from src/L10NSharp/UI/HowToDistributeDialog.resx rename to src/L10NSharp/WindowsForms/UI/HowToDistributeDialog.resx diff --git a/src/L10NSharp/UI/InitializationProgressDlg.cs b/src/L10NSharp/WindowsForms/UI/InitializationProgressDlg.cs similarity index 98% rename from src/L10NSharp/UI/InitializationProgressDlg.cs rename to src/L10NSharp/WindowsForms/UI/InitializationProgressDlg.cs index d434104..bc6d00e 100644 --- a/src/L10NSharp/UI/InitializationProgressDlg.cs +++ b/src/L10NSharp/WindowsForms/UI/InitializationProgressDlg.cs @@ -6,7 +6,7 @@ using System.Reflection; using L10NSharp.CodeReader; -namespace L10NSharp.UI +namespace L10NSharp.WindowsForms.UI { internal class InitializationProgressDlg: InitializationProgressDlgBase { diff --git a/src/L10NSharp/UI/InitializationProgressDlgBase.Designer.cs b/src/L10NSharp/WindowsForms/UI/InitializationProgressDlgBase.Designer.cs similarity index 99% rename from src/L10NSharp/UI/InitializationProgressDlgBase.Designer.cs rename to src/L10NSharp/WindowsForms/UI/InitializationProgressDlgBase.Designer.cs index ed524ba..e8a0ea7 100644 --- a/src/L10NSharp/UI/InitializationProgressDlgBase.Designer.cs +++ b/src/L10NSharp/WindowsForms/UI/InitializationProgressDlgBase.Designer.cs @@ -1,4 +1,4 @@ -namespace L10NSharp.UI +namespace L10NSharp.WindowsForms.UI { partial class InitializationProgressDlgBase { diff --git a/src/L10NSharp/UI/InitializationProgressDlgBase.cs b/src/L10NSharp/WindowsForms/UI/InitializationProgressDlgBase.cs similarity index 98% rename from src/L10NSharp/UI/InitializationProgressDlgBase.cs rename to src/L10NSharp/WindowsForms/UI/InitializationProgressDlgBase.cs index 7b7909b..aca7b10 100644 --- a/src/L10NSharp/UI/InitializationProgressDlgBase.cs +++ b/src/L10NSharp/WindowsForms/UI/InitializationProgressDlgBase.cs @@ -5,7 +5,7 @@ using System.Reflection; using System.Windows.Forms; -namespace L10NSharp.UI +namespace L10NSharp.WindowsForms.UI { /// ---------------------------------------------------------------------------------------- internal partial class InitializationProgressDlgBase : Form diff --git a/src/L10NSharp/UI/InitializationProgressDlgBase.resx b/src/L10NSharp/WindowsForms/UI/InitializationProgressDlgBase.resx similarity index 100% rename from src/L10NSharp/UI/InitializationProgressDlgBase.resx rename to src/L10NSharp/WindowsForms/UI/InitializationProgressDlgBase.resx diff --git a/src/L10NSharp/UI/L10NExtender.cs b/src/L10NSharp/WindowsForms/UI/L10NExtender.cs similarity index 97% rename from src/L10NSharp/UI/L10NExtender.cs rename to src/L10NSharp/WindowsForms/UI/L10NExtender.cs index 32e7386..3b4dad5 100644 --- a/src/L10NSharp/UI/L10NExtender.cs +++ b/src/L10NSharp/WindowsForms/UI/L10NExtender.cs @@ -21,9 +21,8 @@ using System.Diagnostics; using System.Linq; using System.Windows.Forms; -using L10NSharp.WindowsForms; -namespace L10NSharp.UI +namespace L10NSharp.WindowsForms.UI { /// ---------------------------------------------------------------------------------------- [ProvideProperty("LocalizingId", typeof(IComponent))] @@ -38,7 +37,7 @@ public class L10NSharpExtender : Component, IExtenderProvider, ISupportInitializ // Required for Windows.Forms Class Composition Designer support private Container components = null; #pragma warning restore CS0414 - private Dictionary m_extendedCtrls; + private Dictionary m_extendedCtrls; private ILocalizationManagerInternalWinforms _manager; private string _locManagerId; //private string _idPrefixForThisForm=""; @@ -61,7 +60,7 @@ public L10NSharpExtender() // Required for Windows.Forms Class Composition Designer support components = new Container(); - m_extendedCtrls = new Dictionary(); + m_extendedCtrls = new Dictionary(); } #endregion @@ -365,7 +364,7 @@ private void FinalizationForDataGridViewColumns() /// ------------------------------------------------------------------------------------ private void HandleGridColumnAdded(object sender, DataGridViewColumnEventArgs e) { - var locInfo = new LocalizingInfo(e.Column, true); + var locInfo = new LocalizingInfoWinforms(e.Column, true); _manager.RegisterComponentForLocalizing(locInfo, (lm, info) => lm.ApplyLocalization(info.Component)); } @@ -505,13 +504,13 @@ public void SetLocalizableToolTip(IComponent component, string tip) /// Gets the localized object info. for the specified component. /// /// ------------------------------------------------------------------------------------ - private LocalizingInfo GetLocalizedComponentInfo(IComponent component, bool initTextFromCompIfNewlyCreated) + private LocalizingInfoWinforms GetLocalizedComponentInfo(IComponent component, bool initTextFromCompIfNewlyCreated) { - LocalizingInfo loi; + LocalizingInfoWinforms loi; if (m_extendedCtrls.TryGetValue(component, out loi)) // && !string.IsNullOrEmpty(loi.Id) && loi.Priority != LocalizationPriority.NotLocalizable) return loi; - loi = new LocalizingInfo(component, initTextFromCompIfNewlyCreated); + loi = new LocalizingInfoWinforms(component, initTextFromCompIfNewlyCreated); m_extendedCtrls[component] = loi; return loi; } diff --git a/src/L10NSharp/UI/L10NExtender.resx b/src/L10NSharp/WindowsForms/UI/L10NExtender.resx similarity index 100% rename from src/L10NSharp/UI/L10NExtender.resx rename to src/L10NSharp/WindowsForms/UI/L10NExtender.resx diff --git a/src/L10NSharp/UI/LanguageChoosingDialog.Designer.cs b/src/L10NSharp/WindowsForms/UI/LanguageChoosingDialog.Designer.cs similarity index 97% rename from src/L10NSharp/UI/LanguageChoosingDialog.Designer.cs rename to src/L10NSharp/WindowsForms/UI/LanguageChoosingDialog.Designer.cs index 7317fab..f63deb3 100644 --- a/src/L10NSharp/UI/LanguageChoosingDialog.Designer.cs +++ b/src/L10NSharp/WindowsForms/UI/LanguageChoosingDialog.Designer.cs @@ -1,6 +1,6 @@ using System.Drawing; -namespace L10NSharp.UI +namespace L10NSharp.WindowsForms.UI { partial class LanguageChoosingDialog { @@ -32,7 +32,7 @@ private void InitializeComponent() { this._messageLabel = new System.Windows.Forms.Label(); this._OKButton = new System.Windows.Forms.Button(); - this.uiLanguageComboBox1 = new L10NSharp.UI.UILanguageComboBox(); + this.uiLanguageComboBox1 = new L10NSharp.WindowsForms.UI.UILanguageComboBox(); this.SuspendLayout(); // // _messageLabel diff --git a/src/L10NSharp/UI/LanguageChoosingDialog.cs b/src/L10NSharp/WindowsForms/UI/LanguageChoosingDialog.cs similarity index 96% rename from src/L10NSharp/UI/LanguageChoosingDialog.cs rename to src/L10NSharp/WindowsForms/UI/LanguageChoosingDialog.cs index 069f1bd..3f1d1a8 100644 --- a/src/L10NSharp/UI/LanguageChoosingDialog.cs +++ b/src/L10NSharp/WindowsForms/UI/LanguageChoosingDialog.cs @@ -3,7 +3,7 @@ using System.Windows.Forms; using L10NSharp.Translators; -namespace L10NSharp.UI +namespace L10NSharp.WindowsForms.UI { public partial class LanguageChoosingDialog : Form { diff --git a/src/L10NSharp/UI/LanguageChoosingDialog.resx b/src/L10NSharp/WindowsForms/UI/LanguageChoosingDialog.resx similarity index 100% rename from src/L10NSharp/UI/LanguageChoosingDialog.resx rename to src/L10NSharp/WindowsForms/UI/LanguageChoosingDialog.resx diff --git a/src/L10NSharp/UI/LanguageChoosingDialogViewModel.cs b/src/L10NSharp/WindowsForms/UI/LanguageChoosingDialogViewModel.cs similarity index 99% rename from src/L10NSharp/UI/LanguageChoosingDialogViewModel.cs rename to src/L10NSharp/WindowsForms/UI/LanguageChoosingDialogViewModel.cs index db9ee28..e6e0d47 100644 --- a/src/L10NSharp/UI/LanguageChoosingDialogViewModel.cs +++ b/src/L10NSharp/WindowsForms/UI/LanguageChoosingDialogViewModel.cs @@ -2,7 +2,7 @@ using System.Diagnostics; using L10NSharp.Translators; -namespace L10NSharp.UI +namespace L10NSharp.WindowsForms.UI { internal class LanguageChoosingDialogViewModel { diff --git a/src/L10NSharp/UI/LanguageChoosingSimpleDialog.Designer.cs b/src/L10NSharp/WindowsForms/UI/LanguageChoosingSimpleDialog.Designer.cs similarity index 93% rename from src/L10NSharp/UI/LanguageChoosingSimpleDialog.Designer.cs rename to src/L10NSharp/WindowsForms/UI/LanguageChoosingSimpleDialog.Designer.cs index 616a8c8..e640dfc 100644 --- a/src/L10NSharp/UI/LanguageChoosingSimpleDialog.Designer.cs +++ b/src/L10NSharp/WindowsForms/UI/LanguageChoosingSimpleDialog.Designer.cs @@ -1,4 +1,4 @@ -namespace L10NSharp.UI +namespace L10NSharp.WindowsForms.UI { partial class LanguageChoosingSimpleDialog { @@ -28,7 +28,7 @@ protected override void Dispose(bool disposing) /// private void InitializeComponent() { - this._uiLanguageListBox = new L10NSharp.UI.UILanguageListBox(); + this._uiLanguageListBox = new L10NSharp.WindowsForms.UI.UILanguageListBox(); this._btnOk = new System.Windows.Forms.Button(); this.SuspendLayout(); // @@ -77,7 +77,7 @@ private void InitializeComponent() #endregion - private L10NSharp.UI.UILanguageListBox _uiLanguageListBox; + private L10NSharp.WindowsForms.UI.UILanguageListBox _uiLanguageListBox; private System.Windows.Forms.Button _btnOk; } } diff --git a/src/L10NSharp/UI/LanguageChoosingSimpleDialog.cs b/src/L10NSharp/WindowsForms/UI/LanguageChoosingSimpleDialog.cs similarity index 95% rename from src/L10NSharp/UI/LanguageChoosingSimpleDialog.cs rename to src/L10NSharp/WindowsForms/UI/LanguageChoosingSimpleDialog.cs index ca9d5cc..563ed45 100644 --- a/src/L10NSharp/UI/LanguageChoosingSimpleDialog.cs +++ b/src/L10NSharp/WindowsForms/UI/LanguageChoosingSimpleDialog.cs @@ -2,7 +2,7 @@ using System.Drawing; using System.Windows.Forms; -namespace L10NSharp.UI +namespace L10NSharp.WindowsForms.UI { /// /// The current thinking for use of this dialog is when an application first starts up, diff --git a/src/L10NSharp/UI/LanguageChoosingSimpleDialog.resx b/src/L10NSharp/WindowsForms/UI/LanguageChoosingSimpleDialog.resx similarity index 100% rename from src/L10NSharp/UI/LanguageChoosingSimpleDialog.resx rename to src/L10NSharp/WindowsForms/UI/LanguageChoosingSimpleDialog.resx diff --git a/src/L10NSharp/UI/LocTreeNode.cs b/src/L10NSharp/WindowsForms/UI/LocTreeNode.cs similarity index 87% rename from src/L10NSharp/UI/LocTreeNode.cs rename to src/L10NSharp/WindowsForms/UI/LocTreeNode.cs index acc4e8f..ce1c7b6 100644 --- a/src/L10NSharp/UI/LocTreeNode.cs +++ b/src/L10NSharp/WindowsForms/UI/LocTreeNode.cs @@ -2,15 +2,15 @@ using System.Linq; using System.Windows.Forms; -namespace L10NSharp.UI +namespace L10NSharp.WindowsForms.UI { /// ---------------------------------------------------------------------------------------- internal class LocTreeNode : TreeNode { internal string Group { get; set; } internal string Id { get; private set; } - internal ILocalizationManagerInternal Manager { get; private set; } - internal Dictionary SavedTranslationInfo { get; private set; } + internal ILocalizationManagerInternalWinforms Manager { get; private set; } + internal Dictionary SavedTranslationInfo { get; private set; } internal string SavedComment { get; set; } /// ------------------------------------------------------------------------------------ @@ -18,14 +18,14 @@ internal class LocTreeNode : TreeNode /// Initializes a new instance of the class. /// /// ------------------------------------------------------------------------------------ - internal LocTreeNode(ILocalizationManagerInternal manager, string text, string id, string key) + internal LocTreeNode(ILocalizationManagerInternalWinforms manager, string text, string id, string key) { Manager = manager; Text = text; Id = id; Name = key; - SavedTranslationInfo = new Dictionary(); + SavedTranslationInfo = new Dictionary(); } /// ------------------------------------------------------------------------------------ diff --git a/src/L10NSharp/UI/LocalizeItemDlg.Designer.cs b/src/L10NSharp/WindowsForms/UI/LocalizeItemDlg.Designer.cs similarity index 99% rename from src/L10NSharp/UI/LocalizeItemDlg.Designer.cs rename to src/L10NSharp/WindowsForms/UI/LocalizeItemDlg.Designer.cs index 3a76700..bd30f70 100644 --- a/src/L10NSharp/UI/LocalizeItemDlg.Designer.cs +++ b/src/L10NSharp/WindowsForms/UI/LocalizeItemDlg.Designer.cs @@ -1,4 +1,4 @@ -namespace L10NSharp.UI +namespace L10NSharp.WindowsForms.UI { partial class LocalizeItemDlg { @@ -43,15 +43,15 @@ private void InitializeComponent() this._treeView = new System.Windows.Forms.TreeView(); this._toolStripLeftSide = new System.Windows.Forms.ToolStrip(); this._labelGroups = new System.Windows.Forms.ToolStripLabel(); - this._buttonMoveNext = new L10NSharp.UI.XButton(); - this._grid = new L10NSharp.UI.LmGrid(); + this._buttonMoveNext = new L10NSharp.WindowsForms.UI.XButton(); + this._grid = new L10NSharp.WindowsForms.UI.LmGrid(); this._colId = new System.Windows.Forms.DataGridViewTextBoxColumn(); this._colSourceText = new System.Windows.Forms.DataGridViewTextBoxColumn(); this._colTargetText = new System.Windows.Forms.DataGridViewTextBoxColumn(); this._colSrcToolTip = new System.Windows.Forms.DataGridViewTextBoxColumn(); this._colTgtToolTip = new System.Windows.Forms.DataGridViewTextBoxColumn(); this._colComments = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this._buttonMovePrev = new L10NSharp.UI.XButton(); + this._buttonMovePrev = new L10NSharp.WindowsForms.UI.XButton(); this._toolStripRightSide = new System.Windows.Forms.ToolStrip(); this._buttonBingTranslator = new System.Windows.Forms.ToolStripSplitButton(); this._menuTranslateUsingBing = new System.Windows.Forms.ToolStripMenuItem(); @@ -62,13 +62,13 @@ private void InitializeComponent() this._labelSourceLang = new System.Windows.Forms.ToolStripLabel(); this._tableLayout = new System.Windows.Forms.TableLayoutPanel(); this._panelIdentifier = new System.Windows.Forms.Panel(); - this.btnCopyToolTip = new L10NSharp.UI.XButton(); - this.btnCopyShortcutKeys = new L10NSharp.UI.XButton(); - this.btnCopyText = new L10NSharp.UI.XButton(); + this.btnCopyToolTip = new L10NSharp.WindowsForms.UI.XButton(); + this.btnCopyShortcutKeys = new L10NSharp.WindowsForms.UI.XButton(); + this.btnCopyText = new L10NSharp.WindowsForms.UI.XButton(); this._panelTargetText = new System.Windows.Forms.Panel(); this._groupBoxTgtTranslation = new System.Windows.Forms.GroupBox(); this._labelTgtShortcutKeys = new System.Windows.Forms.Label(); - this._shortcutKeysDropDown = new L10NSharp.UI.ShortcutKeysDropDown(); + this._shortcutKeysDropDown = new L10NSharp.WindowsForms.UI.ShortcutKeysDropDown(); this._labelTgtToolTip = new System.Windows.Forms.Label(); this._textBoxTgtToolTip = new System.Windows.Forms.TextBox(); this._panelSourceText = new System.Windows.Forms.Panel(); diff --git a/src/L10NSharp/UI/LocalizeItemDlg.cs b/src/L10NSharp/WindowsForms/UI/LocalizeItemDlg.cs similarity index 99% rename from src/L10NSharp/UI/LocalizeItemDlg.cs rename to src/L10NSharp/WindowsForms/UI/LocalizeItemDlg.cs index b0a4957..7ea31e3 100644 --- a/src/L10NSharp/UI/LocalizeItemDlg.cs +++ b/src/L10NSharp/WindowsForms/UI/LocalizeItemDlg.cs @@ -3,13 +3,11 @@ using System.ComponentModel; using System.Linq; using System.Drawing; -using System.Globalization; using System.Text; using System.Windows.Forms; using L10NSharp.Properties; -using L10NSharp.WindowsForms; -namespace L10NSharp.UI +namespace L10NSharp.WindowsForms.UI { /// ---------------------------------------------------------------------------------------- public partial class LocalizeItemDlg : Form @@ -346,7 +344,7 @@ private void SaveChangesFromSingleItemView() if (_grid.Visible || node == null) return; - var locInfo = new LocalizingInfo(node.Id); + var locInfo = new LocalizingInfoWinforms(node.Id); locInfo.Text = _textBoxTgtTranslation.Text.Trim(); locInfo.ToolTipText = _textBoxTgtToolTip.Text.Trim(); locInfo.ShortcutKeys = _shortcutKeysDropDown.Text.Trim(); @@ -810,7 +808,7 @@ private void HandleGridCellValuePushed(object sender, DataGridViewCellValueEvent if (_viewModel.AllLeafNodesShowingInGrid == null || e.RowIndex >= _viewModel.AllLeafNodesShowingInGrid.Count) return; - var locInfo = new LocalizingInfo(_viewModel.CurrentNode.Id); + var locInfo = new LocalizingInfoWinforms(_viewModel.CurrentNode.Id); locInfo.UpdateFields = UpdateFields.None; switch (e.ColumnIndex) { diff --git a/src/L10NSharp/UI/LocalizeItemDlg.resx b/src/L10NSharp/WindowsForms/UI/LocalizeItemDlg.resx similarity index 100% rename from src/L10NSharp/UI/LocalizeItemDlg.resx rename to src/L10NSharp/WindowsForms/UI/LocalizeItemDlg.resx diff --git a/src/L10NSharp/UI/LocalizeItemDlgViewModel.cs b/src/L10NSharp/WindowsForms/UI/LocalizeItemDlgViewModel.cs similarity index 97% rename from src/L10NSharp/UI/LocalizeItemDlgViewModel.cs rename to src/L10NSharp/WindowsForms/UI/LocalizeItemDlgViewModel.cs index 98795fe..c205d21 100644 --- a/src/L10NSharp/UI/LocalizeItemDlgViewModel.cs +++ b/src/L10NSharp/WindowsForms/UI/LocalizeItemDlgViewModel.cs @@ -6,7 +6,7 @@ using System.Windows.Forms; using L10NSharp.Translators; -namespace L10NSharp.UI +namespace L10NSharp.WindowsForms.UI { internal class LocalizeItemDlgViewModel { @@ -20,9 +20,9 @@ internal class LocalizeItemDlgViewModel public List> AllLeafNodesShowingInGrid { get; private set; } public List> AllLeafNodes { get; private set; } - public List> EnabledManagers; - private readonly Dictionary, HashSet> _modifiedManagersAndLanguages = - new Dictionary, HashSet>(); + public List> EnabledManagers; + private readonly Dictionary, HashSet> _modifiedManagersAndLanguages = + new Dictionary, HashSet>(); public ITranslator BingTranslator { get; private set; } public NodeComparer.SortField GridSortField { get; set; } public SortOrder GridSortOrder { get; set; } @@ -169,7 +169,7 @@ public void LoadTreeNodes(TreeView treeVw) { AllLeafNodes = new List>(); - EnabledManagers = LocalizationManagerInternal.LoadedManagers.Values + EnabledManagers = LocalizationManagerInternalWinforms.LoadedManagers.Values .OrderBy(lm => lm.Name).ToList(); foreach (var lm in EnabledManagers) @@ -258,7 +258,7 @@ public bool Save() /// Saves localization changes. /// /// ------------------------------------------------------------------------------------ - public void SaveChangesInMemory(LocalizingInfo locInfo) + public void SaveChangesInMemory(LocalizingInfoWinforms locInfo) { if (locInfo?.Id == null || locInfo.UpdateFields == UpdateFields.None) return; @@ -267,7 +267,7 @@ public void SaveChangesInMemory(LocalizingInfo locInfo) } /// ------------------------------------------------------------------------------------ - public void SaveChangesInMemory(LocTreeNode node, LocalizingInfo locInfo) + public void SaveChangesInMemory(LocTreeNode node, LocalizingInfoWinforms locInfo) { if (locInfo?.Id == null || locInfo.UpdateFields == UpdateFields.None || _tgtLangId == _srcLangId) { @@ -412,7 +412,7 @@ private void HandleTranslateItems(object sender, DoWorkEventArgs e) foreach (var kvp in nodesToTranslate) { var node = kvp.Value; - var locInfo = new LocalizingInfo(node.Id); + var locInfo = new LocalizingInfoWinforms(node.Id); locInfo.UpdateFields = UpdateFields.None; locInfo.LangId = TgtLangId; diff --git a/src/L10NSharp/UI/NodeComparer.cs b/src/L10NSharp/WindowsForms/UI/NodeComparer.cs similarity index 97% rename from src/L10NSharp/UI/NodeComparer.cs rename to src/L10NSharp/WindowsForms/UI/NodeComparer.cs index a3678f2..3a5ac25 100644 --- a/src/L10NSharp/UI/NodeComparer.cs +++ b/src/L10NSharp/WindowsForms/UI/NodeComparer.cs @@ -4,8 +4,9 @@ using System.Collections.Generic; using System.Globalization; using System.Windows.Forms; +using L10NSharp.WindowsForms; -namespace L10NSharp.UI +namespace L10NSharp.WindowsForms.UI { /// ---------------------------------------------------------------------------------------- internal class NodeComparer : IComparer> diff --git a/src/L10NSharp/UI/PaintingHelper.cs b/src/L10NSharp/WindowsForms/UI/PaintingHelper.cs similarity index 99% rename from src/L10NSharp/UI/PaintingHelper.cs rename to src/L10NSharp/WindowsForms/UI/PaintingHelper.cs index ab8d61c..6f4331f 100644 --- a/src/L10NSharp/UI/PaintingHelper.cs +++ b/src/L10NSharp/WindowsForms/UI/PaintingHelper.cs @@ -5,7 +5,7 @@ using System.Windows.Forms; using System.Windows.Forms.VisualStyles; -namespace L10NSharp.UI +namespace L10NSharp.WindowsForms.UI { /// ------------------------------------------------------------------------------------ /// diff --git a/src/L10NSharp/UI/PopupControl.cs b/src/L10NSharp/WindowsForms/UI/PopupControl.cs similarity index 99% rename from src/L10NSharp/UI/PopupControl.cs rename to src/L10NSharp/WindowsForms/UI/PopupControl.cs index 290f3b5..5d6338b 100644 --- a/src/L10NSharp/UI/PopupControl.cs +++ b/src/L10NSharp/WindowsForms/UI/PopupControl.cs @@ -5,7 +5,7 @@ using System.Drawing.Drawing2D; using System.Windows.Forms; -namespace L10NSharp.UI +namespace L10NSharp.WindowsForms.UI { /// ---------------------------------------------------------------------------------------- internal partial class PopupControl : UserControl diff --git a/src/L10NSharp/UI/PopupControl.designer.cs b/src/L10NSharp/WindowsForms/UI/PopupControl.designer.cs similarity index 95% rename from src/L10NSharp/UI/PopupControl.designer.cs rename to src/L10NSharp/WindowsForms/UI/PopupControl.designer.cs index 1fc9b46..94d1cff 100644 --- a/src/L10NSharp/UI/PopupControl.designer.cs +++ b/src/L10NSharp/WindowsForms/UI/PopupControl.designer.cs @@ -1,4 +1,4 @@ -namespace L10NSharp.UI +namespace L10NSharp.WindowsForms.UI { partial class PopupControl { diff --git a/src/L10NSharp/UI/PopupControl.resx b/src/L10NSharp/WindowsForms/UI/PopupControl.resx similarity index 100% rename from src/L10NSharp/UI/PopupControl.resx rename to src/L10NSharp/WindowsForms/UI/PopupControl.resx diff --git a/src/L10NSharp/UI/ShortcutKeysDropDown.cs b/src/L10NSharp/WindowsForms/UI/ShortcutKeysDropDown.cs similarity index 98% rename from src/L10NSharp/UI/ShortcutKeysDropDown.cs rename to src/L10NSharp/WindowsForms/UI/ShortcutKeysDropDown.cs index 1d2710f..5275be6 100644 --- a/src/L10NSharp/UI/ShortcutKeysDropDown.cs +++ b/src/L10NSharp/WindowsForms/UI/ShortcutKeysDropDown.cs @@ -1,7 +1,7 @@ using System; using System.Windows.Forms; -namespace L10NSharp.UI +namespace L10NSharp.WindowsForms.UI { /// ---------------------------------------------------------------------------------------- internal class ShortcutKeysDropDown : CustomDropDownComboBox diff --git a/src/L10NSharp/UI/ShortcutKeysEditor.Designer.cs b/src/L10NSharp/WindowsForms/UI/ShortcutKeysEditor.Designer.cs similarity index 99% rename from src/L10NSharp/UI/ShortcutKeysEditor.Designer.cs rename to src/L10NSharp/WindowsForms/UI/ShortcutKeysEditor.Designer.cs index 5ec6a91..803e1cd 100644 --- a/src/L10NSharp/UI/ShortcutKeysEditor.Designer.cs +++ b/src/L10NSharp/WindowsForms/UI/ShortcutKeysEditor.Designer.cs @@ -1,4 +1,4 @@ -namespace L10NSharp.UI +namespace L10NSharp.WindowsForms.UI { partial class ShortcutKeysEditor { diff --git a/src/L10NSharp/UI/ShortcutKeysEditor.cs b/src/L10NSharp/WindowsForms/UI/ShortcutKeysEditor.cs similarity index 99% rename from src/L10NSharp/UI/ShortcutKeysEditor.cs rename to src/L10NSharp/WindowsForms/UI/ShortcutKeysEditor.cs index 22b30c9..4763088 100644 --- a/src/L10NSharp/UI/ShortcutKeysEditor.cs +++ b/src/L10NSharp/WindowsForms/UI/ShortcutKeysEditor.cs @@ -2,7 +2,7 @@ using System.Drawing; using System.Windows.Forms; -namespace L10NSharp.UI +namespace L10NSharp.WindowsForms.UI { /// ---------------------------------------------------------------------------------------- internal partial class ShortcutKeysEditor : PopupControl diff --git a/src/L10NSharp/UI/ShortcutKeysEditor.resx b/src/L10NSharp/WindowsForms/UI/ShortcutKeysEditor.resx similarity index 100% rename from src/L10NSharp/UI/ShortcutKeysEditor.resx rename to src/L10NSharp/WindowsForms/UI/ShortcutKeysEditor.resx diff --git a/src/L10NSharp/UI/TipDialog.cs b/src/L10NSharp/WindowsForms/UI/TipDialog.cs similarity index 98% rename from src/L10NSharp/UI/TipDialog.cs rename to src/L10NSharp/WindowsForms/UI/TipDialog.cs index b858f71..18ac9f0 100644 --- a/src/L10NSharp/UI/TipDialog.cs +++ b/src/L10NSharp/WindowsForms/UI/TipDialog.cs @@ -3,7 +3,7 @@ using System.Windows.Forms; using L10NSharp.Properties; -namespace L10NSharp.UI +namespace L10NSharp.WindowsForms.UI { public partial class TipDialog : Form { diff --git a/src/L10NSharp/UI/TipDialog.designer.cs b/src/L10NSharp/WindowsForms/UI/TipDialog.designer.cs similarity index 99% rename from src/L10NSharp/UI/TipDialog.designer.cs rename to src/L10NSharp/WindowsForms/UI/TipDialog.designer.cs index 8d15a5a..b570870 100644 --- a/src/L10NSharp/UI/TipDialog.designer.cs +++ b/src/L10NSharp/WindowsForms/UI/TipDialog.designer.cs @@ -1,4 +1,4 @@ -namespace L10NSharp.UI +namespace L10NSharp.WindowsForms.UI { partial class TipDialog { diff --git a/src/L10NSharp/UI/TipDialog.resx b/src/L10NSharp/WindowsForms/UI/TipDialog.resx similarity index 100% rename from src/L10NSharp/UI/TipDialog.resx rename to src/L10NSharp/WindowsForms/UI/TipDialog.resx diff --git a/src/L10NSharp/UI/UILanguageComboBox.cs b/src/L10NSharp/WindowsForms/UI/UILanguageComboBox.cs similarity index 98% rename from src/L10NSharp/UI/UILanguageComboBox.cs rename to src/L10NSharp/WindowsForms/UI/UILanguageComboBox.cs index 7ea016a..38ad37c 100644 --- a/src/L10NSharp/UI/UILanguageComboBox.cs +++ b/src/L10NSharp/WindowsForms/UI/UILanguageComboBox.cs @@ -6,7 +6,7 @@ using System.Linq; using System.Windows.Forms; -namespace L10NSharp.UI +namespace L10NSharp.WindowsForms.UI { /// ---------------------------------------------------------------------------------------- public class UILanguageComboBox : ComboBox diff --git a/src/L10NSharp/UI/UILanguageListBox.cs b/src/L10NSharp/WindowsForms/UI/UILanguageListBox.cs similarity index 98% rename from src/L10NSharp/UI/UILanguageListBox.cs rename to src/L10NSharp/WindowsForms/UI/UILanguageListBox.cs index b23c80c..e47ff06 100644 --- a/src/L10NSharp/UI/UILanguageListBox.cs +++ b/src/L10NSharp/WindowsForms/UI/UILanguageListBox.cs @@ -5,7 +5,7 @@ using System.Linq; using System.Windows.Forms; -namespace L10NSharp.UI +namespace L10NSharp.WindowsForms.UI { /// ---------------------------------------------------------------------------------------- public class UILanguageListBox : ListBox diff --git a/src/L10NSharp/UI/XButton.cs b/src/L10NSharp/WindowsForms/UI/XButton.cs similarity index 99% rename from src/L10NSharp/UI/XButton.cs rename to src/L10NSharp/WindowsForms/UI/XButton.cs index 6d4f881..35ca62b 100644 --- a/src/L10NSharp/UI/XButton.cs +++ b/src/L10NSharp/WindowsForms/UI/XButton.cs @@ -3,7 +3,7 @@ using System.Windows.Forms; using System.Windows.Forms.VisualStyles; -namespace L10NSharp.UI +namespace L10NSharp.WindowsForms.UI { /// ---------------------------------------------------------------------------------------- internal class XButton : Label diff --git a/src/L10NSharp/WindowsForms/XLiffUtils/XliffLocalizationManagerWinforms.cs b/src/L10NSharp/WindowsForms/XLiffUtils/XliffLocalizationManagerWinforms.cs index 50dd247..fcffa03 100644 --- a/src/L10NSharp/WindowsForms/XLiffUtils/XliffLocalizationManagerWinforms.cs +++ b/src/L10NSharp/WindowsForms/XLiffUtils/XliffLocalizationManagerWinforms.cs @@ -11,7 +11,7 @@ using System.Text.RegularExpressions; using System.Windows.Forms; using System.Xml.Linq; -using L10NSharp.UI; +using L10NSharp.WindowsForms.UI; using L10NSharp.XLiffUtils; namespace L10NSharp.WindowsForms.XLiffUtils @@ -22,6 +22,7 @@ internal class XliffLocalizationManagerWinforms : XliffLocalizationManager, ILoc /// ------------------------------------------------------------------------------------ private static Icon _applicationIcon; public Dictionary ToolTipCtrls { get; } + public Dictionary> LocalizableComponents { get; } #region XliffLocalizationManager construction/disposal /// ------------------------------------------------------------------------------------ @@ -32,6 +33,9 @@ internal XliffLocalizationManagerWinforms(string appId, string origExtension, st params string[] namespaceBeginnings) : base(appId, appName ?? appId, appVersion) { ToolTipCtrls = new Dictionary(); + StringCache = new XliffLocalizedStringCacheWinforms(this); + LocalizableComponents = new Dictionary>(); } /// Sometimes, on Linux, there is an empty DefaultStringFile. This causes problems. @@ -48,6 +52,12 @@ private bool DefaultStringFileExistsAndHasContents() #endregion + #region Public Properties + /// ------------------------------------------------------------------------------------ + new public ILocalizedStringCacheWinforms StringCache { get; } + + #endregion + #region Methods for caching and localizing objects. /// /// Adds the specified component to the localization manager's cache of objects to be @@ -57,7 +67,7 @@ private bool DefaultStringFileExistsAndHasContents() public void RegisterComponentForLocalizing(IComponent component, string id, string defaultText, string defaultTooltip, string defaultShortcutKeys, string comment) { - RegisterComponentForLocalizing(new LocalizingInfo(component, id) + RegisterComponentForLocalizing(new LocalizingInfoWinforms(component, id) { Text = defaultText, ToolTipText = defaultTooltip, @@ -66,8 +76,8 @@ public void RegisterComponentForLocalizing(IComponent component, string id, stri }, null); } - public void RegisterComponentForLocalizing(LocalizingInfo info, - Action successAction) + public void RegisterComponentForLocalizing(LocalizingInfoWinforms info, + Action successAction) { var component = info.Component; var id = info.Id; @@ -220,6 +230,34 @@ private Keys GetShortCutKeyFromStringCache(string uiLangId, string id) #endregion #region Methods that apply localizations to an object. + public void ApplyLocalizationsToILocalizableComponent(LocalizingInfo locInfo) + { + if (locInfo.Component is ILocalizableComponent locComponent && + LocalizableComponents.TryGetValue(locComponent, out var idToLocInfo)) + { + ApplyLocalizationsToLocalizableComponent(locComponent, idToLocInfo); + return; + } +#if DEBUG + var msg = + "Either locInfo.component is not an ILocalizableComponent or LocalizableComponents hasn't been updated with id={0}."; + throw new ApplicationException(string.Format(msg, locInfo.Id)); +#endif + } + + /// ------------------------------------------------------------------------------------ + /// + /// Reapplies the localizations to all components in the localization manager's cache of + /// localized components. + /// + /// ------------------------------------------------------------------------------------ + public new void ReapplyLocalizationsToAllComponents() + { + foreach (var component in ComponentCache.Keys) + ApplyLocalization(component); + + LocalizeItemDlg.FireStringsLocalizedEvent(this); + } /// ------------------------------------------------------------------------------------ /// /// Recreates the tooltip control and updates the tooltip text for each object having @@ -280,6 +318,25 @@ private Keys GetShortCutKeyFromStringCache(string uiLangId, string id) ApplyLocalizationsToDataGridViewColumn(component as DataGridViewColumn, id); } + /// ------------------------------------------------------------------------------------ + /// + /// Initializes the specified ILocalizableComponent. + /// + /// ------------------------------------------------------------------------------------ + internal void ApplyLocalizationsToLocalizableComponent( + ILocalizableComponent locComponent, Dictionary idToLocInfo) + { + if (locComponent == null) + return; + + foreach (var kvp in idToLocInfo) + { + var id = kvp.Key; + var locInfo = kvp.Value; + locComponent.ApplyLocalizationToString(locInfo.Component, id, GetLocalizedString(id, locInfo.Text)); + } + } + /// ------------------------------------------------------------------------------------ /// /// Initializes the specified control. diff --git a/src/L10NSharp/WindowsForms/XLiffUtils/XliffLocalizedStringCacheWinforms.cs b/src/L10NSharp/WindowsForms/XLiffUtils/XliffLocalizedStringCacheWinforms.cs new file mode 100644 index 0000000..27a3cac --- /dev/null +++ b/src/L10NSharp/WindowsForms/XLiffUtils/XliffLocalizedStringCacheWinforms.cs @@ -0,0 +1,116 @@ +using System; +using System.Collections.Concurrent; +using System.Collections.Generic; +using System.Diagnostics; +using System.IO; +using System.Linq; +using System.Security; +using System.Text; +using System.Text.RegularExpressions; +using System.Windows.Forms; +using L10NSharp.WindowsForms.UI; +using L10NSharp.XLiffUtils; + +namespace L10NSharp.WindowsForms.XLiffUtils +{ + /// ---------------------------------------------------------------------------------------- + internal class XliffLocalizedStringCacheWinforms : XliffLocalizedStringCache, ILocalizedStringCacheWinforms + { + private readonly XliffTransUnitUpdater _tuUpdater; + + public List> LeafNodeList { get; private set; } + internal XliffLocalizationManagerWinforms OwningManager { get; private set; } + private XLiffDocument DefaultXliffDocument { get; set; } // matches LanguageManager.kDefaultLanguage + + /// + /// Record the xliff document loaded for each language. Use this with care...XLiff documents are only + /// loaded as needed, so unless _unloadedXliffDocuments is empty, XliffDocuments won't necessarily + /// contain the one you want or have a complete list of keys. This class has its own GetDocument, + /// TryGetDocument, and AvailableLangKeys which should usually be used instead. To help enforce this, + /// XliffDocuments should be kept private, and any access to it should go through methods that + /// take lazy loading of Xliff documents into account. + /// + private readonly ConcurrentDictionary XliffDocuments = new ConcurrentDictionary(); + + private readonly ConcurrentDictionary _unloadedXliffDocuments = new ConcurrentDictionary(); + + #region Loading methods + + /// ------------------------------------------------------------------------------------ + /// + /// Loads the string cache from all the specified Xliff files + /// + /// ------------------------------------------------------------------------------------ + internal XliffLocalizedStringCacheWinforms(ILocalizationManager owningManager, bool loadAvailableXliffFiles = true) : base(owningManager, loadAvailableXliffFiles) + { + LeafNodeList = new List>(); + } + + /// ------------------------------------------------------------------------------------ + /// + /// Gets the localized tooltip text for the specified id and suffix. + /// + /// ------------------------------------------------------------------------------------ + public Keys GetShortcutKeys(string langId, string id) + { + string keys = GetValueForLangAndIdWithFallback(langId, id + kShortcutSuffix); + return ShortcutKeysEditor.KeysFromString(keys); + } + + /*/// ------------------------------------------------------------------------------------ + /// + /// Gets the localized tooltip text for the specified id and suffix. + /// + /// ------------------------------------------------------------------------------------ + public string GetShortcutKeysText(string langId, string id) + { + return GetValueForExactLangAndId(langId, id + kShortcutSuffix, false); + }*/ + + #endregion + + #region Methods for loading a tree node collection with all the localizable strings. + + /// ------------------------------------------------------------------------------------ + /// + /// Loads the specified tree node collection with all the string groups and their + /// localizable string ids. + /// + /// ------------------------------------------------------------------------------------ + public void LoadGroupNodes(TreeNodeCollection topCollection) + { + LeafNodeList.Clear(); + + foreach (var tu in GetTranslationUnitsForTree()) + { + string id = GetBaseId(tu.Id); + var groupChain = ParseGroupAndId(GetGroup(tu.Id), id); + var nodeKey = string.Empty; + var nodeCollection = topCollection; + LocTreeNode newNode; + + for (int i = groupChain.Count - 1; i > 0; i--) + { + nodeKey = (nodeKey + "." + groupChain[i]).TrimStart('.'); + + var nodes = nodeCollection.Find(nodeKey, true); + if (nodes.Length > 0) + nodeCollection = nodes[0].Nodes; + else + { + newNode = new LocTreeNode(OwningManager, groupChain[i], null, + nodeKey); + nodeCollection.Add(newNode); + nodeCollection = newNode.Nodes; + } + } + + nodeKey = nodeKey + ("." + groupChain[0]).TrimStart('.'); + newNode = new LocTreeNode(OwningManager, groupChain[0], id, nodeKey); + nodeCollection.Add(newNode); + LeafNodeList.Add(newNode); + } + } + #endregion + } +} diff --git a/src/L10NSharp/XLiffUtils/XLiffBody.cs b/src/L10NSharp/XLiffUtils/XLiffBody.cs index cb396f6..1a14658 100644 --- a/src/L10NSharp/XLiffUtils/XLiffBody.cs +++ b/src/L10NSharp/XLiffUtils/XLiffBody.cs @@ -20,7 +20,6 @@ using System.Collections.Generic; using System.Threading; using System.Xml.Serialization; -using L10NSharp.XLiffUtils; namespace L10NSharp.XLiffUtils { diff --git a/src/L10NSharp/XLiffUtils/XliffLocalizationManager.cs b/src/L10NSharp/XLiffUtils/XliffLocalizationManager.cs index 4bf0172..f645cd0 100644 --- a/src/L10NSharp/XLiffUtils/XliffLocalizationManager.cs +++ b/src/L10NSharp/XLiffUtils/XliffLocalizationManager.cs @@ -2,7 +2,6 @@ using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; -//using System.Drawing; using System.IO; using System.Linq; using System.Reflection; @@ -10,7 +9,6 @@ using System.Security.Permissions; using System.Text.RegularExpressions; using System.Xml.Linq; -using L10NSharp.UI; namespace L10NSharp.XLiffUtils { @@ -27,7 +25,7 @@ internal class XliffLocalizationManager : ILocalizationManagerInternal ComponentCache { get; } //public Dictionary ToolTipCtrls { get; } - public Dictionary> LocalizableComponents { get; } + //public Dictionary> LocalizableComponents { get; } #region Static methods /// ------------------------------------------------------------------------------------ @@ -128,10 +126,7 @@ internal XliffLocalizationManager(string appId, string origExtension, string app } ComponentCache = new Dictionary(); - //ToolTipCtrls = new Dictionary(); StringCache = new XliffLocalizedStringCache(this); - LocalizableComponents = new Dictionary>(); } /// @@ -590,17 +585,7 @@ protected string GetTooltipFromStringCache(string uiLangId, string id) #region Methods that apply localizations to an object. public void ApplyLocalizationsToILocalizableComponent(LocalizingInfo locInfo) { - if (locInfo.Component is ILocalizableComponent locComponent && - LocalizableComponents.TryGetValue(locComponent, out var idToLocInfo)) - { - ApplyLocalizationsToLocalizableComponent(locComponent, idToLocInfo); - return; - } -#if DEBUG - var msg = - "Either locInfo.component is not an ILocalizableComponent or LocalizableComponents hasn't been updated with id={0}."; - throw new ApplicationException(string.Format(msg, locInfo.Id)); -#endif + // Do nothing because we won't be dealing with an ILocalizableComponent outside of Winforms. } /// ------------------------------------------------------------------------------------ @@ -611,10 +596,7 @@ public void ApplyLocalizationsToILocalizableComponent(LocalizingInfo locInfo) /// ------------------------------------------------------------------------------------ public void ReapplyLocalizationsToAllComponents() { - foreach (var component in ComponentCache.Keys) - ApplyLocalization(component); - - LocalizeItemDlg.FireStringsLocalizedEvent(this); + // Do nothing because we won't be dealing with an ILocalizableComponent outside of Winforms. } /// ------------------------------------------------------------------------------------ @@ -636,23 +618,10 @@ public void RefreshToolTips() /// ------------------------------------------------------------------------------------ public void ApplyLocalization(IComponent component) { - if (component == null) - return; - - if (!ComponentCache.TryGetValue(component, out var id)) - return; - - if (component is ILocalizableComponent locComponent) - { - if (LocalizableComponents.TryGetValue(locComponent, out var idToLocInfo)) - { - ApplyLocalizationsToLocalizableComponent(locComponent, idToLocInfo); - return; - } - } + // Do nothing because we won't be dealing with an ILocalizableComponent outside of Winforms. } - /// ------------------------------------------------------------------------------------ + /*/// ------------------------------------------------------------------------------------ /// /// Initializes the specified ILocalizableComponent. /// @@ -669,7 +638,7 @@ internal void ApplyLocalizationsToLocalizableComponent( var locInfo = kvp.Value; locComponent.ApplyLocalizationToString(locInfo.Component, id, GetLocalizedString(id, locInfo.Text)); } - } + }*/ protected static string UILanguageId => LocalizationManager.UILanguageId; diff --git a/src/L10NSharp/XLiffUtils/XliffLocalizedStringCache.cs b/src/L10NSharp/XLiffUtils/XliffLocalizedStringCache.cs index 761cc4d..8b98c99 100644 --- a/src/L10NSharp/XLiffUtils/XliffLocalizedStringCache.cs +++ b/src/L10NSharp/XLiffUtils/XliffLocalizedStringCache.cs @@ -7,8 +7,6 @@ using System.Security; using System.Text; using System.Text.RegularExpressions; -using System.Windows.Forms; -using L10NSharp.UI; namespace L10NSharp.XLiffUtils { @@ -17,7 +15,6 @@ internal class XliffLocalizedStringCache : LocalizedStringCache, ILocalizedStrin { private readonly XliffTransUnitUpdater _tuUpdater; - public List> LeafNodeList { get; private set; } internal XliffLocalizationManager OwningManager { get; private set; } private XLiffDocument DefaultXliffDocument { get; set; } // matches LanguageManager.kDefaultLanguage @@ -51,8 +48,8 @@ internal XliffLocalizedStringCache(ILocalizationManager owningManager, bool load } catch (Exception e) { - MessageBox.Show("Error occurred reading localization file:" + Environment.NewLine + e.Message, - Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Warning); + //MessageBox.Show("Error occurred reading localization file:" + Environment.NewLine + e.Message, + // Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Warning); LocalizationManager.SetUILanguage(LocalizationManager.kDefaultLang, false); } } @@ -72,7 +69,6 @@ internal XliffLocalizedStringCache(ILocalizationManager owningManager, bool load if (replacement != null) s_literalNewline = replacement; - LeafNodeList = new List>(); IsDirty = false; } @@ -493,17 +489,6 @@ public string GetToolTipText(string langId, string id, bool formatForDisplay) return GetValueForExactLangAndId(langId, id + kToolTipSuffix, formatForDisplay); } - /// ------------------------------------------------------------------------------------ - /// - /// Gets the localized tooltip text for the specified id and suffix. - /// - /// ------------------------------------------------------------------------------------ - public Keys GetShortcutKeys(string langId, string id) - { - string keys = GetValueForLangAndIdWithFallback(langId, id + kShortcutSuffix); - return ShortcutKeysEditor.KeysFromString(keys); - } - /// ------------------------------------------------------------------------------------ /// /// Gets the localized tooltip text for the specified id and suffix. @@ -521,7 +506,7 @@ public string GetShortcutKeysText(string langId, string id) /// fails, then the default (i.e. "en") is used. /// /// ------------------------------------------------------------------------------------ - private string GetValueForLangAndIdWithFallback(string langId, string id) + protected string GetValueForLangAndIdWithFallback(string langId, string id) { var value = GetValueForExactLangAndId(langId, id, true); if (value != null) @@ -686,54 +671,13 @@ internal string GetBaseId(string tuid) return tuid; } - /// ------------------------------------------------------------------------------------ - /// - /// Loads the specified tree node collection with all the string groups and their - /// localizable string ids. - /// - /// ------------------------------------------------------------------------------------ - public void LoadGroupNodes(TreeNodeCollection topCollection) - { - LeafNodeList.Clear(); - - foreach (var tu in GetTranslationUnitsForTree()) - { - string id = GetBaseId(tu.Id); - var groupChain = ParseGroupAndId(GetGroup(tu.Id), id); - var nodeKey = string.Empty; - var nodeCollection = topCollection; - LocTreeNode newNode; - - for (int i = groupChain.Count - 1; i > 0; i--) - { - nodeKey = (nodeKey + "." + groupChain[i]).TrimStart('.'); - - var nodes = nodeCollection.Find(nodeKey, true); - if (nodes.Length > 0) - nodeCollection = nodes[0].Nodes; - else - { - newNode = new LocTreeNode(OwningManager, groupChain[i], null, - nodeKey); - nodeCollection.Add(newNode); - nodeCollection = newNode.Nodes; - } - } - - nodeKey = nodeKey + ("." + groupChain[0]).TrimStart('.'); - newNode = new LocTreeNode(OwningManager, groupChain[0], id, nodeKey); - nodeCollection.Add(newNode); - LeafNodeList.Add(newNode); - } - } - /// ------------------------------------------------------------------------------------ /// /// Gets a list of only those translation units that should show up in the localizing /// dialog's tree control. /// /// ------------------------------------------------------------------------------------ - private IEnumerable GetTranslationUnitsForTree() + protected IEnumerable GetTranslationUnitsForTree() { foreach (var tu in DefaultXliffDocument.File.Body.TransUnitsUnordered) { @@ -769,7 +713,7 @@ private IEnumerable GetTranslationUnitsForTree() /// Parses the group and id and returns all the pieces between periods. /// /// ------------------------------------------------------------------------------------ - private static List ParseGroupAndId(string group, string id) + protected static List ParseGroupAndId(string group, string id) { var allPieces = new List(); string[] pieces; diff --git a/src/L10NSharp/XLiffUtils/XliffTransUnitUpdater.cs b/src/L10NSharp/XLiffUtils/XliffTransUnitUpdater.cs index f58f395..a3dcae0 100644 --- a/src/L10NSharp/XLiffUtils/XliffTransUnitUpdater.cs +++ b/src/L10NSharp/XLiffUtils/XliffTransUnitUpdater.cs @@ -1,7 +1,6 @@ using System; using System.Collections.Generic; using System.Diagnostics; -using L10NSharp.XLiffUtils; namespace L10NSharp.XLiffUtils { diff --git a/src/L10NSharpTests/ILocalizableComponentTests.cs b/src/L10NSharpTests/ILocalizableComponentTests.cs index 96c441d..4580ffb 100644 --- a/src/L10NSharpTests/ILocalizableComponentTests.cs +++ b/src/L10NSharpTests/ILocalizableComponentTests.cs @@ -1,7 +1,7 @@ using System; using System.IO; using System.Reflection; -using L10NSharp.UI; +using L10NSharp.WindowsForms.UI; using L10NSharp.XLiffUtils; using NUnit.Framework; //using L10NSharp.WindowsForms; diff --git a/src/L10NSharpTests/LanguageChoosingDialogViewModelTests.cs b/src/L10NSharpTests/LanguageChoosingDialogViewModelTests.cs index a125627..8ac98a6 100644 --- a/src/L10NSharpTests/LanguageChoosingDialogViewModelTests.cs +++ b/src/L10NSharpTests/LanguageChoosingDialogViewModelTests.cs @@ -3,7 +3,7 @@ using System.Globalization; using System.Linq; using L10NSharp.Translators; -using L10NSharp.UI; +using L10NSharp.WindowsForms.UI; using NUnit.Framework; namespace L10NSharp.Tests diff --git a/src/L10NSharpTests/LocalizationExtenderTests.cs b/src/L10NSharpTests/LocalizationExtenderTests.cs index 4635a11..51a70f8 100644 --- a/src/L10NSharpTests/LocalizationExtenderTests.cs +++ b/src/L10NSharpTests/LocalizationExtenderTests.cs @@ -1,6 +1,6 @@ using System.Collections.Generic; using System.Windows.Forms; -using L10NSharp.UI; +using L10NSharp.WindowsForms.UI; using NUnit.Framework; namespace L10NSharp.Tests diff --git a/src/L10NSharpTests/MockLocalizableComponent.cs b/src/L10NSharpTests/MockLocalizableComponent.cs index 55683da..f655d55 100644 --- a/src/L10NSharpTests/MockLocalizableComponent.cs +++ b/src/L10NSharpTests/MockLocalizableComponent.cs @@ -2,7 +2,8 @@ using System.Collections.Generic; using System.ComponentModel; using System.Windows.Forms; -using L10NSharp.UI; +using L10NSharp.WindowsForms.UI; +using L10NSharp.WindowsForms; namespace L10NSharp.Tests { diff --git a/src/SampleApp/Form1.Designer.cs b/src/SampleApp/Form1.Designer.cs index f099907..36f6db2 100644 --- a/src/SampleApp/Form1.Designer.cs +++ b/src/SampleApp/Form1.Designer.cs @@ -32,11 +32,11 @@ protected override void Dispose(bool disposing) private void InitializeComponent() { this.components = new System.ComponentModel.Container(); - this.localizationExtender1 = new L10NSharp.UI.L10NSharpExtender(this.components); + this.localizationExtender1 = new L10NSharp.WindowsForms.UI.L10NSharpExtender(this.components); this._getDynamicStringButton = new System.Windows.Forms.Button(); this.label1 = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label(); - this.uiLanguageComboBox1 = new L10NSharp.UI.UILanguageComboBox(); + this.uiLanguageComboBox1 = new L10NSharp.WindowsForms.UI.UILanguageComboBox(); this.columnHeader1 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.columnHeader2 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.dataGridView1 = new System.Windows.Forms.DataGridView(); @@ -191,11 +191,11 @@ private void InitializeComponent() #endregion - private L10NSharp.UI.L10NSharpExtender localizationExtender1; + private L10NSharp.WindowsForms.UI.L10NSharpExtender localizationExtender1; private System.Windows.Forms.Button _getDynamicStringButton; private System.Windows.Forms.Label label1; private System.Windows.Forms.Label label2; - private L10NSharp.UI.UILanguageComboBox uiLanguageComboBox1; + private L10NSharp.WindowsForms.UI.UILanguageComboBox uiLanguageComboBox1; private System.Windows.Forms.ListView listView1; private System.Windows.Forms.ColumnHeader columnHeader1; private System.Windows.Forms.ColumnHeader columnHeader2; From d0d1282656d816f21ff8ca173674c78d0297259b Mon Sep 17 00:00:00 2001 From: Ariel Rorabaugh Date: Thu, 17 Jul 2025 15:26:38 -0400 Subject: [PATCH 03/25] Split into two projects with only one dependent on winforms --- L10NSharp.sln | 28 +++++ src/L10NSharp/ILocalizationManager.cs | 1 - src/L10NSharp/ILocalizationManagerInternal.cs | 1 - src/L10NSharp/ILocalizedStringCache.cs | 3 - src/L10NSharp/L10NSharp.csproj | 61 +---------- src/L10NSharp/LocalizationManager.cs | 1 - src/L10NSharp/LocalizationManagerInternal.cs | 13 --- src/L10NSharp/Properties/AssemblyInfo.cs | 2 + .../ILocalizableComponent.cs | 7 +- .../ILocalizationManagerInternalWinforms.cs | 3 +- .../ILocalizedStringCacheWinforms.cs | 6 +- .../L10NSharpWinforms.csproj | 88 +++++++++++++++ .../LocalizationManagerInternalWinforms.cs | 9 +- .../LocalizationManagerWinforms.cs | 14 +-- .../LocalizingInfoWinforms.cs | 5 +- .../Properties/AssemblyInfo.cs | 10 ++ .../UI/ColorHelper.cs | 2 +- .../UI/CustomDropDownComboBox.Designer.cs | 2 +- .../UI/CustomDropDownComboBox.cs | 2 +- .../UI/CustomDropDownComboBox.resx | 0 .../UI/DontShowThisAgainButton.Designer.cs | 2 +- .../UI/DontShowThisAgainButton.cs | 2 +- ...EditSourceBeforeTranslatingDlg.Designer.cs | 2 +- .../UI/EditSourceBeforeTranslatingDlg.cs | 2 +- .../UI/EditSourceBeforeTranslatingDlg.resx | 0 .../UI/FallbackLanguagesDlg.cs | 3 +- .../UI/FallbackLanguagesDlgBase.Designer.cs | 2 +- .../UI/FallbackLanguagesDlgBase.cs | 3 +- .../UI/FallbackLanguagesDlgBase.resx | 0 .../UI/Grid/LmButtonCell.cs | 2 +- .../UI/Grid/LmButtonColumn.cs | 2 +- .../UI/Grid/LmGrid.cs | 2 +- .../UI/HowToDistributeDialog.Designer.cs | 2 +- .../UI/HowToDistributeDialog.cs | 3 +- .../UI/HowToDistributeDialog.resx | 0 .../UI/InitializationProgressDlg.cs | 3 +- .../InitializationProgressDlgBase.Designer.cs | 2 +- .../UI/InitializationProgressDlgBase.cs | 2 +- .../UI/InitializationProgressDlgBase.resx | 0 .../UI/L10NExtender.cs | 3 +- .../UI/L10NExtender.resx | 0 .../UI/LanguageChoosingDialog.Designer.cs | 4 +- .../UI/LanguageChoosingDialog.cs | 3 +- .../UI/LanguageChoosingDialog.resx | 0 .../UI/LanguageChoosingDialogViewModel.cs | 3 +- .../LanguageChoosingSimpleDialog.Designer.cs | 2 +- .../UI/LanguageChoosingSimpleDialog.cs | 2 +- .../UI/LanguageChoosingSimpleDialog.resx | 0 .../UI/LocTreeNode.cs | 2 +- .../UI/LocalizeItemDlg.Designer.cs | 16 +-- .../UI/LocalizeItemDlg.cs | 3 +- .../UI/LocalizeItemDlg.resx | 0 .../UI/LocalizeItemDlgViewModel.cs | 3 +- .../UI/NodeComparer.cs | 3 +- .../UI/PaintingHelper.cs | 2 +- .../UI/PopupControl.cs | 2 +- .../UI/PopupControl.designer.cs | 2 +- .../UI/PopupControl.resx | 0 .../UI/ShortcutKeysDropDown.cs | 2 +- .../UI/ShortcutKeysEditor.Designer.cs | 2 +- .../UI/ShortcutKeysEditor.cs | 2 +- .../UI/ShortcutKeysEditor.resx | 0 .../UI/TipDialog.cs | 2 +- .../UI/TipDialog.designer.cs | 2 +- .../UI/TipDialog.resx | 0 .../UI/UILanguageComboBox.cs | 5 +- .../UI/UILanguageListBox.cs | 3 +- .../UI/XButton.cs | 2 +- .../UtilsWinforms.cs | 6 +- .../XliffLocalizationManagerWinforms.cs | 12 +-- .../XliffLocalizedStringCacheWinforms.cs | 12 +-- .../ILocalizableComponentTests.cs | 11 +- .../L10NSharpWinformsTests.csproj | 20 ++++ .../LanguageChoosingDialogViewModelTests.cs | 5 +- .../LocalizationExtenderTests.cs | 5 +- .../LocalizingInfoTests.cs | 3 +- .../MockLocalizableComponent.cs | 13 +-- .../Properties/Resources.Designer.cs | 63 +++++++++++ .../Properties/Resources.resx | 101 ++++++++++++++++++ .../ReflectionHelper.cs | 2 +- .../UtilsTests.cs | 3 +- 81 files changed, 426 insertions(+), 192 deletions(-) rename src/{L10NSharp/WindowsForms => L10NSharpWinforms}/ILocalizableComponent.cs (86%) rename src/{L10NSharp/WindowsForms => L10NSharpWinforms}/ILocalizationManagerInternalWinforms.cs (95%) rename src/{L10NSharp/WindowsForms => L10NSharpWinforms}/ILocalizedStringCacheWinforms.cs (71%) create mode 100644 src/L10NSharpWinforms/L10NSharpWinforms.csproj rename src/{L10NSharp/WindowsForms => L10NSharpWinforms}/LocalizationManagerInternalWinforms.cs (97%) rename src/{L10NSharp/WindowsForms => L10NSharpWinforms}/LocalizationManagerWinforms.cs (88%) rename src/{L10NSharp/WindowsForms => L10NSharpWinforms}/LocalizingInfoWinforms.cs (99%) create mode 100644 src/L10NSharpWinforms/Properties/AssemblyInfo.cs rename src/{L10NSharp/WindowsForms => L10NSharpWinforms}/UI/ColorHelper.cs (98%) rename src/{L10NSharp/WindowsForms => L10NSharpWinforms}/UI/CustomDropDownComboBox.Designer.cs (98%) rename src/{L10NSharp/WindowsForms => L10NSharpWinforms}/UI/CustomDropDownComboBox.cs (99%) rename src/{L10NSharp/WindowsForms => L10NSharpWinforms}/UI/CustomDropDownComboBox.resx (100%) rename src/{L10NSharp/WindowsForms => L10NSharpWinforms}/UI/DontShowThisAgainButton.Designer.cs (96%) rename src/{L10NSharp/WindowsForms => L10NSharpWinforms}/UI/DontShowThisAgainButton.cs (98%) rename src/{L10NSharp/WindowsForms => L10NSharpWinforms}/UI/EditSourceBeforeTranslatingDlg.Designer.cs (99%) rename src/{L10NSharp/WindowsForms => L10NSharpWinforms}/UI/EditSourceBeforeTranslatingDlg.cs (97%) rename src/{L10NSharp/WindowsForms => L10NSharpWinforms}/UI/EditSourceBeforeTranslatingDlg.resx (100%) rename src/{L10NSharp/WindowsForms => L10NSharpWinforms}/UI/FallbackLanguagesDlg.cs (95%) rename src/{L10NSharp/WindowsForms => L10NSharpWinforms}/UI/FallbackLanguagesDlgBase.Designer.cs (99%) rename src/{L10NSharp/WindowsForms => L10NSharpWinforms}/UI/FallbackLanguagesDlgBase.cs (98%) rename src/{L10NSharp/WindowsForms => L10NSharpWinforms}/UI/FallbackLanguagesDlgBase.resx (100%) rename src/{L10NSharp/WindowsForms => L10NSharpWinforms}/UI/Grid/LmButtonCell.cs (99%) rename src/{L10NSharp/WindowsForms => L10NSharpWinforms}/UI/Grid/LmButtonColumn.cs (99%) rename src/{L10NSharp/WindowsForms => L10NSharpWinforms}/UI/Grid/LmGrid.cs (99%) rename src/{L10NSharp/WindowsForms => L10NSharpWinforms}/UI/HowToDistributeDialog.Designer.cs (99%) rename src/{L10NSharp/WindowsForms => L10NSharpWinforms}/UI/HowToDistributeDialog.cs (98%) rename src/{L10NSharp/WindowsForms => L10NSharpWinforms}/UI/HowToDistributeDialog.resx (100%) rename src/{L10NSharp/WindowsForms => L10NSharpWinforms}/UI/InitializationProgressDlg.cs (98%) rename src/{L10NSharp/WindowsForms => L10NSharpWinforms}/UI/InitializationProgressDlgBase.Designer.cs (99%) rename src/{L10NSharp/WindowsForms => L10NSharpWinforms}/UI/InitializationProgressDlgBase.cs (98%) rename src/{L10NSharp/WindowsForms => L10NSharpWinforms}/UI/InitializationProgressDlgBase.resx (100%) rename src/{L10NSharp/WindowsForms => L10NSharpWinforms}/UI/L10NExtender.cs (99%) rename src/{L10NSharp/WindowsForms => L10NSharpWinforms}/UI/L10NExtender.resx (100%) rename src/{L10NSharp/WindowsForms => L10NSharpWinforms}/UI/LanguageChoosingDialog.Designer.cs (97%) rename src/{L10NSharp/WindowsForms => L10NSharpWinforms}/UI/LanguageChoosingDialog.cs (96%) rename src/{L10NSharp/WindowsForms => L10NSharpWinforms}/UI/LanguageChoosingDialog.resx (100%) rename src/{L10NSharp/WindowsForms => L10NSharpWinforms}/UI/LanguageChoosingDialogViewModel.cs (98%) rename src/{L10NSharp/WindowsForms => L10NSharpWinforms}/UI/LanguageChoosingSimpleDialog.Designer.cs (98%) rename src/{L10NSharp/WindowsForms => L10NSharpWinforms}/UI/LanguageChoosingSimpleDialog.cs (95%) rename src/{L10NSharp/WindowsForms => L10NSharpWinforms}/UI/LanguageChoosingSimpleDialog.resx (100%) rename src/{L10NSharp/WindowsForms => L10NSharpWinforms}/UI/LocTreeNode.cs (98%) rename src/{L10NSharp/WindowsForms => L10NSharpWinforms}/UI/LocalizeItemDlg.Designer.cs (99%) rename src/{L10NSharp/WindowsForms => L10NSharpWinforms}/UI/LocalizeItemDlg.cs (99%) rename src/{L10NSharp/WindowsForms => L10NSharpWinforms}/UI/LocalizeItemDlg.resx (100%) rename src/{L10NSharp/WindowsForms => L10NSharpWinforms}/UI/LocalizeItemDlgViewModel.cs (99%) rename src/{L10NSharp/WindowsForms => L10NSharpWinforms}/UI/NodeComparer.cs (97%) rename src/{L10NSharp/WindowsForms => L10NSharpWinforms}/UI/PaintingHelper.cs (99%) rename src/{L10NSharp/WindowsForms => L10NSharpWinforms}/UI/PopupControl.cs (99%) rename src/{L10NSharp/WindowsForms => L10NSharpWinforms}/UI/PopupControl.designer.cs (95%) rename src/{L10NSharp/WindowsForms => L10NSharpWinforms}/UI/PopupControl.resx (100%) rename src/{L10NSharp/WindowsForms => L10NSharpWinforms}/UI/ShortcutKeysDropDown.cs (98%) rename src/{L10NSharp/WindowsForms => L10NSharpWinforms}/UI/ShortcutKeysEditor.Designer.cs (99%) rename src/{L10NSharp/WindowsForms => L10NSharpWinforms}/UI/ShortcutKeysEditor.cs (99%) rename src/{L10NSharp/WindowsForms => L10NSharpWinforms}/UI/ShortcutKeysEditor.resx (100%) rename src/{L10NSharp/WindowsForms => L10NSharpWinforms}/UI/TipDialog.cs (98%) rename src/{L10NSharp/WindowsForms => L10NSharpWinforms}/UI/TipDialog.designer.cs (99%) rename src/{L10NSharp/WindowsForms => L10NSharpWinforms}/UI/TipDialog.resx (100%) rename src/{L10NSharp/WindowsForms => L10NSharpWinforms}/UI/UILanguageComboBox.cs (97%) rename src/{L10NSharp/WindowsForms => L10NSharpWinforms}/UI/UILanguageListBox.cs (98%) rename src/{L10NSharp/WindowsForms => L10NSharpWinforms}/UI/XButton.cs (99%) rename src/{L10NSharp/WindowsForms => L10NSharpWinforms}/UtilsWinforms.cs (88%) rename src/{L10NSharp/WindowsForms => L10NSharpWinforms}/XLiffUtils/XliffLocalizationManagerWinforms.cs (98%) rename src/{L10NSharp/WindowsForms => L10NSharpWinforms}/XLiffUtils/XliffLocalizedStringCacheWinforms.cs (95%) rename src/{L10NSharpTests => L10NSharpWinformsTests}/ILocalizableComponentTests.cs (94%) create mode 100644 src/L10NSharpWinformsTests/L10NSharpWinformsTests.csproj rename src/{L10NSharpTests => L10NSharpWinformsTests}/LanguageChoosingDialogViewModelTests.cs (99%) rename src/{L10NSharpTests => L10NSharpWinformsTests}/LocalizationExtenderTests.cs (98%) rename src/{L10NSharpTests => L10NSharpWinformsTests}/LocalizingInfoTests.cs (98%) rename src/{L10NSharpTests => L10NSharpWinformsTests}/MockLocalizableComponent.cs (89%) create mode 100644 src/L10NSharpWinformsTests/Properties/Resources.Designer.cs create mode 100644 src/L10NSharpWinformsTests/Properties/Resources.resx rename src/{L10NSharpTests => L10NSharpWinformsTests}/ReflectionHelper.cs (99%) rename src/{L10NSharpTests => L10NSharpWinformsTests}/UtilsTests.cs (95%) diff --git a/L10NSharp.sln b/L10NSharp.sln index 244b42c..eacd806 100644 --- a/L10NSharp.sln +++ b/L10NSharp.sln @@ -24,6 +24,10 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SolutionFolder", "SolutionF README.md = README.md EndProjectSection EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "L10NSharpWinforms", "src\L10NSharpWinforms\L10NSharpWinforms.csproj", "{B66D48A5-AD5D-4A24-9847-66CBC7EB0DCB}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "L10NSharpWinformsTests", "src\L10NSharpWinformsTests\L10NSharpWinformsTests.csproj", "{B6220220-4C18-43B5-85EE-D33D67A227AA}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -89,6 +93,30 @@ Global {E4BB984D-DFB8-42EF-860D-5A038FF85B1C}.Release|Mixed Platforms.Build.0 = Release|Any CPU {E4BB984D-DFB8-42EF-860D-5A038FF85B1C}.Release|x86.ActiveCfg = Release|Any CPU {E4BB984D-DFB8-42EF-860D-5A038FF85B1C}.Release|x86.Build.0 = Release|Any CPU + {B66D48A5-AD5D-4A24-9847-66CBC7EB0DCB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B66D48A5-AD5D-4A24-9847-66CBC7EB0DCB}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B66D48A5-AD5D-4A24-9847-66CBC7EB0DCB}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {B66D48A5-AD5D-4A24-9847-66CBC7EB0DCB}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {B66D48A5-AD5D-4A24-9847-66CBC7EB0DCB}.Debug|x86.ActiveCfg = Debug|Any CPU + {B66D48A5-AD5D-4A24-9847-66CBC7EB0DCB}.Debug|x86.Build.0 = Debug|Any CPU + {B66D48A5-AD5D-4A24-9847-66CBC7EB0DCB}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B66D48A5-AD5D-4A24-9847-66CBC7EB0DCB}.Release|Any CPU.Build.0 = Release|Any CPU + {B66D48A5-AD5D-4A24-9847-66CBC7EB0DCB}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {B66D48A5-AD5D-4A24-9847-66CBC7EB0DCB}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {B66D48A5-AD5D-4A24-9847-66CBC7EB0DCB}.Release|x86.ActiveCfg = Release|Any CPU + {B66D48A5-AD5D-4A24-9847-66CBC7EB0DCB}.Release|x86.Build.0 = Release|Any CPU + {B6220220-4C18-43B5-85EE-D33D67A227AA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B6220220-4C18-43B5-85EE-D33D67A227AA}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B6220220-4C18-43B5-85EE-D33D67A227AA}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {B6220220-4C18-43B5-85EE-D33D67A227AA}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {B6220220-4C18-43B5-85EE-D33D67A227AA}.Debug|x86.ActiveCfg = Debug|Any CPU + {B6220220-4C18-43B5-85EE-D33D67A227AA}.Debug|x86.Build.0 = Debug|Any CPU + {B6220220-4C18-43B5-85EE-D33D67A227AA}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B6220220-4C18-43B5-85EE-D33D67A227AA}.Release|Any CPU.Build.0 = Release|Any CPU + {B6220220-4C18-43B5-85EE-D33D67A227AA}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {B6220220-4C18-43B5-85EE-D33D67A227AA}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {B6220220-4C18-43B5-85EE-D33D67A227AA}.Release|x86.ActiveCfg = Release|Any CPU + {B6220220-4C18-43B5-85EE-D33D67A227AA}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/L10NSharp/ILocalizationManager.cs b/src/L10NSharp/ILocalizationManager.cs index 85c82d0..a250fe2 100644 --- a/src/L10NSharp/ILocalizationManager.cs +++ b/src/L10NSharp/ILocalizationManager.cs @@ -4,7 +4,6 @@ using System; using System.Collections.Generic; using System.ComponentModel; -using System.Windows.Forms; namespace L10NSharp { diff --git a/src/L10NSharp/ILocalizationManagerInternal.cs b/src/L10NSharp/ILocalizationManagerInternal.cs index a39789b..aab4a89 100644 --- a/src/L10NSharp/ILocalizationManagerInternal.cs +++ b/src/L10NSharp/ILocalizationManagerInternal.cs @@ -3,7 +3,6 @@ using System.Collections.Generic; using System.ComponentModel; -//using System.Drawing; namespace L10NSharp { diff --git a/src/L10NSharp/ILocalizedStringCache.cs b/src/L10NSharp/ILocalizedStringCache.cs index 969a89a..dc0c70d 100644 --- a/src/L10NSharp/ILocalizedStringCache.cs +++ b/src/L10NSharp/ILocalizedStringCache.cs @@ -2,9 +2,6 @@ // // This software is licensed under the MIT License (http://opensource.org/licenses/MIT) using System.Collections.Generic; -//using System.Windows.Forms; -//using L10NSharp.WindowsForms.UI; -using L10NSharp.XLiffUtils; namespace L10NSharp { diff --git a/src/L10NSharp/L10NSharp.csproj b/src/L10NSharp/L10NSharp.csproj index 3ae1bfb..93fd6a0 100644 --- a/src/L10NSharp/L10NSharp.csproj +++ b/src/L10NSharp/L10NSharp.csproj @@ -1,4 +1,4 @@ - + L10NSharp L10NSharp is a .NET localization library for Windows Forms applications. It collects strings which need localization when your application first runs and saves them in a XLIFF file. It can also dynamically collect strings at runtime. @@ -6,9 +6,8 @@ L10NSharp https://github.com/sillsdev/l10nsharp - + - @@ -20,60 +19,4 @@ - - - UserControl - - - Component - - - Form - - - - Form - - - Component - - - Form - - - Form - - - Form - - - Component - - - Form - - - Form - - - Form - - - UserControl - - - - - Form - - - Component - - - Component - - - Component - - diff --git a/src/L10NSharp/LocalizationManager.cs b/src/L10NSharp/LocalizationManager.cs index 5e348fb..621e143 100644 --- a/src/L10NSharp/LocalizationManager.cs +++ b/src/L10NSharp/LocalizationManager.cs @@ -4,7 +4,6 @@ using System; using System.Collections.Generic; using System.ComponentModel; -using System.Diagnostics; using System.Globalization; using System.IO; using System.Reflection; diff --git a/src/L10NSharp/LocalizationManagerInternal.cs b/src/L10NSharp/LocalizationManagerInternal.cs index b29e938..1cc3bba 100644 --- a/src/L10NSharp/LocalizationManagerInternal.cs +++ b/src/L10NSharp/LocalizationManagerInternal.cs @@ -47,19 +47,6 @@ internal static string ChooseFallbackLanguage() return LocalizationManager.kDefaultLang; } - /*internal static Func ChooseFallbackLanguage = () => - { - return LocalizationManager.kDefaultLang; - };*/ - /*internal static Func ChooseFallbackLanguage = (desiredUiLangId, icon) => - { - using (var dlg = new LanguageChoosingDialog(L10NCultureInfo.GetCultureInfo(desiredUiLangId), icon)) - { - dlg.ShowDialog(); - return dlg.SelectedLanguage; - } - };*/ - private static readonly Dictionary> s_loadedManagers = new Dictionary>(); diff --git a/src/L10NSharp/Properties/AssemblyInfo.cs b/src/L10NSharp/Properties/AssemblyInfo.cs index 403480d..a78428d 100644 --- a/src/L10NSharp/Properties/AssemblyInfo.cs +++ b/src/L10NSharp/Properties/AssemblyInfo.cs @@ -10,3 +10,5 @@ [assembly: InternalsVisibleTo("L10NSharpTests, PublicKey=002400000480000094000000060200000024000052534131000400000100010019cae48c6e5703818db31fcca17b87012eef38df95e3961c59b035190eace2c4ee5cfa1a258b84867c7549f60eec00ec1e0004c2ed224457128e841311cea0f5a05c3d69b3dfcb7422b214febce6e06c83ce4d29c62f36a7fd5564e922338c800372a5ec09638671b4db1fb33ccbb1dc48d8122ffe0d30dadbfbf325f65437b2")] [assembly: InternalsVisibleTo("ExtractXliff, PublicKey=002400000480000094000000060200000024000052534131000400000100010019cae48c6e5703818db31fcca17b87012eef38df95e3961c59b035190eace2c4ee5cfa1a258b84867c7549f60eec00ec1e0004c2ed224457128e841311cea0f5a05c3d69b3dfcb7422b214febce6e06c83ce4d29c62f36a7fd5564e922338c800372a5ec09638671b4db1fb33ccbb1dc48d8122ffe0d30dadbfbf325f65437b2")] [assembly: InternalsVisibleTo("CheckOrFixXliff, PublicKey=002400000480000094000000060200000024000052534131000400000100010019cae48c6e5703818db31fcca17b87012eef38df95e3961c59b035190eace2c4ee5cfa1a258b84867c7549f60eec00ec1e0004c2ed224457128e841311cea0f5a05c3d69b3dfcb7422b214febce6e06c83ce4d29c62f36a7fd5564e922338c800372a5ec09638671b4db1fb33ccbb1dc48d8122ffe0d30dadbfbf325f65437b2")] +[assembly: InternalsVisibleTo("L10NSharpWinforms, PublicKey=002400000480000094000000060200000024000052534131000400000100010019cae48c6e5703818db31fcca17b87012eef38df95e3961c59b035190eace2c4ee5cfa1a258b84867c7549f60eec00ec1e0004c2ed224457128e841311cea0f5a05c3d69b3dfcb7422b214febce6e06c83ce4d29c62f36a7fd5564e922338c800372a5ec09638671b4db1fb33ccbb1dc48d8122ffe0d30dadbfbf325f65437b2")] +[assembly: InternalsVisibleTo("L10NSharpWinformsTests, PublicKey=002400000480000094000000060200000024000052534131000400000100010019cae48c6e5703818db31fcca17b87012eef38df95e3961c59b035190eace2c4ee5cfa1a258b84867c7549f60eec00ec1e0004c2ed224457128e841311cea0f5a05c3d69b3dfcb7422b214febce6e06c83ce4d29c62f36a7fd5564e922338c800372a5ec09638671b4db1fb33ccbb1dc48d8122ffe0d30dadbfbf325f65437b2")] diff --git a/src/L10NSharp/WindowsForms/ILocalizableComponent.cs b/src/L10NSharpWinforms/ILocalizableComponent.cs similarity index 86% rename from src/L10NSharp/WindowsForms/ILocalizableComponent.cs rename to src/L10NSharpWinforms/ILocalizableComponent.cs index 444cb90..36dc3b5 100644 --- a/src/L10NSharp/WindowsForms/ILocalizableComponent.cs +++ b/src/L10NSharpWinforms/ILocalizableComponent.cs @@ -1,7 +1,8 @@ using System.Collections.Generic; -using L10NSharp.WindowsForms.UI; +using L10NSharpWinforms.UI; +using L10NSharp; -namespace L10NSharp.WindowsForms +namespace L10NSharpWinforms { /// /// This interface allows a control to be localized by L10NSharp. It can be used to enable @@ -14,7 +15,7 @@ public interface ILocalizableComponent /// into the localization UI to be localized. /// /// A list of LocalizingInfo objects - IEnumerable GetAllLocalizingInfoObjects(L10NSharpExtender extender); + IEnumerable GetAllLocalizingInfoObjects(L10NSharpExtender extender); /// /// L10NSharp will call this for each localized string so that the component can set diff --git a/src/L10NSharp/WindowsForms/ILocalizationManagerInternalWinforms.cs b/src/L10NSharpWinforms/ILocalizationManagerInternalWinforms.cs similarity index 95% rename from src/L10NSharp/WindowsForms/ILocalizationManagerInternalWinforms.cs rename to src/L10NSharpWinforms/ILocalizationManagerInternalWinforms.cs index 9ca6a04..8e373ef 100644 --- a/src/L10NSharp/WindowsForms/ILocalizationManagerInternalWinforms.cs +++ b/src/L10NSharpWinforms/ILocalizationManagerInternalWinforms.cs @@ -6,8 +6,9 @@ using System.ComponentModel; using System.Drawing; using System.Windows.Forms; +using L10NSharp; -namespace L10NSharp.WindowsForms +namespace L10NSharpWinforms { internal interface ILocalizationManagerInternalWinforms: ILocalizationManagerInternal { diff --git a/src/L10NSharp/WindowsForms/ILocalizedStringCacheWinforms.cs b/src/L10NSharpWinforms/ILocalizedStringCacheWinforms.cs similarity index 71% rename from src/L10NSharp/WindowsForms/ILocalizedStringCacheWinforms.cs rename to src/L10NSharpWinforms/ILocalizedStringCacheWinforms.cs index b4220fd..56f9bc7 100644 --- a/src/L10NSharp/WindowsForms/ILocalizedStringCacheWinforms.cs +++ b/src/L10NSharpWinforms/ILocalizedStringCacheWinforms.cs @@ -3,11 +3,11 @@ using System.Collections.Generic; using System.Windows.Forms; -using L10NSharp.WindowsForms.UI; +using L10NSharpWinforms.UI; -namespace L10NSharp.WindowsForms +namespace L10NSharpWinforms { - internal interface ILocalizedStringCacheWinforms:ILocalizedStringCache + internal interface ILocalizedStringCacheWinforms:L10NSharp.ILocalizedStringCache { List> LeafNodeList { get; } Keys GetShortcutKeys(string langId, string id); diff --git a/src/L10NSharpWinforms/L10NSharpWinforms.csproj b/src/L10NSharpWinforms/L10NSharpWinforms.csproj new file mode 100644 index 0000000..1d86c38 --- /dev/null +++ b/src/L10NSharpWinforms/L10NSharpWinforms.csproj @@ -0,0 +1,88 @@ + + + L10NSharpWinforms + L10NSharpWinforms is a .NET localization library for Windows Forms applications. It collects strings which need localization when your application first runs and saves them in a XLIFF file. It can also dynamically collect strings at runtime. + L10NSharpWinforms + L10NSharpWinforms + True + + + + + + + + + + + + + + + + + + + + + UserControl + + + Component + + + Form + + + Form + + + Form + + + Component + + + Form + + + Form + + + Form + + + Component + + + Form + + + Form + + + Form + + + UserControl + + + UserControl + + + UserControl + + + Form + + + Component + + + Component + + + Component + + + diff --git a/src/L10NSharp/WindowsForms/LocalizationManagerInternalWinforms.cs b/src/L10NSharpWinforms/LocalizationManagerInternalWinforms.cs similarity index 97% rename from src/L10NSharp/WindowsForms/LocalizationManagerInternalWinforms.cs rename to src/L10NSharpWinforms/LocalizationManagerInternalWinforms.cs index c2205ec..de87ca7 100644 --- a/src/L10NSharp/WindowsForms/LocalizationManagerInternalWinforms.cs +++ b/src/L10NSharpWinforms/LocalizationManagerInternalWinforms.cs @@ -11,10 +11,11 @@ using System.Linq; using System.Reflection; using System.Windows.Forms; -using L10NSharp.WindowsForms.XLiffUtils; +using L10NSharp; +using L10NSharpWinforms.XLiffUtils; // ReSharper disable StaticMemberInGenericType - these static fields are parameter-independent -namespace L10NSharp.WindowsForms +namespace L10NSharpWinforms { internal static class LocalizationManagerInternalWinforms { @@ -65,9 +66,9 @@ private static ILocalizationManager Create(string desiredUiLangId, string appId, desiredUiLangId = LocalizationManagerInternal.ChooseFallbackLanguage(); } - LocalizationManager.SetUILanguage(desiredUiLangId, false); + L10NSharp.LocalizationManager.SetUILanguage(desiredUiLangId, false); - LocalizationManager.EnableClickingOnControlToBringUpLocalizationDialog = true; + L10NSharp.LocalizationManager.EnableClickingOnControlToBringUpLocalizationDialog = true; return lm; } diff --git a/src/L10NSharp/WindowsForms/LocalizationManagerWinforms.cs b/src/L10NSharpWinforms/LocalizationManagerWinforms.cs similarity index 88% rename from src/L10NSharp/WindowsForms/LocalizationManagerWinforms.cs rename to src/L10NSharpWinforms/LocalizationManagerWinforms.cs index dc4219f..207c87b 100644 --- a/src/L10NSharp/WindowsForms/LocalizationManagerWinforms.cs +++ b/src/L10NSharpWinforms/LocalizationManagerWinforms.cs @@ -4,8 +4,9 @@ using System.Collections.Generic; using System.Windows.Forms; using L10NSharp.XLiffUtils; +using L10NSharp; -namespace L10NSharp.WindowsForms +namespace L10NSharpWinforms { public static class LocalizationManagerWinforms { @@ -42,17 +43,6 @@ internal static Dictionary LoadedM } } - internal static void ClearLoadedManagers() - { - switch (LocalizationManager.TranslationMemoryKind) - { - default: - case TranslationMemory.XLiff: - LocalizationManagerInternal.LoadedManagers.Clear(); - break; - } - } - /// /// True (default) to throw if we try to get a string from a particular manager /// and it has been disposed. When false, we will instead just return the English string, diff --git a/src/L10NSharp/WindowsForms/LocalizingInfoWinforms.cs b/src/L10NSharpWinforms/LocalizingInfoWinforms.cs similarity index 99% rename from src/L10NSharp/WindowsForms/LocalizingInfoWinforms.cs rename to src/L10NSharpWinforms/LocalizingInfoWinforms.cs index cd2aba0..0053573 100644 --- a/src/L10NSharp/WindowsForms/LocalizingInfoWinforms.cs +++ b/src/L10NSharpWinforms/LocalizingInfoWinforms.cs @@ -1,9 +1,10 @@ using System; using System.ComponentModel; using System.Windows.Forms; -using L10NSharp.WindowsForms.UI; +using L10NSharpWinforms.UI; +using L10NSharp; -namespace L10NSharp.WindowsForms +namespace L10NSharpWinforms { /// ---------------------------------------------------------------------------------------- /// diff --git a/src/L10NSharpWinforms/Properties/AssemblyInfo.cs b/src/L10NSharpWinforms/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..cd7679c --- /dev/null +++ b/src/L10NSharpWinforms/Properties/AssemblyInfo.cs @@ -0,0 +1,10 @@ +using System.Runtime.CompilerServices; + +// to get the public key, run: +// 1. extract the public key from the keyfile with +// sn –p +// 2. show the public key with +// sn -tp +// (use the full public key, not the public key token!) + +[assembly: InternalsVisibleTo("L10NSharpWinformsTests, PublicKey=002400000480000094000000060200000024000052534131000400000100010019cae48c6e5703818db31fcca17b87012eef38df95e3961c59b035190eace2c4ee5cfa1a258b84867c7549f60eec00ec1e0004c2ed224457128e841311cea0f5a05c3d69b3dfcb7422b214febce6e06c83ce4d29c62f36a7fd5564e922338c800372a5ec09638671b4db1fb33ccbb1dc48d8122ffe0d30dadbfbf325f65437b2")] diff --git a/src/L10NSharp/WindowsForms/UI/ColorHelper.cs b/src/L10NSharpWinforms/UI/ColorHelper.cs similarity index 98% rename from src/L10NSharp/WindowsForms/UI/ColorHelper.cs rename to src/L10NSharpWinforms/UI/ColorHelper.cs index f503822..5f624b0 100644 --- a/src/L10NSharp/WindowsForms/UI/ColorHelper.cs +++ b/src/L10NSharpWinforms/UI/ColorHelper.cs @@ -1,6 +1,6 @@ using System.Drawing; -namespace L10NSharp.WindowsForms.UI +namespace L10NSharpWinforms.UI { internal static class ColorHelper { diff --git a/src/L10NSharp/WindowsForms/UI/CustomDropDownComboBox.Designer.cs b/src/L10NSharpWinforms/UI/CustomDropDownComboBox.Designer.cs similarity index 98% rename from src/L10NSharp/WindowsForms/UI/CustomDropDownComboBox.Designer.cs rename to src/L10NSharpWinforms/UI/CustomDropDownComboBox.Designer.cs index 66c8193..36804a1 100644 --- a/src/L10NSharp/WindowsForms/UI/CustomDropDownComboBox.Designer.cs +++ b/src/L10NSharpWinforms/UI/CustomDropDownComboBox.Designer.cs @@ -1,4 +1,4 @@ -namespace L10NSharp.WindowsForms.UI +namespace L10NSharpWinforms.UI { partial class CustomDropDownComboBox { diff --git a/src/L10NSharp/WindowsForms/UI/CustomDropDownComboBox.cs b/src/L10NSharpWinforms/UI/CustomDropDownComboBox.cs similarity index 99% rename from src/L10NSharp/WindowsForms/UI/CustomDropDownComboBox.cs rename to src/L10NSharpWinforms/UI/CustomDropDownComboBox.cs index 0260b56..a5cfebb 100644 --- a/src/L10NSharp/WindowsForms/UI/CustomDropDownComboBox.cs +++ b/src/L10NSharpWinforms/UI/CustomDropDownComboBox.cs @@ -3,7 +3,7 @@ using System.Windows.Forms; using System.Windows.Forms.VisualStyles; -namespace L10NSharp.WindowsForms.UI +namespace L10NSharpWinforms.UI { /// ---------------------------------------------------------------------------------------- internal partial class CustomDropDownComboBox : UserControl diff --git a/src/L10NSharp/WindowsForms/UI/CustomDropDownComboBox.resx b/src/L10NSharpWinforms/UI/CustomDropDownComboBox.resx similarity index 100% rename from src/L10NSharp/WindowsForms/UI/CustomDropDownComboBox.resx rename to src/L10NSharpWinforms/UI/CustomDropDownComboBox.resx diff --git a/src/L10NSharp/WindowsForms/UI/DontShowThisAgainButton.Designer.cs b/src/L10NSharpWinforms/UI/DontShowThisAgainButton.Designer.cs similarity index 96% rename from src/L10NSharp/WindowsForms/UI/DontShowThisAgainButton.Designer.cs rename to src/L10NSharpWinforms/UI/DontShowThisAgainButton.Designer.cs index b0ebe21..30a594a 100644 --- a/src/L10NSharp/WindowsForms/UI/DontShowThisAgainButton.Designer.cs +++ b/src/L10NSharpWinforms/UI/DontShowThisAgainButton.Designer.cs @@ -1,4 +1,4 @@ -namespace L10NSharp.WindowsForms.UI +namespace L10NSharpWinforms.UI { partial class DontShowThisAgainButton { diff --git a/src/L10NSharp/WindowsForms/UI/DontShowThisAgainButton.cs b/src/L10NSharpWinforms/UI/DontShowThisAgainButton.cs similarity index 98% rename from src/L10NSharp/WindowsForms/UI/DontShowThisAgainButton.cs rename to src/L10NSharpWinforms/UI/DontShowThisAgainButton.cs index e46273b..0647a2f 100644 --- a/src/L10NSharp/WindowsForms/UI/DontShowThisAgainButton.cs +++ b/src/L10NSharpWinforms/UI/DontShowThisAgainButton.cs @@ -7,7 +7,7 @@ using System.Windows.Forms; using L10NSharp.Properties; -namespace L10NSharp.WindowsForms.UI +namespace L10NSharpWinforms.UI { public partial class DontShowThisAgainButton : CheckBox { diff --git a/src/L10NSharp/WindowsForms/UI/EditSourceBeforeTranslatingDlg.Designer.cs b/src/L10NSharpWinforms/UI/EditSourceBeforeTranslatingDlg.Designer.cs similarity index 99% rename from src/L10NSharp/WindowsForms/UI/EditSourceBeforeTranslatingDlg.Designer.cs rename to src/L10NSharpWinforms/UI/EditSourceBeforeTranslatingDlg.Designer.cs index 2994637..034537b 100644 --- a/src/L10NSharp/WindowsForms/UI/EditSourceBeforeTranslatingDlg.Designer.cs +++ b/src/L10NSharpWinforms/UI/EditSourceBeforeTranslatingDlg.Designer.cs @@ -1,4 +1,4 @@ -namespace L10NSharp.WindowsForms.UI +namespace L10NSharpWinforms.UI { partial class EditSourceBeforeTranslatingDlg { diff --git a/src/L10NSharp/WindowsForms/UI/EditSourceBeforeTranslatingDlg.cs b/src/L10NSharpWinforms/UI/EditSourceBeforeTranslatingDlg.cs similarity index 97% rename from src/L10NSharp/WindowsForms/UI/EditSourceBeforeTranslatingDlg.cs rename to src/L10NSharpWinforms/UI/EditSourceBeforeTranslatingDlg.cs index fdbc58a..a1cb847 100644 --- a/src/L10NSharp/WindowsForms/UI/EditSourceBeforeTranslatingDlg.cs +++ b/src/L10NSharpWinforms/UI/EditSourceBeforeTranslatingDlg.cs @@ -4,7 +4,7 @@ using System.Windows.Forms; using L10NSharp.Translators; -namespace L10NSharp.WindowsForms.UI +namespace L10NSharpWinforms.UI { public partial class EditSourceBeforeTranslatingDlg : Form { diff --git a/src/L10NSharp/WindowsForms/UI/EditSourceBeforeTranslatingDlg.resx b/src/L10NSharpWinforms/UI/EditSourceBeforeTranslatingDlg.resx similarity index 100% rename from src/L10NSharp/WindowsForms/UI/EditSourceBeforeTranslatingDlg.resx rename to src/L10NSharpWinforms/UI/EditSourceBeforeTranslatingDlg.resx diff --git a/src/L10NSharp/WindowsForms/UI/FallbackLanguagesDlg.cs b/src/L10NSharpWinforms/UI/FallbackLanguagesDlg.cs similarity index 95% rename from src/L10NSharp/WindowsForms/UI/FallbackLanguagesDlg.cs rename to src/L10NSharpWinforms/UI/FallbackLanguagesDlg.cs index 372054a..abd2827 100644 --- a/src/L10NSharp/WindowsForms/UI/FallbackLanguagesDlg.cs +++ b/src/L10NSharpWinforms/UI/FallbackLanguagesDlg.cs @@ -5,8 +5,9 @@ using System.Text; using System.Threading.Tasks; using System.Windows.Forms; +using L10NSharp; -namespace L10NSharp.WindowsForms.UI +namespace L10NSharpWinforms.UI { public class FallbackLanguagesDlg : FallbackLanguagesDlgBase { diff --git a/src/L10NSharp/WindowsForms/UI/FallbackLanguagesDlgBase.Designer.cs b/src/L10NSharpWinforms/UI/FallbackLanguagesDlgBase.Designer.cs similarity index 99% rename from src/L10NSharp/WindowsForms/UI/FallbackLanguagesDlgBase.Designer.cs rename to src/L10NSharpWinforms/UI/FallbackLanguagesDlgBase.Designer.cs index 2b00e9a..2c1b834 100644 --- a/src/L10NSharp/WindowsForms/UI/FallbackLanguagesDlgBase.Designer.cs +++ b/src/L10NSharpWinforms/UI/FallbackLanguagesDlgBase.Designer.cs @@ -1,4 +1,4 @@ -namespace L10NSharp.WindowsForms.UI +namespace L10NSharpWinforms.UI { partial class FallbackLanguagesDlgBase { diff --git a/src/L10NSharp/WindowsForms/UI/FallbackLanguagesDlgBase.cs b/src/L10NSharpWinforms/UI/FallbackLanguagesDlgBase.cs similarity index 98% rename from src/L10NSharp/WindowsForms/UI/FallbackLanguagesDlgBase.cs rename to src/L10NSharpWinforms/UI/FallbackLanguagesDlgBase.cs index 1026020..aefc88b 100644 --- a/src/L10NSharp/WindowsForms/UI/FallbackLanguagesDlgBase.cs +++ b/src/L10NSharpWinforms/UI/FallbackLanguagesDlgBase.cs @@ -3,8 +3,9 @@ using System.Linq; using System.Globalization; using System.Windows.Forms; +using L10NSharp; -namespace L10NSharp.WindowsForms.UI +namespace L10NSharpWinforms.UI { /// ------------------------------------------------------------------------------------ public partial class FallbackLanguagesDlgBase : Form diff --git a/src/L10NSharp/WindowsForms/UI/FallbackLanguagesDlgBase.resx b/src/L10NSharpWinforms/UI/FallbackLanguagesDlgBase.resx similarity index 100% rename from src/L10NSharp/WindowsForms/UI/FallbackLanguagesDlgBase.resx rename to src/L10NSharpWinforms/UI/FallbackLanguagesDlgBase.resx diff --git a/src/L10NSharp/WindowsForms/UI/Grid/LmButtonCell.cs b/src/L10NSharpWinforms/UI/Grid/LmButtonCell.cs similarity index 99% rename from src/L10NSharp/WindowsForms/UI/Grid/LmButtonCell.cs rename to src/L10NSharpWinforms/UI/Grid/LmButtonCell.cs index d498c4d..18b88ec 100644 --- a/src/L10NSharp/WindowsForms/UI/Grid/LmButtonCell.cs +++ b/src/L10NSharpWinforms/UI/Grid/LmButtonCell.cs @@ -3,7 +3,7 @@ using System.Windows.Forms; using System.Windows.Forms.VisualStyles; -namespace L10NSharp.WindowsForms.UI +namespace L10NSharpWinforms.UI { #region LmButtonCell class /// ---------------------------------------------------------------------------------------- diff --git a/src/L10NSharp/WindowsForms/UI/Grid/LmButtonColumn.cs b/src/L10NSharpWinforms/UI/Grid/LmButtonColumn.cs similarity index 99% rename from src/L10NSharp/WindowsForms/UI/Grid/LmButtonColumn.cs rename to src/L10NSharpWinforms/UI/Grid/LmButtonColumn.cs index fc8277f..de9da57 100644 --- a/src/L10NSharp/WindowsForms/UI/Grid/LmButtonColumn.cs +++ b/src/L10NSharpWinforms/UI/Grid/LmButtonColumn.cs @@ -2,7 +2,7 @@ using System.Drawing; using System.Windows.Forms; -namespace L10NSharp.WindowsForms.UI +namespace L10NSharpWinforms.UI { /// ---------------------------------------------------------------------------------------- public class LmButtonColumn : DataGridViewColumn diff --git a/src/L10NSharp/WindowsForms/UI/Grid/LmGrid.cs b/src/L10NSharpWinforms/UI/Grid/LmGrid.cs similarity index 99% rename from src/L10NSharp/WindowsForms/UI/Grid/LmGrid.cs rename to src/L10NSharpWinforms/UI/Grid/LmGrid.cs index 01cd0cc..7db5d43 100644 --- a/src/L10NSharp/WindowsForms/UI/Grid/LmGrid.cs +++ b/src/L10NSharpWinforms/UI/Grid/LmGrid.cs @@ -7,7 +7,7 @@ using System.Windows.Forms; using System.Windows.Forms.VisualStyles; -namespace L10NSharp.WindowsForms.UI +namespace L10NSharpWinforms.UI { /// ---------------------------------------------------------------------------------------- public class LmGrid : DataGridView diff --git a/src/L10NSharp/WindowsForms/UI/HowToDistributeDialog.Designer.cs b/src/L10NSharpWinforms/UI/HowToDistributeDialog.Designer.cs similarity index 99% rename from src/L10NSharp/WindowsForms/UI/HowToDistributeDialog.Designer.cs rename to src/L10NSharpWinforms/UI/HowToDistributeDialog.Designer.cs index b6ba830..f92515c 100644 --- a/src/L10NSharp/WindowsForms/UI/HowToDistributeDialog.Designer.cs +++ b/src/L10NSharpWinforms/UI/HowToDistributeDialog.Designer.cs @@ -1,4 +1,4 @@ -namespace L10NSharp.WindowsForms.UI +namespace L10NSharpWinforms.UI { partial class HowToDistributeDialog { diff --git a/src/L10NSharp/WindowsForms/UI/HowToDistributeDialog.cs b/src/L10NSharpWinforms/UI/HowToDistributeDialog.cs similarity index 98% rename from src/L10NSharp/WindowsForms/UI/HowToDistributeDialog.cs rename to src/L10NSharpWinforms/UI/HowToDistributeDialog.cs index a7e2937..4b29355 100644 --- a/src/L10NSharp/WindowsForms/UI/HowToDistributeDialog.cs +++ b/src/L10NSharpWinforms/UI/HowToDistributeDialog.cs @@ -3,8 +3,9 @@ using System.IO; using System.Linq; using System.Windows.Forms; +using L10NSharp; -namespace L10NSharp.WindowsForms.UI +namespace L10NSharpWinforms.UI { public partial class HowToDistributeDialog : Form { diff --git a/src/L10NSharp/WindowsForms/UI/HowToDistributeDialog.resx b/src/L10NSharpWinforms/UI/HowToDistributeDialog.resx similarity index 100% rename from src/L10NSharp/WindowsForms/UI/HowToDistributeDialog.resx rename to src/L10NSharpWinforms/UI/HowToDistributeDialog.resx diff --git a/src/L10NSharp/WindowsForms/UI/InitializationProgressDlg.cs b/src/L10NSharpWinforms/UI/InitializationProgressDlg.cs similarity index 98% rename from src/L10NSharp/WindowsForms/UI/InitializationProgressDlg.cs rename to src/L10NSharpWinforms/UI/InitializationProgressDlg.cs index bc6d00e..fb5fb73 100644 --- a/src/L10NSharp/WindowsForms/UI/InitializationProgressDlg.cs +++ b/src/L10NSharpWinforms/UI/InitializationProgressDlg.cs @@ -5,8 +5,9 @@ using System.Drawing; using System.Reflection; using L10NSharp.CodeReader; +using L10NSharp; -namespace L10NSharp.WindowsForms.UI +namespace L10NSharpWinforms.UI { internal class InitializationProgressDlg: InitializationProgressDlgBase { diff --git a/src/L10NSharp/WindowsForms/UI/InitializationProgressDlgBase.Designer.cs b/src/L10NSharpWinforms/UI/InitializationProgressDlgBase.Designer.cs similarity index 99% rename from src/L10NSharp/WindowsForms/UI/InitializationProgressDlgBase.Designer.cs rename to src/L10NSharpWinforms/UI/InitializationProgressDlgBase.Designer.cs index e8a0ea7..8620bc9 100644 --- a/src/L10NSharp/WindowsForms/UI/InitializationProgressDlgBase.Designer.cs +++ b/src/L10NSharpWinforms/UI/InitializationProgressDlgBase.Designer.cs @@ -1,4 +1,4 @@ -namespace L10NSharp.WindowsForms.UI +namespace L10NSharpWinforms.UI { partial class InitializationProgressDlgBase { diff --git a/src/L10NSharp/WindowsForms/UI/InitializationProgressDlgBase.cs b/src/L10NSharpWinforms/UI/InitializationProgressDlgBase.cs similarity index 98% rename from src/L10NSharp/WindowsForms/UI/InitializationProgressDlgBase.cs rename to src/L10NSharpWinforms/UI/InitializationProgressDlgBase.cs index aca7b10..ffc4d49 100644 --- a/src/L10NSharp/WindowsForms/UI/InitializationProgressDlgBase.cs +++ b/src/L10NSharpWinforms/UI/InitializationProgressDlgBase.cs @@ -5,7 +5,7 @@ using System.Reflection; using System.Windows.Forms; -namespace L10NSharp.WindowsForms.UI +namespace L10NSharpWinforms.UI { /// ---------------------------------------------------------------------------------------- internal partial class InitializationProgressDlgBase : Form diff --git a/src/L10NSharp/WindowsForms/UI/InitializationProgressDlgBase.resx b/src/L10NSharpWinforms/UI/InitializationProgressDlgBase.resx similarity index 100% rename from src/L10NSharp/WindowsForms/UI/InitializationProgressDlgBase.resx rename to src/L10NSharpWinforms/UI/InitializationProgressDlgBase.resx diff --git a/src/L10NSharp/WindowsForms/UI/L10NExtender.cs b/src/L10NSharpWinforms/UI/L10NExtender.cs similarity index 99% rename from src/L10NSharp/WindowsForms/UI/L10NExtender.cs rename to src/L10NSharpWinforms/UI/L10NExtender.cs index 3b4dad5..f32c70d 100644 --- a/src/L10NSharp/WindowsForms/UI/L10NExtender.cs +++ b/src/L10NSharpWinforms/UI/L10NExtender.cs @@ -21,8 +21,9 @@ using System.Diagnostics; using System.Linq; using System.Windows.Forms; +using L10NSharp; -namespace L10NSharp.WindowsForms.UI +namespace L10NSharpWinforms.UI { /// ---------------------------------------------------------------------------------------- [ProvideProperty("LocalizingId", typeof(IComponent))] diff --git a/src/L10NSharp/WindowsForms/UI/L10NExtender.resx b/src/L10NSharpWinforms/UI/L10NExtender.resx similarity index 100% rename from src/L10NSharp/WindowsForms/UI/L10NExtender.resx rename to src/L10NSharpWinforms/UI/L10NExtender.resx diff --git a/src/L10NSharp/WindowsForms/UI/LanguageChoosingDialog.Designer.cs b/src/L10NSharpWinforms/UI/LanguageChoosingDialog.Designer.cs similarity index 97% rename from src/L10NSharp/WindowsForms/UI/LanguageChoosingDialog.Designer.cs rename to src/L10NSharpWinforms/UI/LanguageChoosingDialog.Designer.cs index f63deb3..dd56e1b 100644 --- a/src/L10NSharp/WindowsForms/UI/LanguageChoosingDialog.Designer.cs +++ b/src/L10NSharpWinforms/UI/LanguageChoosingDialog.Designer.cs @@ -1,6 +1,6 @@ using System.Drawing; -namespace L10NSharp.WindowsForms.UI +namespace L10NSharpWinforms.UI { partial class LanguageChoosingDialog { @@ -32,7 +32,7 @@ private void InitializeComponent() { this._messageLabel = new System.Windows.Forms.Label(); this._OKButton = new System.Windows.Forms.Button(); - this.uiLanguageComboBox1 = new L10NSharp.WindowsForms.UI.UILanguageComboBox(); + this.uiLanguageComboBox1 = new L10NSharpWinforms.UI.UILanguageComboBox(); this.SuspendLayout(); // // _messageLabel diff --git a/src/L10NSharp/WindowsForms/UI/LanguageChoosingDialog.cs b/src/L10NSharpWinforms/UI/LanguageChoosingDialog.cs similarity index 96% rename from src/L10NSharp/WindowsForms/UI/LanguageChoosingDialog.cs rename to src/L10NSharpWinforms/UI/LanguageChoosingDialog.cs index 3f1d1a8..3a614ef 100644 --- a/src/L10NSharp/WindowsForms/UI/LanguageChoosingDialog.cs +++ b/src/L10NSharpWinforms/UI/LanguageChoosingDialog.cs @@ -2,8 +2,9 @@ using System.Drawing; using System.Windows.Forms; using L10NSharp.Translators; +using L10NSharp; -namespace L10NSharp.WindowsForms.UI +namespace L10NSharpWinforms.UI { public partial class LanguageChoosingDialog : Form { diff --git a/src/L10NSharp/WindowsForms/UI/LanguageChoosingDialog.resx b/src/L10NSharpWinforms/UI/LanguageChoosingDialog.resx similarity index 100% rename from src/L10NSharp/WindowsForms/UI/LanguageChoosingDialog.resx rename to src/L10NSharpWinforms/UI/LanguageChoosingDialog.resx diff --git a/src/L10NSharp/WindowsForms/UI/LanguageChoosingDialogViewModel.cs b/src/L10NSharpWinforms/UI/LanguageChoosingDialogViewModel.cs similarity index 98% rename from src/L10NSharp/WindowsForms/UI/LanguageChoosingDialogViewModel.cs rename to src/L10NSharpWinforms/UI/LanguageChoosingDialogViewModel.cs index e6e0d47..4a3228c 100644 --- a/src/L10NSharp/WindowsForms/UI/LanguageChoosingDialogViewModel.cs +++ b/src/L10NSharpWinforms/UI/LanguageChoosingDialogViewModel.cs @@ -1,8 +1,9 @@ using System; using System.Diagnostics; using L10NSharp.Translators; +using L10NSharp; -namespace L10NSharp.WindowsForms.UI +namespace L10NSharpWinforms.UI { internal class LanguageChoosingDialogViewModel { diff --git a/src/L10NSharp/WindowsForms/UI/LanguageChoosingSimpleDialog.Designer.cs b/src/L10NSharpWinforms/UI/LanguageChoosingSimpleDialog.Designer.cs similarity index 98% rename from src/L10NSharp/WindowsForms/UI/LanguageChoosingSimpleDialog.Designer.cs rename to src/L10NSharpWinforms/UI/LanguageChoosingSimpleDialog.Designer.cs index e640dfc..092bdb1 100644 --- a/src/L10NSharp/WindowsForms/UI/LanguageChoosingSimpleDialog.Designer.cs +++ b/src/L10NSharpWinforms/UI/LanguageChoosingSimpleDialog.Designer.cs @@ -1,4 +1,4 @@ -namespace L10NSharp.WindowsForms.UI +namespace L10NSharpWinforms.UI { partial class LanguageChoosingSimpleDialog { diff --git a/src/L10NSharp/WindowsForms/UI/LanguageChoosingSimpleDialog.cs b/src/L10NSharpWinforms/UI/LanguageChoosingSimpleDialog.cs similarity index 95% rename from src/L10NSharp/WindowsForms/UI/LanguageChoosingSimpleDialog.cs rename to src/L10NSharpWinforms/UI/LanguageChoosingSimpleDialog.cs index 563ed45..3adfd82 100644 --- a/src/L10NSharp/WindowsForms/UI/LanguageChoosingSimpleDialog.cs +++ b/src/L10NSharpWinforms/UI/LanguageChoosingSimpleDialog.cs @@ -2,7 +2,7 @@ using System.Drawing; using System.Windows.Forms; -namespace L10NSharp.WindowsForms.UI +namespace L10NSharpWinforms.UI { /// /// The current thinking for use of this dialog is when an application first starts up, diff --git a/src/L10NSharp/WindowsForms/UI/LanguageChoosingSimpleDialog.resx b/src/L10NSharpWinforms/UI/LanguageChoosingSimpleDialog.resx similarity index 100% rename from src/L10NSharp/WindowsForms/UI/LanguageChoosingSimpleDialog.resx rename to src/L10NSharpWinforms/UI/LanguageChoosingSimpleDialog.resx diff --git a/src/L10NSharp/WindowsForms/UI/LocTreeNode.cs b/src/L10NSharpWinforms/UI/LocTreeNode.cs similarity index 98% rename from src/L10NSharp/WindowsForms/UI/LocTreeNode.cs rename to src/L10NSharpWinforms/UI/LocTreeNode.cs index ce1c7b6..2069cbc 100644 --- a/src/L10NSharp/WindowsForms/UI/LocTreeNode.cs +++ b/src/L10NSharpWinforms/UI/LocTreeNode.cs @@ -2,7 +2,7 @@ using System.Linq; using System.Windows.Forms; -namespace L10NSharp.WindowsForms.UI +namespace L10NSharpWinforms.UI { /// ---------------------------------------------------------------------------------------- internal class LocTreeNode : TreeNode diff --git a/src/L10NSharp/WindowsForms/UI/LocalizeItemDlg.Designer.cs b/src/L10NSharpWinforms/UI/LocalizeItemDlg.Designer.cs similarity index 99% rename from src/L10NSharp/WindowsForms/UI/LocalizeItemDlg.Designer.cs rename to src/L10NSharpWinforms/UI/LocalizeItemDlg.Designer.cs index bd30f70..8128b71 100644 --- a/src/L10NSharp/WindowsForms/UI/LocalizeItemDlg.Designer.cs +++ b/src/L10NSharpWinforms/UI/LocalizeItemDlg.Designer.cs @@ -1,4 +1,4 @@ -namespace L10NSharp.WindowsForms.UI +namespace L10NSharpWinforms.UI { partial class LocalizeItemDlg { @@ -43,15 +43,15 @@ private void InitializeComponent() this._treeView = new System.Windows.Forms.TreeView(); this._toolStripLeftSide = new System.Windows.Forms.ToolStrip(); this._labelGroups = new System.Windows.Forms.ToolStripLabel(); - this._buttonMoveNext = new L10NSharp.WindowsForms.UI.XButton(); - this._grid = new L10NSharp.WindowsForms.UI.LmGrid(); + this._buttonMoveNext = new L10NSharpWinforms.UI.XButton(); + this._grid = new L10NSharpWinforms.UI.LmGrid(); this._colId = new System.Windows.Forms.DataGridViewTextBoxColumn(); this._colSourceText = new System.Windows.Forms.DataGridViewTextBoxColumn(); this._colTargetText = new System.Windows.Forms.DataGridViewTextBoxColumn(); this._colSrcToolTip = new System.Windows.Forms.DataGridViewTextBoxColumn(); this._colTgtToolTip = new System.Windows.Forms.DataGridViewTextBoxColumn(); this._colComments = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this._buttonMovePrev = new L10NSharp.WindowsForms.UI.XButton(); + this._buttonMovePrev = new L10NSharpWinforms.UI.XButton(); this._toolStripRightSide = new System.Windows.Forms.ToolStrip(); this._buttonBingTranslator = new System.Windows.Forms.ToolStripSplitButton(); this._menuTranslateUsingBing = new System.Windows.Forms.ToolStripMenuItem(); @@ -62,13 +62,13 @@ private void InitializeComponent() this._labelSourceLang = new System.Windows.Forms.ToolStripLabel(); this._tableLayout = new System.Windows.Forms.TableLayoutPanel(); this._panelIdentifier = new System.Windows.Forms.Panel(); - this.btnCopyToolTip = new L10NSharp.WindowsForms.UI.XButton(); - this.btnCopyShortcutKeys = new L10NSharp.WindowsForms.UI.XButton(); - this.btnCopyText = new L10NSharp.WindowsForms.UI.XButton(); + this.btnCopyToolTip = new L10NSharpWinforms.UI.XButton(); + this.btnCopyShortcutKeys = new L10NSharpWinforms.UI.XButton(); + this.btnCopyText = new L10NSharpWinforms.UI.XButton(); this._panelTargetText = new System.Windows.Forms.Panel(); this._groupBoxTgtTranslation = new System.Windows.Forms.GroupBox(); this._labelTgtShortcutKeys = new System.Windows.Forms.Label(); - this._shortcutKeysDropDown = new L10NSharp.WindowsForms.UI.ShortcutKeysDropDown(); + this._shortcutKeysDropDown = new L10NSharpWinforms.UI.ShortcutKeysDropDown(); this._labelTgtToolTip = new System.Windows.Forms.Label(); this._textBoxTgtToolTip = new System.Windows.Forms.TextBox(); this._panelSourceText = new System.Windows.Forms.Panel(); diff --git a/src/L10NSharp/WindowsForms/UI/LocalizeItemDlg.cs b/src/L10NSharpWinforms/UI/LocalizeItemDlg.cs similarity index 99% rename from src/L10NSharp/WindowsForms/UI/LocalizeItemDlg.cs rename to src/L10NSharpWinforms/UI/LocalizeItemDlg.cs index 7ea31e3..274b8f6 100644 --- a/src/L10NSharp/WindowsForms/UI/LocalizeItemDlg.cs +++ b/src/L10NSharpWinforms/UI/LocalizeItemDlg.cs @@ -6,8 +6,9 @@ using System.Text; using System.Windows.Forms; using L10NSharp.Properties; +using L10NSharp; -namespace L10NSharp.WindowsForms.UI +namespace L10NSharpWinforms.UI { /// ---------------------------------------------------------------------------------------- public partial class LocalizeItemDlg : Form diff --git a/src/L10NSharp/WindowsForms/UI/LocalizeItemDlg.resx b/src/L10NSharpWinforms/UI/LocalizeItemDlg.resx similarity index 100% rename from src/L10NSharp/WindowsForms/UI/LocalizeItemDlg.resx rename to src/L10NSharpWinforms/UI/LocalizeItemDlg.resx diff --git a/src/L10NSharp/WindowsForms/UI/LocalizeItemDlgViewModel.cs b/src/L10NSharpWinforms/UI/LocalizeItemDlgViewModel.cs similarity index 99% rename from src/L10NSharp/WindowsForms/UI/LocalizeItemDlgViewModel.cs rename to src/L10NSharpWinforms/UI/LocalizeItemDlgViewModel.cs index c205d21..459a92d 100644 --- a/src/L10NSharp/WindowsForms/UI/LocalizeItemDlgViewModel.cs +++ b/src/L10NSharpWinforms/UI/LocalizeItemDlgViewModel.cs @@ -5,8 +5,9 @@ using System.Linq; using System.Windows.Forms; using L10NSharp.Translators; +using L10NSharp; -namespace L10NSharp.WindowsForms.UI +namespace L10NSharpWinforms.UI { internal class LocalizeItemDlgViewModel { diff --git a/src/L10NSharp/WindowsForms/UI/NodeComparer.cs b/src/L10NSharpWinforms/UI/NodeComparer.cs similarity index 97% rename from src/L10NSharp/WindowsForms/UI/NodeComparer.cs rename to src/L10NSharpWinforms/UI/NodeComparer.cs index 3a5ac25..f1a78ff 100644 --- a/src/L10NSharp/WindowsForms/UI/NodeComparer.cs +++ b/src/L10NSharpWinforms/UI/NodeComparer.cs @@ -4,9 +4,8 @@ using System.Collections.Generic; using System.Globalization; using System.Windows.Forms; -using L10NSharp.WindowsForms; -namespace L10NSharp.WindowsForms.UI +namespace L10NSharpWinforms.UI { /// ---------------------------------------------------------------------------------------- internal class NodeComparer : IComparer> diff --git a/src/L10NSharp/WindowsForms/UI/PaintingHelper.cs b/src/L10NSharpWinforms/UI/PaintingHelper.cs similarity index 99% rename from src/L10NSharp/WindowsForms/UI/PaintingHelper.cs rename to src/L10NSharpWinforms/UI/PaintingHelper.cs index 6f4331f..6987dfc 100644 --- a/src/L10NSharp/WindowsForms/UI/PaintingHelper.cs +++ b/src/L10NSharpWinforms/UI/PaintingHelper.cs @@ -5,7 +5,7 @@ using System.Windows.Forms; using System.Windows.Forms.VisualStyles; -namespace L10NSharp.WindowsForms.UI +namespace L10NSharpWinforms.UI { /// ------------------------------------------------------------------------------------ /// diff --git a/src/L10NSharp/WindowsForms/UI/PopupControl.cs b/src/L10NSharpWinforms/UI/PopupControl.cs similarity index 99% rename from src/L10NSharp/WindowsForms/UI/PopupControl.cs rename to src/L10NSharpWinforms/UI/PopupControl.cs index 5d6338b..61f6265 100644 --- a/src/L10NSharp/WindowsForms/UI/PopupControl.cs +++ b/src/L10NSharpWinforms/UI/PopupControl.cs @@ -5,7 +5,7 @@ using System.Drawing.Drawing2D; using System.Windows.Forms; -namespace L10NSharp.WindowsForms.UI +namespace L10NSharpWinforms.UI { /// ---------------------------------------------------------------------------------------- internal partial class PopupControl : UserControl diff --git a/src/L10NSharp/WindowsForms/UI/PopupControl.designer.cs b/src/L10NSharpWinforms/UI/PopupControl.designer.cs similarity index 95% rename from src/L10NSharp/WindowsForms/UI/PopupControl.designer.cs rename to src/L10NSharpWinforms/UI/PopupControl.designer.cs index 94d1cff..3b5c072 100644 --- a/src/L10NSharp/WindowsForms/UI/PopupControl.designer.cs +++ b/src/L10NSharpWinforms/UI/PopupControl.designer.cs @@ -1,4 +1,4 @@ -namespace L10NSharp.WindowsForms.UI +namespace L10NSharpWinforms.UI { partial class PopupControl { diff --git a/src/L10NSharp/WindowsForms/UI/PopupControl.resx b/src/L10NSharpWinforms/UI/PopupControl.resx similarity index 100% rename from src/L10NSharp/WindowsForms/UI/PopupControl.resx rename to src/L10NSharpWinforms/UI/PopupControl.resx diff --git a/src/L10NSharp/WindowsForms/UI/ShortcutKeysDropDown.cs b/src/L10NSharpWinforms/UI/ShortcutKeysDropDown.cs similarity index 98% rename from src/L10NSharp/WindowsForms/UI/ShortcutKeysDropDown.cs rename to src/L10NSharpWinforms/UI/ShortcutKeysDropDown.cs index 5275be6..d8d378a 100644 --- a/src/L10NSharp/WindowsForms/UI/ShortcutKeysDropDown.cs +++ b/src/L10NSharpWinforms/UI/ShortcutKeysDropDown.cs @@ -1,7 +1,7 @@ using System; using System.Windows.Forms; -namespace L10NSharp.WindowsForms.UI +namespace L10NSharpWinforms.UI { /// ---------------------------------------------------------------------------------------- internal class ShortcutKeysDropDown : CustomDropDownComboBox diff --git a/src/L10NSharp/WindowsForms/UI/ShortcutKeysEditor.Designer.cs b/src/L10NSharpWinforms/UI/ShortcutKeysEditor.Designer.cs similarity index 99% rename from src/L10NSharp/WindowsForms/UI/ShortcutKeysEditor.Designer.cs rename to src/L10NSharpWinforms/UI/ShortcutKeysEditor.Designer.cs index 803e1cd..0816429 100644 --- a/src/L10NSharp/WindowsForms/UI/ShortcutKeysEditor.Designer.cs +++ b/src/L10NSharpWinforms/UI/ShortcutKeysEditor.Designer.cs @@ -1,4 +1,4 @@ -namespace L10NSharp.WindowsForms.UI +namespace L10NSharpWinforms.UI { partial class ShortcutKeysEditor { diff --git a/src/L10NSharp/WindowsForms/UI/ShortcutKeysEditor.cs b/src/L10NSharpWinforms/UI/ShortcutKeysEditor.cs similarity index 99% rename from src/L10NSharp/WindowsForms/UI/ShortcutKeysEditor.cs rename to src/L10NSharpWinforms/UI/ShortcutKeysEditor.cs index 4763088..1d1ff35 100644 --- a/src/L10NSharp/WindowsForms/UI/ShortcutKeysEditor.cs +++ b/src/L10NSharpWinforms/UI/ShortcutKeysEditor.cs @@ -2,7 +2,7 @@ using System.Drawing; using System.Windows.Forms; -namespace L10NSharp.WindowsForms.UI +namespace L10NSharpWinforms.UI { /// ---------------------------------------------------------------------------------------- internal partial class ShortcutKeysEditor : PopupControl diff --git a/src/L10NSharp/WindowsForms/UI/ShortcutKeysEditor.resx b/src/L10NSharpWinforms/UI/ShortcutKeysEditor.resx similarity index 100% rename from src/L10NSharp/WindowsForms/UI/ShortcutKeysEditor.resx rename to src/L10NSharpWinforms/UI/ShortcutKeysEditor.resx diff --git a/src/L10NSharp/WindowsForms/UI/TipDialog.cs b/src/L10NSharpWinforms/UI/TipDialog.cs similarity index 98% rename from src/L10NSharp/WindowsForms/UI/TipDialog.cs rename to src/L10NSharpWinforms/UI/TipDialog.cs index 18ac9f0..7761f14 100644 --- a/src/L10NSharp/WindowsForms/UI/TipDialog.cs +++ b/src/L10NSharpWinforms/UI/TipDialog.cs @@ -3,7 +3,7 @@ using System.Windows.Forms; using L10NSharp.Properties; -namespace L10NSharp.WindowsForms.UI +namespace L10NSharpWinforms.UI { public partial class TipDialog : Form { diff --git a/src/L10NSharp/WindowsForms/UI/TipDialog.designer.cs b/src/L10NSharpWinforms/UI/TipDialog.designer.cs similarity index 99% rename from src/L10NSharp/WindowsForms/UI/TipDialog.designer.cs rename to src/L10NSharpWinforms/UI/TipDialog.designer.cs index b570870..c1f7562 100644 --- a/src/L10NSharp/WindowsForms/UI/TipDialog.designer.cs +++ b/src/L10NSharpWinforms/UI/TipDialog.designer.cs @@ -1,4 +1,4 @@ -namespace L10NSharp.WindowsForms.UI +namespace L10NSharpWinforms.UI { partial class TipDialog { diff --git a/src/L10NSharp/WindowsForms/UI/TipDialog.resx b/src/L10NSharpWinforms/UI/TipDialog.resx similarity index 100% rename from src/L10NSharp/WindowsForms/UI/TipDialog.resx rename to src/L10NSharpWinforms/UI/TipDialog.resx diff --git a/src/L10NSharp/WindowsForms/UI/UILanguageComboBox.cs b/src/L10NSharpWinforms/UI/UILanguageComboBox.cs similarity index 97% rename from src/L10NSharp/WindowsForms/UI/UILanguageComboBox.cs rename to src/L10NSharpWinforms/UI/UILanguageComboBox.cs index 38ad37c..b955834 100644 --- a/src/L10NSharp/WindowsForms/UI/UILanguageComboBox.cs +++ b/src/L10NSharpWinforms/UI/UILanguageComboBox.cs @@ -1,12 +1,11 @@ -using System.Collections.Generic; using System.ComponentModel; using System.ComponentModel.Design; using System.Drawing; -using System.Globalization; using System.Linq; using System.Windows.Forms; +using L10NSharp; -namespace L10NSharp.WindowsForms.UI +namespace L10NSharpWinforms.UI { /// ---------------------------------------------------------------------------------------- public class UILanguageComboBox : ComboBox diff --git a/src/L10NSharp/WindowsForms/UI/UILanguageListBox.cs b/src/L10NSharpWinforms/UI/UILanguageListBox.cs similarity index 98% rename from src/L10NSharp/WindowsForms/UI/UILanguageListBox.cs rename to src/L10NSharpWinforms/UI/UILanguageListBox.cs index e47ff06..452c06e 100644 --- a/src/L10NSharp/WindowsForms/UI/UILanguageListBox.cs +++ b/src/L10NSharpWinforms/UI/UILanguageListBox.cs @@ -4,8 +4,9 @@ using System.Globalization; using System.Linq; using System.Windows.Forms; +using L10NSharp; -namespace L10NSharp.WindowsForms.UI +namespace L10NSharpWinforms.UI { /// ---------------------------------------------------------------------------------------- public class UILanguageListBox : ListBox diff --git a/src/L10NSharp/WindowsForms/UI/XButton.cs b/src/L10NSharpWinforms/UI/XButton.cs similarity index 99% rename from src/L10NSharp/WindowsForms/UI/XButton.cs rename to src/L10NSharpWinforms/UI/XButton.cs index 35ca62b..26bd671 100644 --- a/src/L10NSharp/WindowsForms/UI/XButton.cs +++ b/src/L10NSharpWinforms/UI/XButton.cs @@ -3,7 +3,7 @@ using System.Windows.Forms; using System.Windows.Forms.VisualStyles; -namespace L10NSharp.WindowsForms.UI +namespace L10NSharpWinforms.UI { /// ---------------------------------------------------------------------------------------- internal class XButton : Label diff --git a/src/L10NSharp/WindowsForms/UtilsWinforms.cs b/src/L10NSharpWinforms/UtilsWinforms.cs similarity index 88% rename from src/L10NSharp/WindowsForms/UtilsWinforms.cs rename to src/L10NSharpWinforms/UtilsWinforms.cs index 872c326..123a7d1 100644 --- a/src/L10NSharp/WindowsForms/UtilsWinforms.cs +++ b/src/L10NSharpWinforms/UtilsWinforms.cs @@ -1,6 +1,6 @@ using System.Windows.Forms; -namespace L10NSharp.WindowsForms +namespace L10NSharpWinforms { /// ---------------------------------------------------------------------------------------- internal static class UtilsWinforms @@ -23,7 +23,7 @@ public static void SetWindowRedraw(Control ctrl, bool turnOn, { if (ctrl != null && !ctrl.IsDisposed && ctrl.IsHandleCreated) { - if (Utils.IsMono) + if (L10NSharp.Utils.IsMono) { if (turnOn) ctrl.ResumeLayout(invalidateAfterTurningOn); @@ -32,7 +32,7 @@ public static void SetWindowRedraw(Control ctrl, bool turnOn, } else { - Utils.SendMessage(ctrl.Handle, WM_SETREDRAW, (turnOn ? 1 : 0), 0); + L10NSharp.Utils.SendMessage(ctrl.Handle, WM_SETREDRAW, (turnOn ? 1 : 0), 0); } if (turnOn && invalidateAfterTurningOn) diff --git a/src/L10NSharp/WindowsForms/XLiffUtils/XliffLocalizationManagerWinforms.cs b/src/L10NSharpWinforms/XLiffUtils/XliffLocalizationManagerWinforms.cs similarity index 98% rename from src/L10NSharp/WindowsForms/XLiffUtils/XliffLocalizationManagerWinforms.cs rename to src/L10NSharpWinforms/XLiffUtils/XliffLocalizationManagerWinforms.cs index fcffa03..0eda55d 100644 --- a/src/L10NSharp/WindowsForms/XLiffUtils/XliffLocalizationManagerWinforms.cs +++ b/src/L10NSharpWinforms/XLiffUtils/XliffLocalizationManagerWinforms.cs @@ -1,20 +1,16 @@ using System; using System.Collections.Generic; using System.ComponentModel; -using System.Diagnostics; using System.Drawing; using System.IO; using System.Linq; using System.Reflection; -using System.Security; -using System.Security.Permissions; -using System.Text.RegularExpressions; using System.Windows.Forms; -using System.Xml.Linq; -using L10NSharp.WindowsForms.UI; +using L10NSharpWinforms.UI; using L10NSharp.XLiffUtils; +using L10NSharp; -namespace L10NSharp.WindowsForms.XLiffUtils +namespace L10NSharpWinforms.XLiffUtils { /// ---------------------------------------------------------------------------------------- internal class XliffLocalizationManagerWinforms : XliffLocalizationManager, ILocalizationManagerInternalWinforms @@ -54,7 +50,7 @@ private bool DefaultStringFileExistsAndHasContents() #region Public Properties /// ------------------------------------------------------------------------------------ - new public ILocalizedStringCacheWinforms StringCache { get; } + public new ILocalizedStringCacheWinforms StringCache { get; } #endregion diff --git a/src/L10NSharp/WindowsForms/XLiffUtils/XliffLocalizedStringCacheWinforms.cs b/src/L10NSharpWinforms/XLiffUtils/XliffLocalizedStringCacheWinforms.cs similarity index 95% rename from src/L10NSharp/WindowsForms/XLiffUtils/XliffLocalizedStringCacheWinforms.cs rename to src/L10NSharpWinforms/XLiffUtils/XliffLocalizedStringCacheWinforms.cs index 27a3cac..e0a766c 100644 --- a/src/L10NSharp/WindowsForms/XLiffUtils/XliffLocalizedStringCacheWinforms.cs +++ b/src/L10NSharpWinforms/XLiffUtils/XliffLocalizedStringCacheWinforms.cs @@ -1,17 +1,11 @@ -using System; using System.Collections.Concurrent; using System.Collections.Generic; -using System.Diagnostics; -using System.IO; -using System.Linq; -using System.Security; -using System.Text; -using System.Text.RegularExpressions; using System.Windows.Forms; -using L10NSharp.WindowsForms.UI; +using L10NSharpWinforms.UI; using L10NSharp.XLiffUtils; +using L10NSharp; -namespace L10NSharp.WindowsForms.XLiffUtils +namespace L10NSharpWinforms.XLiffUtils { /// ---------------------------------------------------------------------------------------- internal class XliffLocalizedStringCacheWinforms : XliffLocalizedStringCache, ILocalizedStringCacheWinforms diff --git a/src/L10NSharpTests/ILocalizableComponentTests.cs b/src/L10NSharpWinformsTests/ILocalizableComponentTests.cs similarity index 94% rename from src/L10NSharpTests/ILocalizableComponentTests.cs rename to src/L10NSharpWinformsTests/ILocalizableComponentTests.cs index 4580ffb..c4f8429 100644 --- a/src/L10NSharpTests/ILocalizableComponentTests.cs +++ b/src/L10NSharpWinformsTests/ILocalizableComponentTests.cs @@ -1,12 +1,13 @@ using System; using System.IO; using System.Reflection; -using L10NSharp.WindowsForms.UI; +using L10NSharp; using L10NSharp.XLiffUtils; +using L10NSharpWinforms; +using L10NSharpWinforms.UI; using NUnit.Framework; -//using L10NSharp.WindowsForms; -namespace L10NSharp.Tests +namespace L10NSharpWinformsTests { /// ---------------------------------------------------------------------------------------- /// @@ -17,7 +18,7 @@ namespace L10NSharp.Tests [TestFixture] public class ILocalizableComponentXLiffTests { - private ILocalizationManagerInternal m_manager; + private ILocalizationManagerInternalWinforms m_manager; private L10NSharpExtender m_extender; private string m_translationPath; @@ -32,7 +33,7 @@ protected void TestSetup(string installedTranslationDir) m_manager = LocalizationManager.Create("en", "Test", "Test", "1.0", Path.Combine(dir, installedTranslationDir), "", "", new string[] { }) - as ILocalizationManagerInternal; + as ILocalizationManagerInternalWinforms; m_translationPath = m_manager.GetPathForLanguage("en", true); m_extender = new L10NSharpExtender { LocalizationManagerId = "Test" }; } diff --git a/src/L10NSharpWinformsTests/L10NSharpWinformsTests.csproj b/src/L10NSharpWinformsTests/L10NSharpWinformsTests.csproj new file mode 100644 index 0000000..1a7cbde --- /dev/null +++ b/src/L10NSharpWinformsTests/L10NSharpWinformsTests.csproj @@ -0,0 +1,20 @@ + + + Unit tests for L10NSharpWinforms + L10NSharpWinformsTests + L10NSharpWinformsTests + false + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/L10NSharpTests/LanguageChoosingDialogViewModelTests.cs b/src/L10NSharpWinformsTests/LanguageChoosingDialogViewModelTests.cs similarity index 99% rename from src/L10NSharpTests/LanguageChoosingDialogViewModelTests.cs rename to src/L10NSharpWinformsTests/LanguageChoosingDialogViewModelTests.cs index 8ac98a6..2127865 100644 --- a/src/L10NSharpTests/LanguageChoosingDialogViewModelTests.cs +++ b/src/L10NSharpWinformsTests/LanguageChoosingDialogViewModelTests.cs @@ -2,11 +2,12 @@ using System.Collections.Generic; using System.Globalization; using System.Linq; +using L10NSharp; using L10NSharp.Translators; -using L10NSharp.WindowsForms.UI; +using L10NSharpWinforms.UI; using NUnit.Framework; -namespace L10NSharp.Tests +namespace L10NSharpWinformsTests { [TestFixture] class LanguageChoosingDialogViewModelTests diff --git a/src/L10NSharpTests/LocalizationExtenderTests.cs b/src/L10NSharpWinformsTests/LocalizationExtenderTests.cs similarity index 98% rename from src/L10NSharpTests/LocalizationExtenderTests.cs rename to src/L10NSharpWinformsTests/LocalizationExtenderTests.cs index 51a70f8..0b349cb 100644 --- a/src/L10NSharpTests/LocalizationExtenderTests.cs +++ b/src/L10NSharpWinformsTests/LocalizationExtenderTests.cs @@ -1,9 +1,10 @@ using System.Collections.Generic; using System.Windows.Forms; -using L10NSharp.WindowsForms.UI; +using L10NSharp; +using L10NSharpWinforms.UI; using NUnit.Framework; -namespace L10NSharp.Tests +namespace L10NSharpWinformsTests { [TestFixture] public class LocalizationExtenderTests diff --git a/src/L10NSharpTests/LocalizingInfoTests.cs b/src/L10NSharpWinformsTests/LocalizingInfoTests.cs similarity index 98% rename from src/L10NSharpTests/LocalizingInfoTests.cs rename to src/L10NSharpWinformsTests/LocalizingInfoTests.cs index fbf6050..6fd59e1 100644 --- a/src/L10NSharpTests/LocalizingInfoTests.cs +++ b/src/L10NSharpWinformsTests/LocalizingInfoTests.cs @@ -1,7 +1,8 @@ using System.Windows.Forms; using NUnit.Framework; +using L10NSharp; -namespace L10NSharp.Tests +namespace L10NSharpWinformsTests { [TestFixture] [Category("RequiresDisplay")] diff --git a/src/L10NSharpTests/MockLocalizableComponent.cs b/src/L10NSharpWinformsTests/MockLocalizableComponent.cs similarity index 89% rename from src/L10NSharpTests/MockLocalizableComponent.cs rename to src/L10NSharpWinformsTests/MockLocalizableComponent.cs index f655d55..594b4ef 100644 --- a/src/L10NSharpTests/MockLocalizableComponent.cs +++ b/src/L10NSharpWinformsTests/MockLocalizableComponent.cs @@ -2,10 +2,11 @@ using System.Collections.Generic; using System.ComponentModel; using System.Windows.Forms; -using L10NSharp.WindowsForms.UI; -using L10NSharp.WindowsForms; +using L10NSharp; +using L10NSharpWinforms; +using L10NSharpWinforms.UI; -namespace L10NSharp.Tests +namespace L10NSharpWinformsTests { class MockLocalizableComponent: ILocalizableComponent, IComponent { @@ -50,14 +51,14 @@ public string GetLocalizedStringFromMock(Control control, string subId) /// into the localization UI to be localized. /// /// A list of LocalizingInfo objects - public IEnumerable GetAllLocalizingInfoObjects(L10NSharpExtender extender) + public IEnumerable GetAllLocalizingInfoObjects(L10NSharpExtender extender) { - var result = new List(); + var result = new List(); foreach (var kvp in StringContainer) { var control = kvp.Key.Item1; var id = extender.GetLocalizingId(control) + kvp.Key.Item2; - result.Add(new LocalizingInfo(control, id) { Text = kvp.Value, Category = LocalizationCategory.LocalizableComponent}); + result.Add(new LocalizingInfoWinforms(control, id) { Text = kvp.Value, Category = LocalizationCategory.LocalizableComponent}); } return result; } diff --git a/src/L10NSharpWinformsTests/Properties/Resources.Designer.cs b/src/L10NSharpWinformsTests/Properties/Resources.Designer.cs new file mode 100644 index 0000000..621ba1c --- /dev/null +++ b/src/L10NSharpWinformsTests/Properties/Resources.Designer.cs @@ -0,0 +1,63 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace L10NSharpWinformsTests.Properties { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("L10NSharp.WindowsFormsTests.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + } +} diff --git a/src/L10NSharpWinformsTests/Properties/Resources.resx b/src/L10NSharpWinformsTests/Properties/Resources.resx new file mode 100644 index 0000000..4fdb1b6 --- /dev/null +++ b/src/L10NSharpWinformsTests/Properties/Resources.resx @@ -0,0 +1,101 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/src/L10NSharpTests/ReflectionHelper.cs b/src/L10NSharpWinformsTests/ReflectionHelper.cs similarity index 99% rename from src/L10NSharpTests/ReflectionHelper.cs rename to src/L10NSharpWinformsTests/ReflectionHelper.cs index f398a7a..2d53e22 100644 --- a/src/L10NSharpTests/ReflectionHelper.cs +++ b/src/L10NSharpWinformsTests/ReflectionHelper.cs @@ -3,7 +3,7 @@ using System.IO; using System.Reflection; -namespace L10NSharp.Tests +namespace L10NSharpWinformsTests { public static class ReflectionHelper { diff --git a/src/L10NSharpTests/UtilsTests.cs b/src/L10NSharpWinformsTests/UtilsTests.cs similarity index 95% rename from src/L10NSharpTests/UtilsTests.cs rename to src/L10NSharpWinformsTests/UtilsTests.cs index 761534a..5ed63e2 100644 --- a/src/L10NSharpTests/UtilsTests.cs +++ b/src/L10NSharpWinformsTests/UtilsTests.cs @@ -1,8 +1,9 @@ using System; using System.Windows.Forms; using NUnit.Framework; +using L10NSharp; -namespace L10NSharp.Tests +namespace L10NSharpWinformsTests { [TestFixture] public class UtilsTests From ba40d24b789e8d9f409fcad80a2a94bc68452477 Mon Sep 17 00:00:00 2001 From: Ariel Rorabaugh Date: Mon, 21 Jul 2025 11:33:36 -0400 Subject: [PATCH 04/25] Fix some winforms references --- src/L10NSharp/LocalizingInfo.cs | 12 ++-- .../ILocalizableComponent.cs | 4 +- .../ILocalizationManagerInternalWinforms.cs | 2 +- .../LocalizationManagerWinforms.cs | 57 +++++++++++++++++ .../LocalizingInfoWinforms.cs | 21 +++---- .../UI/InitializationProgressDlg.cs | 8 +-- src/L10NSharpWinforms/UI/L10NExtender.cs | 12 ++-- .../LanguageChoosingSimpleDialog.Designer.cs | 4 +- src/L10NSharpWinforms/UtilsWinforms.cs | 62 +++++++++++++++++++ .../XliffLocalizationManagerWinforms.cs | 13 ++-- .../ILocalizableComponentTests.cs | 6 +- .../LocalizationExtenderTests.cs | 21 ++++--- .../LocalizingInfoTests.cs | 15 ++--- .../MockLocalizableComponent.cs | 4 +- src/SampleApp/Form1.Designer.cs | 8 +-- 15 files changed, 186 insertions(+), 63 deletions(-) diff --git a/src/L10NSharp/LocalizingInfo.cs b/src/L10NSharp/LocalizingInfo.cs index ad81ea1..bfa1d58 100644 --- a/src/L10NSharp/LocalizingInfo.cs +++ b/src/L10NSharp/LocalizingInfo.cs @@ -101,12 +101,12 @@ internal enum UpdateFields /// ---------------------------------------------------------------------------------------- public class LocalizingInfo { - private IComponent _component; - private string _id; - private string _text; - private string _shortcutKeys; - private string _comment; - private LocalizationCategory _category = LocalizationCategory.Unspecified; + protected IComponent _component; + protected string _id; + protected string _text; + protected string _shortcutKeys; + protected string _comment; + protected LocalizationCategory _category = LocalizationCategory.Unspecified; #region Constructors /// ------------------------------------------------------------------------------------ diff --git a/src/L10NSharpWinforms/ILocalizableComponent.cs b/src/L10NSharpWinforms/ILocalizableComponent.cs index 36dc3b5..caa3fd4 100644 --- a/src/L10NSharpWinforms/ILocalizableComponent.cs +++ b/src/L10NSharpWinforms/ILocalizableComponent.cs @@ -14,14 +14,14 @@ public interface ILocalizableComponent /// Allows the container to give L10NSharp the information it needs to put strings /// into the localization UI to be localized. /// - /// A list of LocalizingInfo objects + /// A list of LocalizingInfoWinforms objects IEnumerable GetAllLocalizingInfoObjects(L10NSharpExtender extender); /// /// L10NSharp will call this for each localized string so that the component can set /// the correct value in the control. /// - /// The control that was returned via the LocalizingInfo in + /// The control that was returned via the LocalizingInfoWinforms in /// GetAllLocalizingInfoObjects(). Will be null if that value was null. /// a key into the ILocalizableComponent allowing it to know what /// string to localize diff --git a/src/L10NSharpWinforms/ILocalizationManagerInternalWinforms.cs b/src/L10NSharpWinforms/ILocalizationManagerInternalWinforms.cs index 8e373ef..b8b6d0f 100644 --- a/src/L10NSharpWinforms/ILocalizationManagerInternalWinforms.cs +++ b/src/L10NSharpWinforms/ILocalizationManagerInternalWinforms.cs @@ -13,7 +13,7 @@ namespace L10NSharpWinforms internal interface ILocalizationManagerInternalWinforms: ILocalizationManagerInternal { Dictionary ToolTipCtrls { get; } - Dictionary> LocalizableComponents { get; } + Dictionary> LocalizableComponents { get; } Icon ApplicationIcon { get; set; } void RegisterComponentForLocalizing(IComponent component, string id, string defaultText, diff --git a/src/L10NSharpWinforms/LocalizationManagerWinforms.cs b/src/L10NSharpWinforms/LocalizationManagerWinforms.cs index 207c87b..72bf4cc 100644 --- a/src/L10NSharpWinforms/LocalizationManagerWinforms.cs +++ b/src/L10NSharpWinforms/LocalizationManagerWinforms.cs @@ -5,11 +5,68 @@ using System.Windows.Forms; using L10NSharp.XLiffUtils; using L10NSharp; +using System.Reflection; +using System.Drawing; namespace L10NSharpWinforms { public static class LocalizationManagerWinforms { + /// ------------------------------------------------------------------------------------ + /// + /// Creates a new instance of a localization manager for the specified application id. + /// If a localization manager has already been created for the specified id, then + /// that is returned. + /// + /// The language code of the desired UI language. If + /// there are no translations for that ID, a message is displayed and the UI language + /// falls back to the default. + /// The application Id (e.g. 'Pa' for Phonology Assistant). + /// This should be a unique name that identifies the manager for an assembly or + /// application. May include an optional file extension, which will be stripped off but + /// used to correctly set the "original" attribute when persisting an XLIFF file. The + /// base portion must still be unique (i.e., it is not valid to create a LM for + /// "Blah.exe" and another for "Blah.dll"). + /// The application's name. This will appear to the user + /// in the localization dialog box as a parent item in the tree. + /// + /// The full folder path of the original l10n + /// files installed with the application. + /// The path, relative to + /// %localappdata%, where your application stores user settings (e.g., "SIL\SayMore"). + /// A folder named "localizations" will be created there. + /// + /// This will be used in UI that helps the translator + /// know what to do with their work + /// A list of namespace beginnings indicating + /// what types to scan for localized string calls. For example, to only scan + /// types found in Pa.exe and assuming all types in that assembly begin with + /// 'Pa', then this value would only contain the string 'Pa'. + /// MethodInfo objects representing + /// additional methods that should be regarded as calls to get localizations. If the method + /// is named "Localize", the extractor will attempt to parse its signature as an extension + /// method with the parameters (this string s, string separateId="", string comment=""). + /// Otherwise, it will be treated like a L10nSharp GetString method if its signature + /// matches one of the following: (string stringId, string englishText), + /// (string stringId, string englishText, string comment), or + /// (string stringId, string englishText, string comment, string englishToolTipText, + /// string englishShortcutKey, IComponent component). + /// ------------------------------------------------------------------------------------ + public static ILocalizationManager Create(string desiredUiLangId, + string appId, string appName, string appVersion, string directoryOfInstalledFiles, + string relativeSettingPathForLocalizationFolder, + Icon applicationIcon, string emailForSubmissions, + string[] namespaceBeginnings, + IEnumerable additionalLocalizationMethods = null) + { + LocalizationManager.TranslationMemoryKind = TranslationMemory.XLiff; + LocalizationManager.EmailForSubmissions = emailForSubmissions; + return LocalizationManagerInternalWinforms.CreateXliff(desiredUiLangId, + appId, appName, appVersion, directoryOfInstalledFiles, + relativeSettingPathForLocalizationFolder, applicationIcon, + additionalLocalizationMethods, + namespaceBeginnings); + } public static string GetLocalizedToolTipForControl(Control ctrl) { diff --git a/src/L10NSharpWinforms/LocalizingInfoWinforms.cs b/src/L10NSharpWinforms/LocalizingInfoWinforms.cs index 0053573..51aa43d 100644 --- a/src/L10NSharpWinforms/LocalizingInfoWinforms.cs +++ b/src/L10NSharpWinforms/LocalizingInfoWinforms.cs @@ -17,17 +17,16 @@ namespace L10NSharpWinforms /// ---------------------------------------------------------------------------------------- public class LocalizingInfoWinforms : LocalizingInfo { - private IComponent _component; - private string _id; - private string _text; - private string _shortcutKeys; - private string _comment; - private LocalizationCategory _category = LocalizationCategory.Unspecified; + //private string _id; + //private string _text; + //private string _shortcutKeys; + //private string _comment; + //private LocalizationCategory _category = LocalizationCategory.Unspecified; #region Constructors /// ------------------------------------------------------------------------------------ /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// ------------------------------------------------------------------------------------ public LocalizingInfoWinforms(IComponent component, bool initTextFromObj) : base(component, initTextFromObj) @@ -41,12 +40,12 @@ public void UpdateTextFromObject() { Text = LocalizationManager.StripOffLocalizationInfoFromText(_component is DataGridViewColumn ? ((DataGridViewColumn) _component).HeaderText - : Utils.GetProperty(_component, "Text") as string); + : UtilsWinforms.GetProperty(_component, "Text") as string); } /// ------------------------------------------------------------------------------------ /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// ------------------------------------------------------------------------------------ public LocalizingInfoWinforms(IComponent component, string id) : this(component, true) @@ -56,7 +55,7 @@ public LocalizingInfoWinforms(IComponent component, string id) : this(component, /// ------------------------------------------------------------------------------------ /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// ------------------------------------------------------------------------------------ public LocalizingInfoWinforms(string id) : base(id) @@ -329,7 +328,7 @@ public bool IsEmpty { if (_shortcutKeys == null && _component != null) { - object keysobj = Utils.GetProperty(_component, "ShortcutKeys"); + object keysobj = UtilsWinforms.GetProperty(_component, "ShortcutKeys"); if (keysobj != null && keysobj.GetType() == typeof(Keys)) { Keys keys = (Keys)keysobj; diff --git a/src/L10NSharpWinforms/UI/InitializationProgressDlg.cs b/src/L10NSharpWinforms/UI/InitializationProgressDlg.cs index fb5fb73..2805ab8 100644 --- a/src/L10NSharpWinforms/UI/InitializationProgressDlg.cs +++ b/src/L10NSharpWinforms/UI/InitializationProgressDlg.cs @@ -11,7 +11,7 @@ namespace L10NSharpWinforms.UI { internal class InitializationProgressDlg: InitializationProgressDlgBase { - public IEnumerable ExtractedInfo { get; private set; } + public IEnumerable ExtractedInfo { get; private set; } /// ------------------------------------------------------------------------------------ public InitializationProgressDlg(string appName, IEnumerable additionalLocalizationMethods, @@ -46,14 +46,14 @@ protected override void backgroundWorker_RunWorkerCompleted(object sender, RunWo { try { - if (e.Result is IEnumerable info) + if (e.Result is IEnumerable info) { ExtractedInfo = info; } else { var got = e.Result == null ? "null" : $"{e.Result.GetType()}: {e.Result}"; - ReportError($"Expected IEnumerable but got {got}"); + ReportError($"Expected IEnumerable but got {got}"); } } catch (Exception ex) @@ -74,7 +74,7 @@ private void ReportError(string message) // 2. It provides a way for the developer to see the actual error which caused extraction to fail. ExtractedInfo = new[] { - new LocalizingInfo("StringExtractor_Error") + new LocalizingInfoWinforms("StringExtractor_Error") { LangId = "en", Text = "An error occurred while collecting strings or there were no strings to collect. " + diff --git a/src/L10NSharpWinforms/UI/L10NExtender.cs b/src/L10NSharpWinforms/UI/L10NExtender.cs index f32c70d..af6c510 100644 --- a/src/L10NSharpWinforms/UI/L10NExtender.cs +++ b/src/L10NSharpWinforms/UI/L10NExtender.cs @@ -79,7 +79,7 @@ public string LocalizationManagerId get { return _locManagerId; } set { - if (LocalizationManager.LoadedManagers == null) + if (LocalizationManagerWinforms.LoadedManagers == null) { return; } @@ -421,13 +421,13 @@ private void AddMultipleStrings(ILocalizableComponent locComponent) if (m_extendedCtrls == null) // no can do! (can happen during view setup) return; var lios = locComponent.GetAllLocalizingInfoObjects(this); - var idToLocInfo = new Dictionary(); - foreach (var localizingInfo in lios) + var idToLocInfo = new Dictionary(); + foreach (var localizingInfoWinforms in lios) { - if (string.IsNullOrEmpty(localizingInfo.Id)) + if (string.IsNullOrEmpty(localizingInfoWinforms.Id)) continue; - _manager.AddString(localizingInfo.Id, localizingInfo.Text, null, null, null); - idToLocInfo.Add(localizingInfo.Id, localizingInfo); + _manager.AddString(localizingInfoWinforms.Id, localizingInfoWinforms.Text, null, null, null); + idToLocInfo.Add(localizingInfoWinforms.Id, localizingInfoWinforms); } _manager.LocalizableComponents.Add(locComponent, idToLocInfo); } diff --git a/src/L10NSharpWinforms/UI/LanguageChoosingSimpleDialog.Designer.cs b/src/L10NSharpWinforms/UI/LanguageChoosingSimpleDialog.Designer.cs index 092bdb1..d4c09ca 100644 --- a/src/L10NSharpWinforms/UI/LanguageChoosingSimpleDialog.Designer.cs +++ b/src/L10NSharpWinforms/UI/LanguageChoosingSimpleDialog.Designer.cs @@ -28,7 +28,7 @@ protected override void Dispose(bool disposing) /// private void InitializeComponent() { - this._uiLanguageListBox = new L10NSharp.WindowsForms.UI.UILanguageListBox(); + this._uiLanguageListBox = new L10NSharpWinforms.UI.UILanguageListBox(); this._btnOk = new System.Windows.Forms.Button(); this.SuspendLayout(); // @@ -77,7 +77,7 @@ private void InitializeComponent() #endregion - private L10NSharp.WindowsForms.UI.UILanguageListBox _uiLanguageListBox; + private L10NSharpWinforms.UI.UILanguageListBox _uiLanguageListBox; private System.Windows.Forms.Button _btnOk; } } diff --git a/src/L10NSharpWinforms/UtilsWinforms.cs b/src/L10NSharpWinforms/UtilsWinforms.cs index 123a7d1..1fd66a4 100644 --- a/src/L10NSharpWinforms/UtilsWinforms.cs +++ b/src/L10NSharpWinforms/UtilsWinforms.cs @@ -1,3 +1,5 @@ +using System.Reflection; +using System; using System.Windows.Forms; namespace L10NSharpWinforms @@ -39,5 +41,65 @@ public static void SetWindowRedraw(Control ctrl, bool turnOn, ctrl.Invalidate(true); } } + + /// ------------------------------------------------------------------------------------ + /// + /// Asks whether the specified property on the specified binding exists. + /// + /// ------------------------------------------------------------------------------------ + public static bool HasProperty(object binding, string propertyName) + { + const BindingFlags flags = + (BindingFlags.GetProperty | BindingFlags.NonPublic | BindingFlags.Public); + + // If binding is a Type then assume invoke on a static method, property or field. + // Otherwise invoke on an instance method, property or field. + if (binding is Type) + { + return ((binding as Type).GetMember(propertyName, + flags | BindingFlags.Static).Length > 0); + } + + return binding.GetType().GetMember(propertyName, + flags | BindingFlags.Instance).Length > 0; + } + + /// ------------------------------------------------------------------------------------ + /// + /// Gets the specified property on the specified binding. + /// Note: although this routine attempts to catch anything that might go wrong and + /// just return null, MissingMethodException cannot be caught. So if you are not sure + /// the method exists you should check first with HasProperty. + /// + /// ------------------------------------------------------------------------------------ + public static object GetProperty(object binding, string propertyName) + { + // It's not clear why this is needed. There is some indication (http://stackoverflow.com/questions/3546580/why-is-it-not-possible-to-catch-missingmethodexception) + // that MissingMethodException cannot be caught. In one situation in Bloom, with a ToolStripButton (which does not implement ShortcutKeys), + // it was indeed not caught, and Bloom failed to start. But a simple unit test trying to get the ShortcutKeys of a ToolStripButton returns null successfully even without + // this check. It seems safest to leave it in, since it currently seems to prevent that crash. + if (!HasProperty(binding, propertyName)) + return null; + const BindingFlags flags = + (BindingFlags.GetProperty | BindingFlags.NonPublic | BindingFlags.Public); + + try + { + // If binding is a Type then assume invoke on a static method, property or field. + // Otherwise invoke on an instance method, property or field. + if (binding is Type) + { + return ((binding as Type).InvokeMember(propertyName, + flags | BindingFlags.Static, null, binding, null)); + } + + return binding.GetType().InvokeMember(propertyName, + flags | BindingFlags.Instance, null, binding, null); + } + // Warning: this will (sometimes?) NOT catch the most likely exception, MissingMethodException, because it has been defined as unrecoverable. + catch { } + + return null; + } } } diff --git a/src/L10NSharpWinforms/XLiffUtils/XliffLocalizationManagerWinforms.cs b/src/L10NSharpWinforms/XLiffUtils/XliffLocalizationManagerWinforms.cs index 0eda55d..778fc39 100644 --- a/src/L10NSharpWinforms/XLiffUtils/XliffLocalizationManagerWinforms.cs +++ b/src/L10NSharpWinforms/XLiffUtils/XliffLocalizationManagerWinforms.cs @@ -18,7 +18,7 @@ internal class XliffLocalizationManagerWinforms : XliffLocalizationManager, ILoc /// ------------------------------------------------------------------------------------ private static Icon _applicationIcon; public Dictionary ToolTipCtrls { get; } - public Dictionary> LocalizableComponents { get; } + public Dictionary> LocalizableComponents { get; } #region XliffLocalizationManager construction/disposal /// ------------------------------------------------------------------------------------ @@ -26,12 +26,15 @@ internal XliffLocalizationManagerWinforms(string appId, string origExtension, st string appVersion, string directoryOfInstalledXliffFiles, string directoryForGeneratedDefaultXliffFile, string directoryOfUserModifiedXliffFiles, IEnumerable additionalLocalizationMethods, - params string[] namespaceBeginnings) : base(appId, appName ?? appId, appVersion) + params string[] namespaceBeginnings) : + base(appId, origExtension, appName, appVersion, directoryOfInstalledXliffFiles, + directoryForGeneratedDefaultXliffFile, directoryOfUserModifiedXliffFiles, + additionalLocalizationMethods, namespaceBeginnings)//base(appId, appName ?? appId, appVersion) { ToolTipCtrls = new Dictionary(); StringCache = new XliffLocalizedStringCacheWinforms(this); LocalizableComponents = new Dictionary>(); + Dictionary>(); } /// Sometimes, on Linux, there is an empty DefaultStringFile. This causes problems. @@ -226,7 +229,7 @@ private Keys GetShortCutKeyFromStringCache(string uiLangId, string id) #endregion #region Methods that apply localizations to an object. - public void ApplyLocalizationsToILocalizableComponent(LocalizingInfo locInfo) + public void ApplyLocalizationsToILocalizableComponent(LocalizingInfoWinforms locInfo) { if (locInfo.Component is ILocalizableComponent locComponent && LocalizableComponents.TryGetValue(locComponent, out var idToLocInfo)) @@ -320,7 +323,7 @@ public void ApplyLocalizationsToILocalizableComponent(LocalizingInfo locInfo) /// /// ------------------------------------------------------------------------------------ internal void ApplyLocalizationsToLocalizableComponent( - ILocalizableComponent locComponent, Dictionary idToLocInfo) + ILocalizableComponent locComponent, Dictionary idToLocInfo) { if (locComponent == null) return; diff --git a/src/L10NSharpWinformsTests/ILocalizableComponentTests.cs b/src/L10NSharpWinformsTests/ILocalizableComponentTests.cs index c4f8429..d4d000d 100644 --- a/src/L10NSharpWinformsTests/ILocalizableComponentTests.cs +++ b/src/L10NSharpWinformsTests/ILocalizableComponentTests.cs @@ -18,7 +18,7 @@ namespace L10NSharpWinformsTests [TestFixture] public class ILocalizableComponentXLiffTests { - private ILocalizationManagerInternalWinforms m_manager; + private ILocalizationManagerInternal m_manager; private L10NSharpExtender m_extender; private string m_translationPath; @@ -30,9 +30,9 @@ public class ILocalizableComponentXLiffTests protected void TestSetup(string installedTranslationDir) { var dir = Path.GetDirectoryName(new Uri(Assembly.GetExecutingAssembly().CodeBase).LocalPath); - m_manager = LocalizationManager.Create("en", "Test", "Test", "1.0", + m_manager = LocalizationManagerWinforms.Create("en", "Test", "Test", "1.0", Path.Combine(dir, installedTranslationDir), - "", "", new string[] { }) + "", null, "", new string[] { }) as ILocalizationManagerInternalWinforms; m_translationPath = m_manager.GetPathForLanguage("en", true); m_extender = new L10NSharpExtender { LocalizationManagerId = "Test" }; diff --git a/src/L10NSharpWinformsTests/LocalizationExtenderTests.cs b/src/L10NSharpWinformsTests/LocalizationExtenderTests.cs index 0b349cb..76476bc 100644 --- a/src/L10NSharpWinformsTests/LocalizationExtenderTests.cs +++ b/src/L10NSharpWinformsTests/LocalizationExtenderTests.cs @@ -3,6 +3,7 @@ using L10NSharp; using L10NSharpWinforms.UI; using NUnit.Framework; +using L10NSharpWinforms; namespace L10NSharpWinformsTests { @@ -10,7 +11,7 @@ namespace L10NSharpWinformsTests public class LocalizationExtenderTests { private L10NSharpExtender m_extender; - private Dictionary m_extCtrls; + private Dictionary m_extCtrls; /// ------------------------------------------------------------------------------------ /// @@ -22,7 +23,7 @@ public void TestSetup() { m_extender = new L10NSharpExtender(); m_extCtrls = ReflectionHelper.GetField(m_extender, "m_extendedCtrls") as - Dictionary; + Dictionary; } /// ------------------------------------------------------------------------------------ @@ -73,28 +74,28 @@ public void GetLocalizedObjectInfoTest() var lbl1 = new Label(); lbl1.Text = "bananas"; - // Make sure calling GetLocalizedObjectInfo creates a LocalizingInfo object when + // Make sure calling GetLocalizedObjectInfo creates a LocalizingInfoWinforms object when // one doesn't exist for the label. - var loi = ReflectionHelper.GetResult(m_extender, "GetLocalizedComponentInfo", new object[] {lbl1, true}) as LocalizingInfo; + var loi = ReflectionHelper.GetResult(m_extender, "GetLocalizedComponentInfo", new object[] {lbl1, true}) as LocalizingInfoWinforms; Assert.AreEqual(1, m_extCtrls.Count); Assert.AreEqual("bananas", loi.Text); - // Make sure calling GetLocalizedObjectInfo does not create a LocalizingInfo object when + // Make sure calling GetLocalizedObjectInfo does not create a LocalizingInfoWinforms object when // one already exists for the label. - loi = ReflectionHelper.GetResult(m_extender, "GetLocalizedComponentInfo", new object[] { lbl1, true }) as LocalizingInfo; + loi = ReflectionHelper.GetResult(m_extender, "GetLocalizedComponentInfo", new object[] { lbl1, true }) as LocalizingInfoWinforms; Assert.AreEqual(1, m_extCtrls.Count); Assert.AreEqual("bananas", loi.Text); - // Create a new LocalizingInfo object for a different label, then poke it into the + // Create a new LocalizingInfoWinforms object for a different label, then poke it into the // extender's internal collection and make sure calling GetLocalizedObjectInfo returns - // that LocalizingInfo for the object. + // that LocalizingInfoWinforms for the object. var lbl2 = new Label(); lbl2.Text = "apples"; - loi = new LocalizingInfo(lbl2, true); + loi = new LocalizingInfoWinforms(lbl2, true); m_extCtrls[lbl2] = loi; Assert.AreEqual(2, m_extCtrls.Count); - loi = ReflectionHelper.GetResult(m_extender, "GetLocalizedComponentInfo", new object[] { lbl2, true }) as LocalizingInfo; + loi = ReflectionHelper.GetResult(m_extender, "GetLocalizedComponentInfo", new object[] { lbl2, true }) as LocalizingInfoWinforms; Assert.AreEqual(2, m_extCtrls.Count); Assert.AreEqual("apples", loi.Text); } diff --git a/src/L10NSharpWinformsTests/LocalizingInfoTests.cs b/src/L10NSharpWinformsTests/LocalizingInfoTests.cs index 6fd59e1..182db87 100644 --- a/src/L10NSharpWinformsTests/LocalizingInfoTests.cs +++ b/src/L10NSharpWinformsTests/LocalizingInfoTests.cs @@ -1,6 +1,7 @@ using System.Windows.Forms; using NUnit.Framework; using L10NSharp; +using L10NSharpWinforms; namespace L10NSharpWinformsTests { @@ -17,7 +18,7 @@ public class LocalizingInfoTests public void MakeIdTest_ForForm() { Form frm = new Form { Name = "hamster" }; - var loi = new LocalizingInfo(frm, true); + var loi = new LocalizingInfoWinforms(frm, true); Assert.AreEqual("hamster.WindowTitle", loi.Id); } @@ -34,7 +35,7 @@ public void MakeIdTest_ForControl() var btn = new Button { Name = "fox" }; frm.Controls.Add(btn); - var loi = new LocalizingInfo(btn, true); + var loi = new LocalizingInfoWinforms(btn, true); Assert.AreEqual("racoon.fox", loi.Id); var lbl = new Label { Name = "opossum" }; @@ -43,7 +44,7 @@ public void MakeIdTest_ForControl() pnl1.Controls.Add(pnl2); pnl2.Controls.Add(lbl); frm.Controls.Add(pnl1); - loi = new LocalizingInfo(lbl, true); + loi = new LocalizingInfoWinforms(lbl, true); Assert.AreEqual("racoon.opossum", loi.Id); } @@ -61,12 +62,12 @@ public void MakeIdTest_ForColumnHeader() var hdr = new ColumnHeader { Name = "monkey" }; lv.Columns.Add(hdr); - var loi = new LocalizingInfo(hdr, true); + var loi = new LocalizingInfoWinforms(hdr, true); Assert.AreEqual("fish.Colmonkey", loi.Id); var frm = new Form { Name = "wolf" }; frm.Controls.Add(lv); - loi = new LocalizingInfo(hdr, true); + loi = new LocalizingInfoWinforms(hdr, true); Assert.AreEqual("wolf.fishColmonkey", loi.Id); } @@ -84,13 +85,13 @@ public void MakeIdTest_ForDataGridViewColumn() var col = new DataGridViewTextBoxColumn { Name = "cheetah" }; grid.Columns.Add(col); - var loi = new LocalizingInfo(col, true); + var loi = new LocalizingInfoWinforms(col, true); Assert.AreEqual("hippo.Colcheetah", loi.Id); var frm = new Form { Name = "jackal" }; frm.Controls.Add(grid); - loi = new LocalizingInfo(col, true); + loi = new LocalizingInfoWinforms(col, true); Assert.AreEqual("jackal.hippoColcheetah", loi.Id); } } diff --git a/src/L10NSharpWinformsTests/MockLocalizableComponent.cs b/src/L10NSharpWinformsTests/MockLocalizableComponent.cs index 594b4ef..a1136f4 100644 --- a/src/L10NSharpWinformsTests/MockLocalizableComponent.cs +++ b/src/L10NSharpWinformsTests/MockLocalizableComponent.cs @@ -50,7 +50,7 @@ public string GetLocalizedStringFromMock(Control control, string subId) /// Allows the MockLocalizableComponent to give L10NSharp the information it needs to put strings /// into the localization UI to be localized. /// - /// A list of LocalizingInfo objects + /// A list of LocalizingInfoWinforms objects public IEnumerable GetAllLocalizingInfoObjects(L10NSharpExtender extender) { var result = new List(); @@ -67,7 +67,7 @@ public IEnumerable GetAllLocalizingInfoObjects(L10NSharp /// L10NSharp will call this for each localized string so that the component can set /// the correct value in the control. /// - /// The control that was returned via the LocalizingInfo in + /// The control that was returned via the LocalizingInfoWinforms in /// GetAllLocalizingInfoObjects(). Will be null if that value was null. /// a key into the ILocalizableComponent allowing it to know what /// string to localize diff --git a/src/SampleApp/Form1.Designer.cs b/src/SampleApp/Form1.Designer.cs index 36f6db2..2a7a853 100644 --- a/src/SampleApp/Form1.Designer.cs +++ b/src/SampleApp/Form1.Designer.cs @@ -32,11 +32,11 @@ protected override void Dispose(bool disposing) private void InitializeComponent() { this.components = new System.ComponentModel.Container(); - this.localizationExtender1 = new L10NSharp.WindowsForms.UI.L10NSharpExtender(this.components); + this.localizationExtender1 = new L10NSharpWinforms.UI.L10NSharpExtender(this.components); this._getDynamicStringButton = new System.Windows.Forms.Button(); this.label1 = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label(); - this.uiLanguageComboBox1 = new L10NSharp.WindowsForms.UI.UILanguageComboBox(); + this.uiLanguageComboBox1 = new L10NSharpWinforms.UI.UILanguageComboBox(); this.columnHeader1 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.columnHeader2 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.dataGridView1 = new System.Windows.Forms.DataGridView(); @@ -191,11 +191,11 @@ private void InitializeComponent() #endregion - private L10NSharp.WindowsForms.UI.L10NSharpExtender localizationExtender1; + private L10NSharpWinforms.UI.L10NSharpExtender localizationExtender1; private System.Windows.Forms.Button _getDynamicStringButton; private System.Windows.Forms.Label label1; private System.Windows.Forms.Label label2; - private L10NSharp.WindowsForms.UI.UILanguageComboBox uiLanguageComboBox1; + private L10NSharpWinforms.UI.UILanguageComboBox uiLanguageComboBox1; private System.Windows.Forms.ListView listView1; private System.Windows.Forms.ColumnHeader columnHeader1; private System.Windows.Forms.ColumnHeader columnHeader2; From c1d263c6bde857ac68036ce84e6b309387c56466 Mon Sep 17 00:00:00 2001 From: Ariel Rorabaugh Date: Tue, 22 Jul 2025 18:20:59 -0400 Subject: [PATCH 05/25] Fix static classes so managers can be inherited in winforms code --- src/L10NSharp/LocalizationManager.cs | 2 +- src/L10NSharp/LocalizationManagerInternal.cs | 12 ++-- .../XLiffUtils/XliffLocalizationManager.cs | 2 - .../LocalizationManagerInternalWinforms.cs | 23 +++---- .../LocalizationManagerWinforms.cs | 23 +------ .../LocalizingInfoWinforms.cs | 9 ++- .../UI/LocalizeItemDlgViewModel.cs | 4 +- src/L10NSharpWinforms/UtilsWinforms.cs | 60 ------------------- .../XliffLocalizationManagerWinforms.cs | 8 +-- .../XliffLocalizedStringCacheWinforms.cs | 7 +-- 10 files changed, 29 insertions(+), 121 deletions(-) diff --git a/src/L10NSharp/LocalizationManager.cs b/src/L10NSharp/LocalizationManager.cs index 621e143..0b5fe48 100644 --- a/src/L10NSharp/LocalizationManager.cs +++ b/src/L10NSharp/LocalizationManager.cs @@ -13,7 +13,7 @@ namespace L10NSharp { - public static class LocalizationManager + public class LocalizationManager { public const string kDefaultLang = "en"; internal const string kL10NPrefix = "_L10N_:"; diff --git a/src/L10NSharp/LocalizationManagerInternal.cs b/src/L10NSharp/LocalizationManagerInternal.cs index 1cc3bba..dbedf92 100644 --- a/src/L10NSharp/LocalizationManagerInternal.cs +++ b/src/L10NSharp/LocalizationManagerInternal.cs @@ -14,9 +14,9 @@ namespace L10NSharp { - internal static class LocalizationManagerInternal + internal class LocalizationManagerInternal { - private static List s_fallbackLanguageIds = + protected static List s_fallbackLanguageIds = new List(new[] { LocalizationManager.kDefaultLang }); /// @@ -47,11 +47,11 @@ internal static string ChooseFallbackLanguage() return LocalizationManager.kDefaultLang; } - private static readonly Dictionary> s_loadedManagers = + protected static readonly Dictionary> s_loadedManagers = new Dictionary>(); #region Static methods for creating a LocalizationManagerInternal - private static ILocalizationManager Create(string desiredUiLangId, string appId, + protected static ILocalizationManager Create(string desiredUiLangId, string appId, string appName, string relativeSettingPathForLocalizationFolder, Func> createMethod) { @@ -170,7 +170,7 @@ public static ILocalizationManager CreateXliff(string desiredUiLangId, string ap /// ------------------------------------------------------------------------------------ internal static Dictionary> LoadedManagers => s_loadedManagers; - private static HashSet PreviouslyLoadedManagers = new HashSet(); + protected static HashSet PreviouslyLoadedManagers = new HashSet(); internal static void RemoveManager(string id) { @@ -690,7 +690,7 @@ internal static string GetStringFromAnyLocalizationManager(string stringId, return null; } - private static string MapToExistingLanguageOrAddMapping(string stringId, string langId, + protected static string MapToExistingLanguageOrAddMapping(string stringId, string langId, out string languageIdUsed) { var realLangId = MapToExistingLanguageIfPossible(langId); diff --git a/src/L10NSharp/XLiffUtils/XliffLocalizationManager.cs b/src/L10NSharp/XLiffUtils/XliffLocalizationManager.cs index f645cd0..505c00a 100644 --- a/src/L10NSharp/XLiffUtils/XliffLocalizationManager.cs +++ b/src/L10NSharp/XLiffUtils/XliffLocalizationManager.cs @@ -24,8 +24,6 @@ internal class XliffLocalizationManager : ILocalizationManagerInternal ComponentCache { get; } - //public Dictionary ToolTipCtrls { get; } - //public Dictionary> LocalizableComponents { get; } #region Static methods /// ------------------------------------------------------------------------------------ diff --git a/src/L10NSharpWinforms/LocalizationManagerInternalWinforms.cs b/src/L10NSharpWinforms/LocalizationManagerInternalWinforms.cs index de87ca7..4e23081 100644 --- a/src/L10NSharpWinforms/LocalizationManagerInternalWinforms.cs +++ b/src/L10NSharpWinforms/LocalizationManagerInternalWinforms.cs @@ -17,14 +17,9 @@ namespace L10NSharpWinforms { - internal static class LocalizationManagerInternalWinforms + internal class LocalizationManagerInternalWinforms : LocalizationManagerInternal { - private static readonly Dictionary> s_loadedManagers = - new Dictionary>(); - internal static Dictionary> LoadedManagers => s_loadedManagers; - - private static HashSet PreviouslyLoadedManagers = new HashSet(); - internal static void RemoveManager(string id) + internal new static void RemoveManager(string id) { if (LoadedManagers.ContainsKey(id)) { @@ -54,7 +49,7 @@ private static ILocalizationManager Create(string desiredUiLangId, string appId, PreviouslyLoadedManagers.Remove(appId); } - lm.ApplicationIcon = applicationIcon; + ((ILocalizationManagerInternalWinforms)lm).ApplicationIcon = applicationIcon; if (string.IsNullOrEmpty(desiredUiLangId)) { @@ -135,16 +130,16 @@ public static ILocalizationManager CreateXliff(string desiredUiLangId, string ap } /// ------------------------------------------------------------------------------------ - internal static ILocalizationManagerInternalWinforms GetLocalizationManagerForComponent( + internal new static ILocalizationManagerInternalWinforms GetLocalizationManagerForComponent( IComponent component) { - return LoadedManagers.Values.FirstOrDefault(lm => lm.ComponentCache.ContainsKey(component)); + return (ILocalizationManagerInternalWinforms)LoadedManagers.Values.FirstOrDefault(lm => lm.ComponentCache.ContainsKey(component)); } /// ------------------------------------------------------------------------------------ - internal static ILocalizationManagerInternalWinforms GetLocalizationManagerForString(string id) + internal new static ILocalizationManagerInternalWinforms GetLocalizationManagerForString(string id) { - return LoadedManagers.Values.FirstOrDefault( + return (ILocalizationManagerInternalWinforms)LoadedManagers.Values.FirstOrDefault( lm => lm.StringCache.GetString(LocalizationManager.UILanguageId, id) != null); } @@ -176,7 +171,7 @@ internal static Control GetRealTopLevelControl(Control ctrl) return parentControl; } - /// + /*/// /// Merge the existing English translation file into newly collected data and write the result to the temp /// directory. /// @@ -212,7 +207,7 @@ public static string GetString(string stringId, string englishText, string comme return LocalizationManagerInternal.GetStringFromAnyLocalizationManager(stringId) ?? LocalizationManager.StripOffLocalizationInfoFromText(englishText); - } + }*/ } } diff --git a/src/L10NSharpWinforms/LocalizationManagerWinforms.cs b/src/L10NSharpWinforms/LocalizationManagerWinforms.cs index 72bf4cc..02566fe 100644 --- a/src/L10NSharpWinforms/LocalizationManagerWinforms.cs +++ b/src/L10NSharpWinforms/LocalizationManagerWinforms.cs @@ -10,7 +10,7 @@ namespace L10NSharpWinforms { - public static class LocalizationManagerWinforms + public class LocalizationManagerWinforms : LocalizationManager { /// ------------------------------------------------------------------------------------ /// @@ -79,7 +79,7 @@ public static string GetLocalizedToolTipForControl(Control ctrl) } /// ------------------------------------------------------------------------------------ - internal static Dictionary LoadedManagers + internal new static Dictionary LoadedManagers { get { @@ -91,7 +91,7 @@ internal static Dictionary LoadedM var loadedManagers = new Dictionary(); foreach (var keyValuePair in LocalizationManagerInternalWinforms.LoadedManagers) { - loadedManagers.Add(keyValuePair.Key, keyValuePair.Value); + loadedManagers.Add(keyValuePair.Key, (ILocalizationManagerInternalWinforms)keyValuePair.Value); } return loadedManagers; @@ -100,22 +100,5 @@ internal static Dictionary LoadedM } } - /// - /// True (default) to throw if we try to get a string from a particular manager - /// and it has been disposed. When false, we will instead just return the English string, - /// or if none, the ID. This is useful in some apps (e.g., Bloom) which may - /// accidentally request a localized string during shutdown after disposing of - /// the localization managers. - /// - public static bool ThrowIfManagerDisposed = true; - - /// - /// True (default) to throw if we try to get a localized string before creating any localization managers. - /// This is to prevent an invalid state where language IDs get mapped incorrectly at the beginning and - /// then never get updated which can cause us to fail to return properly localized strings when requested (see BL-13245). - /// The fix is to ensure that a LocalizationManager is created before calling any localization methods. - /// Or, to maintain prior behavior, set this to false. - /// - public static bool StrictInitializationMode = true; } } diff --git a/src/L10NSharpWinforms/LocalizingInfoWinforms.cs b/src/L10NSharpWinforms/LocalizingInfoWinforms.cs index 51aa43d..6ece2b4 100644 --- a/src/L10NSharpWinforms/LocalizingInfoWinforms.cs +++ b/src/L10NSharpWinforms/LocalizingInfoWinforms.cs @@ -40,7 +40,7 @@ public void UpdateTextFromObject() { Text = LocalizationManager.StripOffLocalizationInfoFromText(_component is DataGridViewColumn ? ((DataGridViewColumn) _component).HeaderText - : UtilsWinforms.GetProperty(_component, "Text") as string); + : Utils.GetProperty(_component, "Text") as string); } /// ------------------------------------------------------------------------------------ @@ -48,9 +48,8 @@ public void UpdateTextFromObject() /// Initializes a new instance of the class. /// /// ------------------------------------------------------------------------------------ - public LocalizingInfoWinforms(IComponent component, string id) : this(component, true) + public LocalizingInfoWinforms(IComponent component, string id) : base(component, id) { - Id = id; } /// ------------------------------------------------------------------------------------ @@ -261,7 +260,7 @@ private static LocalizationCategory GetCategory(IComponent component) #region Properties /// ------------------------------------------------------------------------------------ - public bool IsEmpty + public new bool IsEmpty { get { @@ -328,7 +327,7 @@ public bool IsEmpty { if (_shortcutKeys == null && _component != null) { - object keysobj = UtilsWinforms.GetProperty(_component, "ShortcutKeys"); + object keysobj = Utils.GetProperty(_component, "ShortcutKeys"); if (keysobj != null && keysobj.GetType() == typeof(Keys)) { Keys keys = (Keys)keysobj; diff --git a/src/L10NSharpWinforms/UI/LocalizeItemDlgViewModel.cs b/src/L10NSharpWinforms/UI/LocalizeItemDlgViewModel.cs index 459a92d..d43b872 100644 --- a/src/L10NSharpWinforms/UI/LocalizeItemDlgViewModel.cs +++ b/src/L10NSharpWinforms/UI/LocalizeItemDlgViewModel.cs @@ -170,8 +170,8 @@ public void LoadTreeNodes(TreeView treeVw) { AllLeafNodes = new List>(); - EnabledManagers = LocalizationManagerInternalWinforms.LoadedManagers.Values - .OrderBy(lm => lm.Name).ToList(); + EnabledManagers = LocalizationManagerInternal.LoadedManagers.Values + .OrderBy(lm => lm.Name).Cast>().ToList(); foreach (var lm in EnabledManagers) { diff --git a/src/L10NSharpWinforms/UtilsWinforms.cs b/src/L10NSharpWinforms/UtilsWinforms.cs index 1fd66a4..06423c4 100644 --- a/src/L10NSharpWinforms/UtilsWinforms.cs +++ b/src/L10NSharpWinforms/UtilsWinforms.cs @@ -41,65 +41,5 @@ public static void SetWindowRedraw(Control ctrl, bool turnOn, ctrl.Invalidate(true); } } - - /// ------------------------------------------------------------------------------------ - /// - /// Asks whether the specified property on the specified binding exists. - /// - /// ------------------------------------------------------------------------------------ - public static bool HasProperty(object binding, string propertyName) - { - const BindingFlags flags = - (BindingFlags.GetProperty | BindingFlags.NonPublic | BindingFlags.Public); - - // If binding is a Type then assume invoke on a static method, property or field. - // Otherwise invoke on an instance method, property or field. - if (binding is Type) - { - return ((binding as Type).GetMember(propertyName, - flags | BindingFlags.Static).Length > 0); - } - - return binding.GetType().GetMember(propertyName, - flags | BindingFlags.Instance).Length > 0; - } - - /// ------------------------------------------------------------------------------------ - /// - /// Gets the specified property on the specified binding. - /// Note: although this routine attempts to catch anything that might go wrong and - /// just return null, MissingMethodException cannot be caught. So if you are not sure - /// the method exists you should check first with HasProperty. - /// - /// ------------------------------------------------------------------------------------ - public static object GetProperty(object binding, string propertyName) - { - // It's not clear why this is needed. There is some indication (http://stackoverflow.com/questions/3546580/why-is-it-not-possible-to-catch-missingmethodexception) - // that MissingMethodException cannot be caught. In one situation in Bloom, with a ToolStripButton (which does not implement ShortcutKeys), - // it was indeed not caught, and Bloom failed to start. But a simple unit test trying to get the ShortcutKeys of a ToolStripButton returns null successfully even without - // this check. It seems safest to leave it in, since it currently seems to prevent that crash. - if (!HasProperty(binding, propertyName)) - return null; - const BindingFlags flags = - (BindingFlags.GetProperty | BindingFlags.NonPublic | BindingFlags.Public); - - try - { - // If binding is a Type then assume invoke on a static method, property or field. - // Otherwise invoke on an instance method, property or field. - if (binding is Type) - { - return ((binding as Type).InvokeMember(propertyName, - flags | BindingFlags.Static, null, binding, null)); - } - - return binding.GetType().InvokeMember(propertyName, - flags | BindingFlags.Instance, null, binding, null); - } - // Warning: this will (sometimes?) NOT catch the most likely exception, MissingMethodException, because it has been defined as unrecoverable. - catch { } - - return null; - } } } diff --git a/src/L10NSharpWinforms/XLiffUtils/XliffLocalizationManagerWinforms.cs b/src/L10NSharpWinforms/XLiffUtils/XliffLocalizationManagerWinforms.cs index 778fc39..17dc0b8 100644 --- a/src/L10NSharpWinforms/XLiffUtils/XliffLocalizationManagerWinforms.cs +++ b/src/L10NSharpWinforms/XLiffUtils/XliffLocalizationManagerWinforms.cs @@ -29,7 +29,7 @@ internal XliffLocalizationManagerWinforms(string appId, string origExtension, st params string[] namespaceBeginnings) : base(appId, origExtension, appName, appVersion, directoryOfInstalledXliffFiles, directoryForGeneratedDefaultXliffFile, directoryOfUserModifiedXliffFiles, - additionalLocalizationMethods, namespaceBeginnings)//base(appId, appName ?? appId, appVersion) + additionalLocalizationMethods, namespaceBeginnings) { ToolTipCtrls = new Dictionary(); StringCache = new XliffLocalizedStringCacheWinforms(this); @@ -43,12 +43,6 @@ private bool DefaultStringFileExistsAndHasContents() return File.Exists(DefaultStringFilePath) && !string.IsNullOrWhiteSpace(File.ReadAllText(DefaultStringFilePath)); } - /// ------------------------------------------------------------------------------------ - /*public void Dispose() - { - LocalizationManagerInternal.RemoveManager(Id); - }*/ - #endregion #region Public Properties diff --git a/src/L10NSharpWinforms/XLiffUtils/XliffLocalizedStringCacheWinforms.cs b/src/L10NSharpWinforms/XLiffUtils/XliffLocalizedStringCacheWinforms.cs index e0a766c..9edef6f 100644 --- a/src/L10NSharpWinforms/XLiffUtils/XliffLocalizedStringCacheWinforms.cs +++ b/src/L10NSharpWinforms/XLiffUtils/XliffLocalizedStringCacheWinforms.cs @@ -10,10 +10,9 @@ namespace L10NSharpWinforms.XLiffUtils /// ---------------------------------------------------------------------------------------- internal class XliffLocalizedStringCacheWinforms : XliffLocalizedStringCache, ILocalizedStringCacheWinforms { - private readonly XliffTransUnitUpdater _tuUpdater; public List> LeafNodeList { get; private set; } - internal XliffLocalizationManagerWinforms OwningManager { get; private set; } + //internal XliffLocalizationManagerWinforms OwningManager { get; private set; } private XLiffDocument DefaultXliffDocument { get; set; } // matches LanguageManager.kDefaultLanguage /// @@ -92,7 +91,7 @@ public void LoadGroupNodes(TreeNodeCollection topCollection) nodeCollection = nodes[0].Nodes; else { - newNode = new LocTreeNode(OwningManager, groupChain[i], null, + newNode = new LocTreeNode((XliffLocalizationManagerWinforms)OwningManager, groupChain[i], null, nodeKey); nodeCollection.Add(newNode); nodeCollection = newNode.Nodes; @@ -100,7 +99,7 @@ public void LoadGroupNodes(TreeNodeCollection topCollection) } nodeKey = nodeKey + ("." + groupChain[0]).TrimStart('.'); - newNode = new LocTreeNode(OwningManager, groupChain[0], id, nodeKey); + newNode = new LocTreeNode((XliffLocalizationManagerWinforms)OwningManager, groupChain[0], id, nodeKey); nodeCollection.Add(newNode); LeafNodeList.Add(newNode); } From 96d547b91212038d6e8853e9a661b8457e3dd6f1 Mon Sep 17 00:00:00 2001 From: Ariel Rorabaugh Date: Tue, 22 Jul 2025 18:29:20 -0400 Subject: [PATCH 06/25] Cleanup commented code --- src/L10NSharp/LocalizationManagerInternal.cs | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/src/L10NSharp/LocalizationManagerInternal.cs b/src/L10NSharp/LocalizationManagerInternal.cs index dbedf92..904f10e 100644 --- a/src/L10NSharp/LocalizationManagerInternal.cs +++ b/src/L10NSharp/LocalizationManagerInternal.cs @@ -71,8 +71,6 @@ protected static ILocalizationManager Create(string desiredUiLangId, string appI PreviouslyLoadedManagers.Remove(appId); } - //lm.ApplicationIcon = applicationIcon; - if (string.IsNullOrEmpty(desiredUiLangId)) { desiredUiLangId = CultureInfo.CurrentUICulture.TwoLetterISOLanguageName; @@ -744,20 +742,6 @@ public static string GetString(string stringId, string englishText, string comme public static string GetString(string stringId, string englishText, string comment, string englishToolTipText, string englishShortcutKey, IComponent component) { - /*if (component != null) - { - var lm = GetLocalizationManagerForComponent(component) ?? - GetLocalizationManagerForString(stringId); - - if (lm != null) - { - lm.RegisterComponentForLocalizing(component, stringId, englishText, - englishToolTipText, englishShortcutKey, comment); - - return lm.GetLocalizedString(stringId, englishText); - } - }*/ - return GetStringFromAnyLocalizationManager(stringId) ?? LocalizationManager.StripOffLocalizationInfoFromText(englishText); } From 4aa2bd0a3022993996494963ff2e25b810b7bebf Mon Sep 17 00:00:00 2001 From: Ariel Rorabaugh Date: Tue, 22 Jul 2025 18:37:07 -0400 Subject: [PATCH 07/25] Update SampleApp csproj --- src/SampleApp/SampleApp.csproj | 1 + 1 file changed, 1 insertion(+) diff --git a/src/SampleApp/SampleApp.csproj b/src/SampleApp/SampleApp.csproj index 23b2ab8..7eb5fa5 100644 --- a/src/SampleApp/SampleApp.csproj +++ b/src/SampleApp/SampleApp.csproj @@ -11,6 +11,7 @@ + From 5cb261db4db30dd20f49591b3effcc633644b1fc Mon Sep 17 00:00:00 2001 From: Ariel Rorabaugh Date: Thu, 31 Jul 2025 10:00:33 -0400 Subject: [PATCH 08/25] Cleanup & add ChooseFallbackLanguage in Winforms --- src/L10NSharp/L10NSharp.csproj | 2 +- src/L10NSharp/LocalizationManagerInternal.cs | 27 ---------- .../LocalizationManagerInternalWinforms.cs | 54 +++++-------------- .../LocalizationManagerWinforms.cs | 20 ++++++- src/L10NSharpWinforms/UI/L10NExtender.cs | 2 +- 5 files changed, 35 insertions(+), 70 deletions(-) diff --git a/src/L10NSharp/L10NSharp.csproj b/src/L10NSharp/L10NSharp.csproj index 93fd6a0..84ac35f 100644 --- a/src/L10NSharp/L10NSharp.csproj +++ b/src/L10NSharp/L10NSharp.csproj @@ -1,7 +1,7 @@ L10NSharp - L10NSharp is a .NET localization library for Windows Forms applications. It collects strings which need localization when your application first runs and saves them in a XLIFF file. It can also dynamically collect strings at runtime. + L10NSharp is a .NET localization library. It collects strings which need localization when your application first runs and saves them in a XLIFF file. L10NSharp L10NSharp https://github.com/sillsdev/l10nsharp diff --git a/src/L10NSharp/LocalizationManagerInternal.cs b/src/L10NSharp/LocalizationManagerInternal.cs index 904f10e..074291e 100644 --- a/src/L10NSharp/LocalizationManagerInternal.cs +++ b/src/L10NSharp/LocalizationManagerInternal.cs @@ -776,33 +776,6 @@ public static string GetString(string stringId, string englishText, string comme return stringFromAnyLocalizationManager; } - /*/// ------------------------------------------------------------------------------------ - public static string GetLocalizedToolTipForControl(Control ctrl) - { - var lm = GetLocalizationManagerForComponent(ctrl); - var topCtrl = GetRealTopLevelControl(ctrl); - if (topCtrl == null || lm == null) - return null; - - return lm.ToolTipCtrls.TryGetValue(topCtrl, out var ttctrl) ? ttctrl.GetToolTip(ctrl) - : null; - } - - /// ------------------------------------------------------------------------------------ - /// - /// Gets the real top level control (using the control's TopLevelControl property - /// seems to return null until the control is on a form). - /// - /// ------------------------------------------------------------------------------------ - internal static Control GetRealTopLevelControl(Control ctrl) - { - var parentControl = ctrl; - while (parentControl.Parent != null) - parentControl = parentControl.Parent; - - return parentControl; - }*/ - /// /// Merge the existing English translation file into newly collected data and write the result to the temp /// directory. diff --git a/src/L10NSharpWinforms/LocalizationManagerInternalWinforms.cs b/src/L10NSharpWinforms/LocalizationManagerInternalWinforms.cs index 4e23081..03fc7b7 100644 --- a/src/L10NSharpWinforms/LocalizationManagerInternalWinforms.cs +++ b/src/L10NSharpWinforms/LocalizationManagerInternalWinforms.cs @@ -13,12 +13,25 @@ using System.Windows.Forms; using L10NSharp; using L10NSharpWinforms.XLiffUtils; +using L10NSharpWinforms.UI; // ReSharper disable StaticMemberInGenericType - these static fields are parameter-independent namespace L10NSharpWinforms { internal class LocalizationManagerInternalWinforms : LocalizationManagerInternal { + + /// + /// Function to choose a fallback language during construction. Overridable by unit tests. + /// + internal new static Func ChooseFallbackLanguage = (desiredUiLangId, icon) => + { + using (var dlg = new LanguageChoosingDialog(L10NCultureInfo.GetCultureInfo(desiredUiLangId), icon)) + { + dlg.ShowDialog(); + return dlg.SelectedLanguage; + } + }; internal new static void RemoveManager(string id) { if (LoadedManagers.ContainsKey(id)) @@ -58,7 +71,7 @@ private static ILocalizationManager Create(string desiredUiLangId, string appId, if (!LocalizationManagerInternal.IsDesiredUiCultureAvailable(desiredUiLangId)) { - desiredUiLangId = LocalizationManagerInternal.ChooseFallbackLanguage(); + desiredUiLangId = ChooseFallbackLanguage(desiredUiLangId, applicationIcon); } L10NSharp.LocalizationManager.SetUILanguage(desiredUiLangId, false); @@ -170,44 +183,5 @@ internal static Control GetRealTopLevelControl(Control ctrl) return parentControl; } - - /*/// - /// Merge the existing English translation file into newly collected data and write the result to the temp - /// directory. - /// - public static void MergeExistingEnglishTranslationFileIntoNew(string installedStringFileFolder, - string appId) - { - if (!LoadedManagers.TryGetValue(appId, out var lm)) - return; - if (!lm.StringCache.TryGetDocument("en", out var newDoc)) - return; - var oldDocPath = Path.Combine(installedStringFileFolder, - LocalizationManager.GetTranslationFileNameForLanguage(appId, "en")); - - lm.MergeTranslationDocuments(appId, newDoc, oldDocPath); - } - - public static string GetString(string stringId, string englishText, string comment, string englishToolTipText, - string englishShortcutKey, IComponent component) - { - if (component != null) - { - var lm = GetLocalizationManagerForComponent(component) ?? - GetLocalizationManagerForString(stringId); - - if (lm != null) - { - lm.RegisterComponentForLocalizing(component, stringId, englishText, - englishToolTipText, englishShortcutKey, comment); - - return lm.GetLocalizedString(stringId, englishText); - } - } - - return LocalizationManagerInternal.GetStringFromAnyLocalizationManager(stringId) ?? - LocalizationManager.StripOffLocalizationInfoFromText(englishText); - }*/ - } } diff --git a/src/L10NSharpWinforms/LocalizationManagerWinforms.cs b/src/L10NSharpWinforms/LocalizationManagerWinforms.cs index 02566fe..79dbd94 100644 --- a/src/L10NSharpWinforms/LocalizationManagerWinforms.cs +++ b/src/L10NSharpWinforms/LocalizationManagerWinforms.cs @@ -91,7 +91,8 @@ public static string GetLocalizedToolTipForControl(Control ctrl) var loadedManagers = new Dictionary(); foreach (var keyValuePair in LocalizationManagerInternalWinforms.LoadedManagers) { - loadedManagers.Add(keyValuePair.Key, (ILocalizationManagerInternalWinforms)keyValuePair.Value); + if(keyValuePair.Value is ILocalizationManagerInternalWinforms) + loadedManagers.Add(keyValuePair.Key, (ILocalizationManagerInternalWinforms)keyValuePair.Value); } return loadedManagers; @@ -100,5 +101,22 @@ public static string GetLocalizedToolTipForControl(Control ctrl) } } + /*/// + /// True (default) to throw if we try to get a string from a particular manager + /// and it has been disposed. When false, we will instead just return the English string, + /// or if none, the ID. This is useful in some apps (e.g., Bloom) which may + /// accidentally request a localized string during shutdown after disposing of + /// the localization managers. + /// + public static bool ThrowIfManagerDisposed = true; + + /// + /// True (default) to throw if we try to get a localized string before creating any localization managers. + /// This is to prevent an invalid state where language IDs get mapped incorrectly at the beginning and + /// then never get updated which can cause us to fail to return properly localized strings when requested (see BL-13245). + /// The fix is to ensure that a LocalizationManager is created before calling any localization methods. + /// Or, to maintain prior behavior, set this to false. + /// + public static bool StrictInitializationMode = true;*/ } } diff --git a/src/L10NSharpWinforms/UI/L10NExtender.cs b/src/L10NSharpWinforms/UI/L10NExtender.cs index af6c510..ea4a7ba 100644 --- a/src/L10NSharpWinforms/UI/L10NExtender.cs +++ b/src/L10NSharpWinforms/UI/L10NExtender.cs @@ -87,7 +87,7 @@ public string LocalizationManagerId Debug.Assert(ReallyDesignMode || value != null, "You need to enter the manager/package id for this L10NExtender"); _locManagerId = value; - if (value != null && !DesignMode && LocalizationManager.LoadedManagers.ContainsKey(_locManagerId)) + if (value != null && !DesignMode && LocalizationManagerWinforms.LoadedManagers.ContainsKey(_locManagerId)) { _manager = LocalizationManagerWinforms.LoadedManagers[_locManagerId]; LocalizeControls(); From 9e1252feb826e6101194d3cb2d5dd03d6a5bde78 Mon Sep 17 00:00:00 2001 From: Ariel Rorabaugh Date: Thu, 31 Jul 2025 10:43:47 -0400 Subject: [PATCH 09/25] Update namespaces Change L10NSharpWinforms to L10NSharp.Windows.Forms Change L10NSharpWinformsTests to L10NSharp.Windows.Forms.Tests Change L10NSharpTests folder to L10NSharp.Tests --- L10NSharp.sln | 78 ++++++++++--------- .../CodeReaderTests.cs | 0 .../L10NCultureInfoTests.cs | 0 .../L10NSharp.Tests.csproj} | 0 .../LocalizationManagerTestsBase.cs | 0 ...calizationManagerTests_NoManagersLoaded.cs | 0 .../LocalizationManagerXliffTests.cs | 2 +- .../ProxyLocalizationManager.cs | 0 .../TempFile.cs | 0 .../TestXliff/Test.en.xlf | 0 .../TestXliff/Test.es.xlf | 0 .../TestXliff/Test.fr.xlf | 0 .../TestXliff/Test2.en.xlf | 0 .../TestXliff/xliff-core-1.2-strict.xsd | 0 .../TestXliff/xliff-core-1.2-transitional.xsd | 0 .../TestXliff2/Test.en.xlf | 0 .../TestXliff2/Test.es.xlf | 0 .../TestXliff2/Test.pt.xlf | 0 .../XLiffLocalizationManagerTests.cs | 0 .../XLiffLocalizedStringCacheTests.cs | 0 .../XLiffSchemaValidationTests.cs | 2 +- .../XLiffUtilsTests.cs | 2 +- .../ILocalizableComponentTests.cs | 8 +- .../L10NSharp.Windows.Forms.Tests.csproj} | 6 +- .../LanguageChoosingDialogViewModelTests.cs | 4 +- .../LocalizationExtenderTests.cs | 6 +- .../LocalizingInfoTests.cs | 4 +- .../MockLocalizableComponent.cs | 6 +- .../Properties/Resources.Designer.cs | 2 +- .../Properties/Resources.resx | 0 .../ReflectionHelper.cs | 2 +- .../UtilsTests.cs | 2 +- .../ILocalizableComponent.cs | 4 +- .../ILocalizationManagerInternalWinforms.cs | 2 +- .../ILocalizedStringCacheWinforms.cs | 4 +- .../L10NSharp.Windows.Forms.csproj} | 8 +- .../LocalizationManagerInternalWinforms.cs | 6 +- .../LocalizationManagerWinforms.cs | 2 +- .../LocalizingInfoWinforms.cs | 4 +- .../Properties/AssemblyInfo.cs | 10 +++ .../UI/ColorHelper.cs | 2 +- .../UI/CustomDropDownComboBox.Designer.cs | 2 +- .../UI/CustomDropDownComboBox.cs | 2 +- .../UI/CustomDropDownComboBox.resx | 0 .../UI/DontShowThisAgainButton.Designer.cs | 2 +- .../UI/DontShowThisAgainButton.cs | 2 +- ...EditSourceBeforeTranslatingDlg.Designer.cs | 2 +- .../UI/EditSourceBeforeTranslatingDlg.cs | 2 +- .../UI/EditSourceBeforeTranslatingDlg.resx | 0 .../UI/FallbackLanguagesDlg.cs | 2 +- .../UI/FallbackLanguagesDlgBase.Designer.cs | 2 +- .../UI/FallbackLanguagesDlgBase.cs | 2 +- .../UI/FallbackLanguagesDlgBase.resx | 0 .../UI/Grid/LmButtonCell.cs | 2 +- .../UI/Grid/LmButtonColumn.cs | 2 +- .../UI/Grid/LmGrid.cs | 2 +- .../UI/HowToDistributeDialog.Designer.cs | 2 +- .../UI/HowToDistributeDialog.cs | 2 +- .../UI/HowToDistributeDialog.resx | 0 .../UI/InitializationProgressDlg.cs | 2 +- .../InitializationProgressDlgBase.Designer.cs | 2 +- .../UI/InitializationProgressDlgBase.cs | 2 +- .../UI/InitializationProgressDlgBase.resx | 0 .../UI/L10NExtender.cs | 2 +- .../UI/L10NExtender.resx | 0 .../UI/LanguageChoosingDialog.Designer.cs | 4 +- .../UI/LanguageChoosingDialog.cs | 2 +- .../UI/LanguageChoosingDialog.resx | 0 .../UI/LanguageChoosingDialogViewModel.cs | 2 +- .../LanguageChoosingSimpleDialog.Designer.cs | 6 +- .../UI/LanguageChoosingSimpleDialog.cs | 2 +- .../UI/LanguageChoosingSimpleDialog.resx | 0 .../UI/LocTreeNode.cs | 2 +- .../UI/LocalizeItemDlg.Designer.cs | 16 ++-- .../UI/LocalizeItemDlg.cs | 2 +- .../UI/LocalizeItemDlg.resx | 0 .../UI/LocalizeItemDlgViewModel.cs | 2 +- .../UI/NodeComparer.cs | 2 +- .../UI/PaintingHelper.cs | 2 +- .../UI/PopupControl.cs | 2 +- .../UI/PopupControl.designer.cs | 2 +- .../UI/PopupControl.resx | 0 .../UI/ShortcutKeysDropDown.cs | 2 +- .../UI/ShortcutKeysEditor.Designer.cs | 2 +- .../UI/ShortcutKeysEditor.cs | 2 +- .../UI/ShortcutKeysEditor.resx | 0 .../UI/TipDialog.cs | 2 +- .../UI/TipDialog.designer.cs | 2 +- .../UI/TipDialog.resx | 0 .../UI/UILanguageComboBox.cs | 2 +- .../UI/UILanguageListBox.cs | 2 +- .../UI/XButton.cs | 2 +- .../UtilsWinforms.cs | 2 +- .../XliffLocalizationManagerWinforms.cs | 4 +- .../XliffLocalizedStringCacheWinforms.cs | 4 +- src/L10NSharp/L10NSharp.csproj | 13 ++++ src/L10NSharp/Properties/AssemblyInfo.cs | 6 +- src/L10NSharp/Properties/Settings.Designer.cs | 2 +- .../Properties/AssemblyInfo.cs | 10 --- src/SampleApp/Form1.Designer.cs | 8 +- src/SampleApp/SampleApp.csproj | 2 +- 101 files changed, 165 insertions(+), 150 deletions(-) rename src/{L10NSharpTests => L10NSharp.Tests}/CodeReaderTests.cs (100%) rename src/{L10NSharpTests => L10NSharp.Tests}/L10NCultureInfoTests.cs (100%) rename src/{L10NSharpTests/L10NSharpTests.csproj => L10NSharp.Tests/L10NSharp.Tests.csproj} (100%) rename src/{L10NSharpTests => L10NSharp.Tests}/LocalizationManagerTestsBase.cs (100%) rename src/{L10NSharpTests => L10NSharp.Tests}/LocalizationManagerTests_NoManagersLoaded.cs (100%) rename src/{L10NSharpTests => L10NSharp.Tests}/LocalizationManagerXliffTests.cs (97%) rename src/{L10NSharpTests => L10NSharp.Tests}/ProxyLocalizationManager.cs (100%) rename src/{L10NSharpTests => L10NSharp.Tests}/TempFile.cs (100%) rename src/{L10NSharpTests => L10NSharp.Tests}/TestXliff/Test.en.xlf (100%) rename src/{L10NSharpTests => L10NSharp.Tests}/TestXliff/Test.es.xlf (100%) rename src/{L10NSharpTests => L10NSharp.Tests}/TestXliff/Test.fr.xlf (100%) rename src/{L10NSharpTests => L10NSharp.Tests}/TestXliff/Test2.en.xlf (100%) rename src/{L10NSharpTests => L10NSharp.Tests}/TestXliff/xliff-core-1.2-strict.xsd (100%) rename src/{L10NSharpTests => L10NSharp.Tests}/TestXliff/xliff-core-1.2-transitional.xsd (100%) rename src/{L10NSharpTests => L10NSharp.Tests}/TestXliff2/Test.en.xlf (100%) rename src/{L10NSharpTests => L10NSharp.Tests}/TestXliff2/Test.es.xlf (100%) rename src/{L10NSharpTests => L10NSharp.Tests}/TestXliff2/Test.pt.xlf (100%) rename src/{L10NSharpTests => L10NSharp.Tests}/XLiffLocalizationManagerTests.cs (100%) rename src/{L10NSharpTests => L10NSharp.Tests}/XLiffLocalizedStringCacheTests.cs (100%) rename src/{L10NSharpTests => L10NSharp.Tests}/XLiffSchemaValidationTests.cs (98%) rename src/{L10NSharpTests => L10NSharp.Tests}/XLiffUtilsTests.cs (99%) rename src/{L10NSharpWinformsTests => L10NSharp.Windows.Forms.Tests}/ILocalizableComponentTests.cs (96%) rename src/{L10NSharpWinformsTests/L10NSharpWinformsTests.csproj => L10NSharp.Windows.Forms.Tests/L10NSharp.Windows.Forms.Tests.csproj} (74%) rename src/{L10NSharpWinformsTests => L10NSharp.Windows.Forms.Tests}/LanguageChoosingDialogViewModelTests.cs (99%) rename src/{L10NSharpWinformsTests => L10NSharp.Windows.Forms.Tests}/LocalizationExtenderTests.cs (98%) rename src/{L10NSharpWinformsTests => L10NSharp.Windows.Forms.Tests}/LocalizingInfoTests.cs (97%) rename src/{L10NSharpWinformsTests => L10NSharp.Windows.Forms.Tests}/MockLocalizableComponent.cs (97%) rename src/{L10NSharpWinformsTests => L10NSharp.Windows.Forms.Tests}/Properties/Resources.Designer.cs (98%) rename src/{L10NSharpWinformsTests => L10NSharp.Windows.Forms.Tests}/Properties/Resources.resx (100%) rename src/{L10NSharpWinformsTests => L10NSharp.Windows.Forms.Tests}/ReflectionHelper.cs (99%) rename src/{L10NSharpWinformsTests => L10NSharp.Windows.Forms.Tests}/UtilsTests.cs (96%) rename src/{L10NSharpWinforms => L10NSharp.Windows.Forms}/ILocalizableComponent.cs (94%) rename src/{L10NSharpWinforms => L10NSharp.Windows.Forms}/ILocalizationManagerInternalWinforms.cs (96%) rename src/{L10NSharpWinforms => L10NSharp.Windows.Forms}/ILocalizedStringCacheWinforms.cs (86%) rename src/{L10NSharpWinforms/L10NSharpWinforms.csproj => L10NSharp.Windows.Forms/L10NSharp.Windows.Forms.csproj} (87%) rename src/{L10NSharpWinforms => L10NSharp.Windows.Forms}/LocalizationManagerInternalWinforms.cs (98%) rename src/{L10NSharpWinforms => L10NSharp.Windows.Forms}/LocalizationManagerWinforms.cs (99%) rename src/{L10NSharpWinforms => L10NSharp.Windows.Forms}/LocalizingInfoWinforms.cs (99%) create mode 100644 src/L10NSharp.Windows.Forms/Properties/AssemblyInfo.cs rename src/{L10NSharpWinforms => L10NSharp.Windows.Forms}/UI/ColorHelper.cs (98%) rename src/{L10NSharpWinforms => L10NSharp.Windows.Forms}/UI/CustomDropDownComboBox.Designer.cs (98%) rename src/{L10NSharpWinforms => L10NSharp.Windows.Forms}/UI/CustomDropDownComboBox.cs (99%) rename src/{L10NSharpWinforms => L10NSharp.Windows.Forms}/UI/CustomDropDownComboBox.resx (100%) rename src/{L10NSharpWinforms => L10NSharp.Windows.Forms}/UI/DontShowThisAgainButton.Designer.cs (96%) rename src/{L10NSharpWinforms => L10NSharp.Windows.Forms}/UI/DontShowThisAgainButton.cs (98%) rename src/{L10NSharpWinforms => L10NSharp.Windows.Forms}/UI/EditSourceBeforeTranslatingDlg.Designer.cs (99%) rename src/{L10NSharpWinforms => L10NSharp.Windows.Forms}/UI/EditSourceBeforeTranslatingDlg.cs (97%) rename src/{L10NSharpWinforms => L10NSharp.Windows.Forms}/UI/EditSourceBeforeTranslatingDlg.resx (100%) rename src/{L10NSharpWinforms => L10NSharp.Windows.Forms}/UI/FallbackLanguagesDlg.cs (96%) rename src/{L10NSharpWinforms => L10NSharp.Windows.Forms}/UI/FallbackLanguagesDlgBase.Designer.cs (99%) rename src/{L10NSharpWinforms => L10NSharp.Windows.Forms}/UI/FallbackLanguagesDlgBase.cs (99%) rename src/{L10NSharpWinforms => L10NSharp.Windows.Forms}/UI/FallbackLanguagesDlgBase.resx (100%) rename src/{L10NSharpWinforms => L10NSharp.Windows.Forms}/UI/Grid/LmButtonCell.cs (99%) rename src/{L10NSharpWinforms => L10NSharp.Windows.Forms}/UI/Grid/LmButtonColumn.cs (99%) rename src/{L10NSharpWinforms => L10NSharp.Windows.Forms}/UI/Grid/LmGrid.cs (99%) rename src/{L10NSharpWinforms => L10NSharp.Windows.Forms}/UI/HowToDistributeDialog.Designer.cs (99%) rename src/{L10NSharpWinforms => L10NSharp.Windows.Forms}/UI/HowToDistributeDialog.cs (98%) rename src/{L10NSharpWinforms => L10NSharp.Windows.Forms}/UI/HowToDistributeDialog.resx (100%) rename src/{L10NSharpWinforms => L10NSharp.Windows.Forms}/UI/InitializationProgressDlg.cs (98%) rename src/{L10NSharpWinforms => L10NSharp.Windows.Forms}/UI/InitializationProgressDlgBase.Designer.cs (99%) rename src/{L10NSharpWinforms => L10NSharp.Windows.Forms}/UI/InitializationProgressDlgBase.cs (98%) rename src/{L10NSharpWinforms => L10NSharp.Windows.Forms}/UI/InitializationProgressDlgBase.resx (100%) rename src/{L10NSharpWinforms => L10NSharp.Windows.Forms}/UI/L10NExtender.cs (99%) rename src/{L10NSharpWinforms => L10NSharp.Windows.Forms}/UI/L10NExtender.resx (100%) rename src/{L10NSharpWinforms => L10NSharp.Windows.Forms}/UI/LanguageChoosingDialog.Designer.cs (97%) rename src/{L10NSharpWinforms => L10NSharp.Windows.Forms}/UI/LanguageChoosingDialog.cs (96%) rename src/{L10NSharpWinforms => L10NSharp.Windows.Forms}/UI/LanguageChoosingDialog.resx (100%) rename src/{L10NSharpWinforms => L10NSharp.Windows.Forms}/UI/LanguageChoosingDialogViewModel.cs (99%) rename src/{L10NSharpWinforms => L10NSharp.Windows.Forms}/UI/LanguageChoosingSimpleDialog.Designer.cs (93%) rename src/{L10NSharpWinforms => L10NSharp.Windows.Forms}/UI/LanguageChoosingSimpleDialog.cs (95%) rename src/{L10NSharpWinforms => L10NSharp.Windows.Forms}/UI/LanguageChoosingSimpleDialog.resx (100%) rename src/{L10NSharpWinforms => L10NSharp.Windows.Forms}/UI/LocTreeNode.cs (98%) rename src/{L10NSharpWinforms => L10NSharp.Windows.Forms}/UI/LocalizeItemDlg.Designer.cs (99%) rename src/{L10NSharpWinforms => L10NSharp.Windows.Forms}/UI/LocalizeItemDlg.cs (99%) rename src/{L10NSharpWinforms => L10NSharp.Windows.Forms}/UI/LocalizeItemDlg.resx (100%) rename src/{L10NSharpWinforms => L10NSharp.Windows.Forms}/UI/LocalizeItemDlgViewModel.cs (99%) rename src/{L10NSharpWinforms => L10NSharp.Windows.Forms}/UI/NodeComparer.cs (98%) rename src/{L10NSharpWinforms => L10NSharp.Windows.Forms}/UI/PaintingHelper.cs (99%) rename src/{L10NSharpWinforms => L10NSharp.Windows.Forms}/UI/PopupControl.cs (99%) rename src/{L10NSharpWinforms => L10NSharp.Windows.Forms}/UI/PopupControl.designer.cs (95%) rename src/{L10NSharpWinforms => L10NSharp.Windows.Forms}/UI/PopupControl.resx (100%) rename src/{L10NSharpWinforms => L10NSharp.Windows.Forms}/UI/ShortcutKeysDropDown.cs (98%) rename src/{L10NSharpWinforms => L10NSharp.Windows.Forms}/UI/ShortcutKeysEditor.Designer.cs (99%) rename src/{L10NSharpWinforms => L10NSharp.Windows.Forms}/UI/ShortcutKeysEditor.cs (99%) rename src/{L10NSharpWinforms => L10NSharp.Windows.Forms}/UI/ShortcutKeysEditor.resx (100%) rename src/{L10NSharpWinforms => L10NSharp.Windows.Forms}/UI/TipDialog.cs (98%) rename src/{L10NSharpWinforms => L10NSharp.Windows.Forms}/UI/TipDialog.designer.cs (99%) rename src/{L10NSharpWinforms => L10NSharp.Windows.Forms}/UI/TipDialog.resx (100%) rename src/{L10NSharpWinforms => L10NSharp.Windows.Forms}/UI/UILanguageComboBox.cs (98%) rename src/{L10NSharpWinforms => L10NSharp.Windows.Forms}/UI/UILanguageListBox.cs (98%) rename src/{L10NSharpWinforms => L10NSharp.Windows.Forms}/UI/XButton.cs (99%) rename src/{L10NSharpWinforms => L10NSharp.Windows.Forms}/UtilsWinforms.cs (97%) rename src/{L10NSharpWinforms => L10NSharp.Windows.Forms}/XLiffUtils/XliffLocalizationManagerWinforms.cs (99%) rename src/{L10NSharpWinforms => L10NSharp.Windows.Forms}/XLiffUtils/XliffLocalizedStringCacheWinforms.cs (98%) delete mode 100644 src/L10NSharpWinforms/Properties/AssemblyInfo.cs diff --git a/L10NSharp.sln b/L10NSharp.sln index eacd806..4309409 100644 --- a/L10NSharp.sln +++ b/L10NSharp.sln @@ -4,8 +4,6 @@ VisualStudioVersion = 17.0.32112.339 MinimumVisualStudioVersion = 10.0.40219.1 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "L10NSharp", "src\L10NSharp\L10NSharp.csproj", "{8EE0895A-7B9D-4B49-8F73-9F1270F1E583}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "L10NSharpTests", "src\L10NSharpTests\L10NSharpTests.csproj", "{BCE5B569-057C-4D7E-832E-E44A2DA705AC}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SampleApp", "src\SampleApp\SampleApp.csproj", "{58923B30-FD84-4BCC-85E0-607DCA7E7C95}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ExtractXliff", "src\ExtractXliff\ExtractXliff.csproj", "{E0666C78-B8DC-4232-952C-753940D54921}" @@ -24,9 +22,11 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SolutionFolder", "SolutionF README.md = README.md EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "L10NSharpWinforms", "src\L10NSharpWinforms\L10NSharpWinforms.csproj", "{B66D48A5-AD5D-4A24-9847-66CBC7EB0DCB}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "L10NSharp.Windows.Forms", "src\L10NSharp.Windows.Forms\L10NSharp.Windows.Forms.csproj", "{B118A158-F6A9-4346-ADC7-A9FEBCE5BE68}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "L10NSharp.Windows.Forms.Tests", "src\L10NSharp.Windows.Forms.Tests\L10NSharp.Windows.Forms.Tests.csproj", "{DCF3741C-9496-4495-BF57-0DBA1DBBB7F5}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "L10NSharpWinformsTests", "src\L10NSharpWinformsTests\L10NSharpWinformsTests.csproj", "{B6220220-4C18-43B5-85EE-D33D67A227AA}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "L10NSharp.Tests", "src\L10NSharp.Tests\L10NSharp.Tests.csproj", "{B0218FB3-62E0-487B-B154-5788D8EF8345}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -48,16 +48,6 @@ Global {8EE0895A-7B9D-4B49-8F73-9F1270F1E583}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU {8EE0895A-7B9D-4B49-8F73-9F1270F1E583}.Release|Mixed Platforms.Build.0 = Release|Any CPU {8EE0895A-7B9D-4B49-8F73-9F1270F1E583}.Release|x86.ActiveCfg = Release|Any CPU - {BCE5B569-057C-4D7E-832E-E44A2DA705AC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {BCE5B569-057C-4D7E-832E-E44A2DA705AC}.Debug|Any CPU.Build.0 = Debug|Any CPU - {BCE5B569-057C-4D7E-832E-E44A2DA705AC}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU - {BCE5B569-057C-4D7E-832E-E44A2DA705AC}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU - {BCE5B569-057C-4D7E-832E-E44A2DA705AC}.Debug|x86.ActiveCfg = Debug|Any CPU - {BCE5B569-057C-4D7E-832E-E44A2DA705AC}.Release|Any CPU.ActiveCfg = Release|Any CPU - {BCE5B569-057C-4D7E-832E-E44A2DA705AC}.Release|Any CPU.Build.0 = Release|Any CPU - {BCE5B569-057C-4D7E-832E-E44A2DA705AC}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU - {BCE5B569-057C-4D7E-832E-E44A2DA705AC}.Release|Mixed Platforms.Build.0 = Release|Any CPU - {BCE5B569-057C-4D7E-832E-E44A2DA705AC}.Release|x86.ActiveCfg = Release|Any CPU {58923B30-FD84-4BCC-85E0-607DCA7E7C95}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {58923B30-FD84-4BCC-85E0-607DCA7E7C95}.Debug|Any CPU.Build.0 = Debug|Any CPU {58923B30-FD84-4BCC-85E0-607DCA7E7C95}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU @@ -93,30 +83,42 @@ Global {E4BB984D-DFB8-42EF-860D-5A038FF85B1C}.Release|Mixed Platforms.Build.0 = Release|Any CPU {E4BB984D-DFB8-42EF-860D-5A038FF85B1C}.Release|x86.ActiveCfg = Release|Any CPU {E4BB984D-DFB8-42EF-860D-5A038FF85B1C}.Release|x86.Build.0 = Release|Any CPU - {B66D48A5-AD5D-4A24-9847-66CBC7EB0DCB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {B66D48A5-AD5D-4A24-9847-66CBC7EB0DCB}.Debug|Any CPU.Build.0 = Debug|Any CPU - {B66D48A5-AD5D-4A24-9847-66CBC7EB0DCB}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU - {B66D48A5-AD5D-4A24-9847-66CBC7EB0DCB}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU - {B66D48A5-AD5D-4A24-9847-66CBC7EB0DCB}.Debug|x86.ActiveCfg = Debug|Any CPU - {B66D48A5-AD5D-4A24-9847-66CBC7EB0DCB}.Debug|x86.Build.0 = Debug|Any CPU - {B66D48A5-AD5D-4A24-9847-66CBC7EB0DCB}.Release|Any CPU.ActiveCfg = Release|Any CPU - {B66D48A5-AD5D-4A24-9847-66CBC7EB0DCB}.Release|Any CPU.Build.0 = Release|Any CPU - {B66D48A5-AD5D-4A24-9847-66CBC7EB0DCB}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU - {B66D48A5-AD5D-4A24-9847-66CBC7EB0DCB}.Release|Mixed Platforms.Build.0 = Release|Any CPU - {B66D48A5-AD5D-4A24-9847-66CBC7EB0DCB}.Release|x86.ActiveCfg = Release|Any CPU - {B66D48A5-AD5D-4A24-9847-66CBC7EB0DCB}.Release|x86.Build.0 = Release|Any CPU - {B6220220-4C18-43B5-85EE-D33D67A227AA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {B6220220-4C18-43B5-85EE-D33D67A227AA}.Debug|Any CPU.Build.0 = Debug|Any CPU - {B6220220-4C18-43B5-85EE-D33D67A227AA}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU - {B6220220-4C18-43B5-85EE-D33D67A227AA}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU - {B6220220-4C18-43B5-85EE-D33D67A227AA}.Debug|x86.ActiveCfg = Debug|Any CPU - {B6220220-4C18-43B5-85EE-D33D67A227AA}.Debug|x86.Build.0 = Debug|Any CPU - {B6220220-4C18-43B5-85EE-D33D67A227AA}.Release|Any CPU.ActiveCfg = Release|Any CPU - {B6220220-4C18-43B5-85EE-D33D67A227AA}.Release|Any CPU.Build.0 = Release|Any CPU - {B6220220-4C18-43B5-85EE-D33D67A227AA}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU - {B6220220-4C18-43B5-85EE-D33D67A227AA}.Release|Mixed Platforms.Build.0 = Release|Any CPU - {B6220220-4C18-43B5-85EE-D33D67A227AA}.Release|x86.ActiveCfg = Release|Any CPU - {B6220220-4C18-43B5-85EE-D33D67A227AA}.Release|x86.Build.0 = Release|Any CPU + {B118A158-F6A9-4346-ADC7-A9FEBCE5BE68}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B118A158-F6A9-4346-ADC7-A9FEBCE5BE68}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B118A158-F6A9-4346-ADC7-A9FEBCE5BE68}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {B118A158-F6A9-4346-ADC7-A9FEBCE5BE68}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {B118A158-F6A9-4346-ADC7-A9FEBCE5BE68}.Debug|x86.ActiveCfg = Debug|Any CPU + {B118A158-F6A9-4346-ADC7-A9FEBCE5BE68}.Debug|x86.Build.0 = Debug|Any CPU + {B118A158-F6A9-4346-ADC7-A9FEBCE5BE68}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B118A158-F6A9-4346-ADC7-A9FEBCE5BE68}.Release|Any CPU.Build.0 = Release|Any CPU + {B118A158-F6A9-4346-ADC7-A9FEBCE5BE68}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {B118A158-F6A9-4346-ADC7-A9FEBCE5BE68}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {B118A158-F6A9-4346-ADC7-A9FEBCE5BE68}.Release|x86.ActiveCfg = Release|Any CPU + {B118A158-F6A9-4346-ADC7-A9FEBCE5BE68}.Release|x86.Build.0 = Release|Any CPU + {DCF3741C-9496-4495-BF57-0DBA1DBBB7F5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {DCF3741C-9496-4495-BF57-0DBA1DBBB7F5}.Debug|Any CPU.Build.0 = Debug|Any CPU + {DCF3741C-9496-4495-BF57-0DBA1DBBB7F5}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {DCF3741C-9496-4495-BF57-0DBA1DBBB7F5}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {DCF3741C-9496-4495-BF57-0DBA1DBBB7F5}.Debug|x86.ActiveCfg = Debug|Any CPU + {DCF3741C-9496-4495-BF57-0DBA1DBBB7F5}.Debug|x86.Build.0 = Debug|Any CPU + {DCF3741C-9496-4495-BF57-0DBA1DBBB7F5}.Release|Any CPU.ActiveCfg = Release|Any CPU + {DCF3741C-9496-4495-BF57-0DBA1DBBB7F5}.Release|Any CPU.Build.0 = Release|Any CPU + {DCF3741C-9496-4495-BF57-0DBA1DBBB7F5}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {DCF3741C-9496-4495-BF57-0DBA1DBBB7F5}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {DCF3741C-9496-4495-BF57-0DBA1DBBB7F5}.Release|x86.ActiveCfg = Release|Any CPU + {DCF3741C-9496-4495-BF57-0DBA1DBBB7F5}.Release|x86.Build.0 = Release|Any CPU + {B0218FB3-62E0-487B-B154-5788D8EF8345}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B0218FB3-62E0-487B-B154-5788D8EF8345}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B0218FB3-62E0-487B-B154-5788D8EF8345}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {B0218FB3-62E0-487B-B154-5788D8EF8345}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {B0218FB3-62E0-487B-B154-5788D8EF8345}.Debug|x86.ActiveCfg = Debug|Any CPU + {B0218FB3-62E0-487B-B154-5788D8EF8345}.Debug|x86.Build.0 = Debug|Any CPU + {B0218FB3-62E0-487B-B154-5788D8EF8345}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B0218FB3-62E0-487B-B154-5788D8EF8345}.Release|Any CPU.Build.0 = Release|Any CPU + {B0218FB3-62E0-487B-B154-5788D8EF8345}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {B0218FB3-62E0-487B-B154-5788D8EF8345}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {B0218FB3-62E0-487B-B154-5788D8EF8345}.Release|x86.ActiveCfg = Release|Any CPU + {B0218FB3-62E0-487B-B154-5788D8EF8345}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/L10NSharpTests/CodeReaderTests.cs b/src/L10NSharp.Tests/CodeReaderTests.cs similarity index 100% rename from src/L10NSharpTests/CodeReaderTests.cs rename to src/L10NSharp.Tests/CodeReaderTests.cs diff --git a/src/L10NSharpTests/L10NCultureInfoTests.cs b/src/L10NSharp.Tests/L10NCultureInfoTests.cs similarity index 100% rename from src/L10NSharpTests/L10NCultureInfoTests.cs rename to src/L10NSharp.Tests/L10NCultureInfoTests.cs diff --git a/src/L10NSharpTests/L10NSharpTests.csproj b/src/L10NSharp.Tests/L10NSharp.Tests.csproj similarity index 100% rename from src/L10NSharpTests/L10NSharpTests.csproj rename to src/L10NSharp.Tests/L10NSharp.Tests.csproj diff --git a/src/L10NSharpTests/LocalizationManagerTestsBase.cs b/src/L10NSharp.Tests/LocalizationManagerTestsBase.cs similarity index 100% rename from src/L10NSharpTests/LocalizationManagerTestsBase.cs rename to src/L10NSharp.Tests/LocalizationManagerTestsBase.cs diff --git a/src/L10NSharpTests/LocalizationManagerTests_NoManagersLoaded.cs b/src/L10NSharp.Tests/LocalizationManagerTests_NoManagersLoaded.cs similarity index 100% rename from src/L10NSharpTests/LocalizationManagerTests_NoManagersLoaded.cs rename to src/L10NSharp.Tests/LocalizationManagerTests_NoManagersLoaded.cs diff --git a/src/L10NSharpTests/LocalizationManagerXliffTests.cs b/src/L10NSharp.Tests/LocalizationManagerXliffTests.cs similarity index 97% rename from src/L10NSharpTests/LocalizationManagerXliffTests.cs rename to src/L10NSharp.Tests/LocalizationManagerXliffTests.cs index b8b9791..47ff2f7 100644 --- a/src/L10NSharpTests/LocalizationManagerXliffTests.cs +++ b/src/L10NSharp.Tests/LocalizationManagerXliffTests.cs @@ -40,7 +40,7 @@ public void Create_PreferredUiLanguageIsGenericVariant_CreatesLocalizationManage LocalizationManager.ClearLoadedManagers(); var dir = Path.GetDirectoryName(new Uri(Assembly.GetExecutingAssembly().CodeBase).LocalPath); var lm = LocalizationManager.Create(genericLocaleId, "Test", "Test", "1.0", - Path.Combine(dir, "../../../src/L10NSharpTests/TestXliff2"), "", "", + Path.Combine(dir, "../../../src/L10NSharp.Tests/TestXliff2"), "", "", new string[] {}); Assert.AreEqual($"Protección de configuraciones ({genericLocaleId})...", lm.GetLocalizedString("SettingsProtection.LauncherButtonLabel", "don't use this")); diff --git a/src/L10NSharpTests/ProxyLocalizationManager.cs b/src/L10NSharp.Tests/ProxyLocalizationManager.cs similarity index 100% rename from src/L10NSharpTests/ProxyLocalizationManager.cs rename to src/L10NSharp.Tests/ProxyLocalizationManager.cs diff --git a/src/L10NSharpTests/TempFile.cs b/src/L10NSharp.Tests/TempFile.cs similarity index 100% rename from src/L10NSharpTests/TempFile.cs rename to src/L10NSharp.Tests/TempFile.cs diff --git a/src/L10NSharpTests/TestXliff/Test.en.xlf b/src/L10NSharp.Tests/TestXliff/Test.en.xlf similarity index 100% rename from src/L10NSharpTests/TestXliff/Test.en.xlf rename to src/L10NSharp.Tests/TestXliff/Test.en.xlf diff --git a/src/L10NSharpTests/TestXliff/Test.es.xlf b/src/L10NSharp.Tests/TestXliff/Test.es.xlf similarity index 100% rename from src/L10NSharpTests/TestXliff/Test.es.xlf rename to src/L10NSharp.Tests/TestXliff/Test.es.xlf diff --git a/src/L10NSharpTests/TestXliff/Test.fr.xlf b/src/L10NSharp.Tests/TestXliff/Test.fr.xlf similarity index 100% rename from src/L10NSharpTests/TestXliff/Test.fr.xlf rename to src/L10NSharp.Tests/TestXliff/Test.fr.xlf diff --git a/src/L10NSharpTests/TestXliff/Test2.en.xlf b/src/L10NSharp.Tests/TestXliff/Test2.en.xlf similarity index 100% rename from src/L10NSharpTests/TestXliff/Test2.en.xlf rename to src/L10NSharp.Tests/TestXliff/Test2.en.xlf diff --git a/src/L10NSharpTests/TestXliff/xliff-core-1.2-strict.xsd b/src/L10NSharp.Tests/TestXliff/xliff-core-1.2-strict.xsd similarity index 100% rename from src/L10NSharpTests/TestXliff/xliff-core-1.2-strict.xsd rename to src/L10NSharp.Tests/TestXliff/xliff-core-1.2-strict.xsd diff --git a/src/L10NSharpTests/TestXliff/xliff-core-1.2-transitional.xsd b/src/L10NSharp.Tests/TestXliff/xliff-core-1.2-transitional.xsd similarity index 100% rename from src/L10NSharpTests/TestXliff/xliff-core-1.2-transitional.xsd rename to src/L10NSharp.Tests/TestXliff/xliff-core-1.2-transitional.xsd diff --git a/src/L10NSharpTests/TestXliff2/Test.en.xlf b/src/L10NSharp.Tests/TestXliff2/Test.en.xlf similarity index 100% rename from src/L10NSharpTests/TestXliff2/Test.en.xlf rename to src/L10NSharp.Tests/TestXliff2/Test.en.xlf diff --git a/src/L10NSharpTests/TestXliff2/Test.es.xlf b/src/L10NSharp.Tests/TestXliff2/Test.es.xlf similarity index 100% rename from src/L10NSharpTests/TestXliff2/Test.es.xlf rename to src/L10NSharp.Tests/TestXliff2/Test.es.xlf diff --git a/src/L10NSharpTests/TestXliff2/Test.pt.xlf b/src/L10NSharp.Tests/TestXliff2/Test.pt.xlf similarity index 100% rename from src/L10NSharpTests/TestXliff2/Test.pt.xlf rename to src/L10NSharp.Tests/TestXliff2/Test.pt.xlf diff --git a/src/L10NSharpTests/XLiffLocalizationManagerTests.cs b/src/L10NSharp.Tests/XLiffLocalizationManagerTests.cs similarity index 100% rename from src/L10NSharpTests/XLiffLocalizationManagerTests.cs rename to src/L10NSharp.Tests/XLiffLocalizationManagerTests.cs diff --git a/src/L10NSharpTests/XLiffLocalizedStringCacheTests.cs b/src/L10NSharp.Tests/XLiffLocalizedStringCacheTests.cs similarity index 100% rename from src/L10NSharpTests/XLiffLocalizedStringCacheTests.cs rename to src/L10NSharp.Tests/XLiffLocalizedStringCacheTests.cs diff --git a/src/L10NSharpTests/XLiffSchemaValidationTests.cs b/src/L10NSharp.Tests/XLiffSchemaValidationTests.cs similarity index 98% rename from src/L10NSharpTests/XLiffSchemaValidationTests.cs rename to src/L10NSharp.Tests/XLiffSchemaValidationTests.cs index a586e66..706dd12 100644 --- a/src/L10NSharpTests/XLiffSchemaValidationTests.cs +++ b/src/L10NSharp.Tests/XLiffSchemaValidationTests.cs @@ -19,7 +19,7 @@ private static string SchemaLocation get { var dir = Path.GetDirectoryName(new Uri(Assembly.GetExecutingAssembly().CodeBase).LocalPath); - var installedXliffDir = "../../../src/L10NSharpTests/TestXliff"; + var installedXliffDir = "../../../src/L10NSharp.Tests/TestXliff"; var schemaLocation = Path.Combine(dir, installedXliffDir, "xliff-core-1.2-transitional.xsd"); diff --git a/src/L10NSharpTests/XLiffUtilsTests.cs b/src/L10NSharp.Tests/XLiffUtilsTests.cs similarity index 99% rename from src/L10NSharpTests/XLiffUtilsTests.cs rename to src/L10NSharp.Tests/XLiffUtilsTests.cs index ba2c83a..6bd68ba 100644 --- a/src/L10NSharpTests/XLiffUtilsTests.cs +++ b/src/L10NSharp.Tests/XLiffUtilsTests.cs @@ -20,7 +20,7 @@ public XLiffUtilsTests() folder = Path.GetDirectoryName(folder); folder = Path.GetDirectoryName(folder); folder = Path.GetDirectoryName(folder); - _testFolder = Path.Combine(folder, "src", "L10NSharpTests", "TestXliff"); + _testFolder = Path.Combine(folder, "src", "L10NSharp.Tests", "TestXliff"); } [Test] diff --git a/src/L10NSharpWinformsTests/ILocalizableComponentTests.cs b/src/L10NSharp.Windows.Forms.Tests/ILocalizableComponentTests.cs similarity index 96% rename from src/L10NSharpWinformsTests/ILocalizableComponentTests.cs rename to src/L10NSharp.Windows.Forms.Tests/ILocalizableComponentTests.cs index d4d000d..9e87042 100644 --- a/src/L10NSharpWinformsTests/ILocalizableComponentTests.cs +++ b/src/L10NSharp.Windows.Forms.Tests/ILocalizableComponentTests.cs @@ -3,11 +3,11 @@ using System.Reflection; using L10NSharp; using L10NSharp.XLiffUtils; -using L10NSharpWinforms; -using L10NSharpWinforms.UI; +using L10NSharp.Windows.Forms; +using L10NSharp.Windows.Forms.UI; using NUnit.Framework; -namespace L10NSharpWinformsTests +namespace L10NSharp.Windows.Forms.Tests { /// ---------------------------------------------------------------------------------------- /// @@ -41,7 +41,7 @@ protected void TestSetup(string installedTranslationDir) [SetUp] public void TestSetup() { - TestSetup("../../../src/L10NSharpTests/TestXliff"); + TestSetup("../../../src/L10NSharp.Tests/TestXliff"); } /// ------------------------------------------------------------------------------------ diff --git a/src/L10NSharpWinformsTests/L10NSharpWinformsTests.csproj b/src/L10NSharp.Windows.Forms.Tests/L10NSharp.Windows.Forms.Tests.csproj similarity index 74% rename from src/L10NSharpWinformsTests/L10NSharpWinformsTests.csproj rename to src/L10NSharp.Windows.Forms.Tests/L10NSharp.Windows.Forms.Tests.csproj index 1a7cbde..5e267f2 100644 --- a/src/L10NSharpWinformsTests/L10NSharpWinformsTests.csproj +++ b/src/L10NSharp.Windows.Forms.Tests/L10NSharp.Windows.Forms.Tests.csproj @@ -1,13 +1,13 @@ Unit tests for L10NSharpWinforms - L10NSharpWinformsTests - L10NSharpWinformsTests + L10NSharp.Windows.Forms.Tests + L10NSharp.Windows.Forms.Tests false - + diff --git a/src/L10NSharpWinformsTests/LanguageChoosingDialogViewModelTests.cs b/src/L10NSharp.Windows.Forms.Tests/LanguageChoosingDialogViewModelTests.cs similarity index 99% rename from src/L10NSharpWinformsTests/LanguageChoosingDialogViewModelTests.cs rename to src/L10NSharp.Windows.Forms.Tests/LanguageChoosingDialogViewModelTests.cs index 2127865..27b14e7 100644 --- a/src/L10NSharpWinformsTests/LanguageChoosingDialogViewModelTests.cs +++ b/src/L10NSharp.Windows.Forms.Tests/LanguageChoosingDialogViewModelTests.cs @@ -4,10 +4,10 @@ using System.Linq; using L10NSharp; using L10NSharp.Translators; -using L10NSharpWinforms.UI; +using L10NSharp.Windows.Forms.UI; using NUnit.Framework; -namespace L10NSharpWinformsTests +namespace L10NSharp.Windows.Forms.Tests { [TestFixture] class LanguageChoosingDialogViewModelTests diff --git a/src/L10NSharpWinformsTests/LocalizationExtenderTests.cs b/src/L10NSharp.Windows.Forms.Tests/LocalizationExtenderTests.cs similarity index 98% rename from src/L10NSharpWinformsTests/LocalizationExtenderTests.cs rename to src/L10NSharp.Windows.Forms.Tests/LocalizationExtenderTests.cs index 76476bc..abfea0c 100644 --- a/src/L10NSharpWinformsTests/LocalizationExtenderTests.cs +++ b/src/L10NSharp.Windows.Forms.Tests/LocalizationExtenderTests.cs @@ -1,11 +1,11 @@ using System.Collections.Generic; using System.Windows.Forms; using L10NSharp; -using L10NSharpWinforms.UI; +using L10NSharp.Windows.Forms.UI; using NUnit.Framework; -using L10NSharpWinforms; +using L10NSharp.Windows.Forms; -namespace L10NSharpWinformsTests +namespace L10NSharp.Windows.Forms.Tests { [TestFixture] public class LocalizationExtenderTests diff --git a/src/L10NSharpWinformsTests/LocalizingInfoTests.cs b/src/L10NSharp.Windows.Forms.Tests/LocalizingInfoTests.cs similarity index 97% rename from src/L10NSharpWinformsTests/LocalizingInfoTests.cs rename to src/L10NSharp.Windows.Forms.Tests/LocalizingInfoTests.cs index 182db87..7fe2f6f 100644 --- a/src/L10NSharpWinformsTests/LocalizingInfoTests.cs +++ b/src/L10NSharp.Windows.Forms.Tests/LocalizingInfoTests.cs @@ -1,9 +1,9 @@ using System.Windows.Forms; using NUnit.Framework; using L10NSharp; -using L10NSharpWinforms; +using L10NSharp.Windows.Forms; -namespace L10NSharpWinformsTests +namespace L10NSharp.Windows.Forms.Tests { [TestFixture] [Category("RequiresDisplay")] diff --git a/src/L10NSharpWinformsTests/MockLocalizableComponent.cs b/src/L10NSharp.Windows.Forms.Tests/MockLocalizableComponent.cs similarity index 97% rename from src/L10NSharpWinformsTests/MockLocalizableComponent.cs rename to src/L10NSharp.Windows.Forms.Tests/MockLocalizableComponent.cs index a1136f4..1021d70 100644 --- a/src/L10NSharpWinformsTests/MockLocalizableComponent.cs +++ b/src/L10NSharp.Windows.Forms.Tests/MockLocalizableComponent.cs @@ -3,10 +3,10 @@ using System.ComponentModel; using System.Windows.Forms; using L10NSharp; -using L10NSharpWinforms; -using L10NSharpWinforms.UI; +using L10NSharp.Windows.Forms; +using L10NSharp.Windows.Forms.UI; -namespace L10NSharpWinformsTests +namespace L10NSharp.Windows.Forms.Tests { class MockLocalizableComponent: ILocalizableComponent, IComponent { diff --git a/src/L10NSharpWinformsTests/Properties/Resources.Designer.cs b/src/L10NSharp.Windows.Forms.Tests/Properties/Resources.Designer.cs similarity index 98% rename from src/L10NSharpWinformsTests/Properties/Resources.Designer.cs rename to src/L10NSharp.Windows.Forms.Tests/Properties/Resources.Designer.cs index 621ba1c..6d7c8e6 100644 --- a/src/L10NSharpWinformsTests/Properties/Resources.Designer.cs +++ b/src/L10NSharp.Windows.Forms.Tests/Properties/Resources.Designer.cs @@ -8,7 +8,7 @@ // //------------------------------------------------------------------------------ -namespace L10NSharpWinformsTests.Properties { +namespace L10NSharp.Windows.Forms.Tests.Properties { using System; diff --git a/src/L10NSharpWinformsTests/Properties/Resources.resx b/src/L10NSharp.Windows.Forms.Tests/Properties/Resources.resx similarity index 100% rename from src/L10NSharpWinformsTests/Properties/Resources.resx rename to src/L10NSharp.Windows.Forms.Tests/Properties/Resources.resx diff --git a/src/L10NSharpWinformsTests/ReflectionHelper.cs b/src/L10NSharp.Windows.Forms.Tests/ReflectionHelper.cs similarity index 99% rename from src/L10NSharpWinformsTests/ReflectionHelper.cs rename to src/L10NSharp.Windows.Forms.Tests/ReflectionHelper.cs index 2d53e22..ec5ddf5 100644 --- a/src/L10NSharpWinformsTests/ReflectionHelper.cs +++ b/src/L10NSharp.Windows.Forms.Tests/ReflectionHelper.cs @@ -3,7 +3,7 @@ using System.IO; using System.Reflection; -namespace L10NSharpWinformsTests +namespace L10NSharp.Windows.Forms.Tests { public static class ReflectionHelper { diff --git a/src/L10NSharpWinformsTests/UtilsTests.cs b/src/L10NSharp.Windows.Forms.Tests/UtilsTests.cs similarity index 96% rename from src/L10NSharpWinformsTests/UtilsTests.cs rename to src/L10NSharp.Windows.Forms.Tests/UtilsTests.cs index 5ed63e2..a4273b2 100644 --- a/src/L10NSharpWinformsTests/UtilsTests.cs +++ b/src/L10NSharp.Windows.Forms.Tests/UtilsTests.cs @@ -3,7 +3,7 @@ using NUnit.Framework; using L10NSharp; -namespace L10NSharpWinformsTests +namespace L10NSharp.Windows.Forms.Tests { [TestFixture] public class UtilsTests diff --git a/src/L10NSharpWinforms/ILocalizableComponent.cs b/src/L10NSharp.Windows.Forms/ILocalizableComponent.cs similarity index 94% rename from src/L10NSharpWinforms/ILocalizableComponent.cs rename to src/L10NSharp.Windows.Forms/ILocalizableComponent.cs index caa3fd4..7648722 100644 --- a/src/L10NSharpWinforms/ILocalizableComponent.cs +++ b/src/L10NSharp.Windows.Forms/ILocalizableComponent.cs @@ -1,8 +1,8 @@ using System.Collections.Generic; -using L10NSharpWinforms.UI; +using L10NSharp.Windows.Forms.UI; using L10NSharp; -namespace L10NSharpWinforms +namespace L10NSharp.Windows.Forms { /// /// This interface allows a control to be localized by L10NSharp. It can be used to enable diff --git a/src/L10NSharpWinforms/ILocalizationManagerInternalWinforms.cs b/src/L10NSharp.Windows.Forms/ILocalizationManagerInternalWinforms.cs similarity index 96% rename from src/L10NSharpWinforms/ILocalizationManagerInternalWinforms.cs rename to src/L10NSharp.Windows.Forms/ILocalizationManagerInternalWinforms.cs index b8b6d0f..e035eed 100644 --- a/src/L10NSharpWinforms/ILocalizationManagerInternalWinforms.cs +++ b/src/L10NSharp.Windows.Forms/ILocalizationManagerInternalWinforms.cs @@ -8,7 +8,7 @@ using System.Windows.Forms; using L10NSharp; -namespace L10NSharpWinforms +namespace L10NSharp.Windows.Forms { internal interface ILocalizationManagerInternalWinforms: ILocalizationManagerInternal { diff --git a/src/L10NSharpWinforms/ILocalizedStringCacheWinforms.cs b/src/L10NSharp.Windows.Forms/ILocalizedStringCacheWinforms.cs similarity index 86% rename from src/L10NSharpWinforms/ILocalizedStringCacheWinforms.cs rename to src/L10NSharp.Windows.Forms/ILocalizedStringCacheWinforms.cs index 56f9bc7..509b2ad 100644 --- a/src/L10NSharpWinforms/ILocalizedStringCacheWinforms.cs +++ b/src/L10NSharp.Windows.Forms/ILocalizedStringCacheWinforms.cs @@ -3,9 +3,9 @@ using System.Collections.Generic; using System.Windows.Forms; -using L10NSharpWinforms.UI; +using L10NSharp.Windows.Forms.UI; -namespace L10NSharpWinforms +namespace L10NSharp.Windows.Forms { internal interface ILocalizedStringCacheWinforms:L10NSharp.ILocalizedStringCache { diff --git a/src/L10NSharpWinforms/L10NSharpWinforms.csproj b/src/L10NSharp.Windows.Forms/L10NSharp.Windows.Forms.csproj similarity index 87% rename from src/L10NSharpWinforms/L10NSharpWinforms.csproj rename to src/L10NSharp.Windows.Forms/L10NSharp.Windows.Forms.csproj index 1d86c38..a5b9292 100644 --- a/src/L10NSharpWinforms/L10NSharpWinforms.csproj +++ b/src/L10NSharp.Windows.Forms/L10NSharp.Windows.Forms.csproj @@ -1,9 +1,9 @@ - L10NSharpWinforms - L10NSharpWinforms is a .NET localization library for Windows Forms applications. It collects strings which need localization when your application first runs and saves them in a XLIFF file. It can also dynamically collect strings at runtime. - L10NSharpWinforms - L10NSharpWinforms + L10NSharp.Windows.Forms + L10NSharp.Windows.Forms is a .NET localization library for Windows Forms applications. It collects strings which need localization when your application first runs and saves them in a XLIFF file. It can also dynamically collect strings at runtime. + L10NSharp.Windows.Forms + L10NSharp.Windows.Forms True diff --git a/src/L10NSharpWinforms/LocalizationManagerInternalWinforms.cs b/src/L10NSharp.Windows.Forms/LocalizationManagerInternalWinforms.cs similarity index 98% rename from src/L10NSharpWinforms/LocalizationManagerInternalWinforms.cs rename to src/L10NSharp.Windows.Forms/LocalizationManagerInternalWinforms.cs index 03fc7b7..b070aec 100644 --- a/src/L10NSharpWinforms/LocalizationManagerInternalWinforms.cs +++ b/src/L10NSharp.Windows.Forms/LocalizationManagerInternalWinforms.cs @@ -12,11 +12,11 @@ using System.Reflection; using System.Windows.Forms; using L10NSharp; -using L10NSharpWinforms.XLiffUtils; -using L10NSharpWinforms.UI; +using L10NSharp.Windows.Forms.XLiffUtils; +using L10NSharp.Windows.Forms.UI; // ReSharper disable StaticMemberInGenericType - these static fields are parameter-independent -namespace L10NSharpWinforms +namespace L10NSharp.Windows.Forms { internal class LocalizationManagerInternalWinforms : LocalizationManagerInternal { diff --git a/src/L10NSharpWinforms/LocalizationManagerWinforms.cs b/src/L10NSharp.Windows.Forms/LocalizationManagerWinforms.cs similarity index 99% rename from src/L10NSharpWinforms/LocalizationManagerWinforms.cs rename to src/L10NSharp.Windows.Forms/LocalizationManagerWinforms.cs index 79dbd94..b193f4f 100644 --- a/src/L10NSharpWinforms/LocalizationManagerWinforms.cs +++ b/src/L10NSharp.Windows.Forms/LocalizationManagerWinforms.cs @@ -8,7 +8,7 @@ using System.Reflection; using System.Drawing; -namespace L10NSharpWinforms +namespace L10NSharp.Windows.Forms { public class LocalizationManagerWinforms : LocalizationManager { diff --git a/src/L10NSharpWinforms/LocalizingInfoWinforms.cs b/src/L10NSharp.Windows.Forms/LocalizingInfoWinforms.cs similarity index 99% rename from src/L10NSharpWinforms/LocalizingInfoWinforms.cs rename to src/L10NSharp.Windows.Forms/LocalizingInfoWinforms.cs index 6ece2b4..23de2e8 100644 --- a/src/L10NSharpWinforms/LocalizingInfoWinforms.cs +++ b/src/L10NSharp.Windows.Forms/LocalizingInfoWinforms.cs @@ -1,10 +1,10 @@ using System; using System.ComponentModel; using System.Windows.Forms; -using L10NSharpWinforms.UI; +using L10NSharp.Windows.Forms.UI; using L10NSharp; -namespace L10NSharpWinforms +namespace L10NSharp.Windows.Forms { /// ---------------------------------------------------------------------------------------- /// diff --git a/src/L10NSharp.Windows.Forms/Properties/AssemblyInfo.cs b/src/L10NSharp.Windows.Forms/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..707e25e --- /dev/null +++ b/src/L10NSharp.Windows.Forms/Properties/AssemblyInfo.cs @@ -0,0 +1,10 @@ +using System.Runtime.CompilerServices; + +// to get the public key, run: +// 1. extract the public key from the keyfile with +// sn –p +// 2. show the public key with +// sn -tp +// (use the full public key, not the public key token!) + +[assembly: InternalsVisibleTo("L10NSharp.Windows.Forms.Tests, PublicKey=002400000480000094000000060200000024000052534131000400000100010019cae48c6e5703818db31fcca17b87012eef38df95e3961c59b035190eace2c4ee5cfa1a258b84867c7549f60eec00ec1e0004c2ed224457128e841311cea0f5a05c3d69b3dfcb7422b214febce6e06c83ce4d29c62f36a7fd5564e922338c800372a5ec09638671b4db1fb33ccbb1dc48d8122ffe0d30dadbfbf325f65437b2")] diff --git a/src/L10NSharpWinforms/UI/ColorHelper.cs b/src/L10NSharp.Windows.Forms/UI/ColorHelper.cs similarity index 98% rename from src/L10NSharpWinforms/UI/ColorHelper.cs rename to src/L10NSharp.Windows.Forms/UI/ColorHelper.cs index 5f624b0..6c943c0 100644 --- a/src/L10NSharpWinforms/UI/ColorHelper.cs +++ b/src/L10NSharp.Windows.Forms/UI/ColorHelper.cs @@ -1,6 +1,6 @@ using System.Drawing; -namespace L10NSharpWinforms.UI +namespace L10NSharp.Windows.Forms.UI { internal static class ColorHelper { diff --git a/src/L10NSharpWinforms/UI/CustomDropDownComboBox.Designer.cs b/src/L10NSharp.Windows.Forms/UI/CustomDropDownComboBox.Designer.cs similarity index 98% rename from src/L10NSharpWinforms/UI/CustomDropDownComboBox.Designer.cs rename to src/L10NSharp.Windows.Forms/UI/CustomDropDownComboBox.Designer.cs index 36804a1..506332a 100644 --- a/src/L10NSharpWinforms/UI/CustomDropDownComboBox.Designer.cs +++ b/src/L10NSharp.Windows.Forms/UI/CustomDropDownComboBox.Designer.cs @@ -1,4 +1,4 @@ -namespace L10NSharpWinforms.UI +namespace L10NSharp.Windows.Forms.UI { partial class CustomDropDownComboBox { diff --git a/src/L10NSharpWinforms/UI/CustomDropDownComboBox.cs b/src/L10NSharp.Windows.Forms/UI/CustomDropDownComboBox.cs similarity index 99% rename from src/L10NSharpWinforms/UI/CustomDropDownComboBox.cs rename to src/L10NSharp.Windows.Forms/UI/CustomDropDownComboBox.cs index a5cfebb..b6f3c6b 100644 --- a/src/L10NSharpWinforms/UI/CustomDropDownComboBox.cs +++ b/src/L10NSharp.Windows.Forms/UI/CustomDropDownComboBox.cs @@ -3,7 +3,7 @@ using System.Windows.Forms; using System.Windows.Forms.VisualStyles; -namespace L10NSharpWinforms.UI +namespace L10NSharp.Windows.Forms.UI { /// ---------------------------------------------------------------------------------------- internal partial class CustomDropDownComboBox : UserControl diff --git a/src/L10NSharpWinforms/UI/CustomDropDownComboBox.resx b/src/L10NSharp.Windows.Forms/UI/CustomDropDownComboBox.resx similarity index 100% rename from src/L10NSharpWinforms/UI/CustomDropDownComboBox.resx rename to src/L10NSharp.Windows.Forms/UI/CustomDropDownComboBox.resx diff --git a/src/L10NSharpWinforms/UI/DontShowThisAgainButton.Designer.cs b/src/L10NSharp.Windows.Forms/UI/DontShowThisAgainButton.Designer.cs similarity index 96% rename from src/L10NSharpWinforms/UI/DontShowThisAgainButton.Designer.cs rename to src/L10NSharp.Windows.Forms/UI/DontShowThisAgainButton.Designer.cs index 30a594a..6331aac 100644 --- a/src/L10NSharpWinforms/UI/DontShowThisAgainButton.Designer.cs +++ b/src/L10NSharp.Windows.Forms/UI/DontShowThisAgainButton.Designer.cs @@ -1,4 +1,4 @@ -namespace L10NSharpWinforms.UI +namespace L10NSharp.Windows.Forms.UI { partial class DontShowThisAgainButton { diff --git a/src/L10NSharpWinforms/UI/DontShowThisAgainButton.cs b/src/L10NSharp.Windows.Forms/UI/DontShowThisAgainButton.cs similarity index 98% rename from src/L10NSharpWinforms/UI/DontShowThisAgainButton.cs rename to src/L10NSharp.Windows.Forms/UI/DontShowThisAgainButton.cs index 0647a2f..900b502 100644 --- a/src/L10NSharpWinforms/UI/DontShowThisAgainButton.cs +++ b/src/L10NSharp.Windows.Forms/UI/DontShowThisAgainButton.cs @@ -7,7 +7,7 @@ using System.Windows.Forms; using L10NSharp.Properties; -namespace L10NSharpWinforms.UI +namespace L10NSharp.Windows.Forms.UI { public partial class DontShowThisAgainButton : CheckBox { diff --git a/src/L10NSharpWinforms/UI/EditSourceBeforeTranslatingDlg.Designer.cs b/src/L10NSharp.Windows.Forms/UI/EditSourceBeforeTranslatingDlg.Designer.cs similarity index 99% rename from src/L10NSharpWinforms/UI/EditSourceBeforeTranslatingDlg.Designer.cs rename to src/L10NSharp.Windows.Forms/UI/EditSourceBeforeTranslatingDlg.Designer.cs index 034537b..b926289 100644 --- a/src/L10NSharpWinforms/UI/EditSourceBeforeTranslatingDlg.Designer.cs +++ b/src/L10NSharp.Windows.Forms/UI/EditSourceBeforeTranslatingDlg.Designer.cs @@ -1,4 +1,4 @@ -namespace L10NSharpWinforms.UI +namespace L10NSharp.Windows.Forms.UI { partial class EditSourceBeforeTranslatingDlg { diff --git a/src/L10NSharpWinforms/UI/EditSourceBeforeTranslatingDlg.cs b/src/L10NSharp.Windows.Forms/UI/EditSourceBeforeTranslatingDlg.cs similarity index 97% rename from src/L10NSharpWinforms/UI/EditSourceBeforeTranslatingDlg.cs rename to src/L10NSharp.Windows.Forms/UI/EditSourceBeforeTranslatingDlg.cs index a1cb847..bdbb47a 100644 --- a/src/L10NSharpWinforms/UI/EditSourceBeforeTranslatingDlg.cs +++ b/src/L10NSharp.Windows.Forms/UI/EditSourceBeforeTranslatingDlg.cs @@ -4,7 +4,7 @@ using System.Windows.Forms; using L10NSharp.Translators; -namespace L10NSharpWinforms.UI +namespace L10NSharp.Windows.Forms.UI { public partial class EditSourceBeforeTranslatingDlg : Form { diff --git a/src/L10NSharpWinforms/UI/EditSourceBeforeTranslatingDlg.resx b/src/L10NSharp.Windows.Forms/UI/EditSourceBeforeTranslatingDlg.resx similarity index 100% rename from src/L10NSharpWinforms/UI/EditSourceBeforeTranslatingDlg.resx rename to src/L10NSharp.Windows.Forms/UI/EditSourceBeforeTranslatingDlg.resx diff --git a/src/L10NSharpWinforms/UI/FallbackLanguagesDlg.cs b/src/L10NSharp.Windows.Forms/UI/FallbackLanguagesDlg.cs similarity index 96% rename from src/L10NSharpWinforms/UI/FallbackLanguagesDlg.cs rename to src/L10NSharp.Windows.Forms/UI/FallbackLanguagesDlg.cs index abd2827..4905521 100644 --- a/src/L10NSharpWinforms/UI/FallbackLanguagesDlg.cs +++ b/src/L10NSharp.Windows.Forms/UI/FallbackLanguagesDlg.cs @@ -7,7 +7,7 @@ using System.Windows.Forms; using L10NSharp; -namespace L10NSharpWinforms.UI +namespace L10NSharp.Windows.Forms.UI { public class FallbackLanguagesDlg : FallbackLanguagesDlgBase { diff --git a/src/L10NSharpWinforms/UI/FallbackLanguagesDlgBase.Designer.cs b/src/L10NSharp.Windows.Forms/UI/FallbackLanguagesDlgBase.Designer.cs similarity index 99% rename from src/L10NSharpWinforms/UI/FallbackLanguagesDlgBase.Designer.cs rename to src/L10NSharp.Windows.Forms/UI/FallbackLanguagesDlgBase.Designer.cs index 2c1b834..7917c3f 100644 --- a/src/L10NSharpWinforms/UI/FallbackLanguagesDlgBase.Designer.cs +++ b/src/L10NSharp.Windows.Forms/UI/FallbackLanguagesDlgBase.Designer.cs @@ -1,4 +1,4 @@ -namespace L10NSharpWinforms.UI +namespace L10NSharp.Windows.Forms.UI { partial class FallbackLanguagesDlgBase { diff --git a/src/L10NSharpWinforms/UI/FallbackLanguagesDlgBase.cs b/src/L10NSharp.Windows.Forms/UI/FallbackLanguagesDlgBase.cs similarity index 99% rename from src/L10NSharpWinforms/UI/FallbackLanguagesDlgBase.cs rename to src/L10NSharp.Windows.Forms/UI/FallbackLanguagesDlgBase.cs index aefc88b..f5cb7b1 100644 --- a/src/L10NSharpWinforms/UI/FallbackLanguagesDlgBase.cs +++ b/src/L10NSharp.Windows.Forms/UI/FallbackLanguagesDlgBase.cs @@ -5,7 +5,7 @@ using System.Windows.Forms; using L10NSharp; -namespace L10NSharpWinforms.UI +namespace L10NSharp.Windows.Forms.UI { /// ------------------------------------------------------------------------------------ public partial class FallbackLanguagesDlgBase : Form diff --git a/src/L10NSharpWinforms/UI/FallbackLanguagesDlgBase.resx b/src/L10NSharp.Windows.Forms/UI/FallbackLanguagesDlgBase.resx similarity index 100% rename from src/L10NSharpWinforms/UI/FallbackLanguagesDlgBase.resx rename to src/L10NSharp.Windows.Forms/UI/FallbackLanguagesDlgBase.resx diff --git a/src/L10NSharpWinforms/UI/Grid/LmButtonCell.cs b/src/L10NSharp.Windows.Forms/UI/Grid/LmButtonCell.cs similarity index 99% rename from src/L10NSharpWinforms/UI/Grid/LmButtonCell.cs rename to src/L10NSharp.Windows.Forms/UI/Grid/LmButtonCell.cs index 18b88ec..b343bd0 100644 --- a/src/L10NSharpWinforms/UI/Grid/LmButtonCell.cs +++ b/src/L10NSharp.Windows.Forms/UI/Grid/LmButtonCell.cs @@ -3,7 +3,7 @@ using System.Windows.Forms; using System.Windows.Forms.VisualStyles; -namespace L10NSharpWinforms.UI +namespace L10NSharp.Windows.Forms.UI { #region LmButtonCell class /// ---------------------------------------------------------------------------------------- diff --git a/src/L10NSharpWinforms/UI/Grid/LmButtonColumn.cs b/src/L10NSharp.Windows.Forms/UI/Grid/LmButtonColumn.cs similarity index 99% rename from src/L10NSharpWinforms/UI/Grid/LmButtonColumn.cs rename to src/L10NSharp.Windows.Forms/UI/Grid/LmButtonColumn.cs index de9da57..b97e8ab 100644 --- a/src/L10NSharpWinforms/UI/Grid/LmButtonColumn.cs +++ b/src/L10NSharp.Windows.Forms/UI/Grid/LmButtonColumn.cs @@ -2,7 +2,7 @@ using System.Drawing; using System.Windows.Forms; -namespace L10NSharpWinforms.UI +namespace L10NSharp.Windows.Forms.UI { /// ---------------------------------------------------------------------------------------- public class LmButtonColumn : DataGridViewColumn diff --git a/src/L10NSharpWinforms/UI/Grid/LmGrid.cs b/src/L10NSharp.Windows.Forms/UI/Grid/LmGrid.cs similarity index 99% rename from src/L10NSharpWinforms/UI/Grid/LmGrid.cs rename to src/L10NSharp.Windows.Forms/UI/Grid/LmGrid.cs index 7db5d43..89df711 100644 --- a/src/L10NSharpWinforms/UI/Grid/LmGrid.cs +++ b/src/L10NSharp.Windows.Forms/UI/Grid/LmGrid.cs @@ -7,7 +7,7 @@ using System.Windows.Forms; using System.Windows.Forms.VisualStyles; -namespace L10NSharpWinforms.UI +namespace L10NSharp.Windows.Forms.UI { /// ---------------------------------------------------------------------------------------- public class LmGrid : DataGridView diff --git a/src/L10NSharpWinforms/UI/HowToDistributeDialog.Designer.cs b/src/L10NSharp.Windows.Forms/UI/HowToDistributeDialog.Designer.cs similarity index 99% rename from src/L10NSharpWinforms/UI/HowToDistributeDialog.Designer.cs rename to src/L10NSharp.Windows.Forms/UI/HowToDistributeDialog.Designer.cs index f92515c..3a88148 100644 --- a/src/L10NSharpWinforms/UI/HowToDistributeDialog.Designer.cs +++ b/src/L10NSharp.Windows.Forms/UI/HowToDistributeDialog.Designer.cs @@ -1,4 +1,4 @@ -namespace L10NSharpWinforms.UI +namespace L10NSharp.Windows.Forms.UI { partial class HowToDistributeDialog { diff --git a/src/L10NSharpWinforms/UI/HowToDistributeDialog.cs b/src/L10NSharp.Windows.Forms/UI/HowToDistributeDialog.cs similarity index 98% rename from src/L10NSharpWinforms/UI/HowToDistributeDialog.cs rename to src/L10NSharp.Windows.Forms/UI/HowToDistributeDialog.cs index 4b29355..0286910 100644 --- a/src/L10NSharpWinforms/UI/HowToDistributeDialog.cs +++ b/src/L10NSharp.Windows.Forms/UI/HowToDistributeDialog.cs @@ -5,7 +5,7 @@ using System.Windows.Forms; using L10NSharp; -namespace L10NSharpWinforms.UI +namespace L10NSharp.Windows.Forms.UI { public partial class HowToDistributeDialog : Form { diff --git a/src/L10NSharpWinforms/UI/HowToDistributeDialog.resx b/src/L10NSharp.Windows.Forms/UI/HowToDistributeDialog.resx similarity index 100% rename from src/L10NSharpWinforms/UI/HowToDistributeDialog.resx rename to src/L10NSharp.Windows.Forms/UI/HowToDistributeDialog.resx diff --git a/src/L10NSharpWinforms/UI/InitializationProgressDlg.cs b/src/L10NSharp.Windows.Forms/UI/InitializationProgressDlg.cs similarity index 98% rename from src/L10NSharpWinforms/UI/InitializationProgressDlg.cs rename to src/L10NSharp.Windows.Forms/UI/InitializationProgressDlg.cs index 2805ab8..c28ff7d 100644 --- a/src/L10NSharpWinforms/UI/InitializationProgressDlg.cs +++ b/src/L10NSharp.Windows.Forms/UI/InitializationProgressDlg.cs @@ -7,7 +7,7 @@ using L10NSharp.CodeReader; using L10NSharp; -namespace L10NSharpWinforms.UI +namespace L10NSharp.Windows.Forms.UI { internal class InitializationProgressDlg: InitializationProgressDlgBase { diff --git a/src/L10NSharpWinforms/UI/InitializationProgressDlgBase.Designer.cs b/src/L10NSharp.Windows.Forms/UI/InitializationProgressDlgBase.Designer.cs similarity index 99% rename from src/L10NSharpWinforms/UI/InitializationProgressDlgBase.Designer.cs rename to src/L10NSharp.Windows.Forms/UI/InitializationProgressDlgBase.Designer.cs index 8620bc9..e4d1cee 100644 --- a/src/L10NSharpWinforms/UI/InitializationProgressDlgBase.Designer.cs +++ b/src/L10NSharp.Windows.Forms/UI/InitializationProgressDlgBase.Designer.cs @@ -1,4 +1,4 @@ -namespace L10NSharpWinforms.UI +namespace L10NSharp.Windows.Forms.UI { partial class InitializationProgressDlgBase { diff --git a/src/L10NSharpWinforms/UI/InitializationProgressDlgBase.cs b/src/L10NSharp.Windows.Forms/UI/InitializationProgressDlgBase.cs similarity index 98% rename from src/L10NSharpWinforms/UI/InitializationProgressDlgBase.cs rename to src/L10NSharp.Windows.Forms/UI/InitializationProgressDlgBase.cs index ffc4d49..36a0823 100644 --- a/src/L10NSharpWinforms/UI/InitializationProgressDlgBase.cs +++ b/src/L10NSharp.Windows.Forms/UI/InitializationProgressDlgBase.cs @@ -5,7 +5,7 @@ using System.Reflection; using System.Windows.Forms; -namespace L10NSharpWinforms.UI +namespace L10NSharp.Windows.Forms.UI { /// ---------------------------------------------------------------------------------------- internal partial class InitializationProgressDlgBase : Form diff --git a/src/L10NSharpWinforms/UI/InitializationProgressDlgBase.resx b/src/L10NSharp.Windows.Forms/UI/InitializationProgressDlgBase.resx similarity index 100% rename from src/L10NSharpWinforms/UI/InitializationProgressDlgBase.resx rename to src/L10NSharp.Windows.Forms/UI/InitializationProgressDlgBase.resx diff --git a/src/L10NSharpWinforms/UI/L10NExtender.cs b/src/L10NSharp.Windows.Forms/UI/L10NExtender.cs similarity index 99% rename from src/L10NSharpWinforms/UI/L10NExtender.cs rename to src/L10NSharp.Windows.Forms/UI/L10NExtender.cs index ea4a7ba..651fb1c 100644 --- a/src/L10NSharpWinforms/UI/L10NExtender.cs +++ b/src/L10NSharp.Windows.Forms/UI/L10NExtender.cs @@ -23,7 +23,7 @@ using System.Windows.Forms; using L10NSharp; -namespace L10NSharpWinforms.UI +namespace L10NSharp.Windows.Forms.UI { /// ---------------------------------------------------------------------------------------- [ProvideProperty("LocalizingId", typeof(IComponent))] diff --git a/src/L10NSharpWinforms/UI/L10NExtender.resx b/src/L10NSharp.Windows.Forms/UI/L10NExtender.resx similarity index 100% rename from src/L10NSharpWinforms/UI/L10NExtender.resx rename to src/L10NSharp.Windows.Forms/UI/L10NExtender.resx diff --git a/src/L10NSharpWinforms/UI/LanguageChoosingDialog.Designer.cs b/src/L10NSharp.Windows.Forms/UI/LanguageChoosingDialog.Designer.cs similarity index 97% rename from src/L10NSharpWinforms/UI/LanguageChoosingDialog.Designer.cs rename to src/L10NSharp.Windows.Forms/UI/LanguageChoosingDialog.Designer.cs index dd56e1b..430595a 100644 --- a/src/L10NSharpWinforms/UI/LanguageChoosingDialog.Designer.cs +++ b/src/L10NSharp.Windows.Forms/UI/LanguageChoosingDialog.Designer.cs @@ -1,6 +1,6 @@ using System.Drawing; -namespace L10NSharpWinforms.UI +namespace L10NSharp.Windows.Forms.UI { partial class LanguageChoosingDialog { @@ -32,7 +32,7 @@ private void InitializeComponent() { this._messageLabel = new System.Windows.Forms.Label(); this._OKButton = new System.Windows.Forms.Button(); - this.uiLanguageComboBox1 = new L10NSharpWinforms.UI.UILanguageComboBox(); + this.uiLanguageComboBox1 = new L10NSharp.Windows.Forms.UI.UILanguageComboBox(); this.SuspendLayout(); // // _messageLabel diff --git a/src/L10NSharpWinforms/UI/LanguageChoosingDialog.cs b/src/L10NSharp.Windows.Forms/UI/LanguageChoosingDialog.cs similarity index 96% rename from src/L10NSharpWinforms/UI/LanguageChoosingDialog.cs rename to src/L10NSharp.Windows.Forms/UI/LanguageChoosingDialog.cs index 3a614ef..9d1a656 100644 --- a/src/L10NSharpWinforms/UI/LanguageChoosingDialog.cs +++ b/src/L10NSharp.Windows.Forms/UI/LanguageChoosingDialog.cs @@ -4,7 +4,7 @@ using L10NSharp.Translators; using L10NSharp; -namespace L10NSharpWinforms.UI +namespace L10NSharp.Windows.Forms.UI { public partial class LanguageChoosingDialog : Form { diff --git a/src/L10NSharpWinforms/UI/LanguageChoosingDialog.resx b/src/L10NSharp.Windows.Forms/UI/LanguageChoosingDialog.resx similarity index 100% rename from src/L10NSharpWinforms/UI/LanguageChoosingDialog.resx rename to src/L10NSharp.Windows.Forms/UI/LanguageChoosingDialog.resx diff --git a/src/L10NSharpWinforms/UI/LanguageChoosingDialogViewModel.cs b/src/L10NSharp.Windows.Forms/UI/LanguageChoosingDialogViewModel.cs similarity index 99% rename from src/L10NSharpWinforms/UI/LanguageChoosingDialogViewModel.cs rename to src/L10NSharp.Windows.Forms/UI/LanguageChoosingDialogViewModel.cs index 4a3228c..4f5ab3f 100644 --- a/src/L10NSharpWinforms/UI/LanguageChoosingDialogViewModel.cs +++ b/src/L10NSharp.Windows.Forms/UI/LanguageChoosingDialogViewModel.cs @@ -3,7 +3,7 @@ using L10NSharp.Translators; using L10NSharp; -namespace L10NSharpWinforms.UI +namespace L10NSharp.Windows.Forms.UI { internal class LanguageChoosingDialogViewModel { diff --git a/src/L10NSharpWinforms/UI/LanguageChoosingSimpleDialog.Designer.cs b/src/L10NSharp.Windows.Forms/UI/LanguageChoosingSimpleDialog.Designer.cs similarity index 93% rename from src/L10NSharpWinforms/UI/LanguageChoosingSimpleDialog.Designer.cs rename to src/L10NSharp.Windows.Forms/UI/LanguageChoosingSimpleDialog.Designer.cs index d4c09ca..d1ec13f 100644 --- a/src/L10NSharpWinforms/UI/LanguageChoosingSimpleDialog.Designer.cs +++ b/src/L10NSharp.Windows.Forms/UI/LanguageChoosingSimpleDialog.Designer.cs @@ -1,4 +1,4 @@ -namespace L10NSharpWinforms.UI +namespace L10NSharp.Windows.Forms.UI { partial class LanguageChoosingSimpleDialog { @@ -28,7 +28,7 @@ protected override void Dispose(bool disposing) /// private void InitializeComponent() { - this._uiLanguageListBox = new L10NSharpWinforms.UI.UILanguageListBox(); + this._uiLanguageListBox = new L10NSharp.Windows.Forms.UI.UILanguageListBox(); this._btnOk = new System.Windows.Forms.Button(); this.SuspendLayout(); // @@ -77,7 +77,7 @@ private void InitializeComponent() #endregion - private L10NSharpWinforms.UI.UILanguageListBox _uiLanguageListBox; + private L10NSharp.Windows.Forms.UI.UILanguageListBox _uiLanguageListBox; private System.Windows.Forms.Button _btnOk; } } diff --git a/src/L10NSharpWinforms/UI/LanguageChoosingSimpleDialog.cs b/src/L10NSharp.Windows.Forms/UI/LanguageChoosingSimpleDialog.cs similarity index 95% rename from src/L10NSharpWinforms/UI/LanguageChoosingSimpleDialog.cs rename to src/L10NSharp.Windows.Forms/UI/LanguageChoosingSimpleDialog.cs index 3adfd82..d1f32fc 100644 --- a/src/L10NSharpWinforms/UI/LanguageChoosingSimpleDialog.cs +++ b/src/L10NSharp.Windows.Forms/UI/LanguageChoosingSimpleDialog.cs @@ -2,7 +2,7 @@ using System.Drawing; using System.Windows.Forms; -namespace L10NSharpWinforms.UI +namespace L10NSharp.Windows.Forms.UI { /// /// The current thinking for use of this dialog is when an application first starts up, diff --git a/src/L10NSharpWinforms/UI/LanguageChoosingSimpleDialog.resx b/src/L10NSharp.Windows.Forms/UI/LanguageChoosingSimpleDialog.resx similarity index 100% rename from src/L10NSharpWinforms/UI/LanguageChoosingSimpleDialog.resx rename to src/L10NSharp.Windows.Forms/UI/LanguageChoosingSimpleDialog.resx diff --git a/src/L10NSharpWinforms/UI/LocTreeNode.cs b/src/L10NSharp.Windows.Forms/UI/LocTreeNode.cs similarity index 98% rename from src/L10NSharpWinforms/UI/LocTreeNode.cs rename to src/L10NSharp.Windows.Forms/UI/LocTreeNode.cs index 2069cbc..4acf43e 100644 --- a/src/L10NSharpWinforms/UI/LocTreeNode.cs +++ b/src/L10NSharp.Windows.Forms/UI/LocTreeNode.cs @@ -2,7 +2,7 @@ using System.Linq; using System.Windows.Forms; -namespace L10NSharpWinforms.UI +namespace L10NSharp.Windows.Forms.UI { /// ---------------------------------------------------------------------------------------- internal class LocTreeNode : TreeNode diff --git a/src/L10NSharpWinforms/UI/LocalizeItemDlg.Designer.cs b/src/L10NSharp.Windows.Forms/UI/LocalizeItemDlg.Designer.cs similarity index 99% rename from src/L10NSharpWinforms/UI/LocalizeItemDlg.Designer.cs rename to src/L10NSharp.Windows.Forms/UI/LocalizeItemDlg.Designer.cs index 8128b71..53a0542 100644 --- a/src/L10NSharpWinforms/UI/LocalizeItemDlg.Designer.cs +++ b/src/L10NSharp.Windows.Forms/UI/LocalizeItemDlg.Designer.cs @@ -1,4 +1,4 @@ -namespace L10NSharpWinforms.UI +namespace L10NSharp.Windows.Forms.UI { partial class LocalizeItemDlg { @@ -43,15 +43,15 @@ private void InitializeComponent() this._treeView = new System.Windows.Forms.TreeView(); this._toolStripLeftSide = new System.Windows.Forms.ToolStrip(); this._labelGroups = new System.Windows.Forms.ToolStripLabel(); - this._buttonMoveNext = new L10NSharpWinforms.UI.XButton(); - this._grid = new L10NSharpWinforms.UI.LmGrid(); + this._buttonMoveNext = new L10NSharp.Windows.Forms.UI.XButton(); + this._grid = new L10NSharp.Windows.Forms.UI.LmGrid(); this._colId = new System.Windows.Forms.DataGridViewTextBoxColumn(); this._colSourceText = new System.Windows.Forms.DataGridViewTextBoxColumn(); this._colTargetText = new System.Windows.Forms.DataGridViewTextBoxColumn(); this._colSrcToolTip = new System.Windows.Forms.DataGridViewTextBoxColumn(); this._colTgtToolTip = new System.Windows.Forms.DataGridViewTextBoxColumn(); this._colComments = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this._buttonMovePrev = new L10NSharpWinforms.UI.XButton(); + this._buttonMovePrev = new L10NSharp.Windows.Forms.UI.XButton(); this._toolStripRightSide = new System.Windows.Forms.ToolStrip(); this._buttonBingTranslator = new System.Windows.Forms.ToolStripSplitButton(); this._menuTranslateUsingBing = new System.Windows.Forms.ToolStripMenuItem(); @@ -62,13 +62,13 @@ private void InitializeComponent() this._labelSourceLang = new System.Windows.Forms.ToolStripLabel(); this._tableLayout = new System.Windows.Forms.TableLayoutPanel(); this._panelIdentifier = new System.Windows.Forms.Panel(); - this.btnCopyToolTip = new L10NSharpWinforms.UI.XButton(); - this.btnCopyShortcutKeys = new L10NSharpWinforms.UI.XButton(); - this.btnCopyText = new L10NSharpWinforms.UI.XButton(); + this.btnCopyToolTip = new L10NSharp.Windows.Forms.UI.XButton(); + this.btnCopyShortcutKeys = new L10NSharp.Windows.Forms.UI.XButton(); + this.btnCopyText = new L10NSharp.Windows.Forms.UI.XButton(); this._panelTargetText = new System.Windows.Forms.Panel(); this._groupBoxTgtTranslation = new System.Windows.Forms.GroupBox(); this._labelTgtShortcutKeys = new System.Windows.Forms.Label(); - this._shortcutKeysDropDown = new L10NSharpWinforms.UI.ShortcutKeysDropDown(); + this._shortcutKeysDropDown = new L10NSharp.Windows.Forms.UI.ShortcutKeysDropDown(); this._labelTgtToolTip = new System.Windows.Forms.Label(); this._textBoxTgtToolTip = new System.Windows.Forms.TextBox(); this._panelSourceText = new System.Windows.Forms.Panel(); diff --git a/src/L10NSharpWinforms/UI/LocalizeItemDlg.cs b/src/L10NSharp.Windows.Forms/UI/LocalizeItemDlg.cs similarity index 99% rename from src/L10NSharpWinforms/UI/LocalizeItemDlg.cs rename to src/L10NSharp.Windows.Forms/UI/LocalizeItemDlg.cs index 274b8f6..857500b 100644 --- a/src/L10NSharpWinforms/UI/LocalizeItemDlg.cs +++ b/src/L10NSharp.Windows.Forms/UI/LocalizeItemDlg.cs @@ -8,7 +8,7 @@ using L10NSharp.Properties; using L10NSharp; -namespace L10NSharpWinforms.UI +namespace L10NSharp.Windows.Forms.UI { /// ---------------------------------------------------------------------------------------- public partial class LocalizeItemDlg : Form diff --git a/src/L10NSharpWinforms/UI/LocalizeItemDlg.resx b/src/L10NSharp.Windows.Forms/UI/LocalizeItemDlg.resx similarity index 100% rename from src/L10NSharpWinforms/UI/LocalizeItemDlg.resx rename to src/L10NSharp.Windows.Forms/UI/LocalizeItemDlg.resx diff --git a/src/L10NSharpWinforms/UI/LocalizeItemDlgViewModel.cs b/src/L10NSharp.Windows.Forms/UI/LocalizeItemDlgViewModel.cs similarity index 99% rename from src/L10NSharpWinforms/UI/LocalizeItemDlgViewModel.cs rename to src/L10NSharp.Windows.Forms/UI/LocalizeItemDlgViewModel.cs index d43b872..be3bc87 100644 --- a/src/L10NSharpWinforms/UI/LocalizeItemDlgViewModel.cs +++ b/src/L10NSharp.Windows.Forms/UI/LocalizeItemDlgViewModel.cs @@ -7,7 +7,7 @@ using L10NSharp.Translators; using L10NSharp; -namespace L10NSharpWinforms.UI +namespace L10NSharp.Windows.Forms.UI { internal class LocalizeItemDlgViewModel { diff --git a/src/L10NSharpWinforms/UI/NodeComparer.cs b/src/L10NSharp.Windows.Forms/UI/NodeComparer.cs similarity index 98% rename from src/L10NSharpWinforms/UI/NodeComparer.cs rename to src/L10NSharp.Windows.Forms/UI/NodeComparer.cs index f1a78ff..be386fd 100644 --- a/src/L10NSharpWinforms/UI/NodeComparer.cs +++ b/src/L10NSharp.Windows.Forms/UI/NodeComparer.cs @@ -5,7 +5,7 @@ using System.Globalization; using System.Windows.Forms; -namespace L10NSharpWinforms.UI +namespace L10NSharp.Windows.Forms.UI { /// ---------------------------------------------------------------------------------------- internal class NodeComparer : IComparer> diff --git a/src/L10NSharpWinforms/UI/PaintingHelper.cs b/src/L10NSharp.Windows.Forms/UI/PaintingHelper.cs similarity index 99% rename from src/L10NSharpWinforms/UI/PaintingHelper.cs rename to src/L10NSharp.Windows.Forms/UI/PaintingHelper.cs index 6987dfc..e87fc74 100644 --- a/src/L10NSharpWinforms/UI/PaintingHelper.cs +++ b/src/L10NSharp.Windows.Forms/UI/PaintingHelper.cs @@ -5,7 +5,7 @@ using System.Windows.Forms; using System.Windows.Forms.VisualStyles; -namespace L10NSharpWinforms.UI +namespace L10NSharp.Windows.Forms.UI { /// ------------------------------------------------------------------------------------ /// diff --git a/src/L10NSharpWinforms/UI/PopupControl.cs b/src/L10NSharp.Windows.Forms/UI/PopupControl.cs similarity index 99% rename from src/L10NSharpWinforms/UI/PopupControl.cs rename to src/L10NSharp.Windows.Forms/UI/PopupControl.cs index 61f6265..2559683 100644 --- a/src/L10NSharpWinforms/UI/PopupControl.cs +++ b/src/L10NSharp.Windows.Forms/UI/PopupControl.cs @@ -5,7 +5,7 @@ using System.Drawing.Drawing2D; using System.Windows.Forms; -namespace L10NSharpWinforms.UI +namespace L10NSharp.Windows.Forms.UI { /// ---------------------------------------------------------------------------------------- internal partial class PopupControl : UserControl diff --git a/src/L10NSharpWinforms/UI/PopupControl.designer.cs b/src/L10NSharp.Windows.Forms/UI/PopupControl.designer.cs similarity index 95% rename from src/L10NSharpWinforms/UI/PopupControl.designer.cs rename to src/L10NSharp.Windows.Forms/UI/PopupControl.designer.cs index 3b5c072..77e49e6 100644 --- a/src/L10NSharpWinforms/UI/PopupControl.designer.cs +++ b/src/L10NSharp.Windows.Forms/UI/PopupControl.designer.cs @@ -1,4 +1,4 @@ -namespace L10NSharpWinforms.UI +namespace L10NSharp.Windows.Forms.UI { partial class PopupControl { diff --git a/src/L10NSharpWinforms/UI/PopupControl.resx b/src/L10NSharp.Windows.Forms/UI/PopupControl.resx similarity index 100% rename from src/L10NSharpWinforms/UI/PopupControl.resx rename to src/L10NSharp.Windows.Forms/UI/PopupControl.resx diff --git a/src/L10NSharpWinforms/UI/ShortcutKeysDropDown.cs b/src/L10NSharp.Windows.Forms/UI/ShortcutKeysDropDown.cs similarity index 98% rename from src/L10NSharpWinforms/UI/ShortcutKeysDropDown.cs rename to src/L10NSharp.Windows.Forms/UI/ShortcutKeysDropDown.cs index d8d378a..9d5e178 100644 --- a/src/L10NSharpWinforms/UI/ShortcutKeysDropDown.cs +++ b/src/L10NSharp.Windows.Forms/UI/ShortcutKeysDropDown.cs @@ -1,7 +1,7 @@ using System; using System.Windows.Forms; -namespace L10NSharpWinforms.UI +namespace L10NSharp.Windows.Forms.UI { /// ---------------------------------------------------------------------------------------- internal class ShortcutKeysDropDown : CustomDropDownComboBox diff --git a/src/L10NSharpWinforms/UI/ShortcutKeysEditor.Designer.cs b/src/L10NSharp.Windows.Forms/UI/ShortcutKeysEditor.Designer.cs similarity index 99% rename from src/L10NSharpWinforms/UI/ShortcutKeysEditor.Designer.cs rename to src/L10NSharp.Windows.Forms/UI/ShortcutKeysEditor.Designer.cs index 0816429..aea4214 100644 --- a/src/L10NSharpWinforms/UI/ShortcutKeysEditor.Designer.cs +++ b/src/L10NSharp.Windows.Forms/UI/ShortcutKeysEditor.Designer.cs @@ -1,4 +1,4 @@ -namespace L10NSharpWinforms.UI +namespace L10NSharp.Windows.Forms.UI { partial class ShortcutKeysEditor { diff --git a/src/L10NSharpWinforms/UI/ShortcutKeysEditor.cs b/src/L10NSharp.Windows.Forms/UI/ShortcutKeysEditor.cs similarity index 99% rename from src/L10NSharpWinforms/UI/ShortcutKeysEditor.cs rename to src/L10NSharp.Windows.Forms/UI/ShortcutKeysEditor.cs index 1d1ff35..d516a02 100644 --- a/src/L10NSharpWinforms/UI/ShortcutKeysEditor.cs +++ b/src/L10NSharp.Windows.Forms/UI/ShortcutKeysEditor.cs @@ -2,7 +2,7 @@ using System.Drawing; using System.Windows.Forms; -namespace L10NSharpWinforms.UI +namespace L10NSharp.Windows.Forms.UI { /// ---------------------------------------------------------------------------------------- internal partial class ShortcutKeysEditor : PopupControl diff --git a/src/L10NSharpWinforms/UI/ShortcutKeysEditor.resx b/src/L10NSharp.Windows.Forms/UI/ShortcutKeysEditor.resx similarity index 100% rename from src/L10NSharpWinforms/UI/ShortcutKeysEditor.resx rename to src/L10NSharp.Windows.Forms/UI/ShortcutKeysEditor.resx diff --git a/src/L10NSharpWinforms/UI/TipDialog.cs b/src/L10NSharp.Windows.Forms/UI/TipDialog.cs similarity index 98% rename from src/L10NSharpWinforms/UI/TipDialog.cs rename to src/L10NSharp.Windows.Forms/UI/TipDialog.cs index 7761f14..c3385a1 100644 --- a/src/L10NSharpWinforms/UI/TipDialog.cs +++ b/src/L10NSharp.Windows.Forms/UI/TipDialog.cs @@ -3,7 +3,7 @@ using System.Windows.Forms; using L10NSharp.Properties; -namespace L10NSharpWinforms.UI +namespace L10NSharp.Windows.Forms.UI { public partial class TipDialog : Form { diff --git a/src/L10NSharpWinforms/UI/TipDialog.designer.cs b/src/L10NSharp.Windows.Forms/UI/TipDialog.designer.cs similarity index 99% rename from src/L10NSharpWinforms/UI/TipDialog.designer.cs rename to src/L10NSharp.Windows.Forms/UI/TipDialog.designer.cs index c1f7562..91e0648 100644 --- a/src/L10NSharpWinforms/UI/TipDialog.designer.cs +++ b/src/L10NSharp.Windows.Forms/UI/TipDialog.designer.cs @@ -1,4 +1,4 @@ -namespace L10NSharpWinforms.UI +namespace L10NSharp.Windows.Forms.UI { partial class TipDialog { diff --git a/src/L10NSharpWinforms/UI/TipDialog.resx b/src/L10NSharp.Windows.Forms/UI/TipDialog.resx similarity index 100% rename from src/L10NSharpWinforms/UI/TipDialog.resx rename to src/L10NSharp.Windows.Forms/UI/TipDialog.resx diff --git a/src/L10NSharpWinforms/UI/UILanguageComboBox.cs b/src/L10NSharp.Windows.Forms/UI/UILanguageComboBox.cs similarity index 98% rename from src/L10NSharpWinforms/UI/UILanguageComboBox.cs rename to src/L10NSharp.Windows.Forms/UI/UILanguageComboBox.cs index b955834..d741496 100644 --- a/src/L10NSharpWinforms/UI/UILanguageComboBox.cs +++ b/src/L10NSharp.Windows.Forms/UI/UILanguageComboBox.cs @@ -5,7 +5,7 @@ using System.Windows.Forms; using L10NSharp; -namespace L10NSharpWinforms.UI +namespace L10NSharp.Windows.Forms.UI { /// ---------------------------------------------------------------------------------------- public class UILanguageComboBox : ComboBox diff --git a/src/L10NSharpWinforms/UI/UILanguageListBox.cs b/src/L10NSharp.Windows.Forms/UI/UILanguageListBox.cs similarity index 98% rename from src/L10NSharpWinforms/UI/UILanguageListBox.cs rename to src/L10NSharp.Windows.Forms/UI/UILanguageListBox.cs index 452c06e..4fdd3a7 100644 --- a/src/L10NSharpWinforms/UI/UILanguageListBox.cs +++ b/src/L10NSharp.Windows.Forms/UI/UILanguageListBox.cs @@ -6,7 +6,7 @@ using System.Windows.Forms; using L10NSharp; -namespace L10NSharpWinforms.UI +namespace L10NSharp.Windows.Forms.UI { /// ---------------------------------------------------------------------------------------- public class UILanguageListBox : ListBox diff --git a/src/L10NSharpWinforms/UI/XButton.cs b/src/L10NSharp.Windows.Forms/UI/XButton.cs similarity index 99% rename from src/L10NSharpWinforms/UI/XButton.cs rename to src/L10NSharp.Windows.Forms/UI/XButton.cs index 26bd671..70dfdfa 100644 --- a/src/L10NSharpWinforms/UI/XButton.cs +++ b/src/L10NSharp.Windows.Forms/UI/XButton.cs @@ -3,7 +3,7 @@ using System.Windows.Forms; using System.Windows.Forms.VisualStyles; -namespace L10NSharpWinforms.UI +namespace L10NSharp.Windows.Forms.UI { /// ---------------------------------------------------------------------------------------- internal class XButton : Label diff --git a/src/L10NSharpWinforms/UtilsWinforms.cs b/src/L10NSharp.Windows.Forms/UtilsWinforms.cs similarity index 97% rename from src/L10NSharpWinforms/UtilsWinforms.cs rename to src/L10NSharp.Windows.Forms/UtilsWinforms.cs index 06423c4..c5f0854 100644 --- a/src/L10NSharpWinforms/UtilsWinforms.cs +++ b/src/L10NSharp.Windows.Forms/UtilsWinforms.cs @@ -2,7 +2,7 @@ using System; using System.Windows.Forms; -namespace L10NSharpWinforms +namespace L10NSharp.Windows.Forms { /// ---------------------------------------------------------------------------------------- internal static class UtilsWinforms diff --git a/src/L10NSharpWinforms/XLiffUtils/XliffLocalizationManagerWinforms.cs b/src/L10NSharp.Windows.Forms/XLiffUtils/XliffLocalizationManagerWinforms.cs similarity index 99% rename from src/L10NSharpWinforms/XLiffUtils/XliffLocalizationManagerWinforms.cs rename to src/L10NSharp.Windows.Forms/XLiffUtils/XliffLocalizationManagerWinforms.cs index 17dc0b8..3ab5030 100644 --- a/src/L10NSharpWinforms/XLiffUtils/XliffLocalizationManagerWinforms.cs +++ b/src/L10NSharp.Windows.Forms/XLiffUtils/XliffLocalizationManagerWinforms.cs @@ -6,11 +6,11 @@ using System.Linq; using System.Reflection; using System.Windows.Forms; -using L10NSharpWinforms.UI; +using L10NSharp.Windows.Forms.UI; using L10NSharp.XLiffUtils; using L10NSharp; -namespace L10NSharpWinforms.XLiffUtils +namespace L10NSharp.Windows.Forms.XLiffUtils { /// ---------------------------------------------------------------------------------------- internal class XliffLocalizationManagerWinforms : XliffLocalizationManager, ILocalizationManagerInternalWinforms diff --git a/src/L10NSharpWinforms/XLiffUtils/XliffLocalizedStringCacheWinforms.cs b/src/L10NSharp.Windows.Forms/XLiffUtils/XliffLocalizedStringCacheWinforms.cs similarity index 98% rename from src/L10NSharpWinforms/XLiffUtils/XliffLocalizedStringCacheWinforms.cs rename to src/L10NSharp.Windows.Forms/XLiffUtils/XliffLocalizedStringCacheWinforms.cs index 9edef6f..e58d894 100644 --- a/src/L10NSharpWinforms/XLiffUtils/XliffLocalizedStringCacheWinforms.cs +++ b/src/L10NSharp.Windows.Forms/XLiffUtils/XliffLocalizedStringCacheWinforms.cs @@ -1,11 +1,11 @@ using System.Collections.Concurrent; using System.Collections.Generic; using System.Windows.Forms; -using L10NSharpWinforms.UI; +using L10NSharp.Windows.Forms.UI; using L10NSharp.XLiffUtils; using L10NSharp; -namespace L10NSharpWinforms.XLiffUtils +namespace L10NSharp.Windows.Forms.XLiffUtils { /// ---------------------------------------------------------------------------------------- internal class XliffLocalizedStringCacheWinforms : XliffLocalizedStringCache, ILocalizedStringCacheWinforms diff --git a/src/L10NSharp/L10NSharp.csproj b/src/L10NSharp/L10NSharp.csproj index 84ac35f..41f8e99 100644 --- a/src/L10NSharp/L10NSharp.csproj +++ b/src/L10NSharp/L10NSharp.csproj @@ -19,4 +19,17 @@ + + + True + True + Settings.settings + + + + + SettingsSingleFileGenerator + Settings.Designer.cs + + diff --git a/src/L10NSharp/Properties/AssemblyInfo.cs b/src/L10NSharp/Properties/AssemblyInfo.cs index a78428d..124e4c7 100644 --- a/src/L10NSharp/Properties/AssemblyInfo.cs +++ b/src/L10NSharp/Properties/AssemblyInfo.cs @@ -7,8 +7,8 @@ // sn -tp // (use the full public key, not the public key token!) -[assembly: InternalsVisibleTo("L10NSharpTests, PublicKey=002400000480000094000000060200000024000052534131000400000100010019cae48c6e5703818db31fcca17b87012eef38df95e3961c59b035190eace2c4ee5cfa1a258b84867c7549f60eec00ec1e0004c2ed224457128e841311cea0f5a05c3d69b3dfcb7422b214febce6e06c83ce4d29c62f36a7fd5564e922338c800372a5ec09638671b4db1fb33ccbb1dc48d8122ffe0d30dadbfbf325f65437b2")] +[assembly: InternalsVisibleTo("L10NSharp.Tests, PublicKey=002400000480000094000000060200000024000052534131000400000100010019cae48c6e5703818db31fcca17b87012eef38df95e3961c59b035190eace2c4ee5cfa1a258b84867c7549f60eec00ec1e0004c2ed224457128e841311cea0f5a05c3d69b3dfcb7422b214febce6e06c83ce4d29c62f36a7fd5564e922338c800372a5ec09638671b4db1fb33ccbb1dc48d8122ffe0d30dadbfbf325f65437b2")] [assembly: InternalsVisibleTo("ExtractXliff, PublicKey=002400000480000094000000060200000024000052534131000400000100010019cae48c6e5703818db31fcca17b87012eef38df95e3961c59b035190eace2c4ee5cfa1a258b84867c7549f60eec00ec1e0004c2ed224457128e841311cea0f5a05c3d69b3dfcb7422b214febce6e06c83ce4d29c62f36a7fd5564e922338c800372a5ec09638671b4db1fb33ccbb1dc48d8122ffe0d30dadbfbf325f65437b2")] [assembly: InternalsVisibleTo("CheckOrFixXliff, PublicKey=002400000480000094000000060200000024000052534131000400000100010019cae48c6e5703818db31fcca17b87012eef38df95e3961c59b035190eace2c4ee5cfa1a258b84867c7549f60eec00ec1e0004c2ed224457128e841311cea0f5a05c3d69b3dfcb7422b214febce6e06c83ce4d29c62f36a7fd5564e922338c800372a5ec09638671b4db1fb33ccbb1dc48d8122ffe0d30dadbfbf325f65437b2")] -[assembly: InternalsVisibleTo("L10NSharpWinforms, PublicKey=002400000480000094000000060200000024000052534131000400000100010019cae48c6e5703818db31fcca17b87012eef38df95e3961c59b035190eace2c4ee5cfa1a258b84867c7549f60eec00ec1e0004c2ed224457128e841311cea0f5a05c3d69b3dfcb7422b214febce6e06c83ce4d29c62f36a7fd5564e922338c800372a5ec09638671b4db1fb33ccbb1dc48d8122ffe0d30dadbfbf325f65437b2")] -[assembly: InternalsVisibleTo("L10NSharpWinformsTests, PublicKey=002400000480000094000000060200000024000052534131000400000100010019cae48c6e5703818db31fcca17b87012eef38df95e3961c59b035190eace2c4ee5cfa1a258b84867c7549f60eec00ec1e0004c2ed224457128e841311cea0f5a05c3d69b3dfcb7422b214febce6e06c83ce4d29c62f36a7fd5564e922338c800372a5ec09638671b4db1fb33ccbb1dc48d8122ffe0d30dadbfbf325f65437b2")] +[assembly: InternalsVisibleTo("L10NSharp.Windows.Forms, PublicKey=002400000480000094000000060200000024000052534131000400000100010019cae48c6e5703818db31fcca17b87012eef38df95e3961c59b035190eace2c4ee5cfa1a258b84867c7549f60eec00ec1e0004c2ed224457128e841311cea0f5a05c3d69b3dfcb7422b214febce6e06c83ce4d29c62f36a7fd5564e922338c800372a5ec09638671b4db1fb33ccbb1dc48d8122ffe0d30dadbfbf325f65437b2")] +[assembly: InternalsVisibleTo("L10NSharp.Windows.Forms.Tests, PublicKey=002400000480000094000000060200000024000052534131000400000100010019cae48c6e5703818db31fcca17b87012eef38df95e3961c59b035190eace2c4ee5cfa1a258b84867c7549f60eec00ec1e0004c2ed224457128e841311cea0f5a05c3d69b3dfcb7422b214febce6e06c83ce4d29c62f36a7fd5564e922338c800372a5ec09638671b4db1fb33ccbb1dc48d8122ffe0d30dadbfbf325f65437b2")] diff --git a/src/L10NSharp/Properties/Settings.Designer.cs b/src/L10NSharp/Properties/Settings.Designer.cs index 7c82023..f9c53bf 100644 --- a/src/L10NSharp/Properties/Settings.Designer.cs +++ b/src/L10NSharp/Properties/Settings.Designer.cs @@ -12,7 +12,7 @@ namespace L10NSharp.Properties { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.12.0.0")] internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); diff --git a/src/L10NSharpWinforms/Properties/AssemblyInfo.cs b/src/L10NSharpWinforms/Properties/AssemblyInfo.cs deleted file mode 100644 index cd7679c..0000000 --- a/src/L10NSharpWinforms/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System.Runtime.CompilerServices; - -// to get the public key, run: -// 1. extract the public key from the keyfile with -// sn –p -// 2. show the public key with -// sn -tp -// (use the full public key, not the public key token!) - -[assembly: InternalsVisibleTo("L10NSharpWinformsTests, PublicKey=002400000480000094000000060200000024000052534131000400000100010019cae48c6e5703818db31fcca17b87012eef38df95e3961c59b035190eace2c4ee5cfa1a258b84867c7549f60eec00ec1e0004c2ed224457128e841311cea0f5a05c3d69b3dfcb7422b214febce6e06c83ce4d29c62f36a7fd5564e922338c800372a5ec09638671b4db1fb33ccbb1dc48d8122ffe0d30dadbfbf325f65437b2")] diff --git a/src/SampleApp/Form1.Designer.cs b/src/SampleApp/Form1.Designer.cs index 2a7a853..3231a99 100644 --- a/src/SampleApp/Form1.Designer.cs +++ b/src/SampleApp/Form1.Designer.cs @@ -32,11 +32,11 @@ protected override void Dispose(bool disposing) private void InitializeComponent() { this.components = new System.ComponentModel.Container(); - this.localizationExtender1 = new L10NSharpWinforms.UI.L10NSharpExtender(this.components); + this.localizationExtender1 = new L10NSharp.Windows.Forms.UI.L10NSharpExtender(this.components); this._getDynamicStringButton = new System.Windows.Forms.Button(); this.label1 = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label(); - this.uiLanguageComboBox1 = new L10NSharpWinforms.UI.UILanguageComboBox(); + this.uiLanguageComboBox1 = new L10NSharp.Windows.Forms.UI.UILanguageComboBox(); this.columnHeader1 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.columnHeader2 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.dataGridView1 = new System.Windows.Forms.DataGridView(); @@ -191,11 +191,11 @@ private void InitializeComponent() #endregion - private L10NSharpWinforms.UI.L10NSharpExtender localizationExtender1; + private L10NSharp.Windows.Forms.UI.L10NSharpExtender localizationExtender1; private System.Windows.Forms.Button _getDynamicStringButton; private System.Windows.Forms.Label label1; private System.Windows.Forms.Label label2; - private L10NSharpWinforms.UI.UILanguageComboBox uiLanguageComboBox1; + private L10NSharp.Windows.Forms.UI.UILanguageComboBox uiLanguageComboBox1; private System.Windows.Forms.ListView listView1; private System.Windows.Forms.ColumnHeader columnHeader1; private System.Windows.Forms.ColumnHeader columnHeader2; diff --git a/src/SampleApp/SampleApp.csproj b/src/SampleApp/SampleApp.csproj index 7eb5fa5..bf73b24 100644 --- a/src/SampleApp/SampleApp.csproj +++ b/src/SampleApp/SampleApp.csproj @@ -11,7 +11,7 @@ - + From c6fa510e6bdf5eb696802e8547db310137be10a1 Mon Sep 17 00:00:00 2001 From: Ariel Rorabaugh Date: Thu, 31 Jul 2025 13:16:27 -0400 Subject: [PATCH 10/25] Move winforms properties & fix SampleApp --- .../L10NSharp.Windows.Forms.csproj | 11 ++ .../Properties/Resources.Designer.cs | 163 ++++++++++++++++++ .../Properties/Resources.resx | 152 ++++++++++++++++ .../Properties/Settings.Designer.cs | 2 +- .../Properties/Settings.settings | 0 .../Resources/Copy_Translation (toolbar).png | Bin 0 -> 1416 bytes .../Resources/Copy_Translation.png | Bin 0 -> 490 bytes .../Resources/Google.png | Bin 0 -> 810 bytes .../Resources/Move.png | Bin 0 -> 1307 bytes .../Resources/Move_Next.png | Bin 0 -> 1096 bytes .../Resources/Move_Previous.png | Bin 0 -> 1096 bytes .../Resources/Move_down.png | Bin 0 -> 1148 bytes .../Resources/Move_up.png | Bin 0 -> 1148 bytes .../Resources/SelectAllRows.png | Bin 0 -> 3191 bytes .../Resources/bing.png | Bin 0 -> 1161 bytes .../UI/LocalizeItemDlg.cs | 3 +- src/L10NSharp.Windows.Forms/UI/TipDialog.cs | 2 +- src/L10NSharp/L10NSharp.csproj | 13 -- src/SampleApp/Program.cs | 15 +- src/SampleApp/SampleApp.csproj | 2 +- 20 files changed, 339 insertions(+), 24 deletions(-) create mode 100644 src/L10NSharp.Windows.Forms/Properties/Resources.Designer.cs create mode 100644 src/L10NSharp.Windows.Forms/Properties/Resources.resx rename src/{L10NSharp => L10NSharp.Windows.Forms}/Properties/Settings.Designer.cs (97%) rename src/{L10NSharp => L10NSharp.Windows.Forms}/Properties/Settings.settings (100%) create mode 100644 src/L10NSharp.Windows.Forms/Resources/Copy_Translation (toolbar).png create mode 100644 src/L10NSharp.Windows.Forms/Resources/Copy_Translation.png create mode 100644 src/L10NSharp.Windows.Forms/Resources/Google.png create mode 100644 src/L10NSharp.Windows.Forms/Resources/Move.png create mode 100644 src/L10NSharp.Windows.Forms/Resources/Move_Next.png create mode 100644 src/L10NSharp.Windows.Forms/Resources/Move_Previous.png create mode 100644 src/L10NSharp.Windows.Forms/Resources/Move_down.png create mode 100644 src/L10NSharp.Windows.Forms/Resources/Move_up.png create mode 100644 src/L10NSharp.Windows.Forms/Resources/SelectAllRows.png create mode 100644 src/L10NSharp.Windows.Forms/Resources/bing.png diff --git a/src/L10NSharp.Windows.Forms/L10NSharp.Windows.Forms.csproj b/src/L10NSharp.Windows.Forms/L10NSharp.Windows.Forms.csproj index a5b9292..806455f 100644 --- a/src/L10NSharp.Windows.Forms/L10NSharp.Windows.Forms.csproj +++ b/src/L10NSharp.Windows.Forms/L10NSharp.Windows.Forms.csproj @@ -24,6 +24,11 @@ + + True + Settings.settings + True + UserControl @@ -85,4 +90,10 @@ Component + + + Settings.Designer.cs + SettingsSingleFileGenerator + + diff --git a/src/L10NSharp.Windows.Forms/Properties/Resources.Designer.cs b/src/L10NSharp.Windows.Forms/Properties/Resources.Designer.cs new file mode 100644 index 0000000..49026aa --- /dev/null +++ b/src/L10NSharp.Windows.Forms/Properties/Resources.Designer.cs @@ -0,0 +1,163 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace L10NSharp.Windows.Forms.Properties { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("L10NSharp.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap kimidBing { + get { + object obj = ResourceManager.GetObject("kimidBing", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap kimidCopyTranslation { + get { + object obj = ResourceManager.GetObject("kimidCopyTranslation", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap kimidCopyTranslationBig { + get { + object obj = ResourceManager.GetObject("kimidCopyTranslationBig", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap kimidGoogle { + get { + object obj = ResourceManager.GetObject("kimidGoogle", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap kimidMoveNext { + get { + object obj = ResourceManager.GetObject("kimidMoveNext", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap kimidMovePrevious { + get { + object obj = ResourceManager.GetObject("kimidMovePrevious", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap Move { + get { + object obj = ResourceManager.GetObject("Move", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap Move_down { + get { + object obj = ResourceManager.GetObject("Move_down", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap Move_up { + get { + object obj = ResourceManager.GetObject("Move_up", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap SelectAllRows { + get { + object obj = ResourceManager.GetObject("SelectAllRows", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + } +} diff --git a/src/L10NSharp.Windows.Forms/Properties/Resources.resx b/src/L10NSharp.Windows.Forms/Properties/Resources.resx new file mode 100644 index 0000000..f26f49d --- /dev/null +++ b/src/L10NSharp.Windows.Forms/Properties/Resources.resx @@ -0,0 +1,152 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + ..\Resources\bing.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\Copy_Translation.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\Copy_Translation (toolbar).png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\Google.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\Move_Next.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\Move_Previous.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\Move_down.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\Move_up.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\Move.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + + ..\Resources\SelectAllRows.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + \ No newline at end of file diff --git a/src/L10NSharp/Properties/Settings.Designer.cs b/src/L10NSharp.Windows.Forms/Properties/Settings.Designer.cs similarity index 97% rename from src/L10NSharp/Properties/Settings.Designer.cs rename to src/L10NSharp.Windows.Forms/Properties/Settings.Designer.cs index f9c53bf..98bcecc 100644 --- a/src/L10NSharp/Properties/Settings.Designer.cs +++ b/src/L10NSharp.Windows.Forms/Properties/Settings.Designer.cs @@ -8,7 +8,7 @@ // //------------------------------------------------------------------------------ -namespace L10NSharp.Properties { +namespace L10NSharp.Windows.Forms.Properties { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] diff --git a/src/L10NSharp/Properties/Settings.settings b/src/L10NSharp.Windows.Forms/Properties/Settings.settings similarity index 100% rename from src/L10NSharp/Properties/Settings.settings rename to src/L10NSharp.Windows.Forms/Properties/Settings.settings diff --git a/src/L10NSharp.Windows.Forms/Resources/Copy_Translation (toolbar).png b/src/L10NSharp.Windows.Forms/Resources/Copy_Translation (toolbar).png new file mode 100644 index 0000000000000000000000000000000000000000..6dc60d81ea84527375d8a517096112b872ea729a GIT binary patch literal 1416 zcmb`GUr19?9LK*`ckk}*yk^bm*bHa?aQ0Uu6I#O7)Jb3=TBMZKV-zUXdqo&QpwOP8 zz!!_6q{qU9UVG6u3&IR@b92u9^UrpZt>2lgO^IT|d-zFP zlcxrNH?=x!9Su9V5|TuoE*WQANt`op(^`0A=h z)}Wi9A2TC#2I)N{*nS##Nmg5PveTo)*NjLc5D115iz(o>rRZ#~MrFB}(nnT)V!F^_2O7FUGvB^nb-R70u}4R_iD!-6)QE#qR{VXh-+#eZcMS1$ zDieuEU>T>QF&sOwWdm0;lx3uIq=GF6XlOJkm52 zi}(p z8t`g01gfjqIWKg@g_*KR&+tFbpyoq1f)S8GMJWZIoe$#EkeSPAh3Ux{)U>w_DnWvZ zpdN1kQ_mf#($5RXzzkYmQ4Rls8`JM@WbP5WDft@JFiAJ-^Il;({jJ_yAMU7lbMr0h NZ*6LGjM}f<`vt_!4AB4p literal 0 HcmV?d00001 diff --git a/src/L10NSharp.Windows.Forms/Resources/Copy_Translation.png b/src/L10NSharp.Windows.Forms/Resources/Copy_Translation.png new file mode 100644 index 0000000000000000000000000000000000000000..4b154986debdfb123429d5f3129424ea5c93b9e9 GIT binary patch literal 490 zcmeAS@N?(olHy`uVBq!ia0vp^oIuRQ!3HGLSWET+DaPU;cPEB*=VV?2Ic!PZ?k)`f zL2$v|<&%LToCO|{#S9GG!XV7ZFl&wkP)n_+i(`m{Bx4a{??1->|Nk>+gseIC^XE@X zRu(1(24>dPx7LJ&0X4$`qei|NHOh{Rejq?{AKN4N}Pj zQgC6uE92e?W{j*H0+X0I1Q|FuIi;l}Wm;fHF@Y4oI1F+;#UHeW8`SzaS_wU~fzkdDmO=y262$BUm9K_HGoc*7Xm5YI$PnLmQK#oCKN|52@ ztLF?R8iEXPlLRESb3`PR8CZD4802N87|b=e85Dpa%gDl709SNmn$=VWMz#z-_J0hT zQj84OAHHP}7ZJ#Bi4mH}0178$9M6vM<(6o3R{=H6qSxb3GOOaX`% XdSCx28}b1x3h=qLvjZ!pM+e&_yCO=H`CS*7;^Gr@io9obNmD^FHtMz7K^RArJ`SR4P?T zUS8hCg z*J`zm27_U27eH%kYg1=uXCI%>r#BOTwcjoTf-DZ~PXe=fjbJdyc64+!_w@AiM*(VT zYRZO&hRh7Z&|Y5t*@^y9~l`Lqmq)6 z;$~)MY+|uk6bOdV_RxZwav5YNvSR3KACKX9b~;KgNC^OJHk-Y$urQZWtJM|V-QC9c z_;?JPW)TXpP+vZ`Q(L&)9_&qw=a{h(0FTFm_V)HlN~hBea^k6IK7$)wqqtdn7N;dg z@IMjBApl;l7jCy3TnlE3V3qle}ghHWcb(hNp zlgTtm_4f8oR99CQ|8jbvd-efWFUe7GG7CH&FNOh0<|Y82&ljmq0E|ZCB&E@41{)e0 zR1C8Rw;xO(J#8QE-co?3=?DYTyJ_MRe*AR7=?>spl?;4dI07&{Jglb_3PlAsQ)5Cx z0-le4#><)S=xbvcKf*F?!_%%ZY;0`6;c$Rks!A%33r`49%4@D9F!<0=%%yVe;KF`tKA)M6_D1c5Z8PBPz+|a%FH13*NZo13$n&F031g@xT_+6vAOarycAB|@Pv o#?C7%D^v6H^W%X)AjZyr0LJuX@|xd){Qv*}07*qoM6N<$g6&6fdH?_b literal 0 HcmV?d00001 diff --git a/src/L10NSharp.Windows.Forms/Resources/Move.png b/src/L10NSharp.Windows.Forms/Resources/Move.png new file mode 100644 index 0000000000000000000000000000000000000000..5731d8f92dfb25bf34c1486877b17b8c05664a54 GIT binary patch literal 1307 zcmeAS@N?(olHy`uVBq!ia0vp^LO?9Q!3HFy+4N(86k~CayA#8@b22Z19JVBHcNd2L zAh=-f^2tCE&H|6fVg?3oVGw3ym^DWND9B#o>FdgVi&I3{LRzmOK97NcWwxh_V~B+y z;{=xc-#`^32F%$q;s3G&Gyaq6VHR`^-@pB2c=7l(x-daL6S|6@-+wZgcxf@TOt1bw zb3-rDE@ND@XX^i7KYlZSTmmxW$M;_h=Ds=%w;$bLcz5A9gQ%nsLwZ0lBf5p?d=`)) zy0$6|zyJPX`2FV(!>?aJ`uA^!Z@<1V{E`07@cJnO!_1An|I_{P8^!{1$=`o}8D4&Q z%JA*m4~DN_zcGCI@)d}I^p9^0AAY}NczhI;yzv7Tuy=m_V7Phl0mJw2-+^BI!SL<- z4+bt_4u)H2A2OUv*qa;e928&V=#7ne9+M)!hBJ?KSya@#by?GG4c=0A} zQ7_(#NUtq=Qt_vSO0`z2v9V<(X{|}tq}}v6FMn7!vwS;m-_G~V?9AIc=aPK^tK9++ z80b$7k`EGgnmXNIUF_uK*zjOqFUH@6ZFpdF>zt|VG+8v7%A@b$w>oV_vE zEX+%;6T7>@a5jK={G`}>AlBYYU|Z%o@klI;(k4(S0ijk)R*`Nd&>;Uylr=g;&KIlI zl9)>ZKmHeB*GFx!wdHLZV*;*QMzBRibRYE@5HoXW=J0UG(wDhq*+e#U^O-nwEDl|z zY0>;N0;e^nnk3f$0Hy{Qa<)|gkU*FO+W2B>1%XJFsMms|NFCWcO_|Py-=qm>V6u_3 zA1j~GQPIoT8K{~8u4$B6gG#BTkgOtC5b&7{mI1VofS-Ic5*CZ!R?deWnZf?gE_ zQShdxf*`1%LT`$gDELt=SgQ$bdXYBS@3*_o+a@(%&NBOU=gn_s-n_XvnN0@+0|5ZR z%vfrQ)-KZSP9MGBP7g`6u-U2fDCTqF68-pQ#?vV{;(7S$(QUH$ua2Fc1$OiZWw>|0 z5AZH!Qm4;Fd)Wu?G0q&vA-`6cxc&u426sc1`f>MS>%Opf+L;Bo{PhhEM*0!p1zdj6 z&Z`Y9zx(OVQwGXfj*MUWH=AzJw1}Fpz zX&1n4SQ98Z$d-StVWVO}lDu#n<_4&Lc{~hk{MzRPov|cJ710H#Q(lcScKHErSJeVc zvKvC_`_sDxNL8>X8l%t|MVT^{D^s&X0N1$+iJ(T+_G4uglAo^@4n)Gv`X-oYkb6#A zRn0*~Wn0+@u((CvCb((BGRc8N`o8if`QrJr+?mN4D3npBbeg6>SIbc3UF2+#vj&p@ z%h15NN~?~tVxiWs1Pw**=!q8jMR6E-J+K$`+smI2!`NjX(vZ^5Dj>UiSk z;`>~8PY9+ilWNdxADArwY5)y=y>Pwq4;CA>0G%C@ZQJl1PEN4U-XI3|0PAZd+`1I1 z=No7H>0B%yi6)2371Z_T jfrZ2GrF>rU`CGl4=(#8HEBk|YBEp{XE z)7O>#8n-k*Kik|pUbh$+Sfo8&978G?83kD0{|2fU>VOfO2Nvy_`v2FD-wfZs{bcz0 z{U^hZ@4pyoGFq^zWx-|uNVBf33d7%je;I!K`oWOuREbR)SPZKHAe(>x{l)O|%TtD% z7auTia&zJ|fC-xn$l1UD{9*X^?FYm6@820Xxj3*XLv_KNEffAD`}xoHy8v&KG;UF9GNBR@Pmmgo@nxzz^7*6dwjiDYR5Yq#S8AT<97+9Y2F?@LO1#B}e%^(Xg t3;+p&4UrOJV1B~IASo}2)n<^oVFG&OCf&16S-u$L9Zy$3mvv4FO#t+st2+Py literal 0 HcmV?d00001 diff --git a/src/L10NSharp.Windows.Forms/Resources/Move_up.png b/src/L10NSharp.Windows.Forms/Resources/Move_up.png new file mode 100644 index 0000000000000000000000000000000000000000..d39a96b043ad512dbf1c3bd7e13d5081115ea33c GIT binary patch literal 1148 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`oCO|{#S9GG!XV7ZFl&wkP>{XE z)7O>#8n-mRfHlWEj!*^$7HLlx$B+s}Mgf-hzkw=-I$*@*ftee7|DQX0nc>{&D-5Ui zpTVh)37Y{kH}w90{p=mXUzu+V&mTT#Fmp2fk4+s&48s7h=I8Gi{z!jf5Rl+uFbdUR zc=q5KPD5DGO@0m3EM&mS@a-2T0|WDa1~p@Ou#$7DZ!oCps{Frw`3{PA;GAU#X8gZ* z{V{`ymlgvv3p2y--@h5IJ-p0t@7fcFZ{NN%ynFSD0c41PhycTtQ&-{o;4b*~Z8HH!^6$M#mT{NY10D+XHPo@!va&VYk&s89S%1j#isynYR|%^ z|7>h*4BXsY44hmX3_rjBWN6ImfXl;m0~r{B2$E#yWM^PyVPW6`YUbqRWcdE=2eKX% zHdX^Txqt>RvoT2W$}w1&nK69-`W;0RG6$=(7VVk(|JRS-K%0Mpoev6=nv52#YLN{a ZqU=8lD@+P+D$fKt-_zC4Wt~$(69CRfkI4W4 literal 0 HcmV?d00001 diff --git a/src/L10NSharp.Windows.Forms/Resources/SelectAllRows.png b/src/L10NSharp.Windows.Forms/Resources/SelectAllRows.png new file mode 100644 index 0000000000000000000000000000000000000000..560a458a4fa378ed65f905848f2d9831f256af0c GIT binary patch literal 3191 zcmV--42biIP)KLZ*U+IBfRsybQWXdwQbLP>6pAqfylh#{fb6;Z(vMMVS~$e@S=j*ftg6;Uhf59&ghTmgWD0l;*T zI709Y^p6lP1rIRMx#05C~cW=H_Aw*bJ-5DT&Z2n+x)QHX^p z00esgV8|mQcmRZ%02D^@S3L16t`O%c004NIvOKvYIYoh62rY33S640`D9%Y2D-rV&neh&#Q1i z007~1e$oCcFS8neI|hJl{-P!B1ZZ9hpmq0)X0i`JwE&>$+E?>%_LC6RbVIkUx0b+_+BaR3cnT7Zv!AJxW zizFb)h!jyGOOZ85F;a?DAXP{m@;!0_IfqH8(HlgRxt7s3}k3K`kFu>>-2Q$QMFfPW!La{h336o>X zu_CMttHv6zR;&ZNiS=X8v3CR#fknUxHUxJ0uoBa_M6WNWeqIg~6QE69c9o#eyhGvpiOA@W-aonk<7r1(?fC{oI5N*U!4 zfg=2N-7=cNnjjOr{yriy6mMFgG#l znCF=fnQv8CDz++o6_Lscl}eQ+l^ZHARH>?_s@|##Rr6KLRFA1%Q+=*RRWnoLsR`7U zt5vFIcfW3@?wFpwUVxrVZ>QdQz32KIeJ}k~{cZZE^+ya? z2D1z#2HOnI7(B%_ac?{wFUQ;QQA1tBKtrWrm0_3Rgps+?Jfqb{jYbcQX~taRB;#$y zZN{S}1|}gUOHJxc?wV3fxuz+mJ4`!F$IZ;mqRrNsHJd##*D~ju=bP7?-?v~|cv>vB zsJ6IeNwVZxrdjT`yl#bBIa#GxRa#xMMy;K#CDyyGyQdMSxlWT#tDe?p!?5wT$+oGt z8L;Kp2HUQ-ZMJ=3XJQv;x5ci*?vuTfeY$;({XGW_huIFR9a(?@3)XSs8O^N5RyOM=TTmp(3=8^+zpz2r)C z^>JO{deZfso3oq3?Wo(Y?l$ge?uXo;%ru`Vo>?<<(8I_>;8Eq#KMS9gFl*neeosSB zfoHYnBQIkwkyowPu(zdms`p{<7e4kra-ZWq<2*OsGTvEV%s0Td$hXT+!*8Bnh2KMe zBmZRodjHV?r+_5^X9J0WL4jKW`}lf%A-|44I@@LTvf1rHjG(ze6+w@Jt%Bvjts!X0 z?2xS?_ve_-kiKB_KiJlZ$9G`c^=E@oNG)mWWaNo-3TIW8)$Hg0Ub-~8?KhvJ>$ z3*&nim@mj(aCxE5!t{lw7O5^0EIO7zOo&c6l<+|iDySBWCGrz@C5{St!X3hAA}`T4 z(TLbXTq+(;@<=L8dXnssyft|w#WSTW<++3>sgS%(4NTpeI-VAqb|7ssJvzNHgOZVu zaYCvgO_R1~>SyL=cFU|~g|hy|Zi}}s9+d~lYqOB71z9Z$wnC=pR9Yz4DhIM>Wmjgu z&56o6maCpC&F##y%G;1PobR9i?GnNg;gYtchD%p19a!eQtZF&3JaKv33gZ<8D~47E ztUS1iwkmDaPpj=$m#%)jCVEY4fnLGNg2A-`YwHVD3gv};>)hAvT~AmqS>Lr``i7kw zJ{5_It`yrBmlc25DBO7E8;5VoznR>Ww5hAaxn$2~(q`%A-YuS64wkBy=9dm`4cXeX z4c}I@?e+FW+b@^RDBHV(wnMq2zdX3SWv9u`%{xC-q*U}&`cyXV(%rRT*Z6MH?i+i& z_B8C(+grT%{XWUQ+f@NoP1R=AW&26{v-dx)iK^-Nmiuj8txj!m?Z*Ss1N{dh4z}01 z)YTo*JycSU)+_5r4#yw9{+;i4Ee$peRgIj+;v;ZGdF1K$3E%e~4LaI(jC-u%2h$&R z9cLXcYC@Xwnns&bn)_Q~Te?roKGD|d-g^8;+aC{{G(1^(O7m37Y1-+6)01cN&y1aw zoqc{T`P^XJqPBbIW6s}d4{z_f5Om?vMgNQEJG?v2T=KYd^0M3I6IZxbny)%vZR&LD zJpPl@Psh8QyPB@KTx+@RdcC!KX7}kEo;S|j^u2lU7XQ}Oo;f|;z4Ll+_r>@1-xl3| zawq-H%e&ckC+@AhPrP6BKT#_XdT7&;F71j}Joy zkC~6lh7E@6o;W@^IpRNZ{ptLtL(gQ-CY~4mqW;US7Zxvm_|@yz&e53Bp_lTPlfP|z zrTyx_>lv@x#=^!PzR7qqF<$gm`|ZJZ+;<)Cqu&ot2z=0000WV@Og>004R=004l4008;_004mL004C`008P>0026e000+nl3&F} z0004^Nklfgc5Qd-79>WD_K1>th)QK8Y&iqOE6L91oAg*u%3DJT`992~~ z(5MF}iJjQHGsD5HTc@1JNUJ@J=9zci-Km)w+r%!wi#Hb)it~^;W0f0eW~8_7bq;H1 zIB$G-*{SVb7d2aZh#F1|?~U9Wb!TMG$h?s|C3i;V!FlE5=LyiE1kBGbfTDAn!*Z=G zSH^N}ELTdJLFR9Ss<@jG_UkiF-X>+T2Hd|oWr2bkh=Ld6{m<9H^8(<#2OvJ1qpFA+ zPosd7$q!T%5#`w^JDG28>V7Q8iSRUN>NJ zIxAnH`=rNo8lz^kn~l2wRcJk`BU*G{EE5_JA0TRoL6Ri2+d<_MRRHheSO2w4wQaZY d9$UuW0RY@=BiSNd051Rl002ovPDHLkV1gl=>UsbG literal 0 HcmV?d00001 diff --git a/src/L10NSharp.Windows.Forms/Resources/bing.png b/src/L10NSharp.Windows.Forms/Resources/bing.png new file mode 100644 index 0000000000000000000000000000000000000000..91884f3f60da91f140d7acdf002525887400f168 GIT binary patch literal 1161 zcmbVLUr1A76#sqe=GNT5OxD_z9vo6n1@%z#Wy+TBAqf+rha~&ssIUTkZG?M@o~$Rw zYT#2rNIew_wg;CzQIzPr1P5d|GM-#Pd9opZkP@7_7p*={wv z%>b;SjzAYl2eYY$&i(6ZF9|Ww)!v4&bVHUtcHQhaI{?(~VHSwRT?85jLnnjAkF_qR z`(XY_{b@k)gaWPI$94;c@_kFZ`ILbQL6-kVLb>)@Wp@>bPTy#VREALr{1+*IGAQ{~ zCsw*Bdl|~ArX3$%u7>{ltyBgrXgT-zhL^qMwU@ZL!h4?dRO-5Cl(Ck38Kn9>5X#kQ z>Y>avMmRh8iK!`-p(UanLa-gC`rToc#Q>~oWHAc#`Rd^Jn&GzZl;BE!3o}bUF!E{@ zU-H`$6GB8M!}SrdgEG*2)$FXn$Qd^*CTh*vB9KdIQJpP-tqJR!1%w~3U_SRt4-%s> zQVB(RcDYe|H8T#pyQ{;RJaC1!uS*7Lz5iKaltt3O3n1&Inmu-fR*G7Zd7(+UV!UR= z*(oV)CV?Z3MyZph%RmiG%5ZdWt&-{v=}=i(o21TVq?a~z{3|a~g4oZ<;M1(^fz{gs zaFB0r8J6{f`#^O2c}~jWkr0zJ?{VVc+7Q&jEe7{d8GSwnO~C>yHHNxDi*Tyl)EiAbjBP?{qF!FZkn z>6^$lI`JRBFmcf?9fJ?@Ae{ot&JnI}f^J(a%NbPP9Nm7@lRejcnDJ1sGceY6e&{#W C%)|5m literal 0 HcmV?d00001 diff --git a/src/L10NSharp.Windows.Forms/UI/LocalizeItemDlg.cs b/src/L10NSharp.Windows.Forms/UI/LocalizeItemDlg.cs index 857500b..e5a9f61 100644 --- a/src/L10NSharp.Windows.Forms/UI/LocalizeItemDlg.cs +++ b/src/L10NSharp.Windows.Forms/UI/LocalizeItemDlg.cs @@ -5,7 +5,8 @@ using System.Drawing; using System.Text; using System.Windows.Forms; -using L10NSharp.Properties; +//using L10NSharp.Properties; +using L10NSharp.Windows.Forms.Properties; using L10NSharp; namespace L10NSharp.Windows.Forms.UI diff --git a/src/L10NSharp.Windows.Forms/UI/TipDialog.cs b/src/L10NSharp.Windows.Forms/UI/TipDialog.cs index c3385a1..3bd659a 100644 --- a/src/L10NSharp.Windows.Forms/UI/TipDialog.cs +++ b/src/L10NSharp.Windows.Forms/UI/TipDialog.cs @@ -1,7 +1,7 @@ using System; using System.Drawing; using System.Windows.Forms; -using L10NSharp.Properties; +using L10NSharp.Windows.Forms.Properties; namespace L10NSharp.Windows.Forms.UI { diff --git a/src/L10NSharp/L10NSharp.csproj b/src/L10NSharp/L10NSharp.csproj index 41f8e99..84ac35f 100644 --- a/src/L10NSharp/L10NSharp.csproj +++ b/src/L10NSharp/L10NSharp.csproj @@ -19,17 +19,4 @@ - - - True - True - Settings.settings - - - - - SettingsSingleFileGenerator - Settings.Designer.cs - - diff --git a/src/SampleApp/Program.cs b/src/SampleApp/Program.cs index 20167d0..735b73d 100644 --- a/src/SampleApp/Program.cs +++ b/src/SampleApp/Program.cs @@ -6,6 +6,7 @@ using System.Reflection; using System.Windows.Forms; using L10NSharp; +using L10NSharp.Windows.Forms; using SampleApp.Properties; using static System.String; @@ -24,7 +25,7 @@ static void Main(string[] args) Application.SetCompatibleTextRenderingDefault(false); if (args.Any(a => a == "-i:permissive")) - LocalizationManager.StrictInitializationMode = false; + LocalizationManagerWinforms.StrictInitializationMode = false; try { @@ -32,7 +33,7 @@ static void Main(string[] args) // InvalidOperationException, which we will catch and (for the purposes // of this sample app) ignore. MessageBox.Show(Format( - LocalizationManager.GetString("accessed.before.setting.up.lm", + LocalizationManagerWinforms.GetString("accessed.before.setting.up.lm", "Localization is not yet set up, so this will always be in English. " + "It should not cause anything bad to happen even if the current culture " + "is some other variant of a localized language (e.g., es-MX). By the " + @@ -42,7 +43,7 @@ static void Main(string[] args) } catch (InvalidOperationException ex) { - if (LocalizationManager.StrictInitializationMode) + if (LocalizationManagerWinforms.StrictInitializationMode) Trace.WriteLine($"Got expected {ex.GetType().FullName} exception: {ex.Message}"); else throw; @@ -50,7 +51,7 @@ static void Main(string[] args) SetUpLocalization(args.Any(a => a == "-m"), args.Any(a => a == "-tmx")); - LocalizationManager.SetUILanguage(Settings.Default.UserInterfaceLanguage, false); + LocalizationManagerWinforms.SetUILanguage(Settings.Default.UserInterfaceLanguage, false); Application.Run(new Form1()); Settings.Default.Save(); @@ -82,7 +83,7 @@ private static void SetUpLocalization(bool useAdditionalMethodInfo, bool useTmx) "The generated localization file should contain this string and the window title.", "This is a comment"), MyOwnGetString("SampleApp.InformationalMessageBox.Title", "Cool Title")); - _localizationManager = LocalizationManager.Create(theLanguageYouRememberedFromLastTime, + _localizationManager = LocalizationManagerWinforms.Create(theLanguageYouRememberedFromLastTime, "SampleApp.exe", "SampleApp", Application.ProductVersion, directoryOfInstalledLocFiles, "MyCompany/L10NSharpSample", @@ -94,7 +95,7 @@ private static void SetUpLocalization(bool useAdditionalMethodInfo, bool useTmx) } else { - _localizationManager = LocalizationManager.Create(theLanguageYouRememberedFromLastTime, + _localizationManager = LocalizationManagerWinforms.Create(theLanguageYouRememberedFromLastTime, "SampleApp.exe", "SampleApp", Application.ProductVersion, directoryOfInstalledLocFiles, "MyCompany/L10NSharpSample", @@ -102,7 +103,7 @@ private static void SetUpLocalization(bool useAdditionalMethodInfo, bool useTmx) new[] { "SampleApp" }); } - Settings.Default.UserInterfaceLanguage = LocalizationManager.UILanguageId; + Settings.Default.UserInterfaceLanguage = LocalizationManagerWinforms.UILanguageId; } catch (Exception error) { diff --git a/src/SampleApp/SampleApp.csproj b/src/SampleApp/SampleApp.csproj index bf73b24..be693f9 100644 --- a/src/SampleApp/SampleApp.csproj +++ b/src/SampleApp/SampleApp.csproj @@ -11,7 +11,7 @@ - + From aae03c73d6c737a042e7a6d2630a9b424cd7696c Mon Sep 17 00:00:00 2001 From: Ariel Rorabaugh Date: Mon, 4 Aug 2025 10:22:24 -0400 Subject: [PATCH 11/25] Fix UI namespace +semver:major --- .../ILocalizableComponentTests.cs | 2 +- .../LanguageChoosingDialogViewModelTests.cs | 2 +- .../LocalizationExtenderTests.cs | 2 +- .../MockLocalizableComponent.cs | 2 +- .../ILocalizableComponent.cs | 2 - .../ILocalizedStringCacheWinforms.cs | 2 +- .../{UI => }/L10NExtender.cs | 3 +- .../{UI => }/L10NExtender.resx | 0 .../L10NSharp.Windows.Forms.csproj | 44 +++---- .../LocalizationManagerInternalWinforms.cs | 9 +- .../LocalizingInfoWinforms.cs | 4 +- .../{UI => UIComponents}/ColorHelper.cs | 2 +- .../CustomDropDownComboBox.Designer.cs | 2 +- .../CustomDropDownComboBox.cs | 2 +- .../CustomDropDownComboBox.resx | 0 .../DontShowThisAgainButton.Designer.cs | 2 +- .../DontShowThisAgainButton.cs | 2 +- ...EditSourceBeforeTranslatingDlg.Designer.cs | 2 +- .../EditSourceBeforeTranslatingDlg.cs | 2 +- .../EditSourceBeforeTranslatingDlg.resx | 0 .../FallbackLanguagesDlg.cs | 2 +- .../FallbackLanguagesDlgBase.Designer.cs | 2 +- .../FallbackLanguagesDlgBase.cs | 2 +- .../FallbackLanguagesDlgBase.resx | 0 .../{UI => UIComponents}/Grid/LmButtonCell.cs | 2 +- .../Grid/LmButtonColumn.cs | 2 +- .../{UI => UIComponents}/Grid/LmGrid.cs | 2 +- .../HowToDistributeDialog.Designer.cs | 2 +- .../HowToDistributeDialog.cs | 2 +- .../HowToDistributeDialog.resx | 0 .../InitializationProgressDlg.cs | 2 +- .../InitializationProgressDlgBase.Designer.cs | 2 +- .../InitializationProgressDlgBase.cs | 2 +- .../InitializationProgressDlgBase.resx | 0 .../LanguageChoosingDialog.Designer.cs | 4 +- .../LanguageChoosingDialog.cs | 2 +- .../LanguageChoosingDialog.resx | 0 .../LanguageChoosingDialogViewModel.cs | 2 +- .../LanguageChoosingSimpleDialog.Designer.cs | 6 +- .../LanguageChoosingSimpleDialog.cs | 2 +- .../LanguageChoosingSimpleDialog.resx | 0 .../{UI => UIComponents}/LocTreeNode.cs | 2 +- .../LocalizeItemDlg.Designer.cs | 16 +-- .../{UI => UIComponents}/LocalizeItemDlg.cs | 2 +- .../{UI => UIComponents}/LocalizeItemDlg.resx | 0 .../LocalizeItemDlgViewModel.cs | 2 +- .../{UI => UIComponents}/NodeComparer.cs | 2 +- .../{UI => UIComponents}/PaintingHelper.cs | 2 +- .../{UI => UIComponents}/PopupControl.cs | 2 +- .../PopupControl.designer.cs | 2 +- .../{UI => UIComponents}/PopupControl.resx | 0 .../ShortcutKeysDropDown.cs | 2 +- .../ShortcutKeysEditor.Designer.cs | 2 +- .../ShortcutKeysEditor.cs | 2 +- .../ShortcutKeysEditor.resx | 0 .../{UI => UIComponents}/TipDialog.cs | 2 +- .../TipDialog.designer.cs | 2 +- .../{UI => UIComponents}/TipDialog.resx | 0 .../UILanguageComboBox.cs | 2 +- .../{UI => UIComponents}/UILanguageListBox.cs | 2 +- .../{UI => UIComponents}/XButton.cs | 2 +- .../XliffLocalizationManagerWinforms.cs | 2 +- .../XliffLocalizedStringCacheWinforms.cs | 2 +- src/SampleApp/Form1.Designer.cs | 123 +++++++++--------- src/SampleApp/Form1.resx | 3 - 65 files changed, 149 insertions(+), 151 deletions(-) rename src/L10NSharp.Windows.Forms/{UI => }/L10NExtender.cs (99%) rename src/L10NSharp.Windows.Forms/{UI => }/L10NExtender.resx (100%) rename src/L10NSharp.Windows.Forms/{UI => UIComponents}/ColorHelper.cs (98%) rename src/L10NSharp.Windows.Forms/{UI => UIComponents}/CustomDropDownComboBox.Designer.cs (98%) rename src/L10NSharp.Windows.Forms/{UI => UIComponents}/CustomDropDownComboBox.cs (99%) rename src/L10NSharp.Windows.Forms/{UI => UIComponents}/CustomDropDownComboBox.resx (100%) rename src/L10NSharp.Windows.Forms/{UI => UIComponents}/DontShowThisAgainButton.Designer.cs (95%) rename src/L10NSharp.Windows.Forms/{UI => UIComponents}/DontShowThisAgainButton.cs (98%) rename src/L10NSharp.Windows.Forms/{UI => UIComponents}/EditSourceBeforeTranslatingDlg.Designer.cs (99%) rename src/L10NSharp.Windows.Forms/{UI => UIComponents}/EditSourceBeforeTranslatingDlg.cs (97%) rename src/L10NSharp.Windows.Forms/{UI => UIComponents}/EditSourceBeforeTranslatingDlg.resx (100%) rename src/L10NSharp.Windows.Forms/{UI => UIComponents}/FallbackLanguagesDlg.cs (95%) rename src/L10NSharp.Windows.Forms/{UI => UIComponents}/FallbackLanguagesDlgBase.Designer.cs (99%) rename src/L10NSharp.Windows.Forms/{UI => UIComponents}/FallbackLanguagesDlgBase.cs (99%) rename src/L10NSharp.Windows.Forms/{UI => UIComponents}/FallbackLanguagesDlgBase.resx (100%) rename src/L10NSharp.Windows.Forms/{UI => UIComponents}/Grid/LmButtonCell.cs (99%) rename src/L10NSharp.Windows.Forms/{UI => UIComponents}/Grid/LmButtonColumn.cs (99%) rename src/L10NSharp.Windows.Forms/{UI => UIComponents}/Grid/LmGrid.cs (99%) rename src/L10NSharp.Windows.Forms/{UI => UIComponents}/HowToDistributeDialog.Designer.cs (99%) rename src/L10NSharp.Windows.Forms/{UI => UIComponents}/HowToDistributeDialog.cs (98%) rename src/L10NSharp.Windows.Forms/{UI => UIComponents}/HowToDistributeDialog.resx (100%) rename src/L10NSharp.Windows.Forms/{UI => UIComponents}/InitializationProgressDlg.cs (98%) rename src/L10NSharp.Windows.Forms/{UI => UIComponents}/InitializationProgressDlgBase.Designer.cs (99%) rename src/L10NSharp.Windows.Forms/{UI => UIComponents}/InitializationProgressDlgBase.cs (97%) rename src/L10NSharp.Windows.Forms/{UI => UIComponents}/InitializationProgressDlgBase.resx (100%) rename src/L10NSharp.Windows.Forms/{UI => UIComponents}/LanguageChoosingDialog.Designer.cs (96%) rename src/L10NSharp.Windows.Forms/{UI => UIComponents}/LanguageChoosingDialog.cs (96%) rename src/L10NSharp.Windows.Forms/{UI => UIComponents}/LanguageChoosingDialog.resx (100%) rename src/L10NSharp.Windows.Forms/{UI => UIComponents}/LanguageChoosingDialogViewModel.cs (98%) rename src/L10NSharp.Windows.Forms/{UI => UIComponents}/LanguageChoosingSimpleDialog.Designer.cs (92%) rename src/L10NSharp.Windows.Forms/{UI => UIComponents}/LanguageChoosingSimpleDialog.cs (94%) rename src/L10NSharp.Windows.Forms/{UI => UIComponents}/LanguageChoosingSimpleDialog.resx (100%) rename src/L10NSharp.Windows.Forms/{UI => UIComponents}/LocTreeNode.cs (98%) rename src/L10NSharp.Windows.Forms/{UI => UIComponents}/LocalizeItemDlg.Designer.cs (99%) rename src/L10NSharp.Windows.Forms/{UI => UIComponents}/LocalizeItemDlg.cs (99%) rename src/L10NSharp.Windows.Forms/{UI => UIComponents}/LocalizeItemDlg.resx (100%) rename src/L10NSharp.Windows.Forms/{UI => UIComponents}/LocalizeItemDlgViewModel.cs (99%) rename src/L10NSharp.Windows.Forms/{UI => UIComponents}/NodeComparer.cs (98%) rename src/L10NSharp.Windows.Forms/{UI => UIComponents}/PaintingHelper.cs (99%) rename src/L10NSharp.Windows.Forms/{UI => UIComponents}/PopupControl.cs (99%) rename src/L10NSharp.Windows.Forms/{UI => UIComponents}/PopupControl.designer.cs (94%) rename src/L10NSharp.Windows.Forms/{UI => UIComponents}/PopupControl.resx (100%) rename src/L10NSharp.Windows.Forms/{UI => UIComponents}/ShortcutKeysDropDown.cs (98%) rename src/L10NSharp.Windows.Forms/{UI => UIComponents}/ShortcutKeysEditor.Designer.cs (99%) rename src/L10NSharp.Windows.Forms/{UI => UIComponents}/ShortcutKeysEditor.cs (99%) rename src/L10NSharp.Windows.Forms/{UI => UIComponents}/ShortcutKeysEditor.resx (100%) rename src/L10NSharp.Windows.Forms/{UI => UIComponents}/TipDialog.cs (98%) rename src/L10NSharp.Windows.Forms/{UI => UIComponents}/TipDialog.designer.cs (99%) rename src/L10NSharp.Windows.Forms/{UI => UIComponents}/TipDialog.resx (100%) rename src/L10NSharp.Windows.Forms/{UI => UIComponents}/UILanguageComboBox.cs (98%) rename src/L10NSharp.Windows.Forms/{UI => UIComponents}/UILanguageListBox.cs (98%) rename src/L10NSharp.Windows.Forms/{UI => UIComponents}/XButton.cs (99%) diff --git a/src/L10NSharp.Windows.Forms.Tests/ILocalizableComponentTests.cs b/src/L10NSharp.Windows.Forms.Tests/ILocalizableComponentTests.cs index 9e87042..0bfbded 100644 --- a/src/L10NSharp.Windows.Forms.Tests/ILocalizableComponentTests.cs +++ b/src/L10NSharp.Windows.Forms.Tests/ILocalizableComponentTests.cs @@ -4,7 +4,7 @@ using L10NSharp; using L10NSharp.XLiffUtils; using L10NSharp.Windows.Forms; -using L10NSharp.Windows.Forms.UI; +using L10NSharp.Windows.Forms.UIComponents; using NUnit.Framework; namespace L10NSharp.Windows.Forms.Tests diff --git a/src/L10NSharp.Windows.Forms.Tests/LanguageChoosingDialogViewModelTests.cs b/src/L10NSharp.Windows.Forms.Tests/LanguageChoosingDialogViewModelTests.cs index 27b14e7..bb7c2a2 100644 --- a/src/L10NSharp.Windows.Forms.Tests/LanguageChoosingDialogViewModelTests.cs +++ b/src/L10NSharp.Windows.Forms.Tests/LanguageChoosingDialogViewModelTests.cs @@ -4,7 +4,7 @@ using System.Linq; using L10NSharp; using L10NSharp.Translators; -using L10NSharp.Windows.Forms.UI; +using L10NSharp.Windows.Forms.UIComponents; using NUnit.Framework; namespace L10NSharp.Windows.Forms.Tests diff --git a/src/L10NSharp.Windows.Forms.Tests/LocalizationExtenderTests.cs b/src/L10NSharp.Windows.Forms.Tests/LocalizationExtenderTests.cs index abfea0c..6f79859 100644 --- a/src/L10NSharp.Windows.Forms.Tests/LocalizationExtenderTests.cs +++ b/src/L10NSharp.Windows.Forms.Tests/LocalizationExtenderTests.cs @@ -1,7 +1,7 @@ using System.Collections.Generic; using System.Windows.Forms; using L10NSharp; -using L10NSharp.Windows.Forms.UI; +using L10NSharp.Windows.Forms.UIComponents; using NUnit.Framework; using L10NSharp.Windows.Forms; diff --git a/src/L10NSharp.Windows.Forms.Tests/MockLocalizableComponent.cs b/src/L10NSharp.Windows.Forms.Tests/MockLocalizableComponent.cs index 1021d70..c458127 100644 --- a/src/L10NSharp.Windows.Forms.Tests/MockLocalizableComponent.cs +++ b/src/L10NSharp.Windows.Forms.Tests/MockLocalizableComponent.cs @@ -4,7 +4,7 @@ using System.Windows.Forms; using L10NSharp; using L10NSharp.Windows.Forms; -using L10NSharp.Windows.Forms.UI; +using L10NSharp.Windows.Forms.UIComponents; namespace L10NSharp.Windows.Forms.Tests { diff --git a/src/L10NSharp.Windows.Forms/ILocalizableComponent.cs b/src/L10NSharp.Windows.Forms/ILocalizableComponent.cs index 7648722..3c83908 100644 --- a/src/L10NSharp.Windows.Forms/ILocalizableComponent.cs +++ b/src/L10NSharp.Windows.Forms/ILocalizableComponent.cs @@ -1,6 +1,4 @@ using System.Collections.Generic; -using L10NSharp.Windows.Forms.UI; -using L10NSharp; namespace L10NSharp.Windows.Forms { diff --git a/src/L10NSharp.Windows.Forms/ILocalizedStringCacheWinforms.cs b/src/L10NSharp.Windows.Forms/ILocalizedStringCacheWinforms.cs index 509b2ad..df54b51 100644 --- a/src/L10NSharp.Windows.Forms/ILocalizedStringCacheWinforms.cs +++ b/src/L10NSharp.Windows.Forms/ILocalizedStringCacheWinforms.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; using System.Windows.Forms; -using L10NSharp.Windows.Forms.UI; +using L10NSharp.Windows.Forms.UIComponents; namespace L10NSharp.Windows.Forms { diff --git a/src/L10NSharp.Windows.Forms/UI/L10NExtender.cs b/src/L10NSharp.Windows.Forms/L10NExtender.cs similarity index 99% rename from src/L10NSharp.Windows.Forms/UI/L10NExtender.cs rename to src/L10NSharp.Windows.Forms/L10NExtender.cs index 651fb1c..8ad9b1a 100644 --- a/src/L10NSharp.Windows.Forms/UI/L10NExtender.cs +++ b/src/L10NSharp.Windows.Forms/L10NExtender.cs @@ -21,9 +21,8 @@ using System.Diagnostics; using System.Linq; using System.Windows.Forms; -using L10NSharp; -namespace L10NSharp.Windows.Forms.UI +namespace L10NSharp.Windows.Forms { /// ---------------------------------------------------------------------------------------- [ProvideProperty("LocalizingId", typeof(IComponent))] diff --git a/src/L10NSharp.Windows.Forms/UI/L10NExtender.resx b/src/L10NSharp.Windows.Forms/L10NExtender.resx similarity index 100% rename from src/L10NSharp.Windows.Forms/UI/L10NExtender.resx rename to src/L10NSharp.Windows.Forms/L10NExtender.resx diff --git a/src/L10NSharp.Windows.Forms/L10NSharp.Windows.Forms.csproj b/src/L10NSharp.Windows.Forms/L10NSharp.Windows.Forms.csproj index 806455f..7392e83 100644 --- a/src/L10NSharp.Windows.Forms/L10NSharp.Windows.Forms.csproj +++ b/src/L10NSharp.Windows.Forms/L10NSharp.Windows.Forms.csproj @@ -24,69 +24,69 @@ + + Component + True Settings.settings True - + UserControl - + Component - + Form - + Form - + Form - + Component - + Form - + Form - + Form - - Component - - + Form - + Form - + Form - + UserControl - + UserControl - + UserControl - + Form - + Component - + Component - + Component diff --git a/src/L10NSharp.Windows.Forms/LocalizationManagerInternalWinforms.cs b/src/L10NSharp.Windows.Forms/LocalizationManagerInternalWinforms.cs index b070aec..8d569e7 100644 --- a/src/L10NSharp.Windows.Forms/LocalizationManagerInternalWinforms.cs +++ b/src/L10NSharp.Windows.Forms/LocalizationManagerInternalWinforms.cs @@ -2,7 +2,6 @@ // This software is licensed under the MIT License (http://opensource.org/licenses/MIT) using System; -using System.Collections.Concurrent; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; @@ -11,9 +10,8 @@ using System.Linq; using System.Reflection; using System.Windows.Forms; -using L10NSharp; using L10NSharp.Windows.Forms.XLiffUtils; -using L10NSharp.Windows.Forms.UI; +using L10NSharp.Windows.Forms.UIComponents; // ReSharper disable StaticMemberInGenericType - these static fields are parameter-independent namespace L10NSharp.Windows.Forms @@ -62,14 +60,15 @@ private static ILocalizationManager Create(string desiredUiLangId, string appId, PreviouslyLoadedManagers.Remove(appId); } - ((ILocalizationManagerInternalWinforms)lm).ApplicationIcon = applicationIcon; + if (lm is ILocalizationManagerInternalWinforms) + ((ILocalizationManagerInternalWinforms)lm).ApplicationIcon = applicationIcon; if (string.IsNullOrEmpty(desiredUiLangId)) { desiredUiLangId = CultureInfo.CurrentUICulture.TwoLetterISOLanguageName; } - if (!LocalizationManagerInternal.IsDesiredUiCultureAvailable(desiredUiLangId)) + if (!LocalizationManagerInternalWinforms.IsDesiredUiCultureAvailable(desiredUiLangId)) { desiredUiLangId = ChooseFallbackLanguage(desiredUiLangId, applicationIcon); } diff --git a/src/L10NSharp.Windows.Forms/LocalizingInfoWinforms.cs b/src/L10NSharp.Windows.Forms/LocalizingInfoWinforms.cs index 23de2e8..4a86628 100644 --- a/src/L10NSharp.Windows.Forms/LocalizingInfoWinforms.cs +++ b/src/L10NSharp.Windows.Forms/LocalizingInfoWinforms.cs @@ -1,8 +1,6 @@ -using System; using System.ComponentModel; using System.Windows.Forms; -using L10NSharp.Windows.Forms.UI; -using L10NSharp; +using L10NSharp.Windows.Forms.UIComponents; namespace L10NSharp.Windows.Forms { diff --git a/src/L10NSharp.Windows.Forms/UI/ColorHelper.cs b/src/L10NSharp.Windows.Forms/UIComponents/ColorHelper.cs similarity index 98% rename from src/L10NSharp.Windows.Forms/UI/ColorHelper.cs rename to src/L10NSharp.Windows.Forms/UIComponents/ColorHelper.cs index 6c943c0..2d82c86 100644 --- a/src/L10NSharp.Windows.Forms/UI/ColorHelper.cs +++ b/src/L10NSharp.Windows.Forms/UIComponents/ColorHelper.cs @@ -1,6 +1,6 @@ using System.Drawing; -namespace L10NSharp.Windows.Forms.UI +namespace L10NSharp.Windows.Forms.UIComponents { internal static class ColorHelper { diff --git a/src/L10NSharp.Windows.Forms/UI/CustomDropDownComboBox.Designer.cs b/src/L10NSharp.Windows.Forms/UIComponents/CustomDropDownComboBox.Designer.cs similarity index 98% rename from src/L10NSharp.Windows.Forms/UI/CustomDropDownComboBox.Designer.cs rename to src/L10NSharp.Windows.Forms/UIComponents/CustomDropDownComboBox.Designer.cs index 506332a..3ee2bc0 100644 --- a/src/L10NSharp.Windows.Forms/UI/CustomDropDownComboBox.Designer.cs +++ b/src/L10NSharp.Windows.Forms/UIComponents/CustomDropDownComboBox.Designer.cs @@ -1,4 +1,4 @@ -namespace L10NSharp.Windows.Forms.UI +namespace L10NSharp.Windows.Forms.UIComponents { partial class CustomDropDownComboBox { diff --git a/src/L10NSharp.Windows.Forms/UI/CustomDropDownComboBox.cs b/src/L10NSharp.Windows.Forms/UIComponents/CustomDropDownComboBox.cs similarity index 99% rename from src/L10NSharp.Windows.Forms/UI/CustomDropDownComboBox.cs rename to src/L10NSharp.Windows.Forms/UIComponents/CustomDropDownComboBox.cs index b6f3c6b..dc6c5fb 100644 --- a/src/L10NSharp.Windows.Forms/UI/CustomDropDownComboBox.cs +++ b/src/L10NSharp.Windows.Forms/UIComponents/CustomDropDownComboBox.cs @@ -3,7 +3,7 @@ using System.Windows.Forms; using System.Windows.Forms.VisualStyles; -namespace L10NSharp.Windows.Forms.UI +namespace L10NSharp.Windows.Forms.UIComponents { /// ---------------------------------------------------------------------------------------- internal partial class CustomDropDownComboBox : UserControl diff --git a/src/L10NSharp.Windows.Forms/UI/CustomDropDownComboBox.resx b/src/L10NSharp.Windows.Forms/UIComponents/CustomDropDownComboBox.resx similarity index 100% rename from src/L10NSharp.Windows.Forms/UI/CustomDropDownComboBox.resx rename to src/L10NSharp.Windows.Forms/UIComponents/CustomDropDownComboBox.resx diff --git a/src/L10NSharp.Windows.Forms/UI/DontShowThisAgainButton.Designer.cs b/src/L10NSharp.Windows.Forms/UIComponents/DontShowThisAgainButton.Designer.cs similarity index 95% rename from src/L10NSharp.Windows.Forms/UI/DontShowThisAgainButton.Designer.cs rename to src/L10NSharp.Windows.Forms/UIComponents/DontShowThisAgainButton.Designer.cs index 6331aac..5563c81 100644 --- a/src/L10NSharp.Windows.Forms/UI/DontShowThisAgainButton.Designer.cs +++ b/src/L10NSharp.Windows.Forms/UIComponents/DontShowThisAgainButton.Designer.cs @@ -1,4 +1,4 @@ -namespace L10NSharp.Windows.Forms.UI +namespace L10NSharp.Windows.Forms.UIComponents { partial class DontShowThisAgainButton { diff --git a/src/L10NSharp.Windows.Forms/UI/DontShowThisAgainButton.cs b/src/L10NSharp.Windows.Forms/UIComponents/DontShowThisAgainButton.cs similarity index 98% rename from src/L10NSharp.Windows.Forms/UI/DontShowThisAgainButton.cs rename to src/L10NSharp.Windows.Forms/UIComponents/DontShowThisAgainButton.cs index 900b502..bb47056 100644 --- a/src/L10NSharp.Windows.Forms/UI/DontShowThisAgainButton.cs +++ b/src/L10NSharp.Windows.Forms/UIComponents/DontShowThisAgainButton.cs @@ -7,7 +7,7 @@ using System.Windows.Forms; using L10NSharp.Properties; -namespace L10NSharp.Windows.Forms.UI +namespace L10NSharp.Windows.Forms.UIComponents { public partial class DontShowThisAgainButton : CheckBox { diff --git a/src/L10NSharp.Windows.Forms/UI/EditSourceBeforeTranslatingDlg.Designer.cs b/src/L10NSharp.Windows.Forms/UIComponents/EditSourceBeforeTranslatingDlg.Designer.cs similarity index 99% rename from src/L10NSharp.Windows.Forms/UI/EditSourceBeforeTranslatingDlg.Designer.cs rename to src/L10NSharp.Windows.Forms/UIComponents/EditSourceBeforeTranslatingDlg.Designer.cs index b926289..8c5432e 100644 --- a/src/L10NSharp.Windows.Forms/UI/EditSourceBeforeTranslatingDlg.Designer.cs +++ b/src/L10NSharp.Windows.Forms/UIComponents/EditSourceBeforeTranslatingDlg.Designer.cs @@ -1,4 +1,4 @@ -namespace L10NSharp.Windows.Forms.UI +namespace L10NSharp.Windows.Forms.UIComponents { partial class EditSourceBeforeTranslatingDlg { diff --git a/src/L10NSharp.Windows.Forms/UI/EditSourceBeforeTranslatingDlg.cs b/src/L10NSharp.Windows.Forms/UIComponents/EditSourceBeforeTranslatingDlg.cs similarity index 97% rename from src/L10NSharp.Windows.Forms/UI/EditSourceBeforeTranslatingDlg.cs rename to src/L10NSharp.Windows.Forms/UIComponents/EditSourceBeforeTranslatingDlg.cs index bdbb47a..ef047a3 100644 --- a/src/L10NSharp.Windows.Forms/UI/EditSourceBeforeTranslatingDlg.cs +++ b/src/L10NSharp.Windows.Forms/UIComponents/EditSourceBeforeTranslatingDlg.cs @@ -4,7 +4,7 @@ using System.Windows.Forms; using L10NSharp.Translators; -namespace L10NSharp.Windows.Forms.UI +namespace L10NSharp.Windows.Forms.UIComponents { public partial class EditSourceBeforeTranslatingDlg : Form { diff --git a/src/L10NSharp.Windows.Forms/UI/EditSourceBeforeTranslatingDlg.resx b/src/L10NSharp.Windows.Forms/UIComponents/EditSourceBeforeTranslatingDlg.resx similarity index 100% rename from src/L10NSharp.Windows.Forms/UI/EditSourceBeforeTranslatingDlg.resx rename to src/L10NSharp.Windows.Forms/UIComponents/EditSourceBeforeTranslatingDlg.resx diff --git a/src/L10NSharp.Windows.Forms/UI/FallbackLanguagesDlg.cs b/src/L10NSharp.Windows.Forms/UIComponents/FallbackLanguagesDlg.cs similarity index 95% rename from src/L10NSharp.Windows.Forms/UI/FallbackLanguagesDlg.cs rename to src/L10NSharp.Windows.Forms/UIComponents/FallbackLanguagesDlg.cs index 4905521..8a6692c 100644 --- a/src/L10NSharp.Windows.Forms/UI/FallbackLanguagesDlg.cs +++ b/src/L10NSharp.Windows.Forms/UIComponents/FallbackLanguagesDlg.cs @@ -7,7 +7,7 @@ using System.Windows.Forms; using L10NSharp; -namespace L10NSharp.Windows.Forms.UI +namespace L10NSharp.Windows.Forms.UIComponents { public class FallbackLanguagesDlg : FallbackLanguagesDlgBase { diff --git a/src/L10NSharp.Windows.Forms/UI/FallbackLanguagesDlgBase.Designer.cs b/src/L10NSharp.Windows.Forms/UIComponents/FallbackLanguagesDlgBase.Designer.cs similarity index 99% rename from src/L10NSharp.Windows.Forms/UI/FallbackLanguagesDlgBase.Designer.cs rename to src/L10NSharp.Windows.Forms/UIComponents/FallbackLanguagesDlgBase.Designer.cs index 7917c3f..d07a0c5 100644 --- a/src/L10NSharp.Windows.Forms/UI/FallbackLanguagesDlgBase.Designer.cs +++ b/src/L10NSharp.Windows.Forms/UIComponents/FallbackLanguagesDlgBase.Designer.cs @@ -1,4 +1,4 @@ -namespace L10NSharp.Windows.Forms.UI +namespace L10NSharp.Windows.Forms.UIComponents { partial class FallbackLanguagesDlgBase { diff --git a/src/L10NSharp.Windows.Forms/UI/FallbackLanguagesDlgBase.cs b/src/L10NSharp.Windows.Forms/UIComponents/FallbackLanguagesDlgBase.cs similarity index 99% rename from src/L10NSharp.Windows.Forms/UI/FallbackLanguagesDlgBase.cs rename to src/L10NSharp.Windows.Forms/UIComponents/FallbackLanguagesDlgBase.cs index f5cb7b1..4f65c39 100644 --- a/src/L10NSharp.Windows.Forms/UI/FallbackLanguagesDlgBase.cs +++ b/src/L10NSharp.Windows.Forms/UIComponents/FallbackLanguagesDlgBase.cs @@ -5,7 +5,7 @@ using System.Windows.Forms; using L10NSharp; -namespace L10NSharp.Windows.Forms.UI +namespace L10NSharp.Windows.Forms.UIComponents { /// ------------------------------------------------------------------------------------ public partial class FallbackLanguagesDlgBase : Form diff --git a/src/L10NSharp.Windows.Forms/UI/FallbackLanguagesDlgBase.resx b/src/L10NSharp.Windows.Forms/UIComponents/FallbackLanguagesDlgBase.resx similarity index 100% rename from src/L10NSharp.Windows.Forms/UI/FallbackLanguagesDlgBase.resx rename to src/L10NSharp.Windows.Forms/UIComponents/FallbackLanguagesDlgBase.resx diff --git a/src/L10NSharp.Windows.Forms/UI/Grid/LmButtonCell.cs b/src/L10NSharp.Windows.Forms/UIComponents/Grid/LmButtonCell.cs similarity index 99% rename from src/L10NSharp.Windows.Forms/UI/Grid/LmButtonCell.cs rename to src/L10NSharp.Windows.Forms/UIComponents/Grid/LmButtonCell.cs index b343bd0..6cff553 100644 --- a/src/L10NSharp.Windows.Forms/UI/Grid/LmButtonCell.cs +++ b/src/L10NSharp.Windows.Forms/UIComponents/Grid/LmButtonCell.cs @@ -3,7 +3,7 @@ using System.Windows.Forms; using System.Windows.Forms.VisualStyles; -namespace L10NSharp.Windows.Forms.UI +namespace L10NSharp.Windows.Forms.UIComponents { #region LmButtonCell class /// ---------------------------------------------------------------------------------------- diff --git a/src/L10NSharp.Windows.Forms/UI/Grid/LmButtonColumn.cs b/src/L10NSharp.Windows.Forms/UIComponents/Grid/LmButtonColumn.cs similarity index 99% rename from src/L10NSharp.Windows.Forms/UI/Grid/LmButtonColumn.cs rename to src/L10NSharp.Windows.Forms/UIComponents/Grid/LmButtonColumn.cs index b97e8ab..d716b1a 100644 --- a/src/L10NSharp.Windows.Forms/UI/Grid/LmButtonColumn.cs +++ b/src/L10NSharp.Windows.Forms/UIComponents/Grid/LmButtonColumn.cs @@ -2,7 +2,7 @@ using System.Drawing; using System.Windows.Forms; -namespace L10NSharp.Windows.Forms.UI +namespace L10NSharp.Windows.Forms.UIComponents { /// ---------------------------------------------------------------------------------------- public class LmButtonColumn : DataGridViewColumn diff --git a/src/L10NSharp.Windows.Forms/UI/Grid/LmGrid.cs b/src/L10NSharp.Windows.Forms/UIComponents/Grid/LmGrid.cs similarity index 99% rename from src/L10NSharp.Windows.Forms/UI/Grid/LmGrid.cs rename to src/L10NSharp.Windows.Forms/UIComponents/Grid/LmGrid.cs index 89df711..770e9ad 100644 --- a/src/L10NSharp.Windows.Forms/UI/Grid/LmGrid.cs +++ b/src/L10NSharp.Windows.Forms/UIComponents/Grid/LmGrid.cs @@ -7,7 +7,7 @@ using System.Windows.Forms; using System.Windows.Forms.VisualStyles; -namespace L10NSharp.Windows.Forms.UI +namespace L10NSharp.Windows.Forms.UIComponents { /// ---------------------------------------------------------------------------------------- public class LmGrid : DataGridView diff --git a/src/L10NSharp.Windows.Forms/UI/HowToDistributeDialog.Designer.cs b/src/L10NSharp.Windows.Forms/UIComponents/HowToDistributeDialog.Designer.cs similarity index 99% rename from src/L10NSharp.Windows.Forms/UI/HowToDistributeDialog.Designer.cs rename to src/L10NSharp.Windows.Forms/UIComponents/HowToDistributeDialog.Designer.cs index 3a88148..2639d72 100644 --- a/src/L10NSharp.Windows.Forms/UI/HowToDistributeDialog.Designer.cs +++ b/src/L10NSharp.Windows.Forms/UIComponents/HowToDistributeDialog.Designer.cs @@ -1,4 +1,4 @@ -namespace L10NSharp.Windows.Forms.UI +namespace L10NSharp.Windows.Forms.UIComponents { partial class HowToDistributeDialog { diff --git a/src/L10NSharp.Windows.Forms/UI/HowToDistributeDialog.cs b/src/L10NSharp.Windows.Forms/UIComponents/HowToDistributeDialog.cs similarity index 98% rename from src/L10NSharp.Windows.Forms/UI/HowToDistributeDialog.cs rename to src/L10NSharp.Windows.Forms/UIComponents/HowToDistributeDialog.cs index 0286910..a4f954b 100644 --- a/src/L10NSharp.Windows.Forms/UI/HowToDistributeDialog.cs +++ b/src/L10NSharp.Windows.Forms/UIComponents/HowToDistributeDialog.cs @@ -5,7 +5,7 @@ using System.Windows.Forms; using L10NSharp; -namespace L10NSharp.Windows.Forms.UI +namespace L10NSharp.Windows.Forms.UIComponents { public partial class HowToDistributeDialog : Form { diff --git a/src/L10NSharp.Windows.Forms/UI/HowToDistributeDialog.resx b/src/L10NSharp.Windows.Forms/UIComponents/HowToDistributeDialog.resx similarity index 100% rename from src/L10NSharp.Windows.Forms/UI/HowToDistributeDialog.resx rename to src/L10NSharp.Windows.Forms/UIComponents/HowToDistributeDialog.resx diff --git a/src/L10NSharp.Windows.Forms/UI/InitializationProgressDlg.cs b/src/L10NSharp.Windows.Forms/UIComponents/InitializationProgressDlg.cs similarity index 98% rename from src/L10NSharp.Windows.Forms/UI/InitializationProgressDlg.cs rename to src/L10NSharp.Windows.Forms/UIComponents/InitializationProgressDlg.cs index c28ff7d..4dd6b2c 100644 --- a/src/L10NSharp.Windows.Forms/UI/InitializationProgressDlg.cs +++ b/src/L10NSharp.Windows.Forms/UIComponents/InitializationProgressDlg.cs @@ -7,7 +7,7 @@ using L10NSharp.CodeReader; using L10NSharp; -namespace L10NSharp.Windows.Forms.UI +namespace L10NSharp.Windows.Forms.UIComponents { internal class InitializationProgressDlg: InitializationProgressDlgBase { diff --git a/src/L10NSharp.Windows.Forms/UI/InitializationProgressDlgBase.Designer.cs b/src/L10NSharp.Windows.Forms/UIComponents/InitializationProgressDlgBase.Designer.cs similarity index 99% rename from src/L10NSharp.Windows.Forms/UI/InitializationProgressDlgBase.Designer.cs rename to src/L10NSharp.Windows.Forms/UIComponents/InitializationProgressDlgBase.Designer.cs index e4d1cee..955f6ab 100644 --- a/src/L10NSharp.Windows.Forms/UI/InitializationProgressDlgBase.Designer.cs +++ b/src/L10NSharp.Windows.Forms/UIComponents/InitializationProgressDlgBase.Designer.cs @@ -1,4 +1,4 @@ -namespace L10NSharp.Windows.Forms.UI +namespace L10NSharp.Windows.Forms.UIComponents { partial class InitializationProgressDlgBase { diff --git a/src/L10NSharp.Windows.Forms/UI/InitializationProgressDlgBase.cs b/src/L10NSharp.Windows.Forms/UIComponents/InitializationProgressDlgBase.cs similarity index 97% rename from src/L10NSharp.Windows.Forms/UI/InitializationProgressDlgBase.cs rename to src/L10NSharp.Windows.Forms/UIComponents/InitializationProgressDlgBase.cs index 36a0823..e751a6b 100644 --- a/src/L10NSharp.Windows.Forms/UI/InitializationProgressDlgBase.cs +++ b/src/L10NSharp.Windows.Forms/UIComponents/InitializationProgressDlgBase.cs @@ -5,7 +5,7 @@ using System.Reflection; using System.Windows.Forms; -namespace L10NSharp.Windows.Forms.UI +namespace L10NSharp.Windows.Forms.UIComponents { /// ---------------------------------------------------------------------------------------- internal partial class InitializationProgressDlgBase : Form diff --git a/src/L10NSharp.Windows.Forms/UI/InitializationProgressDlgBase.resx b/src/L10NSharp.Windows.Forms/UIComponents/InitializationProgressDlgBase.resx similarity index 100% rename from src/L10NSharp.Windows.Forms/UI/InitializationProgressDlgBase.resx rename to src/L10NSharp.Windows.Forms/UIComponents/InitializationProgressDlgBase.resx diff --git a/src/L10NSharp.Windows.Forms/UI/LanguageChoosingDialog.Designer.cs b/src/L10NSharp.Windows.Forms/UIComponents/LanguageChoosingDialog.Designer.cs similarity index 96% rename from src/L10NSharp.Windows.Forms/UI/LanguageChoosingDialog.Designer.cs rename to src/L10NSharp.Windows.Forms/UIComponents/LanguageChoosingDialog.Designer.cs index 430595a..f425d7e 100644 --- a/src/L10NSharp.Windows.Forms/UI/LanguageChoosingDialog.Designer.cs +++ b/src/L10NSharp.Windows.Forms/UIComponents/LanguageChoosingDialog.Designer.cs @@ -1,6 +1,6 @@ using System.Drawing; -namespace L10NSharp.Windows.Forms.UI +namespace L10NSharp.Windows.Forms.UIComponents { partial class LanguageChoosingDialog { @@ -32,7 +32,7 @@ private void InitializeComponent() { this._messageLabel = new System.Windows.Forms.Label(); this._OKButton = new System.Windows.Forms.Button(); - this.uiLanguageComboBox1 = new L10NSharp.Windows.Forms.UI.UILanguageComboBox(); + this.uiLanguageComboBox1 = new L10NSharp.Windows.Forms.UIComponents.UILanguageComboBox(); this.SuspendLayout(); // // _messageLabel diff --git a/src/L10NSharp.Windows.Forms/UI/LanguageChoosingDialog.cs b/src/L10NSharp.Windows.Forms/UIComponents/LanguageChoosingDialog.cs similarity index 96% rename from src/L10NSharp.Windows.Forms/UI/LanguageChoosingDialog.cs rename to src/L10NSharp.Windows.Forms/UIComponents/LanguageChoosingDialog.cs index 9d1a656..0f02438 100644 --- a/src/L10NSharp.Windows.Forms/UI/LanguageChoosingDialog.cs +++ b/src/L10NSharp.Windows.Forms/UIComponents/LanguageChoosingDialog.cs @@ -4,7 +4,7 @@ using L10NSharp.Translators; using L10NSharp; -namespace L10NSharp.Windows.Forms.UI +namespace L10NSharp.Windows.Forms.UIComponents { public partial class LanguageChoosingDialog : Form { diff --git a/src/L10NSharp.Windows.Forms/UI/LanguageChoosingDialog.resx b/src/L10NSharp.Windows.Forms/UIComponents/LanguageChoosingDialog.resx similarity index 100% rename from src/L10NSharp.Windows.Forms/UI/LanguageChoosingDialog.resx rename to src/L10NSharp.Windows.Forms/UIComponents/LanguageChoosingDialog.resx diff --git a/src/L10NSharp.Windows.Forms/UI/LanguageChoosingDialogViewModel.cs b/src/L10NSharp.Windows.Forms/UIComponents/LanguageChoosingDialogViewModel.cs similarity index 98% rename from src/L10NSharp.Windows.Forms/UI/LanguageChoosingDialogViewModel.cs rename to src/L10NSharp.Windows.Forms/UIComponents/LanguageChoosingDialogViewModel.cs index 4f5ab3f..b433429 100644 --- a/src/L10NSharp.Windows.Forms/UI/LanguageChoosingDialogViewModel.cs +++ b/src/L10NSharp.Windows.Forms/UIComponents/LanguageChoosingDialogViewModel.cs @@ -3,7 +3,7 @@ using L10NSharp.Translators; using L10NSharp; -namespace L10NSharp.Windows.Forms.UI +namespace L10NSharp.Windows.Forms.UIComponents { internal class LanguageChoosingDialogViewModel { diff --git a/src/L10NSharp.Windows.Forms/UI/LanguageChoosingSimpleDialog.Designer.cs b/src/L10NSharp.Windows.Forms/UIComponents/LanguageChoosingSimpleDialog.Designer.cs similarity index 92% rename from src/L10NSharp.Windows.Forms/UI/LanguageChoosingSimpleDialog.Designer.cs rename to src/L10NSharp.Windows.Forms/UIComponents/LanguageChoosingSimpleDialog.Designer.cs index d1ec13f..4c8d667 100644 --- a/src/L10NSharp.Windows.Forms/UI/LanguageChoosingSimpleDialog.Designer.cs +++ b/src/L10NSharp.Windows.Forms/UIComponents/LanguageChoosingSimpleDialog.Designer.cs @@ -1,4 +1,4 @@ -namespace L10NSharp.Windows.Forms.UI +namespace L10NSharp.Windows.Forms.UIComponents { partial class LanguageChoosingSimpleDialog { @@ -28,7 +28,7 @@ protected override void Dispose(bool disposing) /// private void InitializeComponent() { - this._uiLanguageListBox = new L10NSharp.Windows.Forms.UI.UILanguageListBox(); + this._uiLanguageListBox = new L10NSharp.Windows.Forms.UIComponents.UILanguageListBox(); this._btnOk = new System.Windows.Forms.Button(); this.SuspendLayout(); // @@ -77,7 +77,7 @@ private void InitializeComponent() #endregion - private L10NSharp.Windows.Forms.UI.UILanguageListBox _uiLanguageListBox; + private L10NSharp.Windows.Forms.UIComponents.UILanguageListBox _uiLanguageListBox; private System.Windows.Forms.Button _btnOk; } } diff --git a/src/L10NSharp.Windows.Forms/UI/LanguageChoosingSimpleDialog.cs b/src/L10NSharp.Windows.Forms/UIComponents/LanguageChoosingSimpleDialog.cs similarity index 94% rename from src/L10NSharp.Windows.Forms/UI/LanguageChoosingSimpleDialog.cs rename to src/L10NSharp.Windows.Forms/UIComponents/LanguageChoosingSimpleDialog.cs index d1f32fc..14cbb79 100644 --- a/src/L10NSharp.Windows.Forms/UI/LanguageChoosingSimpleDialog.cs +++ b/src/L10NSharp.Windows.Forms/UIComponents/LanguageChoosingSimpleDialog.cs @@ -2,7 +2,7 @@ using System.Drawing; using System.Windows.Forms; -namespace L10NSharp.Windows.Forms.UI +namespace L10NSharp.Windows.Forms.UIComponents { /// /// The current thinking for use of this dialog is when an application first starts up, diff --git a/src/L10NSharp.Windows.Forms/UI/LanguageChoosingSimpleDialog.resx b/src/L10NSharp.Windows.Forms/UIComponents/LanguageChoosingSimpleDialog.resx similarity index 100% rename from src/L10NSharp.Windows.Forms/UI/LanguageChoosingSimpleDialog.resx rename to src/L10NSharp.Windows.Forms/UIComponents/LanguageChoosingSimpleDialog.resx diff --git a/src/L10NSharp.Windows.Forms/UI/LocTreeNode.cs b/src/L10NSharp.Windows.Forms/UIComponents/LocTreeNode.cs similarity index 98% rename from src/L10NSharp.Windows.Forms/UI/LocTreeNode.cs rename to src/L10NSharp.Windows.Forms/UIComponents/LocTreeNode.cs index 4acf43e..1795de3 100644 --- a/src/L10NSharp.Windows.Forms/UI/LocTreeNode.cs +++ b/src/L10NSharp.Windows.Forms/UIComponents/LocTreeNode.cs @@ -2,7 +2,7 @@ using System.Linq; using System.Windows.Forms; -namespace L10NSharp.Windows.Forms.UI +namespace L10NSharp.Windows.Forms.UIComponents { /// ---------------------------------------------------------------------------------------- internal class LocTreeNode : TreeNode diff --git a/src/L10NSharp.Windows.Forms/UI/LocalizeItemDlg.Designer.cs b/src/L10NSharp.Windows.Forms/UIComponents/LocalizeItemDlg.Designer.cs similarity index 99% rename from src/L10NSharp.Windows.Forms/UI/LocalizeItemDlg.Designer.cs rename to src/L10NSharp.Windows.Forms/UIComponents/LocalizeItemDlg.Designer.cs index 53a0542..52712f6 100644 --- a/src/L10NSharp.Windows.Forms/UI/LocalizeItemDlg.Designer.cs +++ b/src/L10NSharp.Windows.Forms/UIComponents/LocalizeItemDlg.Designer.cs @@ -1,4 +1,4 @@ -namespace L10NSharp.Windows.Forms.UI +namespace L10NSharp.Windows.Forms.UIComponents { partial class LocalizeItemDlg { @@ -43,15 +43,15 @@ private void InitializeComponent() this._treeView = new System.Windows.Forms.TreeView(); this._toolStripLeftSide = new System.Windows.Forms.ToolStrip(); this._labelGroups = new System.Windows.Forms.ToolStripLabel(); - this._buttonMoveNext = new L10NSharp.Windows.Forms.UI.XButton(); - this._grid = new L10NSharp.Windows.Forms.UI.LmGrid(); + this._buttonMoveNext = new L10NSharp.Windows.Forms.UIComponents.XButton(); + this._grid = new L10NSharp.Windows.Forms.UIComponents.LmGrid(); this._colId = new System.Windows.Forms.DataGridViewTextBoxColumn(); this._colSourceText = new System.Windows.Forms.DataGridViewTextBoxColumn(); this._colTargetText = new System.Windows.Forms.DataGridViewTextBoxColumn(); this._colSrcToolTip = new System.Windows.Forms.DataGridViewTextBoxColumn(); this._colTgtToolTip = new System.Windows.Forms.DataGridViewTextBoxColumn(); this._colComments = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this._buttonMovePrev = new L10NSharp.Windows.Forms.UI.XButton(); + this._buttonMovePrev = new L10NSharp.Windows.Forms.UIComponents.XButton(); this._toolStripRightSide = new System.Windows.Forms.ToolStrip(); this._buttonBingTranslator = new System.Windows.Forms.ToolStripSplitButton(); this._menuTranslateUsingBing = new System.Windows.Forms.ToolStripMenuItem(); @@ -62,13 +62,13 @@ private void InitializeComponent() this._labelSourceLang = new System.Windows.Forms.ToolStripLabel(); this._tableLayout = new System.Windows.Forms.TableLayoutPanel(); this._panelIdentifier = new System.Windows.Forms.Panel(); - this.btnCopyToolTip = new L10NSharp.Windows.Forms.UI.XButton(); - this.btnCopyShortcutKeys = new L10NSharp.Windows.Forms.UI.XButton(); - this.btnCopyText = new L10NSharp.Windows.Forms.UI.XButton(); + this.btnCopyToolTip = new L10NSharp.Windows.Forms.UIComponents.XButton(); + this.btnCopyShortcutKeys = new L10NSharp.Windows.Forms.UIComponents.XButton(); + this.btnCopyText = new L10NSharp.Windows.Forms.UIComponents.XButton(); this._panelTargetText = new System.Windows.Forms.Panel(); this._groupBoxTgtTranslation = new System.Windows.Forms.GroupBox(); this._labelTgtShortcutKeys = new System.Windows.Forms.Label(); - this._shortcutKeysDropDown = new L10NSharp.Windows.Forms.UI.ShortcutKeysDropDown(); + this._shortcutKeysDropDown = new L10NSharp.Windows.Forms.UIComponents.ShortcutKeysDropDown(); this._labelTgtToolTip = new System.Windows.Forms.Label(); this._textBoxTgtToolTip = new System.Windows.Forms.TextBox(); this._panelSourceText = new System.Windows.Forms.Panel(); diff --git a/src/L10NSharp.Windows.Forms/UI/LocalizeItemDlg.cs b/src/L10NSharp.Windows.Forms/UIComponents/LocalizeItemDlg.cs similarity index 99% rename from src/L10NSharp.Windows.Forms/UI/LocalizeItemDlg.cs rename to src/L10NSharp.Windows.Forms/UIComponents/LocalizeItemDlg.cs index e5a9f61..add7542 100644 --- a/src/L10NSharp.Windows.Forms/UI/LocalizeItemDlg.cs +++ b/src/L10NSharp.Windows.Forms/UIComponents/LocalizeItemDlg.cs @@ -9,7 +9,7 @@ using L10NSharp.Windows.Forms.Properties; using L10NSharp; -namespace L10NSharp.Windows.Forms.UI +namespace L10NSharp.Windows.Forms.UIComponents { /// ---------------------------------------------------------------------------------------- public partial class LocalizeItemDlg : Form diff --git a/src/L10NSharp.Windows.Forms/UI/LocalizeItemDlg.resx b/src/L10NSharp.Windows.Forms/UIComponents/LocalizeItemDlg.resx similarity index 100% rename from src/L10NSharp.Windows.Forms/UI/LocalizeItemDlg.resx rename to src/L10NSharp.Windows.Forms/UIComponents/LocalizeItemDlg.resx diff --git a/src/L10NSharp.Windows.Forms/UI/LocalizeItemDlgViewModel.cs b/src/L10NSharp.Windows.Forms/UIComponents/LocalizeItemDlgViewModel.cs similarity index 99% rename from src/L10NSharp.Windows.Forms/UI/LocalizeItemDlgViewModel.cs rename to src/L10NSharp.Windows.Forms/UIComponents/LocalizeItemDlgViewModel.cs index be3bc87..af3ba82 100644 --- a/src/L10NSharp.Windows.Forms/UI/LocalizeItemDlgViewModel.cs +++ b/src/L10NSharp.Windows.Forms/UIComponents/LocalizeItemDlgViewModel.cs @@ -7,7 +7,7 @@ using L10NSharp.Translators; using L10NSharp; -namespace L10NSharp.Windows.Forms.UI +namespace L10NSharp.Windows.Forms.UIComponents { internal class LocalizeItemDlgViewModel { diff --git a/src/L10NSharp.Windows.Forms/UI/NodeComparer.cs b/src/L10NSharp.Windows.Forms/UIComponents/NodeComparer.cs similarity index 98% rename from src/L10NSharp.Windows.Forms/UI/NodeComparer.cs rename to src/L10NSharp.Windows.Forms/UIComponents/NodeComparer.cs index be386fd..92c7bdd 100644 --- a/src/L10NSharp.Windows.Forms/UI/NodeComparer.cs +++ b/src/L10NSharp.Windows.Forms/UIComponents/NodeComparer.cs @@ -5,7 +5,7 @@ using System.Globalization; using System.Windows.Forms; -namespace L10NSharp.Windows.Forms.UI +namespace L10NSharp.Windows.Forms.UIComponents { /// ---------------------------------------------------------------------------------------- internal class NodeComparer : IComparer> diff --git a/src/L10NSharp.Windows.Forms/UI/PaintingHelper.cs b/src/L10NSharp.Windows.Forms/UIComponents/PaintingHelper.cs similarity index 99% rename from src/L10NSharp.Windows.Forms/UI/PaintingHelper.cs rename to src/L10NSharp.Windows.Forms/UIComponents/PaintingHelper.cs index e87fc74..a9c8618 100644 --- a/src/L10NSharp.Windows.Forms/UI/PaintingHelper.cs +++ b/src/L10NSharp.Windows.Forms/UIComponents/PaintingHelper.cs @@ -5,7 +5,7 @@ using System.Windows.Forms; using System.Windows.Forms.VisualStyles; -namespace L10NSharp.Windows.Forms.UI +namespace L10NSharp.Windows.Forms.UIComponents { /// ------------------------------------------------------------------------------------ /// diff --git a/src/L10NSharp.Windows.Forms/UI/PopupControl.cs b/src/L10NSharp.Windows.Forms/UIComponents/PopupControl.cs similarity index 99% rename from src/L10NSharp.Windows.Forms/UI/PopupControl.cs rename to src/L10NSharp.Windows.Forms/UIComponents/PopupControl.cs index 2559683..7a9f82c 100644 --- a/src/L10NSharp.Windows.Forms/UI/PopupControl.cs +++ b/src/L10NSharp.Windows.Forms/UIComponents/PopupControl.cs @@ -5,7 +5,7 @@ using System.Drawing.Drawing2D; using System.Windows.Forms; -namespace L10NSharp.Windows.Forms.UI +namespace L10NSharp.Windows.Forms.UIComponents { /// ---------------------------------------------------------------------------------------- internal partial class PopupControl : UserControl diff --git a/src/L10NSharp.Windows.Forms/UI/PopupControl.designer.cs b/src/L10NSharp.Windows.Forms/UIComponents/PopupControl.designer.cs similarity index 94% rename from src/L10NSharp.Windows.Forms/UI/PopupControl.designer.cs rename to src/L10NSharp.Windows.Forms/UIComponents/PopupControl.designer.cs index 77e49e6..2e40de5 100644 --- a/src/L10NSharp.Windows.Forms/UI/PopupControl.designer.cs +++ b/src/L10NSharp.Windows.Forms/UIComponents/PopupControl.designer.cs @@ -1,4 +1,4 @@ -namespace L10NSharp.Windows.Forms.UI +namespace L10NSharp.Windows.Forms.UIComponents { partial class PopupControl { diff --git a/src/L10NSharp.Windows.Forms/UI/PopupControl.resx b/src/L10NSharp.Windows.Forms/UIComponents/PopupControl.resx similarity index 100% rename from src/L10NSharp.Windows.Forms/UI/PopupControl.resx rename to src/L10NSharp.Windows.Forms/UIComponents/PopupControl.resx diff --git a/src/L10NSharp.Windows.Forms/UI/ShortcutKeysDropDown.cs b/src/L10NSharp.Windows.Forms/UIComponents/ShortcutKeysDropDown.cs similarity index 98% rename from src/L10NSharp.Windows.Forms/UI/ShortcutKeysDropDown.cs rename to src/L10NSharp.Windows.Forms/UIComponents/ShortcutKeysDropDown.cs index 9d5e178..e937605 100644 --- a/src/L10NSharp.Windows.Forms/UI/ShortcutKeysDropDown.cs +++ b/src/L10NSharp.Windows.Forms/UIComponents/ShortcutKeysDropDown.cs @@ -1,7 +1,7 @@ using System; using System.Windows.Forms; -namespace L10NSharp.Windows.Forms.UI +namespace L10NSharp.Windows.Forms.UIComponents { /// ---------------------------------------------------------------------------------------- internal class ShortcutKeysDropDown : CustomDropDownComboBox diff --git a/src/L10NSharp.Windows.Forms/UI/ShortcutKeysEditor.Designer.cs b/src/L10NSharp.Windows.Forms/UIComponents/ShortcutKeysEditor.Designer.cs similarity index 99% rename from src/L10NSharp.Windows.Forms/UI/ShortcutKeysEditor.Designer.cs rename to src/L10NSharp.Windows.Forms/UIComponents/ShortcutKeysEditor.Designer.cs index aea4214..aed8c78 100644 --- a/src/L10NSharp.Windows.Forms/UI/ShortcutKeysEditor.Designer.cs +++ b/src/L10NSharp.Windows.Forms/UIComponents/ShortcutKeysEditor.Designer.cs @@ -1,4 +1,4 @@ -namespace L10NSharp.Windows.Forms.UI +namespace L10NSharp.Windows.Forms.UIComponents { partial class ShortcutKeysEditor { diff --git a/src/L10NSharp.Windows.Forms/UI/ShortcutKeysEditor.cs b/src/L10NSharp.Windows.Forms/UIComponents/ShortcutKeysEditor.cs similarity index 99% rename from src/L10NSharp.Windows.Forms/UI/ShortcutKeysEditor.cs rename to src/L10NSharp.Windows.Forms/UIComponents/ShortcutKeysEditor.cs index d516a02..5aa150a 100644 --- a/src/L10NSharp.Windows.Forms/UI/ShortcutKeysEditor.cs +++ b/src/L10NSharp.Windows.Forms/UIComponents/ShortcutKeysEditor.cs @@ -2,7 +2,7 @@ using System.Drawing; using System.Windows.Forms; -namespace L10NSharp.Windows.Forms.UI +namespace L10NSharp.Windows.Forms.UIComponents { /// ---------------------------------------------------------------------------------------- internal partial class ShortcutKeysEditor : PopupControl diff --git a/src/L10NSharp.Windows.Forms/UI/ShortcutKeysEditor.resx b/src/L10NSharp.Windows.Forms/UIComponents/ShortcutKeysEditor.resx similarity index 100% rename from src/L10NSharp.Windows.Forms/UI/ShortcutKeysEditor.resx rename to src/L10NSharp.Windows.Forms/UIComponents/ShortcutKeysEditor.resx diff --git a/src/L10NSharp.Windows.Forms/UI/TipDialog.cs b/src/L10NSharp.Windows.Forms/UIComponents/TipDialog.cs similarity index 98% rename from src/L10NSharp.Windows.Forms/UI/TipDialog.cs rename to src/L10NSharp.Windows.Forms/UIComponents/TipDialog.cs index 3bd659a..2ca4230 100644 --- a/src/L10NSharp.Windows.Forms/UI/TipDialog.cs +++ b/src/L10NSharp.Windows.Forms/UIComponents/TipDialog.cs @@ -3,7 +3,7 @@ using System.Windows.Forms; using L10NSharp.Windows.Forms.Properties; -namespace L10NSharp.Windows.Forms.UI +namespace L10NSharp.Windows.Forms.UIComponents { public partial class TipDialog : Form { diff --git a/src/L10NSharp.Windows.Forms/UI/TipDialog.designer.cs b/src/L10NSharp.Windows.Forms/UIComponents/TipDialog.designer.cs similarity index 99% rename from src/L10NSharp.Windows.Forms/UI/TipDialog.designer.cs rename to src/L10NSharp.Windows.Forms/UIComponents/TipDialog.designer.cs index 91e0648..8cfa1a4 100644 --- a/src/L10NSharp.Windows.Forms/UI/TipDialog.designer.cs +++ b/src/L10NSharp.Windows.Forms/UIComponents/TipDialog.designer.cs @@ -1,4 +1,4 @@ -namespace L10NSharp.Windows.Forms.UI +namespace L10NSharp.Windows.Forms.UIComponents { partial class TipDialog { diff --git a/src/L10NSharp.Windows.Forms/UI/TipDialog.resx b/src/L10NSharp.Windows.Forms/UIComponents/TipDialog.resx similarity index 100% rename from src/L10NSharp.Windows.Forms/UI/TipDialog.resx rename to src/L10NSharp.Windows.Forms/UIComponents/TipDialog.resx diff --git a/src/L10NSharp.Windows.Forms/UI/UILanguageComboBox.cs b/src/L10NSharp.Windows.Forms/UIComponents/UILanguageComboBox.cs similarity index 98% rename from src/L10NSharp.Windows.Forms/UI/UILanguageComboBox.cs rename to src/L10NSharp.Windows.Forms/UIComponents/UILanguageComboBox.cs index d741496..f625a4f 100644 --- a/src/L10NSharp.Windows.Forms/UI/UILanguageComboBox.cs +++ b/src/L10NSharp.Windows.Forms/UIComponents/UILanguageComboBox.cs @@ -5,7 +5,7 @@ using System.Windows.Forms; using L10NSharp; -namespace L10NSharp.Windows.Forms.UI +namespace L10NSharp.Windows.Forms.UIComponents { /// ---------------------------------------------------------------------------------------- public class UILanguageComboBox : ComboBox diff --git a/src/L10NSharp.Windows.Forms/UI/UILanguageListBox.cs b/src/L10NSharp.Windows.Forms/UIComponents/UILanguageListBox.cs similarity index 98% rename from src/L10NSharp.Windows.Forms/UI/UILanguageListBox.cs rename to src/L10NSharp.Windows.Forms/UIComponents/UILanguageListBox.cs index 4fdd3a7..0bada8b 100644 --- a/src/L10NSharp.Windows.Forms/UI/UILanguageListBox.cs +++ b/src/L10NSharp.Windows.Forms/UIComponents/UILanguageListBox.cs @@ -6,7 +6,7 @@ using System.Windows.Forms; using L10NSharp; -namespace L10NSharp.Windows.Forms.UI +namespace L10NSharp.Windows.Forms.UIComponents { /// ---------------------------------------------------------------------------------------- public class UILanguageListBox : ListBox diff --git a/src/L10NSharp.Windows.Forms/UI/XButton.cs b/src/L10NSharp.Windows.Forms/UIComponents/XButton.cs similarity index 99% rename from src/L10NSharp.Windows.Forms/UI/XButton.cs rename to src/L10NSharp.Windows.Forms/UIComponents/XButton.cs index 70dfdfa..5a199ff 100644 --- a/src/L10NSharp.Windows.Forms/UI/XButton.cs +++ b/src/L10NSharp.Windows.Forms/UIComponents/XButton.cs @@ -3,7 +3,7 @@ using System.Windows.Forms; using System.Windows.Forms.VisualStyles; -namespace L10NSharp.Windows.Forms.UI +namespace L10NSharp.Windows.Forms.UIComponents { /// ---------------------------------------------------------------------------------------- internal class XButton : Label diff --git a/src/L10NSharp.Windows.Forms/XLiffUtils/XliffLocalizationManagerWinforms.cs b/src/L10NSharp.Windows.Forms/XLiffUtils/XliffLocalizationManagerWinforms.cs index 3ab5030..7d7fab7 100644 --- a/src/L10NSharp.Windows.Forms/XLiffUtils/XliffLocalizationManagerWinforms.cs +++ b/src/L10NSharp.Windows.Forms/XLiffUtils/XliffLocalizationManagerWinforms.cs @@ -6,7 +6,7 @@ using System.Linq; using System.Reflection; using System.Windows.Forms; -using L10NSharp.Windows.Forms.UI; +using L10NSharp.Windows.Forms.UIComponents; using L10NSharp.XLiffUtils; using L10NSharp; diff --git a/src/L10NSharp.Windows.Forms/XLiffUtils/XliffLocalizedStringCacheWinforms.cs b/src/L10NSharp.Windows.Forms/XLiffUtils/XliffLocalizedStringCacheWinforms.cs index e58d894..5a915b3 100644 --- a/src/L10NSharp.Windows.Forms/XLiffUtils/XliffLocalizedStringCacheWinforms.cs +++ b/src/L10NSharp.Windows.Forms/XLiffUtils/XliffLocalizedStringCacheWinforms.cs @@ -1,7 +1,7 @@ using System.Collections.Concurrent; using System.Collections.Generic; using System.Windows.Forms; -using L10NSharp.Windows.Forms.UI; +using L10NSharp.Windows.Forms.UIComponents; using L10NSharp.XLiffUtils; using L10NSharp; diff --git a/src/SampleApp/Form1.Designer.cs b/src/SampleApp/Form1.Designer.cs index 3231a99..cf2fdc5 100644 --- a/src/SampleApp/Form1.Designer.cs +++ b/src/SampleApp/Form1.Designer.cs @@ -32,67 +32,65 @@ protected override void Dispose(bool disposing) private void InitializeComponent() { this.components = new System.ComponentModel.Container(); - this.localizationExtender1 = new L10NSharp.Windows.Forms.UI.L10NSharpExtender(this.components); + this.localizationExtender1 = new L10NSharp.Windows.Forms.L10NSharpExtender(this.components); this._getDynamicStringButton = new System.Windows.Forms.Button(); this.label1 = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label(); - this.uiLanguageComboBox1 = new L10NSharp.Windows.Forms.UI.UILanguageComboBox(); + this.uiLanguageComboBox1 = new L10NSharp.Windows.Forms.UIComponents.UILanguageComboBox(); + this.linkLabel1 = new System.Windows.Forms.LinkLabel(); this.columnHeader1 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.columnHeader2 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.dataGridView1 = new System.Windows.Forms.DataGridView(); - this.Column1 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.listView1 = new System.Windows.Forms.ListView(); + this.Column1 = new System.Windows.Forms.DataGridViewTextBoxColumn(); ((System.ComponentModel.ISupportInitialize)(this.localizationExtender1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit(); this.SuspendLayout(); - // + // // localizationExtender1 - // + // this.localizationExtender1.LocalizationManagerId = "SampleApp"; this.localizationExtender1.PrefixForNewItems = "TheSampleForm"; - // + // // _getDynamicStringButton - // + // this.localizationExtender1.SetLocalizableToolTip(this._getDynamicStringButton, null); this.localizationExtender1.SetLocalizationComment(this._getDynamicStringButton, null); this.localizationExtender1.SetLocalizingId(this._getDynamicStringButton, "TheSampleForm.button1"); - this._getDynamicStringButton.Location = new System.Drawing.Point(51, 198); - this._getDynamicStringButton.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this._getDynamicStringButton.Location = new System.Drawing.Point(38, 161); this._getDynamicStringButton.Name = "_getDynamicStringButton"; - this._getDynamicStringButton.Size = new System.Drawing.Size(168, 28); + this._getDynamicStringButton.Size = new System.Drawing.Size(126, 23); this._getDynamicStringButton.TabIndex = 0; this._getDynamicStringButton.Text = "Get Name Dynamically"; this._getDynamicStringButton.UseVisualStyleBackColor = true; this._getDynamicStringButton.Click += new System.EventHandler(this.button1_Click); - // + // // label1 - // + // this.label1.AutoSize = true; this.localizationExtender1.SetLocalizableToolTip(this.label1, null); this.localizationExtender1.SetLocalizationComment(this.label1, null); this.localizationExtender1.SetLocalizingId(this.label1, "TheSampleForm.ASubHeading.Label"); - this.label1.Location = new System.Drawing.Point(53, 261); - this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label1.Location = new System.Drawing.Point(40, 212); this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(89, 16); + this.label1.Size = new System.Drawing.Size(73, 13); this.label1.TabIndex = 1; this.label1.Text = "A Static Label"; - // + // // label2 - // + // this.label2.AutoSize = true; this.localizationExtender1.SetLocalizableToolTip(this.label2, null); this.localizationExtender1.SetLocalizationComment(this.label2, null); this.localizationExtender1.SetLocalizingId(this.label2, "TheSampleForm.label2"); - this.label2.Location = new System.Drawing.Point(97, 137); - this.label2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label2.Location = new System.Drawing.Point(73, 111); this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(249, 16); + this.label2.Size = new System.Drawing.Size(202, 13); this.label2.TabIndex = 2; - this.label2.Text = "Alt+Shift Click on items to localize them"; - // + this.label2.Text = "or Alt+Shift Click on items to localize them"; + // // uiLanguageComboBox1 - // + // this.uiLanguageComboBox1.DisplayMember = "NativeName"; this.uiLanguageComboBox1.DropDownHeight = 200; this.uiLanguageComboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; @@ -101,74 +99,83 @@ private void InitializeComponent() this.uiLanguageComboBox1.IntegralHeight = false; this.localizationExtender1.SetLocalizableToolTip(this.uiLanguageComboBox1, null); this.localizationExtender1.SetLocalizationComment(this.uiLanguageComboBox1, null); - this.localizationExtender1.SetLocalizationPriority(this.uiLanguageComboBox1, L10NSharp.LocalizationPriority.NotLocalizable); + this.localizationExtender1.SetLocalizationPriority(this.uiLanguageComboBox1, LocalizationPriority.NotLocalizable); this.localizationExtender1.SetLocalizingId(this.uiLanguageComboBox1, "uiLanguageComboBox1.uiLanguageComboBox1"); - this.uiLanguageComboBox1.Location = new System.Drawing.Point(53, 50); - this.uiLanguageComboBox1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.uiLanguageComboBox1.Location = new System.Drawing.Point(40, 41); this.uiLanguageComboBox1.Name = "uiLanguageComboBox1"; this.uiLanguageComboBox1.ShowOnlyLanguagesHavingLocalizations = true; - this.uiLanguageComboBox1.Size = new System.Drawing.Size(160, 28); + this.uiLanguageComboBox1.Size = new System.Drawing.Size(121, 23); this.uiLanguageComboBox1.TabIndex = 3; this.uiLanguageComboBox1.SelectedIndexChanged += new System.EventHandler(this.uiLanguageComboBox1_SelectedIndexChanged); - // + // + // linkLabel1 + // + this.linkLabel1.AutoSize = true; + this.localizationExtender1.SetLocalizableToolTip(this.linkLabel1, null); + this.localizationExtender1.SetLocalizationComment(this.linkLabel1, null); + this.localizationExtender1.SetLocalizingId(this.linkLabel1, "TheSampleForm.linkLabel1"); + this.linkLabel1.Location = new System.Drawing.Point(40, 88); + this.linkLabel1.Name = "linkLabel1"; + this.linkLabel1.Size = new System.Drawing.Size(124, 13); + this.linkLabel1.TabIndex = 4; + this.linkLabel1.TabStop = true; + this.linkLabel1.Text = "Open Translation Dialog,"; + this.linkLabel1.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabel1_LinkClicked); + // // columnHeader1 - // + // this.localizationExtender1.SetLocalizableToolTip(this.columnHeader1, null); this.localizationExtender1.SetLocalizationComment(this.columnHeader1, null); this.localizationExtender1.SetLocalizingId(this.columnHeader1, "TheSampleForm.columnHeader1"); this.columnHeader1.Text = "One"; - // + // // columnHeader2 - // + // this.localizationExtender1.SetLocalizableToolTip(this.columnHeader2, null); this.localizationExtender1.SetLocalizationComment(this.columnHeader2, null); this.localizationExtender1.SetLocalizingId(this.columnHeader2, "TheSampleForm.columnHeader2"); this.columnHeader2.Text = "Two"; - // + // // dataGridView1 - // + // this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.dataGridView1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { this.Column1}); this.localizationExtender1.SetLocalizableToolTip(this.dataGridView1, null); this.localizationExtender1.SetLocalizationComment(this.dataGridView1, null); this.localizationExtender1.SetLocalizingId(this.dataGridView1, "TheSampleForm.dataGridView1"); - this.dataGridView1.Location = new System.Drawing.Point(53, 464); - this.dataGridView1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.dataGridView1.Location = new System.Drawing.Point(40, 377); this.dataGridView1.Name = "dataGridView1"; - this.dataGridView1.RowHeadersWidth = 51; - this.dataGridView1.Size = new System.Drawing.Size(595, 90); + this.dataGridView1.Size = new System.Drawing.Size(446, 73); this.dataGridView1.TabIndex = 6; - // - // Column1 - // - this.Column1.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; - this.Column1.HeaderText = "_L10N_:TheSampleForm.SampleDataGridView.ColumnHeadings.FirstColumn!First"; - this.Column1.MinimumWidth = 6; - this.Column1.Name = "Column1"; - this.Column1.ToolTipText = "My tooltip"; - // + // // listView1 - // + // this.listView1.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { this.columnHeader1, this.columnHeader2}); - this.listView1.HideSelection = false; - this.listView1.Location = new System.Drawing.Point(53, 315); - this.listView1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.listView1.Location = new System.Drawing.Point(40, 256); this.listView1.Name = "listView1"; - this.listView1.Size = new System.Drawing.Size(449, 118); + this.listView1.Size = new System.Drawing.Size(338, 97); this.listView1.TabIndex = 5; this.listView1.UseCompatibleStateImageBehavior = false; this.listView1.View = System.Windows.Forms.View.Details; - // + // + // Column1 + // + this.Column1.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; + this.Column1.HeaderText = "_L10N_:TheSampleForm.SampleDataGridView.ColumnHeadings.FirstColumn!First"; + this.Column1.Name = "Column1"; + this.Column1.ToolTipText = "My tooltip"; + // // Form1 - // - this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(745, 569); + this.ClientSize = new System.Drawing.Size(559, 462); this.Controls.Add(this.dataGridView1); this.Controls.Add(this.listView1); + this.Controls.Add(this.linkLabel1); this.Controls.Add(this.uiLanguageComboBox1); this.Controls.Add(this.label2); this.Controls.Add(this.label1); @@ -176,7 +183,6 @@ private void InitializeComponent() this.localizationExtender1.SetLocalizableToolTip(this, null); this.localizationExtender1.SetLocalizationComment(this, null); this.localizationExtender1.SetLocalizingId(this, "Form1.WindowTitle"); - this.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.MaximizeBox = false; this.MinimizeBox = false; this.Name = "Form1"; @@ -191,11 +197,12 @@ private void InitializeComponent() #endregion - private L10NSharp.Windows.Forms.UI.L10NSharpExtender localizationExtender1; + private L10NSharp.Windows.Forms.L10NSharpExtender localizationExtender1; private System.Windows.Forms.Button _getDynamicStringButton; private System.Windows.Forms.Label label1; private System.Windows.Forms.Label label2; - private L10NSharp.Windows.Forms.UI.UILanguageComboBox uiLanguageComboBox1; + private L10NSharp.Windows.Forms.UIComponents.UILanguageComboBox uiLanguageComboBox1; + private System.Windows.Forms.LinkLabel linkLabel1; private System.Windows.Forms.ListView listView1; private System.Windows.Forms.ColumnHeader columnHeader1; private System.Windows.Forms.ColumnHeader columnHeader2; diff --git a/src/SampleApp/Form1.resx b/src/SampleApp/Form1.resx index bebfe93..19e46eb 100644 --- a/src/SampleApp/Form1.resx +++ b/src/SampleApp/Form1.resx @@ -123,7 +123,4 @@ True - - True - \ No newline at end of file From eb0d7621f441ff4cdef11a016c053f794fb0dce2 Mon Sep 17 00:00:00 2001 From: Ariel Rorabaugh Date: Mon, 4 Aug 2025 10:44:13 -0400 Subject: [PATCH 12/25] Fix SampleApp build errors --- src/SampleApp/Form1.Designer.cs | 119 +++++++++++++------------------- 1 file changed, 48 insertions(+), 71 deletions(-) diff --git a/src/SampleApp/Form1.Designer.cs b/src/SampleApp/Form1.Designer.cs index cf2fdc5..5e2bfa8 100644 --- a/src/SampleApp/Form1.Designer.cs +++ b/src/SampleApp/Form1.Designer.cs @@ -35,62 +35,50 @@ private void InitializeComponent() this.localizationExtender1 = new L10NSharp.Windows.Forms.L10NSharpExtender(this.components); this._getDynamicStringButton = new System.Windows.Forms.Button(); this.label1 = new System.Windows.Forms.Label(); - this.label2 = new System.Windows.Forms.Label(); this.uiLanguageComboBox1 = new L10NSharp.Windows.Forms.UIComponents.UILanguageComboBox(); - this.linkLabel1 = new System.Windows.Forms.LinkLabel(); this.columnHeader1 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.columnHeader2 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.dataGridView1 = new System.Windows.Forms.DataGridView(); - this.listView1 = new System.Windows.Forms.ListView(); this.Column1 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.listView1 = new System.Windows.Forms.ListView(); ((System.ComponentModel.ISupportInitialize)(this.localizationExtender1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit(); this.SuspendLayout(); - // + // // localizationExtender1 - // + // this.localizationExtender1.LocalizationManagerId = "SampleApp"; this.localizationExtender1.PrefixForNewItems = "TheSampleForm"; - // + // // _getDynamicStringButton - // + // this.localizationExtender1.SetLocalizableToolTip(this._getDynamicStringButton, null); this.localizationExtender1.SetLocalizationComment(this._getDynamicStringButton, null); this.localizationExtender1.SetLocalizingId(this._getDynamicStringButton, "TheSampleForm.button1"); - this._getDynamicStringButton.Location = new System.Drawing.Point(38, 161); + this._getDynamicStringButton.Location = new System.Drawing.Point(51, 198); + this._getDynamicStringButton.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this._getDynamicStringButton.Name = "_getDynamicStringButton"; - this._getDynamicStringButton.Size = new System.Drawing.Size(126, 23); + this._getDynamicStringButton.Size = new System.Drawing.Size(168, 28); this._getDynamicStringButton.TabIndex = 0; this._getDynamicStringButton.Text = "Get Name Dynamically"; this._getDynamicStringButton.UseVisualStyleBackColor = true; this._getDynamicStringButton.Click += new System.EventHandler(this.button1_Click); - // + // // label1 - // + // this.label1.AutoSize = true; this.localizationExtender1.SetLocalizableToolTip(this.label1, null); this.localizationExtender1.SetLocalizationComment(this.label1, null); this.localizationExtender1.SetLocalizingId(this.label1, "TheSampleForm.ASubHeading.Label"); - this.label1.Location = new System.Drawing.Point(40, 212); + this.label1.Location = new System.Drawing.Point(53, 261); + this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(73, 13); + this.label1.Size = new System.Drawing.Size(89, 16); this.label1.TabIndex = 1; this.label1.Text = "A Static Label"; - // - // label2 - // - this.label2.AutoSize = true; - this.localizationExtender1.SetLocalizableToolTip(this.label2, null); - this.localizationExtender1.SetLocalizationComment(this.label2, null); - this.localizationExtender1.SetLocalizingId(this.label2, "TheSampleForm.label2"); - this.label2.Location = new System.Drawing.Point(73, 111); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(202, 13); - this.label2.TabIndex = 2; - this.label2.Text = "or Alt+Shift Click on items to localize them"; - // + // // uiLanguageComboBox1 - // + // this.uiLanguageComboBox1.DisplayMember = "NativeName"; this.uiLanguageComboBox1.DropDownHeight = 200; this.uiLanguageComboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; @@ -99,90 +87,81 @@ private void InitializeComponent() this.uiLanguageComboBox1.IntegralHeight = false; this.localizationExtender1.SetLocalizableToolTip(this.uiLanguageComboBox1, null); this.localizationExtender1.SetLocalizationComment(this.uiLanguageComboBox1, null); - this.localizationExtender1.SetLocalizationPriority(this.uiLanguageComboBox1, LocalizationPriority.NotLocalizable); + this.localizationExtender1.SetLocalizationPriority(this.uiLanguageComboBox1, L10NSharp.LocalizationPriority.NotLocalizable); this.localizationExtender1.SetLocalizingId(this.uiLanguageComboBox1, "uiLanguageComboBox1.uiLanguageComboBox1"); - this.uiLanguageComboBox1.Location = new System.Drawing.Point(40, 41); + this.uiLanguageComboBox1.Location = new System.Drawing.Point(53, 50); + this.uiLanguageComboBox1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.uiLanguageComboBox1.Name = "uiLanguageComboBox1"; this.uiLanguageComboBox1.ShowOnlyLanguagesHavingLocalizations = true; - this.uiLanguageComboBox1.Size = new System.Drawing.Size(121, 23); + this.uiLanguageComboBox1.Size = new System.Drawing.Size(160, 28); this.uiLanguageComboBox1.TabIndex = 3; this.uiLanguageComboBox1.SelectedIndexChanged += new System.EventHandler(this.uiLanguageComboBox1_SelectedIndexChanged); - // - // linkLabel1 - // - this.linkLabel1.AutoSize = true; - this.localizationExtender1.SetLocalizableToolTip(this.linkLabel1, null); - this.localizationExtender1.SetLocalizationComment(this.linkLabel1, null); - this.localizationExtender1.SetLocalizingId(this.linkLabel1, "TheSampleForm.linkLabel1"); - this.linkLabel1.Location = new System.Drawing.Point(40, 88); - this.linkLabel1.Name = "linkLabel1"; - this.linkLabel1.Size = new System.Drawing.Size(124, 13); - this.linkLabel1.TabIndex = 4; - this.linkLabel1.TabStop = true; - this.linkLabel1.Text = "Open Translation Dialog,"; - this.linkLabel1.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabel1_LinkClicked); - // + // // columnHeader1 - // + // this.localizationExtender1.SetLocalizableToolTip(this.columnHeader1, null); this.localizationExtender1.SetLocalizationComment(this.columnHeader1, null); this.localizationExtender1.SetLocalizingId(this.columnHeader1, "TheSampleForm.columnHeader1"); this.columnHeader1.Text = "One"; - // + // // columnHeader2 - // + // this.localizationExtender1.SetLocalizableToolTip(this.columnHeader2, null); this.localizationExtender1.SetLocalizationComment(this.columnHeader2, null); this.localizationExtender1.SetLocalizingId(this.columnHeader2, "TheSampleForm.columnHeader2"); this.columnHeader2.Text = "Two"; - // + // // dataGridView1 - // + // this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.dataGridView1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { this.Column1}); this.localizationExtender1.SetLocalizableToolTip(this.dataGridView1, null); this.localizationExtender1.SetLocalizationComment(this.dataGridView1, null); this.localizationExtender1.SetLocalizingId(this.dataGridView1, "TheSampleForm.dataGridView1"); - this.dataGridView1.Location = new System.Drawing.Point(40, 377); + this.dataGridView1.Location = new System.Drawing.Point(53, 464); + this.dataGridView1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.dataGridView1.Name = "dataGridView1"; - this.dataGridView1.Size = new System.Drawing.Size(446, 73); + this.dataGridView1.RowHeadersWidth = 51; + this.dataGridView1.Size = new System.Drawing.Size(595, 90); this.dataGridView1.TabIndex = 6; - // + // + // Column1 + // + this.Column1.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; + this.Column1.HeaderText = "_L10N_:TheSampleForm.SampleDataGridView.ColumnHeadings.FirstColumn!First"; + this.Column1.MinimumWidth = 6; + this.Column1.Name = "Column1"; + this.Column1.ToolTipText = "My tooltip"; + // // listView1 - // + // this.listView1.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { this.columnHeader1, this.columnHeader2}); - this.listView1.Location = new System.Drawing.Point(40, 256); + this.listView1.HideSelection = false; + this.listView1.Location = new System.Drawing.Point(53, 315); + this.listView1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.listView1.Name = "listView1"; - this.listView1.Size = new System.Drawing.Size(338, 97); + this.listView1.Size = new System.Drawing.Size(449, 118); this.listView1.TabIndex = 5; this.listView1.UseCompatibleStateImageBehavior = false; this.listView1.View = System.Windows.Forms.View.Details; - // - // Column1 - // - this.Column1.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; - this.Column1.HeaderText = "_L10N_:TheSampleForm.SampleDataGridView.ColumnHeadings.FirstColumn!First"; - this.Column1.Name = "Column1"; - this.Column1.ToolTipText = "My tooltip"; - // + // // Form1 - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + // + this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(559, 462); + this.ClientSize = new System.Drawing.Size(745, 569); this.Controls.Add(this.dataGridView1); this.Controls.Add(this.listView1); - this.Controls.Add(this.linkLabel1); this.Controls.Add(this.uiLanguageComboBox1); - this.Controls.Add(this.label2); this.Controls.Add(this.label1); this.Controls.Add(this._getDynamicStringButton); this.localizationExtender1.SetLocalizableToolTip(this, null); this.localizationExtender1.SetLocalizationComment(this, null); this.localizationExtender1.SetLocalizingId(this, "Form1.WindowTitle"); + this.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.MaximizeBox = false; this.MinimizeBox = false; this.Name = "Form1"; @@ -200,9 +179,7 @@ private void InitializeComponent() private L10NSharp.Windows.Forms.L10NSharpExtender localizationExtender1; private System.Windows.Forms.Button _getDynamicStringButton; private System.Windows.Forms.Label label1; - private System.Windows.Forms.Label label2; private L10NSharp.Windows.Forms.UIComponents.UILanguageComboBox uiLanguageComboBox1; - private System.Windows.Forms.LinkLabel linkLabel1; private System.Windows.Forms.ListView listView1; private System.Windows.Forms.ColumnHeader columnHeader1; private System.Windows.Forms.ColumnHeader columnHeader2; From fec10e9c4bfe745f003cbfe7abf5a9951220fe5c Mon Sep 17 00:00:00 2001 From: Ariel Rorabaugh Date: Mon, 4 Aug 2025 11:36:16 -0400 Subject: [PATCH 13/25] Fix ILocalizableComponentTests --- .../ILocalizableComponentTests.cs | 9 +- .../TestXliff/LocalizableComponentTest.en.xlf | 23 + .../TestXliff/LocalizableComponentTest.es.xlf | 31 + .../TestXliff/LocalizableComponentTest.fr.xlf | 26 + .../LocalizableComponentTest2.en.xlf | 40 + .../TestXliff/xliff-core-1.2-strict.xsd | 2223 ++++++++++++++++ .../TestXliff/xliff-core-1.2-transitional.xsd | 2261 +++++++++++++++++ 7 files changed, 4607 insertions(+), 6 deletions(-) create mode 100644 src/L10NSharp.Windows.Forms.Tests/TestXliff/LocalizableComponentTest.en.xlf create mode 100644 src/L10NSharp.Windows.Forms.Tests/TestXliff/LocalizableComponentTest.es.xlf create mode 100644 src/L10NSharp.Windows.Forms.Tests/TestXliff/LocalizableComponentTest.fr.xlf create mode 100644 src/L10NSharp.Windows.Forms.Tests/TestXliff/LocalizableComponentTest2.en.xlf create mode 100644 src/L10NSharp.Windows.Forms.Tests/TestXliff/xliff-core-1.2-strict.xsd create mode 100644 src/L10NSharp.Windows.Forms.Tests/TestXliff/xliff-core-1.2-transitional.xsd diff --git a/src/L10NSharp.Windows.Forms.Tests/ILocalizableComponentTests.cs b/src/L10NSharp.Windows.Forms.Tests/ILocalizableComponentTests.cs index 0bfbded..195e5cb 100644 --- a/src/L10NSharp.Windows.Forms.Tests/ILocalizableComponentTests.cs +++ b/src/L10NSharp.Windows.Forms.Tests/ILocalizableComponentTests.cs @@ -1,10 +1,7 @@ using System; using System.IO; using System.Reflection; -using L10NSharp; using L10NSharp.XLiffUtils; -using L10NSharp.Windows.Forms; -using L10NSharp.Windows.Forms.UIComponents; using NUnit.Framework; namespace L10NSharp.Windows.Forms.Tests @@ -30,18 +27,18 @@ public class ILocalizableComponentXLiffTests protected void TestSetup(string installedTranslationDir) { var dir = Path.GetDirectoryName(new Uri(Assembly.GetExecutingAssembly().CodeBase).LocalPath); - m_manager = LocalizationManagerWinforms.Create("en", "Test", "Test", "1.0", + m_manager = LocalizationManagerWinforms.Create("en", "LocalizableComponentTest", "LocalizableComponentTest", "1.0", Path.Combine(dir, installedTranslationDir), "", null, "", new string[] { }) as ILocalizationManagerInternalWinforms; m_translationPath = m_manager.GetPathForLanguage("en", true); - m_extender = new L10NSharpExtender { LocalizationManagerId = "Test" }; + m_extender = new L10NSharpExtender { LocalizationManagerId = "LocalizableComponentTest" }; } [SetUp] public void TestSetup() { - TestSetup("../../../src/L10NSharp.Tests/TestXliff"); + TestSetup("../../../src/L10NSharp.Windows.Forms.Tests/TestXliff"); } /// ------------------------------------------------------------------------------------ diff --git a/src/L10NSharp.Windows.Forms.Tests/TestXliff/LocalizableComponentTest.en.xlf b/src/L10NSharp.Windows.Forms.Tests/TestXliff/LocalizableComponentTest.en.xlf new file mode 100644 index 0000000..049d6c4 --- /dev/null +++ b/src/L10NSharp.Windows.Forms.Tests/TestXliff/LocalizableComponentTest.en.xlf @@ -0,0 +1,23 @@ + + + +
+ This is a test. This is only a test. + I'm not sure I agree with the previous note. +
+ + + It's a crow + + + It's not a crow + + + It's a chicken + + + Fish-eating bird + + +
+
diff --git a/src/L10NSharp.Windows.Forms.Tests/TestXliff/LocalizableComponentTest.es.xlf b/src/L10NSharp.Windows.Forms.Tests/TestXliff/LocalizableComponentTest.es.xlf new file mode 100644 index 0000000..7e1d09c --- /dev/null +++ b/src/L10NSharp.Windows.Forms.Tests/TestXliff/LocalizableComponentTest.es.xlf @@ -0,0 +1,31 @@ + + + + + + The button will show up when you hold down the Ctrl and Shift keys together. + El botón se mostrará cuando se mantengan presionadas juntas las teclas Ctrl y Mayús. + + El botón se mostrará cuando juntamente se presiona las teclas Ctrl y Mayús. + + ID: SettingsProtection.CtrlShiftHint + + + Settings Protection... + Protección de configuraciones... + ID: SettingsProtection.LauncherButtonLabel + OLD TEXT (before 4.0): Settings... + + + Hide the button that opens settings. + Ocultar el botón que abre la configuración. + ID: SettingsProtection.NormallyHiddenCheckbox + + + Factory Password + Factory Password + ID: SettingsProtection.PasswordDialog.FactoryPassword + + + + diff --git a/src/L10NSharp.Windows.Forms.Tests/TestXliff/LocalizableComponentTest.fr.xlf b/src/L10NSharp.Windows.Forms.Tests/TestXliff/LocalizableComponentTest.fr.xlf new file mode 100644 index 0000000..3aab556 --- /dev/null +++ b/src/L10NSharp.Windows.Forms.Tests/TestXliff/LocalizableComponentTest.fr.xlf @@ -0,0 +1,26 @@ + + + +
+ This file supposedly contains French translations. +
+ + + It's a crow + C'est un corbeau + + + It's not a crow + Ce n'est pas un corbeau + + + It's a chicken + C'est un poulet + + + Fish-eating bird + Un oiseau qui mange des poissons + + +
+
diff --git a/src/L10NSharp.Windows.Forms.Tests/TestXliff/LocalizableComponentTest2.en.xlf b/src/L10NSharp.Windows.Forms.Tests/TestXliff/LocalizableComponentTest2.en.xlf new file mode 100644 index 0000000..82652eb --- /dev/null +++ b/src/L10NSharp.Windows.Forms.Tests/TestXliff/LocalizableComponentTest2.en.xlf @@ -0,0 +1,40 @@ + + + + + + This is plain text. + + + This is bold. + + + This is italic. + + + This is superscript. + + + This is a link. + + + This has an embedded image: . + + + This is a paragraph. + + + This is a div. + + + This is a block quote. + + + This is in\npresentation\ndisplay. + + + This is more complex!! + + + + diff --git a/src/L10NSharp.Windows.Forms.Tests/TestXliff/xliff-core-1.2-strict.xsd b/src/L10NSharp.Windows.Forms.Tests/TestXliff/xliff-core-1.2-strict.xsd new file mode 100644 index 0000000..056f5f9 --- /dev/null +++ b/src/L10NSharp.Windows.Forms.Tests/TestXliff/xliff-core-1.2-strict.xsd @@ -0,0 +1,2223 @@ + + + + + + + + + + + + + + + Values for the attribute 'context-type'. + + + + + Indicates a database content. + + + + + Indicates the content of an element within an XML document. + + + + + Indicates the name of an element within an XML document. + + + + + Indicates the line number from the sourcefile (see context-type="sourcefile") where the <source> is found. + + + + + Indicates a the number of parameters contained within the <source>. + + + + + Indicates notes pertaining to the parameters in the <source>. + + + + + Indicates the content of a record within a database. + + + + + Indicates the name of a record within a database. + + + + + Indicates the original source file in the case that multiple files are merged to form the original file from which the XLIFF file is created. This differs from the original <file> attribute in that this sourcefile is one of many that make up that file. + + + + + + + Values for the attribute 'count-type'. + + + + + Indicates the count units are items that are used X times in a certain context; example: this is a reusable text unit which is used 42 times in other texts. + + + + + Indicates the count units are translation units existing already in the same document. + + + + + Indicates a total count. + + + + + + + Values for the attribute 'ctype' when used other elements than <ph> or <x>. + + + + + Indicates a run of bolded text. + + + + + Indicates a run of text in italics. + + + + + Indicates a run of underlined text. + + + + + Indicates a run of hyper-text. + + + + + + + Values for the attribute 'ctype' when used with <ph> or <x>. + + + + + Indicates a inline image. + + + + + Indicates a page break. + + + + + Indicates a line break. + + + + + + + + + + + + Values for the attribute 'datatype'. + + + + + Indicates Active Server Page data. + + + + + Indicates C source file data. + + + + + Indicates Channel Definition Format (CDF) data. + + + + + Indicates ColdFusion data. + + + + + Indicates C++ source file data. + + + + + Indicates C-Sharp data. + + + + + Indicates strings from C, ASM, and driver files data. + + + + + Indicates comma-separated values data. + + + + + Indicates database data. + + + + + Indicates portions of document that follows data and contains metadata. + + + + + Indicates portions of document that precedes data and contains metadata. + + + + + Indicates data from standard UI file operations dialogs (e.g., Open, Save, Save As, Export, Import). + + + + + Indicates standard user input screen data. + + + + + Indicates HyperText Markup Language (HTML) data - document instance. + + + + + Indicates content within an HTML document’s <body> element. + + + + + Indicates Windows INI file data. + + + + + Indicates Interleaf data. + + + + + Indicates Java source file data (extension '.java'). + + + + + Indicates Java property resource bundle data. + + + + + Indicates Java list resource bundle data. + + + + + Indicates JavaScript source file data. + + + + + Indicates JScript source file data. + + + + + Indicates information relating to formatting. + + + + + Indicates LISP source file data. + + + + + Indicates information relating to margin formats. + + + + + Indicates a file containing menu. + + + + + Indicates numerically identified string table. + + + + + Indicates Maker Interchange Format (MIF) data. + + + + + Indicates that the datatype attribute value is a MIME Type value and is defined in the mime-type attribute. + + + + + Indicates GNU Machine Object data. + + + + + Indicates Message Librarian strings created by Novell's Message Librarian Tool. + + + + + Indicates information to be displayed at the bottom of each page of a document. + + + + + Indicates information to be displayed at the top of each page of a document. + + + + + Indicates a list of property values (e.g., settings within INI files or preferences dialog). + + + + + Indicates Pascal source file data. + + + + + Indicates Hypertext Preprocessor data. + + + + + Indicates plain text file (no formatting other than, possibly, wrapping). + + + + + Indicates GNU Portable Object file. + + + + + Indicates dynamically generated user defined document. e.g. Oracle Report, Crystal Report, etc. + + + + + Indicates Windows .NET binary resources. + + + + + Indicates Windows .NET Resources. + + + + + Indicates Rich Text Format (RTF) data. + + + + + Indicates Standard Generalized Markup Language (SGML) data - document instance. + + + + + Indicates Standard Generalized Markup Language (SGML) data - Document Type Definition (DTD). + + + + + Indicates Scalable Vector Graphic (SVG) data. + + + + + Indicates VisualBasic Script source file. + + + + + Indicates warning message. + + + + + Indicates Windows (Win32) resources (i.e. resources extracted from an RC script, a message file, or a compiled file). + + + + + Indicates Extensible HyperText Markup Language (XHTML) data - document instance. + + + + + Indicates Extensible Markup Language (XML) data - document instance. + + + + + Indicates Extensible Markup Language (XML) data - Document Type Definition (DTD). + + + + + Indicates Extensible Stylesheet Language (XSL) data. + + + + + Indicates XUL elements. + + + + + + + Values for the attribute 'mtype'. + + + + + Indicates the marked text is an abbreviation. + + + + + ISO-12620 2.1.8: A term resulting from the omission of any part of the full term while designating the same concept. + + + + + ISO-12620 2.1.8.1: An abbreviated form of a simple term resulting from the omission of some of its letters (e.g. 'adj.' for 'adjective'). + + + + + ISO-12620 2.1.8.4: An abbreviated form of a term made up of letters from the full form of a multiword term strung together into a sequence pronounced only syllabically (e.g. 'radar' for 'radio detecting and ranging'). + + + + + ISO-12620: A proper-name term, such as the name of an agency or other proper entity. + + + + + ISO-12620 2.1.18.1: A recurrent word combination characterized by cohesion in that the components of the collocation must co-occur within an utterance or series of utterances, even though they do not necessarily have to maintain immediate proximity to one another. + + + + + ISO-12620 2.1.5: A synonym for an international scientific term that is used in general discourse in a given language. + + + + + Indicates the marked text is a date and/or time. + + + + + ISO-12620 2.1.15: An expression used to represent a concept based on a statement that two mathematical expressions are, for instance, equal as identified by the equal sign (=), or assigned to one another by a similar sign. + + + + + ISO-12620 2.1.7: The complete representation of a term for which there is an abbreviated form. + + + + + ISO-12620 2.1.14: Figures, symbols or the like used to express a concept briefly, such as a mathematical or chemical formula. + + + + + ISO-12620 2.1.1: The concept designation that has been chosen to head a terminological record. + + + + + ISO-12620 2.1.8.3: An abbreviated form of a term consisting of some of the initial letters of the words making up a multiword term or the term elements making up a compound term when these letters are pronounced individually (e.g. 'BSE' for 'bovine spongiform encephalopathy'). + + + + + ISO-12620 2.1.4: A term that is part of an international scientific nomenclature as adopted by an appropriate scientific body. + + + + + ISO-12620 2.1.6: A term that has the same or nearly identical orthographic or phonemic form in many languages. + + + + + ISO-12620 2.1.16: An expression used to represent a concept based on mathematical or logical relations, such as statements of inequality, set relationships, Boolean operations, and the like. + + + + + ISO-12620 2.1.17: A unit to track object. + + + + + Indicates the marked text is a name. + + + + + ISO-12620 2.1.3: A term that represents the same or a very similar concept as another term in the same language, but for which interchangeability is limited to some contexts and inapplicable in others. + + + + + ISO-12620 2.1.17.2: A unique alphanumeric designation assigned to an object in a manufacturing system. + + + + + Indicates the marked text is a phrase. + + + + + ISO-12620 2.1.18: Any group of two or more words that form a unit, the meaning of which frequently cannot be deduced based on the combined sense of the words making up the phrase. + + + + + Indicates the marked text should not be translated. + + + + + ISO-12620 2.1.12: A form of a term resulting from an operation whereby non-Latin writing systems are converted to the Latin alphabet. + + + + + Indicates that the marked text represents a segment. + + + + + ISO-12620 2.1.18.2: A fixed, lexicalized phrase. + + + + + ISO-12620 2.1.8.2: A variant of a multiword term that includes fewer words than the full form of the term (e.g. 'Group of Twenty-four' for 'Intergovernmental Group of Twenty-four on International Monetary Affairs'). + + + + + ISO-12620 2.1.17.1: Stock keeping unit, an inventory item identified by a unique alphanumeric designation assigned to an object in an inventory control system. + + + + + ISO-12620 2.1.19: A fixed chunk of recurring text. + + + + + ISO-12620 2.1.13: A designation of a concept by letters, numerals, pictograms or any combination thereof. + + + + + ISO-12620 2.1.2: Any term that represents the same or a very similar concept as the main entry term in a term entry. + + + + + ISO-12620 2.1.18.3: Phraseological unit in a language that expresses the same semantic content as another phrase in that same language. + + + + + Indicates the marked text is a term. + + + + + ISO-12620 2.1.11: A form of a term resulting from an operation whereby the characters of one writing system are represented by characters from another writing system, taking into account the pronunciation of the characters converted. + + + + + ISO-12620 2.1.10: A form of a term resulting from an operation whereby the characters of an alphabetic writing system are represented by characters from another alphabetic writing system. + + + + + ISO-12620 2.1.8.5: An abbreviated form of a term resulting from the omission of one or more term elements or syllables (e.g. 'flu' for 'influenza'). + + + + + ISO-12620 2.1.9: One of the alternate forms of a term. + + + + + + + Values for the attribute 'restype'. + + + + + Indicates a Windows RC AUTO3STATE control. + + + + + Indicates a Windows RC AUTOCHECKBOX control. + + + + + Indicates a Windows RC AUTORADIOBUTTON control. + + + + + Indicates a Windows RC BEDIT control. + + + + + Indicates a bitmap, for example a BITMAP resource in Windows. + + + + + Indicates a button object, for example a BUTTON control Windows. + + + + + Indicates a caption, such as the caption of a dialog box. + + + + + Indicates the cell in a table, for example the content of the <td> element in HTML. + + + + + Indicates check box object, for example a CHECKBOX control in Windows. + + + + + Indicates a menu item with an associated checkbox. + + + + + Indicates a list box, but with a check-box for each item. + + + + + Indicates a color selection dialog. + + + + + Indicates a combination of edit box and listbox object, for example a COMBOBOX control in Windows. + + + + + Indicates an initialization entry of an extended combobox DLGINIT resource block. (code 0x1234). + + + + + Indicates an initialization entry of a combobox DLGINIT resource block (code 0x0403). + + + + + Indicates a UI base class element that cannot be represented by any other element. + + + + + Indicates a context menu. + + + + + Indicates a Windows RC CTEXT control. + + + + + Indicates a cursor, for example a CURSOR resource in Windows. + + + + + Indicates a date/time picker. + + + + + Indicates a Windows RC DEFPUSHBUTTON control. + + + + + Indicates a dialog box. + + + + + Indicates a Windows RC DLGINIT resource block. + + + + + Indicates an edit box object, for example an EDIT control in Windows. + + + + + Indicates a filename. + + + + + Indicates a file dialog. + + + + + Indicates a footnote. + + + + + Indicates a font name. + + + + + Indicates a footer. + + + + + Indicates a frame object. + + + + + Indicates a XUL grid element. + + + + + Indicates a groupbox object, for example a GROUPBOX control in Windows. + + + + + Indicates a header item. + + + + + Indicates a heading, such has the content of <h1>, <h2>, etc. in HTML. + + + + + Indicates a Windows RC HEDIT control. + + + + + Indicates a horizontal scrollbar. + + + + + Indicates an icon, for example an ICON resource in Windows. + + + + + Indicates a Windows RC IEDIT control. + + + + + Indicates keyword list, such as the content of the Keywords meta-data in HTML, or a K footnote in WinHelp RTF. + + + + + Indicates a label object. + + + + + Indicates a label that is also a HTML link (not necessarily a URL). + + + + + Indicates a list (a group of list-items, for example an <ol> or <ul> element in HTML). + + + + + Indicates a listbox object, for example an LISTBOX control in Windows. + + + + + Indicates an list item (an entry in a list). + + + + + Indicates a Windows RC LTEXT control. + + + + + Indicates a menu (a group of menu-items). + + + + + Indicates a toolbar containing one or more tope level menus. + + + + + Indicates a menu item (an entry in a menu). + + + + + Indicates a XUL menuseparator element. + + + + + Indicates a message, for example an entry in a MESSAGETABLE resource in Windows. + + + + + Indicates a calendar control. + + + + + Indicates an edit box beside a spin control. + + + + + Indicates a catch all for rectangular areas. + + + + + Indicates a standalone menu not necessarily associated with a menubar. + + + + + Indicates a pushbox object, for example a PUSHBOX control in Windows. + + + + + Indicates a Windows RC PUSHBUTTON control. + + + + + Indicates a radio button object. + + + + + Indicates a menuitem with associated radio button. + + + + + Indicates raw data resources for an application. + + + + + Indicates a row in a table. + + + + + Indicates a Windows RC RTEXT control. + + + + + Indicates a user navigable container used to show a portion of a document. + + + + + Indicates a generic divider object (e.g. menu group separator). + + + + + Windows accelerators, shortcuts in resource or property files. + + + + + Indicates a UI control to indicate process activity but not progress. + + + + + Indicates a splitter bar. + + + + + Indicates a Windows RC STATE3 control. + + + + + Indicates a window for providing feedback to the users, like 'read-only', etc. + + + + + Indicates a string, for example an entry in a STRINGTABLE resource in Windows. + + + + + Indicates a layers of controls with a tab to select layers. + + + + + Indicates a display and edits regular two-dimensional tables of cells. + + + + + Indicates a XUL textbox element. + + + + + Indicates a UI button that can be toggled to on or off state. + + + + + Indicates an array of controls, usually buttons. + + + + + Indicates a pop up tool tip text. + + + + + Indicates a bar with a pointer indicating a position within a certain range. + + + + + Indicates a control that displays a set of hierarchical data. + + + + + Indicates a URI (URN or URL). + + + + + Indicates a Windows RC USERBUTTON control. + + + + + Indicates a user-defined control like CONTROL control in Windows. + + + + + Indicates the text of a variable. + + + + + Indicates version information about a resource like VERSIONINFO in Windows. + + + + + Indicates a vertical scrollbar. + + + + + Indicates a graphical window. + + + + + + + Values for the attribute 'size-unit'. + + + + + Indicates a size in 8-bit bytes. + + + + + Indicates a size in Unicode characters. + + + + + Indicates a size in columns. Used for HTML text area. + + + + + Indicates a size in centimeters. + + + + + Indicates a size in dialog units, as defined in Windows resources. + + + + + Indicates a size in 'font-size' units (as defined in CSS). + + + + + Indicates a size in 'x-height' units (as defined in CSS). + + + + + Indicates a size in glyphs. A glyph is considered to be one or more combined Unicode characters that represent a single displayable text character. Sometimes referred to as a 'grapheme cluster' + + + + + Indicates a size in inches. + + + + + Indicates a size in millimeters. + + + + + Indicates a size in percentage. + + + + + Indicates a size in pixels. + + + + + Indicates a size in point. + + + + + Indicates a size in rows. Used for HTML text area. + + + + + + + Values for the attribute 'state'. + + + + + Indicates the terminating state. + + + + + Indicates only non-textual information needs adaptation. + + + + + Indicates both text and non-textual information needs adaptation. + + + + + Indicates only non-textual information needs review. + + + + + Indicates both text and non-textual information needs review. + + + + + Indicates that only the text of the item needs to be reviewed. + + + + + Indicates that the item needs to be translated. + + + + + Indicates that the item is new. For example, translation units that were not in a previous version of the document. + + + + + Indicates that changes are reviewed and approved. + + + + + Indicates that the item has been translated. + + + + + + + Values for the attribute 'state-qualifier'. + + + + + Indicates an exact match. An exact match occurs when a source text of a segment is exactly the same as the source text of a segment that was translated previously. + + + + + Indicates a fuzzy match. A fuzzy match occurs when a source text of a segment is very similar to the source text of a segment that was translated previously (e.g. when the difference is casing, a few changed words, white-space discripancy, etc.). + + + + + Indicates a match based on matching IDs (in addition to matching text). + + + + + Indicates a translation derived from a glossary. + + + + + Indicates a translation derived from existing translation. + + + + + Indicates a translation derived from machine translation. + + + + + Indicates a translation derived from a translation repository. + + + + + Indicates a translation derived from a translation memory. + + + + + Indicates the translation is suggested by machine translation. + + + + + Indicates that the item has been rejected because of incorrect grammar. + + + + + Indicates that the item has been rejected because it is incorrect. + + + + + Indicates that the item has been rejected because it is too long or too short. + + + + + Indicates that the item has been rejected because of incorrect spelling. + + + + + Indicates the translation is suggested by translation memory. + + + + + + + Values for the attribute 'unit'. + + + + + Refers to words. + + + + + Refers to pages. + + + + + Refers to <trans-unit> elements. + + + + + Refers to <bin-unit> elements. + + + + + Refers to glyphs. + + + + + Refers to <trans-unit> and/or <bin-unit> elements. + + + + + Refers to the occurrences of instances defined by the count-type value. + + + + + Refers to characters. + + + + + Refers to lines. + + + + + Refers to sentences. + + + + + Refers to paragraphs. + + + + + Refers to segments. + + + + + Refers to placeables (inline elements). + + + + + + + Values for the attribute 'priority'. + + + + + Highest priority. + + + + + High priority. + + + + + High priority, but not as important as 2. + + + + + High priority, but not as important as 3. + + + + + Medium priority, but more important than 6. + + + + + Medium priority, but less important than 5. + + + + + Low priority, but more important than 8. + + + + + Low priority, but more important than 9. + + + + + Low priority. + + + + + Lowest priority. + + + + + + + + + This value indicates that all properties can be reformatted. This value must be used alone. + + + + + This value indicates that no properties should be reformatted. This value must be used alone. + + + + + + + + + + + + + This value indicates that all information in the coord attribute can be modified. + + + + + This value indicates that the x information in the coord attribute can be modified. + + + + + This value indicates that the y information in the coord attribute can be modified. + + + + + This value indicates that the cx information in the coord attribute can be modified. + + + + + This value indicates that the cy information in the coord attribute can be modified. + + + + + This value indicates that all the information in the font attribute can be modified. + + + + + This value indicates that the name information in the font attribute can be modified. + + + + + This value indicates that the size information in the font attribute can be modified. + + + + + This value indicates that the weight information in the font attribute can be modified. + + + + + This value indicates that the information in the css-style attribute can be modified. + + + + + This value indicates that the information in the style attribute can be modified. + + + + + This value indicates that the information in the exstyle attribute can be modified. + + + + + + + + + + + + + Indicates that the context is informational in nature, specifying for example, how a term should be translated. Thus, should be displayed to anyone editing the XLIFF document. + + + + + Indicates that the context-group is used to specify where the term was found in the translatable source. Thus, it is not displayed. + + + + + Indicates that the context information should be used during translation memory lookups. Thus, it is not displayed. + + + + + + + + + Represents a translation proposal from a translation memory or other resource. + + + + + Represents a previous version of the target element. + + + + + Represents a rejected version of the target element. + + + + + Represents a translation to be used for reference purposes only, for example from a related product or a different language. + + + + + Represents a proposed translation that was used for the translation of the trans-unit, possibly modified. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Values for the attribute 'coord'. + + + + + + + + Version values: 1.0 and 1.1 are allowed for backward compatibility. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/L10NSharp.Windows.Forms.Tests/TestXliff/xliff-core-1.2-transitional.xsd b/src/L10NSharp.Windows.Forms.Tests/TestXliff/xliff-core-1.2-transitional.xsd new file mode 100644 index 0000000..850cfb8 --- /dev/null +++ b/src/L10NSharp.Windows.Forms.Tests/TestXliff/xliff-core-1.2-transitional.xsd @@ -0,0 +1,2261 @@ + + + + + + + + + + + + + + Values for the attribute 'context-type'. + + + + + Indicates a database content. + + + + + Indicates the content of an element within an XML document. + + + + + Indicates the name of an element within an XML document. + + + + + Indicates the line number from the sourcefile (see context-type="sourcefile") where the <source> is found. + + + + + Indicates a the number of parameters contained within the <source>. + + + + + Indicates notes pertaining to the parameters in the <source>. + + + + + Indicates the content of a record within a database. + + + + + Indicates the name of a record within a database. + + + + + Indicates the original source file in the case that multiple files are merged to form the original file from which the XLIFF file is created. This differs from the original <file> attribute in that this sourcefile is one of many that make up that file. + + + + + + + Values for the attribute 'count-type'. + + + + + Indicates the count units are items that are used X times in a certain context; example: this is a reusable text unit which is used 42 times in other texts. + + + + + Indicates the count units are translation units existing already in the same document. + + + + + Indicates a total count. + + + + + + + Values for the attribute 'ctype' when used other elements than <ph> or <x>. + + + + + Indicates a run of bolded text. + + + + + Indicates a run of text in italics. + + + + + Indicates a run of underlined text. + + + + + Indicates a run of hyper-text. + + + + + + + Values for the attribute 'ctype' when used with <ph> or <x>. + + + + + Indicates a inline image. + + + + + Indicates a page break. + + + + + Indicates a line break. + + + + + + + + + + + + Values for the attribute 'datatype'. + + + + + Indicates Active Server Page data. + + + + + Indicates C source file data. + + + + + Indicates Channel Definition Format (CDF) data. + + + + + Indicates ColdFusion data. + + + + + Indicates C++ source file data. + + + + + Indicates C-Sharp data. + + + + + Indicates strings from C, ASM, and driver files data. + + + + + Indicates comma-separated values data. + + + + + Indicates database data. + + + + + Indicates portions of document that follows data and contains metadata. + + + + + Indicates portions of document that precedes data and contains metadata. + + + + + Indicates data from standard UI file operations dialogs (e.g., Open, Save, Save As, Export, Import). + + + + + Indicates standard user input screen data. + + + + + Indicates HyperText Markup Language (HTML) data - document instance. + + + + + Indicates content within an HTML document’s <body> element. + + + + + Indicates Windows INI file data. + + + + + Indicates Interleaf data. + + + + + Indicates Java source file data (extension '.java'). + + + + + Indicates Java property resource bundle data. + + + + + Indicates Java list resource bundle data. + + + + + Indicates JavaScript source file data. + + + + + Indicates JScript source file data. + + + + + Indicates information relating to formatting. + + + + + Indicates LISP source file data. + + + + + Indicates information relating to margin formats. + + + + + Indicates a file containing menu. + + + + + Indicates numerically identified string table. + + + + + Indicates Maker Interchange Format (MIF) data. + + + + + Indicates that the datatype attribute value is a MIME Type value and is defined in the mime-type attribute. + + + + + Indicates GNU Machine Object data. + + + + + Indicates Message Librarian strings created by Novell's Message Librarian Tool. + + + + + Indicates information to be displayed at the bottom of each page of a document. + + + + + Indicates information to be displayed at the top of each page of a document. + + + + + Indicates a list of property values (e.g., settings within INI files or preferences dialog). + + + + + Indicates Pascal source file data. + + + + + Indicates Hypertext Preprocessor data. + + + + + Indicates plain text file (no formatting other than, possibly, wrapping). + + + + + Indicates GNU Portable Object file. + + + + + Indicates dynamically generated user defined document. e.g. Oracle Report, Crystal Report, etc. + + + + + Indicates Windows .NET binary resources. + + + + + Indicates Windows .NET Resources. + + + + + Indicates Rich Text Format (RTF) data. + + + + + Indicates Standard Generalized Markup Language (SGML) data - document instance. + + + + + Indicates Standard Generalized Markup Language (SGML) data - Document Type Definition (DTD). + + + + + Indicates Scalable Vector Graphic (SVG) data. + + + + + Indicates VisualBasic Script source file. + + + + + Indicates warning message. + + + + + Indicates Windows (Win32) resources (i.e. resources extracted from an RC script, a message file, or a compiled file). + + + + + Indicates Extensible HyperText Markup Language (XHTML) data - document instance. + + + + + Indicates Extensible Markup Language (XML) data - document instance. + + + + + Indicates Extensible Markup Language (XML) data - Document Type Definition (DTD). + + + + + Indicates Extensible Stylesheet Language (XSL) data. + + + + + Indicates XUL elements. + + + + + + + Values for the attribute 'mtype'. + + + + + Indicates the marked text is an abbreviation. + + + + + ISO-12620 2.1.8: A term resulting from the omission of any part of the full term while designating the same concept. + + + + + ISO-12620 2.1.8.1: An abbreviated form of a simple term resulting from the omission of some of its letters (e.g. 'adj.' for 'adjective'). + + + + + ISO-12620 2.1.8.4: An abbreviated form of a term made up of letters from the full form of a multiword term strung together into a sequence pronounced only syllabically (e.g. 'radar' for 'radio detecting and ranging'). + + + + + ISO-12620: A proper-name term, such as the name of an agency or other proper entity. + + + + + ISO-12620 2.1.18.1: A recurrent word combination characterized by cohesion in that the components of the collocation must co-occur within an utterance or series of utterances, even though they do not necessarily have to maintain immediate proximity to one another. + + + + + ISO-12620 2.1.5: A synonym for an international scientific term that is used in general discourse in a given language. + + + + + Indicates the marked text is a date and/or time. + + + + + ISO-12620 2.1.15: An expression used to represent a concept based on a statement that two mathematical expressions are, for instance, equal as identified by the equal sign (=), or assigned to one another by a similar sign. + + + + + ISO-12620 2.1.7: The complete representation of a term for which there is an abbreviated form. + + + + + ISO-12620 2.1.14: Figures, symbols or the like used to express a concept briefly, such as a mathematical or chemical formula. + + + + + ISO-12620 2.1.1: The concept designation that has been chosen to head a terminological record. + + + + + ISO-12620 2.1.8.3: An abbreviated form of a term consisting of some of the initial letters of the words making up a multiword term or the term elements making up a compound term when these letters are pronounced individually (e.g. 'BSE' for 'bovine spongiform encephalopathy'). + + + + + ISO-12620 2.1.4: A term that is part of an international scientific nomenclature as adopted by an appropriate scientific body. + + + + + ISO-12620 2.1.6: A term that has the same or nearly identical orthographic or phonemic form in many languages. + + + + + ISO-12620 2.1.16: An expression used to represent a concept based on mathematical or logical relations, such as statements of inequality, set relationships, Boolean operations, and the like. + + + + + ISO-12620 2.1.17: A unit to track object. + + + + + Indicates the marked text is a name. + + + + + ISO-12620 2.1.3: A term that represents the same or a very similar concept as another term in the same language, but for which interchangeability is limited to some contexts and inapplicable in others. + + + + + ISO-12620 2.1.17.2: A unique alphanumeric designation assigned to an object in a manufacturing system. + + + + + Indicates the marked text is a phrase. + + + + + ISO-12620 2.1.18: Any group of two or more words that form a unit, the meaning of which frequently cannot be deduced based on the combined sense of the words making up the phrase. + + + + + Indicates the marked text should not be translated. + + + + + ISO-12620 2.1.12: A form of a term resulting from an operation whereby non-Latin writing systems are converted to the Latin alphabet. + + + + + Indicates that the marked text represents a segment. + + + + + ISO-12620 2.1.18.2: A fixed, lexicalized phrase. + + + + + ISO-12620 2.1.8.2: A variant of a multiword term that includes fewer words than the full form of the term (e.g. 'Group of Twenty-four' for 'Intergovernmental Group of Twenty-four on International Monetary Affairs'). + + + + + ISO-12620 2.1.17.1: Stock keeping unit, an inventory item identified by a unique alphanumeric designation assigned to an object in an inventory control system. + + + + + ISO-12620 2.1.19: A fixed chunk of recurring text. + + + + + ISO-12620 2.1.13: A designation of a concept by letters, numerals, pictograms or any combination thereof. + + + + + ISO-12620 2.1.2: Any term that represents the same or a very similar concept as the main entry term in a term entry. + + + + + ISO-12620 2.1.18.3: Phraseological unit in a language that expresses the same semantic content as another phrase in that same language. + + + + + Indicates the marked text is a term. + + + + + ISO-12620 2.1.11: A form of a term resulting from an operation whereby the characters of one writing system are represented by characters from another writing system, taking into account the pronunciation of the characters converted. + + + + + ISO-12620 2.1.10: A form of a term resulting from an operation whereby the characters of an alphabetic writing system are represented by characters from another alphabetic writing system. + + + + + ISO-12620 2.1.8.5: An abbreviated form of a term resulting from the omission of one or more term elements or syllables (e.g. 'flu' for 'influenza'). + + + + + ISO-12620 2.1.9: One of the alternate forms of a term. + + + + + + + Values for the attribute 'restype'. + + + + + Indicates a Windows RC AUTO3STATE control. + + + + + Indicates a Windows RC AUTOCHECKBOX control. + + + + + Indicates a Windows RC AUTORADIOBUTTON control. + + + + + Indicates a Windows RC BEDIT control. + + + + + Indicates a bitmap, for example a BITMAP resource in Windows. + + + + + Indicates a button object, for example a BUTTON control Windows. + + + + + Indicates a caption, such as the caption of a dialog box. + + + + + Indicates the cell in a table, for example the content of the <td> element in HTML. + + + + + Indicates check box object, for example a CHECKBOX control in Windows. + + + + + Indicates a menu item with an associated checkbox. + + + + + Indicates a list box, but with a check-box for each item. + + + + + Indicates a color selection dialog. + + + + + Indicates a combination of edit box and listbox object, for example a COMBOBOX control in Windows. + + + + + Indicates an initialization entry of an extended combobox DLGINIT resource block. (code 0x1234). + + + + + Indicates an initialization entry of a combobox DLGINIT resource block (code 0x0403). + + + + + Indicates a UI base class element that cannot be represented by any other element. + + + + + Indicates a context menu. + + + + + Indicates a Windows RC CTEXT control. + + + + + Indicates a cursor, for example a CURSOR resource in Windows. + + + + + Indicates a date/time picker. + + + + + Indicates a Windows RC DEFPUSHBUTTON control. + + + + + Indicates a dialog box. + + + + + Indicates a Windows RC DLGINIT resource block. + + + + + Indicates an edit box object, for example an EDIT control in Windows. + + + + + Indicates a filename. + + + + + Indicates a file dialog. + + + + + Indicates a footnote. + + + + + Indicates a font name. + + + + + Indicates a footer. + + + + + Indicates a frame object. + + + + + Indicates a XUL grid element. + + + + + Indicates a groupbox object, for example a GROUPBOX control in Windows. + + + + + Indicates a header item. + + + + + Indicates a heading, such has the content of <h1>, <h2>, etc. in HTML. + + + + + Indicates a Windows RC HEDIT control. + + + + + Indicates a horizontal scrollbar. + + + + + Indicates an icon, for example an ICON resource in Windows. + + + + + Indicates a Windows RC IEDIT control. + + + + + Indicates keyword list, such as the content of the Keywords meta-data in HTML, or a K footnote in WinHelp RTF. + + + + + Indicates a label object. + + + + + Indicates a label that is also a HTML link (not necessarily a URL). + + + + + Indicates a list (a group of list-items, for example an <ol> or <ul> element in HTML). + + + + + Indicates a listbox object, for example an LISTBOX control in Windows. + + + + + Indicates an list item (an entry in a list). + + + + + Indicates a Windows RC LTEXT control. + + + + + Indicates a menu (a group of menu-items). + + + + + Indicates a toolbar containing one or more tope level menus. + + + + + Indicates a menu item (an entry in a menu). + + + + + Indicates a XUL menuseparator element. + + + + + Indicates a message, for example an entry in a MESSAGETABLE resource in Windows. + + + + + Indicates a calendar control. + + + + + Indicates an edit box beside a spin control. + + + + + Indicates a catch all for rectangular areas. + + + + + Indicates a standalone menu not necessarily associated with a menubar. + + + + + Indicates a pushbox object, for example a PUSHBOX control in Windows. + + + + + Indicates a Windows RC PUSHBUTTON control. + + + + + Indicates a radio button object. + + + + + Indicates a menuitem with associated radio button. + + + + + Indicates raw data resources for an application. + + + + + Indicates a row in a table. + + + + + Indicates a Windows RC RTEXT control. + + + + + Indicates a user navigable container used to show a portion of a document. + + + + + Indicates a generic divider object (e.g. menu group separator). + + + + + Windows accelerators, shortcuts in resource or property files. + + + + + Indicates a UI control to indicate process activity but not progress. + + + + + Indicates a splitter bar. + + + + + Indicates a Windows RC STATE3 control. + + + + + Indicates a window for providing feedback to the users, like 'read-only', etc. + + + + + Indicates a string, for example an entry in a STRINGTABLE resource in Windows. + + + + + Indicates a layers of controls with a tab to select layers. + + + + + Indicates a display and edits regular two-dimensional tables of cells. + + + + + Indicates a XUL textbox element. + + + + + Indicates a UI button that can be toggled to on or off state. + + + + + Indicates an array of controls, usually buttons. + + + + + Indicates a pop up tool tip text. + + + + + Indicates a bar with a pointer indicating a position within a certain range. + + + + + Indicates a control that displays a set of hierarchical data. + + + + + Indicates a URI (URN or URL). + + + + + Indicates a Windows RC USERBUTTON control. + + + + + Indicates a user-defined control like CONTROL control in Windows. + + + + + Indicates the text of a variable. + + + + + Indicates version information about a resource like VERSIONINFO in Windows. + + + + + Indicates a vertical scrollbar. + + + + + Indicates a graphical window. + + + + + + + Values for the attribute 'size-unit'. + + + + + Indicates a size in 8-bit bytes. + + + + + Indicates a size in Unicode characters. + + + + + Indicates a size in columns. Used for HTML text area. + + + + + Indicates a size in centimeters. + + + + + Indicates a size in dialog units, as defined in Windows resources. + + + + + Indicates a size in 'font-size' units (as defined in CSS). + + + + + Indicates a size in 'x-height' units (as defined in CSS). + + + + + Indicates a size in glyphs. A glyph is considered to be one or more combined Unicode characters that represent a single displayable text character. Sometimes referred to as a 'grapheme cluster' + + + + + Indicates a size in inches. + + + + + Indicates a size in millimeters. + + + + + Indicates a size in percentage. + + + + + Indicates a size in pixels. + + + + + Indicates a size in point. + + + + + Indicates a size in rows. Used for HTML text area. + + + + + + + Values for the attribute 'state'. + + + + + Indicates the terminating state. + + + + + Indicates only non-textual information needs adaptation. + + + + + Indicates both text and non-textual information needs adaptation. + + + + + Indicates only non-textual information needs review. + + + + + Indicates both text and non-textual information needs review. + + + + + Indicates that only the text of the item needs to be reviewed. + + + + + Indicates that the item needs to be translated. + + + + + Indicates that the item is new. For example, translation units that were not in a previous version of the document. + + + + + Indicates that changes are reviewed and approved. + + + + + Indicates that the item has been translated. + + + + + + + Values for the attribute 'state-qualifier'. + + + + + Indicates an exact match. An exact match occurs when a source text of a segment is exactly the same as the source text of a segment that was translated previously. + + + + + Indicates a fuzzy match. A fuzzy match occurs when a source text of a segment is very similar to the source text of a segment that was translated previously (e.g. when the difference is casing, a few changed words, white-space discripancy, etc.). + + + + + Indicates a match based on matching IDs (in addition to matching text). + + + + + Indicates a translation derived from a glossary. + + + + + Indicates a translation derived from existing translation. + + + + + Indicates a translation derived from machine translation. + + + + + Indicates a translation derived from a translation repository. + + + + + Indicates a translation derived from a translation memory. + + + + + Indicates the translation is suggested by machine translation. + + + + + Indicates that the item has been rejected because of incorrect grammar. + + + + + Indicates that the item has been rejected because it is incorrect. + + + + + Indicates that the item has been rejected because it is too long or too short. + + + + + Indicates that the item has been rejected because of incorrect spelling. + + + + + Indicates the translation is suggested by translation memory. + + + + + + + Values for the attribute 'unit'. + + + + + Refers to words. + + + + + Refers to pages. + + + + + Refers to <trans-unit> elements. + + + + + Refers to <bin-unit> elements. + + + + + Refers to glyphs. + + + + + Refers to <trans-unit> and/or <bin-unit> elements. + + + + + Refers to the occurrences of instances defined by the count-type value. + + + + + Refers to characters. + + + + + Refers to lines. + + + + + Refers to sentences. + + + + + Refers to paragraphs. + + + + + Refers to segments. + + + + + Refers to placeables (inline elements). + + + + + + + Values for the attribute 'priority'. + + + + + Highest priority. + + + + + High priority. + + + + + High priority, but not as important as 2. + + + + + High priority, but not as important as 3. + + + + + Medium priority, but more important than 6. + + + + + Medium priority, but less important than 5. + + + + + Low priority, but more important than 8. + + + + + Low priority, but more important than 9. + + + + + Low priority. + + + + + Lowest priority. + + + + + + + + + This value indicates that all properties can be reformatted. This value must be used alone. + + + + + This value indicates that no properties should be reformatted. This value must be used alone. + + + + + + + + + + + + + This value indicates that all information in the coord attribute can be modified. + + + + + This value indicates that the x information in the coord attribute can be modified. + + + + + This value indicates that the y information in the coord attribute can be modified. + + + + + This value indicates that the cx information in the coord attribute can be modified. + + + + + This value indicates that the cy information in the coord attribute can be modified. + + + + + This value indicates that all the information in the font attribute can be modified. + + + + + This value indicates that the name information in the font attribute can be modified. + + + + + This value indicates that the size information in the font attribute can be modified. + + + + + This value indicates that the weight information in the font attribute can be modified. + + + + + This value indicates that the information in the css-style attribute can be modified. + + + + + This value indicates that the information in the style attribute can be modified. + + + + + This value indicates that the information in the exstyle attribute can be modified. + + + + + + + + + + + + + Indicates that the context is informational in nature, specifying for example, how a term should be translated. Thus, should be displayed to anyone editing the XLIFF document. + + + + + Indicates that the context-group is used to specify where the term was found in the translatable source. Thus, it is not displayed. + + + + + Indicates that the context information should be used during translation memory lookups. Thus, it is not displayed. + + + + + + + + + Represents a translation proposal from a translation memory or other resource. + + + + + Represents a previous version of the target element. + + + + + Represents a rejected version of the target element. + + + + + Represents a translation to be used for reference purposes only, for example from a related product or a different language. + + + + + Represents a proposed translation that was used for the translation of the trans-unit, possibly modified. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Values for the attribute 'coord'. + + + + + + + + Version values: 1.0 and 1.1 are allowed for backward compatibility. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From da0768ca5e332d0b85d99ac7b542575750672942 Mon Sep 17 00:00:00 2001 From: Ariel Rorabaugh Date: Mon, 4 Aug 2025 11:48:25 -0400 Subject: [PATCH 14/25] Move send message to winforms side --- src/L10NSharp.Windows.Forms/UtilsWinforms.cs | 13 ++++++++++++- src/L10NSharp/Utils.cs | 14 -------------- 2 files changed, 12 insertions(+), 15 deletions(-) diff --git a/src/L10NSharp.Windows.Forms/UtilsWinforms.cs b/src/L10NSharp.Windows.Forms/UtilsWinforms.cs index c5f0854..e296e07 100644 --- a/src/L10NSharp.Windows.Forms/UtilsWinforms.cs +++ b/src/L10NSharp.Windows.Forms/UtilsWinforms.cs @@ -1,6 +1,8 @@ using System.Reflection; using System; using System.Windows.Forms; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; namespace L10NSharp.Windows.Forms { @@ -9,6 +11,15 @@ internal static class UtilsWinforms { private const int WM_SETREDRAW = 0xB; + + [DllImport("user32.dll", CharSet = CharSet.Auto, EntryPoint = "SendMessage")] + private static extern void SendMessageWindows(IntPtr hWnd, int msg, int wParam, int lParam); + + public static void SendMessage(IntPtr hWnd, int msg, int wParam, int lParam) + { + SendMessageWindows(hWnd, msg, wParam, lParam); + } + /// ------------------------------------------------------------------------------------ /// /// Turns window redrawing on or off. After turning on, the window will be invalidated. @@ -34,7 +45,7 @@ public static void SetWindowRedraw(Control ctrl, bool turnOn, } else { - L10NSharp.Utils.SendMessage(ctrl.Handle, WM_SETREDRAW, (turnOn ? 1 : 0), 0); + SendMessage(ctrl.Handle, WM_SETREDRAW, (turnOn ? 1 : 0), 0); } if (turnOn && invalidateAfterTurningOn) diff --git a/src/L10NSharp/Utils.cs b/src/L10NSharp/Utils.cs index e6216d3..5e5ef9b 100644 --- a/src/L10NSharp/Utils.cs +++ b/src/L10NSharp/Utils.cs @@ -21,20 +21,6 @@ public static bool IsMono } } - - [DllImport("user32.dll", CharSet = CharSet.Auto, EntryPoint = "SendMessage")] - private static extern void SendMessageWindows(IntPtr hWnd, int msg, int wParam, int lParam); - - public static void SendMessage(IntPtr hWnd, int msg, int wParam, int lParam) - { - if (IsMono) - Console.WriteLine("Warning--using unimplemented method SendMessage"); // FIXME Linux - else - { - SendMessageWindows(hWnd, msg, wParam, lParam); - } - } - /// ------------------------------------------------------------------------------------ /// /// Asks whether the specified property on the specified binding exists. From e081195cd4764bc43a5cb007fed9204d9ab38863 Mon Sep 17 00:00:00 2001 From: Ariel Rorabaugh Date: Mon, 4 Aug 2025 13:21:31 -0400 Subject: [PATCH 15/25] Move xliff localization winforms test --- .../LocalizationManagerTestsBase.cs | 37 -- src/L10NSharp.Windows.Forms.Tests/TempFile.cs | 328 ++++++++++++++++++ .../XliffLocalizationManagerTests.cs | 197 +++++++++++ .../XliffLocalizationManagerWinforms.cs | 4 + 4 files changed, 529 insertions(+), 37 deletions(-) create mode 100644 src/L10NSharp.Windows.Forms.Tests/TempFile.cs create mode 100644 src/L10NSharp.Windows.Forms.Tests/XliffLocalizationManagerTests.cs diff --git a/src/L10NSharp.Tests/LocalizationManagerTestsBase.cs b/src/L10NSharp.Tests/LocalizationManagerTestsBase.cs index ba9bb73..76e46f7 100644 --- a/src/L10NSharp.Tests/LocalizationManagerTestsBase.cs +++ b/src/L10NSharp.Tests/LocalizationManagerTestsBase.cs @@ -1006,42 +1006,5 @@ public void TestMappingLanguageCodesToAvailable_FindsSpecificGivenGeneric() Assert.That(languageIdUsed, Is.EqualTo("zh-CN")); } } - - /*[Test] - public void TestMappingLanguageCodesToAvailable_AmbiguousOptions_PromptsUser([Values("zh-CN", "zh-TW")] string choice) - { - LocalizationManager.SetUILanguage("en", true); - LocalizationManagerInternal.LoadedManagers.Clear(); - using (var folder = new TempFolder()) - { - var installedFolder = Path.Combine(folder.Path, "installed"); - // ReSharper disable once AssignNullToNotNullAttribute - var userRelativeFolder = Path.Combine("Temp", Path.GetFileName(Path.GetDirectoryName(folder.Path)), - Path.GetFileName(folder.Path), "user"); - AddEnglishTranslation(installedFolder, null); - AddChineseOfChinaTranslation(installedFolder); - AddChineseOfTaiwanTranslation(installedFolder); - var userPromptCount = 0; - LocalizationManagerInternal.ChooseFallbackLanguage = (langTag, icon) => - { - userPromptCount++; - Assert.That(langTag, Is.EqualTo("zh")); - return choice; - }; - var manager = LocalizationManager.Create("zh", AppId, AppName, AppVersion, installedFolder, - userRelativeFolder, null, null, new string[] { }); - Assert.That(userPromptCount, Is.EqualTo(1)); - LocalizationManagerInternal.LoadedManagers[AppId] = (ILocalizationManagerInternal)manager; - - var langs = LocalizationManager.GetAvailableLocalizedLanguages(); - Assert.That(langs, Is.EquivalentTo(new[] { "en", "zh-CN", "zh-TW" })); - Assert.That(LocalizationManager.UILanguageId, Is.EqualTo(choice)); - - Assert.That(LocalizationManager.GetIsStringAvailableForLangId("theId", "zh"), Is.False, "zh is ambiguous"); - Assert.That(LocalizationManager.GetIsStringAvailableForLangId("theId", "zh-CN"), Is.True, "zh-CN should find zh-CN"); - Assert.That(LocalizationManager.GetIsStringAvailableForLangId("theId", "zh-TW"), Is.True, "zh-TW should find zh-TW"); - Assert.That(LocalizationManager.GetIsStringAvailableForLangId("theId", "en"), Is.True, "en should find en"); - } - }*/ } } diff --git a/src/L10NSharp.Windows.Forms.Tests/TempFile.cs b/src/L10NSharp.Windows.Forms.Tests/TempFile.cs new file mode 100644 index 0000000..6774f1d --- /dev/null +++ b/src/L10NSharp.Windows.Forms.Tests/TempFile.cs @@ -0,0 +1,328 @@ +using System; +using System.Diagnostics; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading; +using NUnit.Framework; + +namespace L10NSharp.Windows.Forms.Tests +{ + + /// + /// This is useful a temporary file is needed. When it is disposed, it will delete the file. + /// + /// Sometimes it is useful to make a temp file and NOT have the TempFile class delete it. + /// In such cases, simply do not Dispose() the TempFile. To make this possible and reliable, + /// this class deliberately does NOT implement a destructor or do anything to ensure + /// the file is deleted if the TempFile is not disposed. Please don't change this. + /// + /// using(f = new TempFile()) + public class TempFile : IDisposable + { + protected string _path; + private string _folderToDelete; // if not null, delete this as well on dispose + + public TempFile() + { + _path = System.IO.Path.GetTempFileName(); + } + + public TempFile(bool dontMakeMeAFileAndDontSetPath) + { + if(!dontMakeMeAFileAndDontSetPath) + { + _path = System.IO.Path.GetTempFileName(); + } + } + + public TempFile(string contents) + : this() + { + File.WriteAllText(_path, contents); + } + + public TempFile(string contents, Encoding encoding) + : this() + { + File.WriteAllText(_path, contents, encoding); + } + + public TempFile(string[] contentLines) + : this() + { + File.WriteAllLines(_path, contentLines); + } + + public string Path + { + get { return _path; } + } + + // See comment on class above regarding Dispose + public void Dispose() + { + File.Delete(_path); + if(_folderToDelete != null) + DeleteDirectoryRobust(_folderToDelete); + } + + public static TempFile CopyOf(string pathToExistingFile) + { + TempFile t = new TempFile(); + File.Copy(pathToExistingFile, t.Path, true); + return t; + } + + public TempFile(string existingPath, bool dummy) + { + _path = existingPath; + } + + /// + /// Create a TempFile based on a pre-existing file, which will be deleted when this is disposed. + /// + public static TempFile TrackExisting(string path) + { + return new TempFile(path, false); + } + + public static TempFile CreateAndGetPathButDontMakeTheFile() + { + TempFile t = new TempFile(); + File.Delete(t.Path); + return t; + } + + /// + /// Use this one when it's important to have a certain file extension + /// + /// with or with out '.', will work the same + public static TempFile WithExtension(string extension) + { + extension = extension.TrimStart('.'); + var path = System.IO.Path.Combine(System.IO.Path.GetTempPath(), System.IO.Path.GetRandomFileName() + "." + extension); + File.Create(path).Close(); + return TrackExisting(path); + } + + /// + /// Use this one when it's important to have a certain file name (with, or without extension). + /// + /// with or with out an extension, will work the same + public static TempFile WithFilename(string filename) + { + if(filename == null) + throw new ArgumentNullException("filename"); + if(filename == string.Empty) + throw new ArgumentException("Filename has no content", "filename"); + filename = filename.Trim(); + if(filename == string.Empty) + throw new ArgumentException("Filename has only whitespace", "filename"); + + var pathname = System.IO.Path.Combine(System.IO.Path.GetTempPath(), filename); + File.Create(pathname).Close(); + return TrackExisting(pathname); + } + + /// + /// Creates a file with the specified name in a new, randomly named folder. + /// Dispose will dispose of the folder (and any subsequently added content) as well as the temp file. + /// + /// + /// + public static TempFile WithFilenameInTempFolder(string fileName) + { + var tempFolder = System.IO.Path.Combine(System.IO.Path.GetTempPath(), System.IO.Path.GetRandomFileName()); + Directory.CreateDirectory(tempFolder); + var path = System.IO.Path.Combine(tempFolder, fileName); + var result = TempFile.TrackExisting(path); + result._folderToDelete = tempFolder; + return result; + } + + /// + /// Used to make a real file out of a resource for the purpose of testing + /// + /// e.g., an audio resource + /// with or with out '.', will work the same + public static TempFile FromResource(Stream resource, string extension) + { + var f = WithExtension(extension); + byte[] buffer = new byte[resource.Length + 1]; + resource.Read(buffer, 0, (int)resource.Length); + File.WriteAllBytes(f.Path, buffer); + return f; + } + + /// + /// Used to make a real file out of a resource for the purpose of testing + /// + /// e.g., a video resource + /// with or with out '.', will work the same + public static TempFile FromResource(byte[] resource, string extension) + { + var f = WithExtension(extension); + File.WriteAllBytes(f.Path, resource); + return f; + } + + /// + /// Used to move a file to a new path + /// + public void MoveTo(string path) + { + File.Move(Path, path); + _path = path; + } + + /// + /// There are various things which can prevent a simple directory deletion, mostly timing related things which are hard to debug. + /// This method uses all the tricks to do its best. + /// + /// returns true if the directory is fully deleted + public static bool DeleteDirectoryRobust(string path) + { + // ReSharper disable EmptyGeneralCatchClause + + for(int i = 0; i < 40; i++) // each time, we sleep a little. This will try for up to 2 seconds (40*50ms) + { + if(!Directory.Exists(path)) + break; + + try + { + Directory.Delete(path, true); + } + catch(Exception) + { + } + + if(!Directory.Exists(path)) + break; + + try + { + //try to clear it out a bit + string[] dirs = Directory.GetDirectories(path); + string[] files = Directory.GetFiles(path, "*.*", SearchOption.AllDirectories); + foreach(string filePath in files) + { + try + { + /* we could do this too, but it's dangerous + * File.SetAttributes(filePath, FileAttributes.Normal); + */ + File.Delete(filePath); + } + catch(Exception) + { + } + } + foreach(var dir in dirs) + { + DeleteDirectoryRobust(dir); + } + + } + catch(Exception)//yes, even these simple queries can throw exceptions, as stuff suddenly is deleted base on our prior request + { + } + //sleep and let some OS things catch up + Thread.Sleep(50); + } + + return !Directory.Exists(path); + // ReSharper restore EmptyGeneralCatchClause + } + } + + public class TempFolder : IDisposable + { + private static string _basePath; + private readonly string _path; + + public TempFolder(): this(TestContext.CurrentContext.Test.Name) + { + } + + public TempFolder(string testName) + { + testName = System.IO.Path.GetInvalidPathChars().Aggregate(testName, + (current, c) => current.Replace(c, '_')).Replace('`', '_').Replace('"', '_'); + _path = System.IO.Path.Combine(BasePath, testName); + if(Directory.Exists(_path)) + { + TestUtilities.DeleteFolderThatMayBeInUse(_path); + } + Directory.CreateDirectory(_path); + } + + private static string BasePath => + _basePath ?? (_basePath = System.IO.Path.Combine( + System.IO.Path.GetTempPath(), + System.IO.Path.GetRandomFileName())); + + public string Path => _path; + + public void Dispose() + { + TestUtilities.DeleteFolderThatMayBeInUse(_path); + } + + public TempFile GetPathForNewTempFile(bool doCreateTheFile) + { + var s = System.IO.Path.GetRandomFileName(); + s = System.IO.Path.Combine(_path, s); + if(doCreateTheFile) + { + File.Create(s).Close(); + } + return TempFile.TrackExisting(s); + } + + public string Combine(string innerFileName) + { + return System.IO.Path.Combine(_path, innerFileName); + } + } + + public class TestUtilities + { + public static void DeleteFolderThatMayBeInUse(string folder) + { + if (!Directory.Exists(folder)) + return; + + for(int i = 0; i < 50; i++) //wait up to five seconds + { + try + { + Directory.Delete(folder, true); + return; + } + catch(Exception) + { + } + Thread.Sleep(100); + } + //maybe we can at least clear it out a bit + try + { + Debug.WriteLine("TestUtilities.DeleteFolderThatMayBeInUse(): gave up trying to delete the whole folder. Some files may be abandoned in your temp folder."); + + string[] files = Directory.GetFiles(folder, "*.*", SearchOption.AllDirectories); + foreach(string s in files) + { + File.Delete(s); + } + //sleep and try again + Thread.Sleep(1000); + Directory.Delete(folder, true); + } + catch(Exception) + { + } + } + } +} diff --git a/src/L10NSharp.Windows.Forms.Tests/XliffLocalizationManagerTests.cs b/src/L10NSharp.Windows.Forms.Tests/XliffLocalizationManagerTests.cs new file mode 100644 index 0000000..af21be3 --- /dev/null +++ b/src/L10NSharp.Windows.Forms.Tests/XliffLocalizationManagerTests.cs @@ -0,0 +1,197 @@ +// Copyright © 2022-2025 SIL Global +// This software is licensed under the MIT License (http://opensource.org/licenses/MIT) +using System.Collections.Generic; +using System.IO; +using System.Reflection; +using L10NSharp.XLiffUtils; +using L10NSharp.Windows.Forms.XLiffUtils; +using NUnit.Framework; + +namespace L10NSharp.Windows.Forms.Tests +{ + public class XliffLocalizationManagerTests + { + protected const string AppId = "test"; + protected const string AppName = "unit test"; + protected const string AppVersion = "1.0.0"; + protected const string HigherVersion = "2.0.0"; + protected const string LowerVersion = "0.0.1"; + protected const string LiteralNewline = "\\n"; + + internal ILocalizationManagerInternalWinforms CreateLocalizationManager( + string appId, string appName, string appVersion, string directoryOfInstalledLocFiles, + string directoryForGeneratedDefaultFile, string directoryOfUserModifiedXliffFiles, + IEnumerable additionalGetStringMethodInfo = null, + params string[] namespaceBeginnings) + { + var manager = new XliffLocalizationManagerWinforms(appId, null, appName, appVersion, directoryOfInstalledLocFiles, + directoryForGeneratedDefaultFile, directoryOfUserModifiedXliffFiles, additionalGetStringMethodInfo, + namespaceBeginnings); + Assert.That(manager.OriginalExecutableFile, Is.EqualTo(appId + ".dll")); + LocalizationManagerInternalWinforms.LoadedManagers.Add("myAppId", manager); + return manager; + } + + internal ILocalizationManagerInternalWinforms CreateLocalizationManager( + string appId, string appName, string appVersion) + { + return new XliffLocalizationManagerWinforms(appId, appName, appVersion); + } + + protected XLiffDocument CreateNewDocument(string productVersion, string sourceLang, + string targetLang = null, string otherAppVersion = null) + { + var doc = new XLiffDocument { File = { SourceLang = sourceLang } }; + if (!string.IsNullOrEmpty(productVersion)) + doc.File.ProductVersion = productVersion; + if (!string.IsNullOrEmpty(targetLang)) + doc.File.TargetLang = targetLang; + if (!string.IsNullOrEmpty(otherAppVersion)) + doc.File.SetPropValue(LocalizationManager.kAppVersionPropTag, otherAppVersion); + doc.File.HardLineBreakReplacement = LiteralNewline; + doc.File.Original = "test.dll"; + return doc; + } + + protected ITransUnit CreateTransUnit(string id, bool dynamic, + ITransUnitVariant sourceVariant, ITransUnitVariant targetVariant = null, + string noteText = null, TranslationStatus? translationStatus = null, bool? noLongerUsed = null) + { + var tu = new XLiffTransUnit + { + Id = id, + Source = (XLiffTransUnitVariant)sourceVariant, + Target = (XLiffTransUnitVariant)targetVariant + + }; + + if (dynamic) + tu.Dynamic = true; + + if (!string.IsNullOrEmpty(noteText)) + tu.Notes = new List { new XLiffNote { Text = noteText } }; + + if (translationStatus.HasValue) + tu.TranslationStatus = translationStatus.Value; + return tu; + } + + protected ITransUnitVariant CreateTransUnitVariant(string lang, string value) + { + return new XLiffTransUnitVariant { Lang = lang, Value = value }; + } + + [TearDown] + public void TearDownLocalizationManagers() + { + LocalizationManager.UseLanguageCodeFolders = false; + LocalizationManagerInternalWinforms.LoadedManagers.Clear(); + LocalizationManagerInternalWinforms.MapToExistingLanguage.Clear(); + LocalizationManager.SetUILanguage(LocalizationManager.kDefaultLang, false); + } + + private void AddEnglishTranslation(string folderPath, string appVersion) + { + var englishDoc = CreateNewDocument(appVersion, "en"); + + // first unit + var tu = CreateTransUnit("theId", false, + CreateTransUnitVariant("en", "from English Translation"), + null, "Test"); + englishDoc.AddTransUnit(tu); + // second unit + var tu2 = CreateTransUnit("notUsedId", false, + CreateTransUnitVariant("en", "no longer used English text"), + noLongerUsed: true); + englishDoc.AddTransUnit(tu2); + // third unit + var tu3 = CreateTransUnit("blahId", false, + CreateTransUnitVariant("en", "blah")); + englishDoc.AddTransUnit(tu3); + englishDoc.Save(Path.Combine(folderPath, LocalizationManager.GetTranslationFileNameForLanguage(AppId, "en"))); + } + + private void AddChineseOfChinaTranslation(string folderPath) + { + var chineseDoc = CreateNewDocument(null, "en", "zh-CN"); + // first unit + var tu = CreateTransUnit("theId", false, + CreateTransUnitVariant("en", "from English Translation"), + CreateTransUnitVariant("zh-CN", "from Chinese (China) Translation"), + "Test", TranslationStatus.Approved); + chineseDoc.AddTransUnit(tu); + // second unit + var tu2 = CreateTransUnit("notUsedId", false, + CreateTransUnitVariant("en", "no longer used English text"), + CreateTransUnitVariant("zh-CN", "no longer used Chinese (China) text"), + null, TranslationStatus.Approved); + chineseDoc.AddTransUnit(tu2); + // third unit + var tu3 = CreateTransUnit("blahId", false, + CreateTransUnitVariant("en", "blah"), + CreateTransUnitVariant("zh-CN", "中文(中国) blah")); + chineseDoc.AddTransUnit(tu3); + chineseDoc.Save(Path.Combine(folderPath, LocalizationManager.GetTranslationFileNameForLanguage(AppId, "zh-CN"))); + } + + private void AddChineseOfTaiwanTranslation(string folderPath) + { + var chineseDoc = CreateNewDocument(null, "en", "zh-TW"); + // first unit + var tu = CreateTransUnit("theId", false, + CreateTransUnitVariant("en", "from English Translation"), + CreateTransUnitVariant("zh-TW", "from Chinese (Taiwan) Translation"), + "Test", TranslationStatus.Approved); + chineseDoc.AddTransUnit(tu); + // second unit + var tu2 = CreateTransUnit("notUsedId", false, + CreateTransUnitVariant("en", "no longer used English text"), + CreateTransUnitVariant("zh-TW", "no longer used Chinese (Taiwan) text"), + null, TranslationStatus.Approved); + chineseDoc.AddTransUnit(tu2); + // third unit + var tu3 = CreateTransUnit("blahId", false, + CreateTransUnitVariant("en", "blah"), + CreateTransUnitVariant("zh-TW", "中文(Taiwan) blah")); + chineseDoc.AddTransUnit(tu3); + chineseDoc.Save(Path.Combine(folderPath, LocalizationManager.GetTranslationFileNameForLanguage(AppId, "zh-TW"))); + } + + [Test] + public void TestMappingLanguageCodesToAvailable_AmbiguousOptions_PromptsUser([Values("zh-CN", "zh-TW")] string choice) + { + LocalizationManager.SetUILanguage("en", true); + LocalizationManagerInternalWinforms.LoadedManagers.Clear(); + using (var folder = new TempFolder()) + { + var installedFolder = Path.Combine(folder.Path, "installed"); + // ReSharper disable once AssignNullToNotNullAttribute + var userRelativeFolder = Path.Combine("Temp", Path.GetFileName(Path.GetDirectoryName(folder.Path)), + Path.GetFileName(folder.Path), "user"); + AddEnglishTranslation(installedFolder, null); + AddChineseOfChinaTranslation(installedFolder); + AddChineseOfTaiwanTranslation(installedFolder); + var userPromptCount = 0; + LocalizationManagerInternalWinforms.ChooseFallbackLanguage = (langTag, icon) => + { + userPromptCount++; + Assert.That(langTag, Is.EqualTo("zh")); + return choice; + }; + var manager = LocalizationManagerWinforms.Create("zh", AppId, AppName, AppVersion, installedFolder, + userRelativeFolder, null, null, new string[] { }); + Assert.That(userPromptCount, Is.EqualTo(1)); + LocalizationManagerInternal.LoadedManagers[AppId] = (ILocalizationManagerInternal)manager; + + var langs = LocalizationManager.GetAvailableLocalizedLanguages(); + Assert.That(langs, Is.EquivalentTo(new[] { "en", "zh-CN", "zh-TW" })); + Assert.That(LocalizationManager.UILanguageId, Is.EqualTo(choice)); + + Assert.That(LocalizationManager.GetIsStringAvailableForLangId("theId", "zh"), Is.False, "zh is ambiguous"); + Assert.That(LocalizationManager.GetIsStringAvailableForLangId("theId", "zh-CN"), Is.True, "zh-CN should find zh-CN"); + Assert.That(LocalizationManager.GetIsStringAvailableForLangId("theId", "zh-TW"), Is.True, "zh-TW should find zh-TW"); + Assert.That(LocalizationManager.GetIsStringAvailableForLangId("theId", "en"), Is.True, "en should find en"); + } + } + } +} diff --git a/src/L10NSharp.Windows.Forms/XLiffUtils/XliffLocalizationManagerWinforms.cs b/src/L10NSharp.Windows.Forms/XLiffUtils/XliffLocalizationManagerWinforms.cs index 7d7fab7..ad17c3d 100644 --- a/src/L10NSharp.Windows.Forms/XLiffUtils/XliffLocalizationManagerWinforms.cs +++ b/src/L10NSharp.Windows.Forms/XLiffUtils/XliffLocalizationManagerWinforms.cs @@ -37,6 +37,10 @@ internal XliffLocalizationManagerWinforms(string appId, string origExtension, st Dictionary>(); } + internal XliffLocalizationManagerWinforms(string appId, string appName, string appVersion) : base(appId, appName, appVersion) + { + } + /// Sometimes, on Linux, there is an empty DefaultStringFile. This causes problems. private bool DefaultStringFileExistsAndHasContents() { From 53a04231234abd0150f50fd6a737eb9bff96478a Mon Sep 17 00:00:00 2001 From: Ariel Rorabaugh Date: Tue, 5 Aug 2025 18:59:05 -0400 Subject: [PATCH 16/25] Remove unused resources & alt-shift-click handling --- .../L10NSharp.Windows.Forms.Tests.csproj | 1 + src/L10NSharp.Windows.Forms.Tests/TempFile.cs | 328 --- .../TestXliff/xliff-core-1.2-strict.xsd | 2223 ---------------- .../TestXliff/xliff-core-1.2-transitional.xsd | 2261 ----------------- .../XliffLocalizationManagerTests.cs | 2 +- src/L10NSharp.Windows.Forms/L10NExtender.resx | 3 - .../L10NSharp.Windows.Forms.csproj | 3 - .../Properties/Resources.resx | 152 -- .../Resources/Copy_Translation (toolbar).png | Bin 1416 -> 0 bytes .../Resources/Copy_Translation.png | Bin 490 -> 0 bytes .../Resources/Google.png | Bin 810 -> 0 bytes .../Resources/Move.png | Bin 1307 -> 0 bytes .../Resources/Move_Next.png | Bin 1096 -> 0 bytes .../Resources/Move_Previous.png | Bin 1096 -> 0 bytes .../Resources/Move_down.png | Bin 1148 -> 0 bytes .../Resources/Move_up.png | Bin 1148 -> 0 bytes .../Resources/SelectAllRows.png | Bin 3191 -> 0 bytes .../Resources/bing.png | Bin 1161 -> 0 bytes .../UIComponents/LocalizeItemDlg.Designer.cs | 1061 -------- .../UIComponents/LocalizeItemDlg.cs | 912 ------- .../UIComponents/LocalizeItemDlg.resx | 156 -- .../UIComponents/LocalizeItemDlgViewModel.cs | 592 ----- .../XliffLocalizationManagerWinforms.cs | 306 --- src/L10NSharp/L10NSharp.csproj | 2 +- src/L10NSharp/Properties/Resources.resx | 152 -- .../Resources/Copy_Translation (toolbar).png | Bin 1416 -> 0 bytes src/L10NSharp/Resources/Copy_Translation.png | Bin 490 -> 0 bytes src/L10NSharp/Resources/Google.png | Bin 810 -> 0 bytes src/L10NSharp/Resources/Move.png | Bin 1307 -> 0 bytes src/L10NSharp/Resources/Move_Next.png | Bin 1096 -> 0 bytes src/L10NSharp/Resources/Move_Previous.png | Bin 1096 -> 0 bytes src/L10NSharp/Resources/Move_down.png | Bin 1148 -> 0 bytes src/L10NSharp/Resources/Move_up.png | Bin 1148 -> 0 bytes src/L10NSharp/Resources/SelectAllRows.png | Bin 3191 -> 0 bytes src/L10NSharp/Resources/bing.png | Bin 1161 -> 0 bytes 35 files changed, 3 insertions(+), 8151 deletions(-) delete mode 100644 src/L10NSharp.Windows.Forms.Tests/TempFile.cs delete mode 100644 src/L10NSharp.Windows.Forms.Tests/TestXliff/xliff-core-1.2-strict.xsd delete mode 100644 src/L10NSharp.Windows.Forms.Tests/TestXliff/xliff-core-1.2-transitional.xsd delete mode 100644 src/L10NSharp.Windows.Forms/Properties/Resources.resx delete mode 100644 src/L10NSharp.Windows.Forms/Resources/Copy_Translation (toolbar).png delete mode 100644 src/L10NSharp.Windows.Forms/Resources/Copy_Translation.png delete mode 100644 src/L10NSharp.Windows.Forms/Resources/Google.png delete mode 100644 src/L10NSharp.Windows.Forms/Resources/Move.png delete mode 100644 src/L10NSharp.Windows.Forms/Resources/Move_Next.png delete mode 100644 src/L10NSharp.Windows.Forms/Resources/Move_Previous.png delete mode 100644 src/L10NSharp.Windows.Forms/Resources/Move_down.png delete mode 100644 src/L10NSharp.Windows.Forms/Resources/Move_up.png delete mode 100644 src/L10NSharp.Windows.Forms/Resources/SelectAllRows.png delete mode 100644 src/L10NSharp.Windows.Forms/Resources/bing.png delete mode 100644 src/L10NSharp.Windows.Forms/UIComponents/LocalizeItemDlg.Designer.cs delete mode 100644 src/L10NSharp.Windows.Forms/UIComponents/LocalizeItemDlg.cs delete mode 100644 src/L10NSharp.Windows.Forms/UIComponents/LocalizeItemDlg.resx delete mode 100644 src/L10NSharp.Windows.Forms/UIComponents/LocalizeItemDlgViewModel.cs delete mode 100644 src/L10NSharp/Properties/Resources.resx delete mode 100644 src/L10NSharp/Resources/Copy_Translation (toolbar).png delete mode 100644 src/L10NSharp/Resources/Copy_Translation.png delete mode 100644 src/L10NSharp/Resources/Google.png delete mode 100644 src/L10NSharp/Resources/Move.png delete mode 100644 src/L10NSharp/Resources/Move_Next.png delete mode 100644 src/L10NSharp/Resources/Move_Previous.png delete mode 100644 src/L10NSharp/Resources/Move_down.png delete mode 100644 src/L10NSharp/Resources/Move_up.png delete mode 100644 src/L10NSharp/Resources/SelectAllRows.png delete mode 100644 src/L10NSharp/Resources/bing.png diff --git a/src/L10NSharp.Windows.Forms.Tests/L10NSharp.Windows.Forms.Tests.csproj b/src/L10NSharp.Windows.Forms.Tests/L10NSharp.Windows.Forms.Tests.csproj index 5e267f2..681efd7 100644 --- a/src/L10NSharp.Windows.Forms.Tests/L10NSharp.Windows.Forms.Tests.csproj +++ b/src/L10NSharp.Windows.Forms.Tests/L10NSharp.Windows.Forms.Tests.csproj @@ -7,6 +7,7 @@ + diff --git a/src/L10NSharp.Windows.Forms.Tests/TempFile.cs b/src/L10NSharp.Windows.Forms.Tests/TempFile.cs deleted file mode 100644 index 6774f1d..0000000 --- a/src/L10NSharp.Windows.Forms.Tests/TempFile.cs +++ /dev/null @@ -1,328 +0,0 @@ -using System; -using System.Diagnostics; -using System.IO; -using System.Linq; -using System.Text; -using System.Threading; -using NUnit.Framework; - -namespace L10NSharp.Windows.Forms.Tests -{ - - /// - /// This is useful a temporary file is needed. When it is disposed, it will delete the file. - /// - /// Sometimes it is useful to make a temp file and NOT have the TempFile class delete it. - /// In such cases, simply do not Dispose() the TempFile. To make this possible and reliable, - /// this class deliberately does NOT implement a destructor or do anything to ensure - /// the file is deleted if the TempFile is not disposed. Please don't change this. - /// - /// using(f = new TempFile()) - public class TempFile : IDisposable - { - protected string _path; - private string _folderToDelete; // if not null, delete this as well on dispose - - public TempFile() - { - _path = System.IO.Path.GetTempFileName(); - } - - public TempFile(bool dontMakeMeAFileAndDontSetPath) - { - if(!dontMakeMeAFileAndDontSetPath) - { - _path = System.IO.Path.GetTempFileName(); - } - } - - public TempFile(string contents) - : this() - { - File.WriteAllText(_path, contents); - } - - public TempFile(string contents, Encoding encoding) - : this() - { - File.WriteAllText(_path, contents, encoding); - } - - public TempFile(string[] contentLines) - : this() - { - File.WriteAllLines(_path, contentLines); - } - - public string Path - { - get { return _path; } - } - - // See comment on class above regarding Dispose - public void Dispose() - { - File.Delete(_path); - if(_folderToDelete != null) - DeleteDirectoryRobust(_folderToDelete); - } - - public static TempFile CopyOf(string pathToExistingFile) - { - TempFile t = new TempFile(); - File.Copy(pathToExistingFile, t.Path, true); - return t; - } - - public TempFile(string existingPath, bool dummy) - { - _path = existingPath; - } - - /// - /// Create a TempFile based on a pre-existing file, which will be deleted when this is disposed. - /// - public static TempFile TrackExisting(string path) - { - return new TempFile(path, false); - } - - public static TempFile CreateAndGetPathButDontMakeTheFile() - { - TempFile t = new TempFile(); - File.Delete(t.Path); - return t; - } - - /// - /// Use this one when it's important to have a certain file extension - /// - /// with or with out '.', will work the same - public static TempFile WithExtension(string extension) - { - extension = extension.TrimStart('.'); - var path = System.IO.Path.Combine(System.IO.Path.GetTempPath(), System.IO.Path.GetRandomFileName() + "." + extension); - File.Create(path).Close(); - return TrackExisting(path); - } - - /// - /// Use this one when it's important to have a certain file name (with, or without extension). - /// - /// with or with out an extension, will work the same - public static TempFile WithFilename(string filename) - { - if(filename == null) - throw new ArgumentNullException("filename"); - if(filename == string.Empty) - throw new ArgumentException("Filename has no content", "filename"); - filename = filename.Trim(); - if(filename == string.Empty) - throw new ArgumentException("Filename has only whitespace", "filename"); - - var pathname = System.IO.Path.Combine(System.IO.Path.GetTempPath(), filename); - File.Create(pathname).Close(); - return TrackExisting(pathname); - } - - /// - /// Creates a file with the specified name in a new, randomly named folder. - /// Dispose will dispose of the folder (and any subsequently added content) as well as the temp file. - /// - /// - /// - public static TempFile WithFilenameInTempFolder(string fileName) - { - var tempFolder = System.IO.Path.Combine(System.IO.Path.GetTempPath(), System.IO.Path.GetRandomFileName()); - Directory.CreateDirectory(tempFolder); - var path = System.IO.Path.Combine(tempFolder, fileName); - var result = TempFile.TrackExisting(path); - result._folderToDelete = tempFolder; - return result; - } - - /// - /// Used to make a real file out of a resource for the purpose of testing - /// - /// e.g., an audio resource - /// with or with out '.', will work the same - public static TempFile FromResource(Stream resource, string extension) - { - var f = WithExtension(extension); - byte[] buffer = new byte[resource.Length + 1]; - resource.Read(buffer, 0, (int)resource.Length); - File.WriteAllBytes(f.Path, buffer); - return f; - } - - /// - /// Used to make a real file out of a resource for the purpose of testing - /// - /// e.g., a video resource - /// with or with out '.', will work the same - public static TempFile FromResource(byte[] resource, string extension) - { - var f = WithExtension(extension); - File.WriteAllBytes(f.Path, resource); - return f; - } - - /// - /// Used to move a file to a new path - /// - public void MoveTo(string path) - { - File.Move(Path, path); - _path = path; - } - - /// - /// There are various things which can prevent a simple directory deletion, mostly timing related things which are hard to debug. - /// This method uses all the tricks to do its best. - /// - /// returns true if the directory is fully deleted - public static bool DeleteDirectoryRobust(string path) - { - // ReSharper disable EmptyGeneralCatchClause - - for(int i = 0; i < 40; i++) // each time, we sleep a little. This will try for up to 2 seconds (40*50ms) - { - if(!Directory.Exists(path)) - break; - - try - { - Directory.Delete(path, true); - } - catch(Exception) - { - } - - if(!Directory.Exists(path)) - break; - - try - { - //try to clear it out a bit - string[] dirs = Directory.GetDirectories(path); - string[] files = Directory.GetFiles(path, "*.*", SearchOption.AllDirectories); - foreach(string filePath in files) - { - try - { - /* we could do this too, but it's dangerous - * File.SetAttributes(filePath, FileAttributes.Normal); - */ - File.Delete(filePath); - } - catch(Exception) - { - } - } - foreach(var dir in dirs) - { - DeleteDirectoryRobust(dir); - } - - } - catch(Exception)//yes, even these simple queries can throw exceptions, as stuff suddenly is deleted base on our prior request - { - } - //sleep and let some OS things catch up - Thread.Sleep(50); - } - - return !Directory.Exists(path); - // ReSharper restore EmptyGeneralCatchClause - } - } - - public class TempFolder : IDisposable - { - private static string _basePath; - private readonly string _path; - - public TempFolder(): this(TestContext.CurrentContext.Test.Name) - { - } - - public TempFolder(string testName) - { - testName = System.IO.Path.GetInvalidPathChars().Aggregate(testName, - (current, c) => current.Replace(c, '_')).Replace('`', '_').Replace('"', '_'); - _path = System.IO.Path.Combine(BasePath, testName); - if(Directory.Exists(_path)) - { - TestUtilities.DeleteFolderThatMayBeInUse(_path); - } - Directory.CreateDirectory(_path); - } - - private static string BasePath => - _basePath ?? (_basePath = System.IO.Path.Combine( - System.IO.Path.GetTempPath(), - System.IO.Path.GetRandomFileName())); - - public string Path => _path; - - public void Dispose() - { - TestUtilities.DeleteFolderThatMayBeInUse(_path); - } - - public TempFile GetPathForNewTempFile(bool doCreateTheFile) - { - var s = System.IO.Path.GetRandomFileName(); - s = System.IO.Path.Combine(_path, s); - if(doCreateTheFile) - { - File.Create(s).Close(); - } - return TempFile.TrackExisting(s); - } - - public string Combine(string innerFileName) - { - return System.IO.Path.Combine(_path, innerFileName); - } - } - - public class TestUtilities - { - public static void DeleteFolderThatMayBeInUse(string folder) - { - if (!Directory.Exists(folder)) - return; - - for(int i = 0; i < 50; i++) //wait up to five seconds - { - try - { - Directory.Delete(folder, true); - return; - } - catch(Exception) - { - } - Thread.Sleep(100); - } - //maybe we can at least clear it out a bit - try - { - Debug.WriteLine("TestUtilities.DeleteFolderThatMayBeInUse(): gave up trying to delete the whole folder. Some files may be abandoned in your temp folder."); - - string[] files = Directory.GetFiles(folder, "*.*", SearchOption.AllDirectories); - foreach(string s in files) - { - File.Delete(s); - } - //sleep and try again - Thread.Sleep(1000); - Directory.Delete(folder, true); - } - catch(Exception) - { - } - } - } -} diff --git a/src/L10NSharp.Windows.Forms.Tests/TestXliff/xliff-core-1.2-strict.xsd b/src/L10NSharp.Windows.Forms.Tests/TestXliff/xliff-core-1.2-strict.xsd deleted file mode 100644 index 056f5f9..0000000 --- a/src/L10NSharp.Windows.Forms.Tests/TestXliff/xliff-core-1.2-strict.xsd +++ /dev/null @@ -1,2223 +0,0 @@ - - - - - - - - - - - - - - - Values for the attribute 'context-type'. - - - - - Indicates a database content. - - - - - Indicates the content of an element within an XML document. - - - - - Indicates the name of an element within an XML document. - - - - - Indicates the line number from the sourcefile (see context-type="sourcefile") where the <source> is found. - - - - - Indicates a the number of parameters contained within the <source>. - - - - - Indicates notes pertaining to the parameters in the <source>. - - - - - Indicates the content of a record within a database. - - - - - Indicates the name of a record within a database. - - - - - Indicates the original source file in the case that multiple files are merged to form the original file from which the XLIFF file is created. This differs from the original <file> attribute in that this sourcefile is one of many that make up that file. - - - - - - - Values for the attribute 'count-type'. - - - - - Indicates the count units are items that are used X times in a certain context; example: this is a reusable text unit which is used 42 times in other texts. - - - - - Indicates the count units are translation units existing already in the same document. - - - - - Indicates a total count. - - - - - - - Values for the attribute 'ctype' when used other elements than <ph> or <x>. - - - - - Indicates a run of bolded text. - - - - - Indicates a run of text in italics. - - - - - Indicates a run of underlined text. - - - - - Indicates a run of hyper-text. - - - - - - - Values for the attribute 'ctype' when used with <ph> or <x>. - - - - - Indicates a inline image. - - - - - Indicates a page break. - - - - - Indicates a line break. - - - - - - - - - - - - Values for the attribute 'datatype'. - - - - - Indicates Active Server Page data. - - - - - Indicates C source file data. - - - - - Indicates Channel Definition Format (CDF) data. - - - - - Indicates ColdFusion data. - - - - - Indicates C++ source file data. - - - - - Indicates C-Sharp data. - - - - - Indicates strings from C, ASM, and driver files data. - - - - - Indicates comma-separated values data. - - - - - Indicates database data. - - - - - Indicates portions of document that follows data and contains metadata. - - - - - Indicates portions of document that precedes data and contains metadata. - - - - - Indicates data from standard UI file operations dialogs (e.g., Open, Save, Save As, Export, Import). - - - - - Indicates standard user input screen data. - - - - - Indicates HyperText Markup Language (HTML) data - document instance. - - - - - Indicates content within an HTML document’s <body> element. - - - - - Indicates Windows INI file data. - - - - - Indicates Interleaf data. - - - - - Indicates Java source file data (extension '.java'). - - - - - Indicates Java property resource bundle data. - - - - - Indicates Java list resource bundle data. - - - - - Indicates JavaScript source file data. - - - - - Indicates JScript source file data. - - - - - Indicates information relating to formatting. - - - - - Indicates LISP source file data. - - - - - Indicates information relating to margin formats. - - - - - Indicates a file containing menu. - - - - - Indicates numerically identified string table. - - - - - Indicates Maker Interchange Format (MIF) data. - - - - - Indicates that the datatype attribute value is a MIME Type value and is defined in the mime-type attribute. - - - - - Indicates GNU Machine Object data. - - - - - Indicates Message Librarian strings created by Novell's Message Librarian Tool. - - - - - Indicates information to be displayed at the bottom of each page of a document. - - - - - Indicates information to be displayed at the top of each page of a document. - - - - - Indicates a list of property values (e.g., settings within INI files or preferences dialog). - - - - - Indicates Pascal source file data. - - - - - Indicates Hypertext Preprocessor data. - - - - - Indicates plain text file (no formatting other than, possibly, wrapping). - - - - - Indicates GNU Portable Object file. - - - - - Indicates dynamically generated user defined document. e.g. Oracle Report, Crystal Report, etc. - - - - - Indicates Windows .NET binary resources. - - - - - Indicates Windows .NET Resources. - - - - - Indicates Rich Text Format (RTF) data. - - - - - Indicates Standard Generalized Markup Language (SGML) data - document instance. - - - - - Indicates Standard Generalized Markup Language (SGML) data - Document Type Definition (DTD). - - - - - Indicates Scalable Vector Graphic (SVG) data. - - - - - Indicates VisualBasic Script source file. - - - - - Indicates warning message. - - - - - Indicates Windows (Win32) resources (i.e. resources extracted from an RC script, a message file, or a compiled file). - - - - - Indicates Extensible HyperText Markup Language (XHTML) data - document instance. - - - - - Indicates Extensible Markup Language (XML) data - document instance. - - - - - Indicates Extensible Markup Language (XML) data - Document Type Definition (DTD). - - - - - Indicates Extensible Stylesheet Language (XSL) data. - - - - - Indicates XUL elements. - - - - - - - Values for the attribute 'mtype'. - - - - - Indicates the marked text is an abbreviation. - - - - - ISO-12620 2.1.8: A term resulting from the omission of any part of the full term while designating the same concept. - - - - - ISO-12620 2.1.8.1: An abbreviated form of a simple term resulting from the omission of some of its letters (e.g. 'adj.' for 'adjective'). - - - - - ISO-12620 2.1.8.4: An abbreviated form of a term made up of letters from the full form of a multiword term strung together into a sequence pronounced only syllabically (e.g. 'radar' for 'radio detecting and ranging'). - - - - - ISO-12620: A proper-name term, such as the name of an agency or other proper entity. - - - - - ISO-12620 2.1.18.1: A recurrent word combination characterized by cohesion in that the components of the collocation must co-occur within an utterance or series of utterances, even though they do not necessarily have to maintain immediate proximity to one another. - - - - - ISO-12620 2.1.5: A synonym for an international scientific term that is used in general discourse in a given language. - - - - - Indicates the marked text is a date and/or time. - - - - - ISO-12620 2.1.15: An expression used to represent a concept based on a statement that two mathematical expressions are, for instance, equal as identified by the equal sign (=), or assigned to one another by a similar sign. - - - - - ISO-12620 2.1.7: The complete representation of a term for which there is an abbreviated form. - - - - - ISO-12620 2.1.14: Figures, symbols or the like used to express a concept briefly, such as a mathematical or chemical formula. - - - - - ISO-12620 2.1.1: The concept designation that has been chosen to head a terminological record. - - - - - ISO-12620 2.1.8.3: An abbreviated form of a term consisting of some of the initial letters of the words making up a multiword term or the term elements making up a compound term when these letters are pronounced individually (e.g. 'BSE' for 'bovine spongiform encephalopathy'). - - - - - ISO-12620 2.1.4: A term that is part of an international scientific nomenclature as adopted by an appropriate scientific body. - - - - - ISO-12620 2.1.6: A term that has the same or nearly identical orthographic or phonemic form in many languages. - - - - - ISO-12620 2.1.16: An expression used to represent a concept based on mathematical or logical relations, such as statements of inequality, set relationships, Boolean operations, and the like. - - - - - ISO-12620 2.1.17: A unit to track object. - - - - - Indicates the marked text is a name. - - - - - ISO-12620 2.1.3: A term that represents the same or a very similar concept as another term in the same language, but for which interchangeability is limited to some contexts and inapplicable in others. - - - - - ISO-12620 2.1.17.2: A unique alphanumeric designation assigned to an object in a manufacturing system. - - - - - Indicates the marked text is a phrase. - - - - - ISO-12620 2.1.18: Any group of two or more words that form a unit, the meaning of which frequently cannot be deduced based on the combined sense of the words making up the phrase. - - - - - Indicates the marked text should not be translated. - - - - - ISO-12620 2.1.12: A form of a term resulting from an operation whereby non-Latin writing systems are converted to the Latin alphabet. - - - - - Indicates that the marked text represents a segment. - - - - - ISO-12620 2.1.18.2: A fixed, lexicalized phrase. - - - - - ISO-12620 2.1.8.2: A variant of a multiword term that includes fewer words than the full form of the term (e.g. 'Group of Twenty-four' for 'Intergovernmental Group of Twenty-four on International Monetary Affairs'). - - - - - ISO-12620 2.1.17.1: Stock keeping unit, an inventory item identified by a unique alphanumeric designation assigned to an object in an inventory control system. - - - - - ISO-12620 2.1.19: A fixed chunk of recurring text. - - - - - ISO-12620 2.1.13: A designation of a concept by letters, numerals, pictograms or any combination thereof. - - - - - ISO-12620 2.1.2: Any term that represents the same or a very similar concept as the main entry term in a term entry. - - - - - ISO-12620 2.1.18.3: Phraseological unit in a language that expresses the same semantic content as another phrase in that same language. - - - - - Indicates the marked text is a term. - - - - - ISO-12620 2.1.11: A form of a term resulting from an operation whereby the characters of one writing system are represented by characters from another writing system, taking into account the pronunciation of the characters converted. - - - - - ISO-12620 2.1.10: A form of a term resulting from an operation whereby the characters of an alphabetic writing system are represented by characters from another alphabetic writing system. - - - - - ISO-12620 2.1.8.5: An abbreviated form of a term resulting from the omission of one or more term elements or syllables (e.g. 'flu' for 'influenza'). - - - - - ISO-12620 2.1.9: One of the alternate forms of a term. - - - - - - - Values for the attribute 'restype'. - - - - - Indicates a Windows RC AUTO3STATE control. - - - - - Indicates a Windows RC AUTOCHECKBOX control. - - - - - Indicates a Windows RC AUTORADIOBUTTON control. - - - - - Indicates a Windows RC BEDIT control. - - - - - Indicates a bitmap, for example a BITMAP resource in Windows. - - - - - Indicates a button object, for example a BUTTON control Windows. - - - - - Indicates a caption, such as the caption of a dialog box. - - - - - Indicates the cell in a table, for example the content of the <td> element in HTML. - - - - - Indicates check box object, for example a CHECKBOX control in Windows. - - - - - Indicates a menu item with an associated checkbox. - - - - - Indicates a list box, but with a check-box for each item. - - - - - Indicates a color selection dialog. - - - - - Indicates a combination of edit box and listbox object, for example a COMBOBOX control in Windows. - - - - - Indicates an initialization entry of an extended combobox DLGINIT resource block. (code 0x1234). - - - - - Indicates an initialization entry of a combobox DLGINIT resource block (code 0x0403). - - - - - Indicates a UI base class element that cannot be represented by any other element. - - - - - Indicates a context menu. - - - - - Indicates a Windows RC CTEXT control. - - - - - Indicates a cursor, for example a CURSOR resource in Windows. - - - - - Indicates a date/time picker. - - - - - Indicates a Windows RC DEFPUSHBUTTON control. - - - - - Indicates a dialog box. - - - - - Indicates a Windows RC DLGINIT resource block. - - - - - Indicates an edit box object, for example an EDIT control in Windows. - - - - - Indicates a filename. - - - - - Indicates a file dialog. - - - - - Indicates a footnote. - - - - - Indicates a font name. - - - - - Indicates a footer. - - - - - Indicates a frame object. - - - - - Indicates a XUL grid element. - - - - - Indicates a groupbox object, for example a GROUPBOX control in Windows. - - - - - Indicates a header item. - - - - - Indicates a heading, such has the content of <h1>, <h2>, etc. in HTML. - - - - - Indicates a Windows RC HEDIT control. - - - - - Indicates a horizontal scrollbar. - - - - - Indicates an icon, for example an ICON resource in Windows. - - - - - Indicates a Windows RC IEDIT control. - - - - - Indicates keyword list, such as the content of the Keywords meta-data in HTML, or a K footnote in WinHelp RTF. - - - - - Indicates a label object. - - - - - Indicates a label that is also a HTML link (not necessarily a URL). - - - - - Indicates a list (a group of list-items, for example an <ol> or <ul> element in HTML). - - - - - Indicates a listbox object, for example an LISTBOX control in Windows. - - - - - Indicates an list item (an entry in a list). - - - - - Indicates a Windows RC LTEXT control. - - - - - Indicates a menu (a group of menu-items). - - - - - Indicates a toolbar containing one or more tope level menus. - - - - - Indicates a menu item (an entry in a menu). - - - - - Indicates a XUL menuseparator element. - - - - - Indicates a message, for example an entry in a MESSAGETABLE resource in Windows. - - - - - Indicates a calendar control. - - - - - Indicates an edit box beside a spin control. - - - - - Indicates a catch all for rectangular areas. - - - - - Indicates a standalone menu not necessarily associated with a menubar. - - - - - Indicates a pushbox object, for example a PUSHBOX control in Windows. - - - - - Indicates a Windows RC PUSHBUTTON control. - - - - - Indicates a radio button object. - - - - - Indicates a menuitem with associated radio button. - - - - - Indicates raw data resources for an application. - - - - - Indicates a row in a table. - - - - - Indicates a Windows RC RTEXT control. - - - - - Indicates a user navigable container used to show a portion of a document. - - - - - Indicates a generic divider object (e.g. menu group separator). - - - - - Windows accelerators, shortcuts in resource or property files. - - - - - Indicates a UI control to indicate process activity but not progress. - - - - - Indicates a splitter bar. - - - - - Indicates a Windows RC STATE3 control. - - - - - Indicates a window for providing feedback to the users, like 'read-only', etc. - - - - - Indicates a string, for example an entry in a STRINGTABLE resource in Windows. - - - - - Indicates a layers of controls with a tab to select layers. - - - - - Indicates a display and edits regular two-dimensional tables of cells. - - - - - Indicates a XUL textbox element. - - - - - Indicates a UI button that can be toggled to on or off state. - - - - - Indicates an array of controls, usually buttons. - - - - - Indicates a pop up tool tip text. - - - - - Indicates a bar with a pointer indicating a position within a certain range. - - - - - Indicates a control that displays a set of hierarchical data. - - - - - Indicates a URI (URN or URL). - - - - - Indicates a Windows RC USERBUTTON control. - - - - - Indicates a user-defined control like CONTROL control in Windows. - - - - - Indicates the text of a variable. - - - - - Indicates version information about a resource like VERSIONINFO in Windows. - - - - - Indicates a vertical scrollbar. - - - - - Indicates a graphical window. - - - - - - - Values for the attribute 'size-unit'. - - - - - Indicates a size in 8-bit bytes. - - - - - Indicates a size in Unicode characters. - - - - - Indicates a size in columns. Used for HTML text area. - - - - - Indicates a size in centimeters. - - - - - Indicates a size in dialog units, as defined in Windows resources. - - - - - Indicates a size in 'font-size' units (as defined in CSS). - - - - - Indicates a size in 'x-height' units (as defined in CSS). - - - - - Indicates a size in glyphs. A glyph is considered to be one or more combined Unicode characters that represent a single displayable text character. Sometimes referred to as a 'grapheme cluster' - - - - - Indicates a size in inches. - - - - - Indicates a size in millimeters. - - - - - Indicates a size in percentage. - - - - - Indicates a size in pixels. - - - - - Indicates a size in point. - - - - - Indicates a size in rows. Used for HTML text area. - - - - - - - Values for the attribute 'state'. - - - - - Indicates the terminating state. - - - - - Indicates only non-textual information needs adaptation. - - - - - Indicates both text and non-textual information needs adaptation. - - - - - Indicates only non-textual information needs review. - - - - - Indicates both text and non-textual information needs review. - - - - - Indicates that only the text of the item needs to be reviewed. - - - - - Indicates that the item needs to be translated. - - - - - Indicates that the item is new. For example, translation units that were not in a previous version of the document. - - - - - Indicates that changes are reviewed and approved. - - - - - Indicates that the item has been translated. - - - - - - - Values for the attribute 'state-qualifier'. - - - - - Indicates an exact match. An exact match occurs when a source text of a segment is exactly the same as the source text of a segment that was translated previously. - - - - - Indicates a fuzzy match. A fuzzy match occurs when a source text of a segment is very similar to the source text of a segment that was translated previously (e.g. when the difference is casing, a few changed words, white-space discripancy, etc.). - - - - - Indicates a match based on matching IDs (in addition to matching text). - - - - - Indicates a translation derived from a glossary. - - - - - Indicates a translation derived from existing translation. - - - - - Indicates a translation derived from machine translation. - - - - - Indicates a translation derived from a translation repository. - - - - - Indicates a translation derived from a translation memory. - - - - - Indicates the translation is suggested by machine translation. - - - - - Indicates that the item has been rejected because of incorrect grammar. - - - - - Indicates that the item has been rejected because it is incorrect. - - - - - Indicates that the item has been rejected because it is too long or too short. - - - - - Indicates that the item has been rejected because of incorrect spelling. - - - - - Indicates the translation is suggested by translation memory. - - - - - - - Values for the attribute 'unit'. - - - - - Refers to words. - - - - - Refers to pages. - - - - - Refers to <trans-unit> elements. - - - - - Refers to <bin-unit> elements. - - - - - Refers to glyphs. - - - - - Refers to <trans-unit> and/or <bin-unit> elements. - - - - - Refers to the occurrences of instances defined by the count-type value. - - - - - Refers to characters. - - - - - Refers to lines. - - - - - Refers to sentences. - - - - - Refers to paragraphs. - - - - - Refers to segments. - - - - - Refers to placeables (inline elements). - - - - - - - Values for the attribute 'priority'. - - - - - Highest priority. - - - - - High priority. - - - - - High priority, but not as important as 2. - - - - - High priority, but not as important as 3. - - - - - Medium priority, but more important than 6. - - - - - Medium priority, but less important than 5. - - - - - Low priority, but more important than 8. - - - - - Low priority, but more important than 9. - - - - - Low priority. - - - - - Lowest priority. - - - - - - - - - This value indicates that all properties can be reformatted. This value must be used alone. - - - - - This value indicates that no properties should be reformatted. This value must be used alone. - - - - - - - - - - - - - This value indicates that all information in the coord attribute can be modified. - - - - - This value indicates that the x information in the coord attribute can be modified. - - - - - This value indicates that the y information in the coord attribute can be modified. - - - - - This value indicates that the cx information in the coord attribute can be modified. - - - - - This value indicates that the cy information in the coord attribute can be modified. - - - - - This value indicates that all the information in the font attribute can be modified. - - - - - This value indicates that the name information in the font attribute can be modified. - - - - - This value indicates that the size information in the font attribute can be modified. - - - - - This value indicates that the weight information in the font attribute can be modified. - - - - - This value indicates that the information in the css-style attribute can be modified. - - - - - This value indicates that the information in the style attribute can be modified. - - - - - This value indicates that the information in the exstyle attribute can be modified. - - - - - - - - - - - - - Indicates that the context is informational in nature, specifying for example, how a term should be translated. Thus, should be displayed to anyone editing the XLIFF document. - - - - - Indicates that the context-group is used to specify where the term was found in the translatable source. Thus, it is not displayed. - - - - - Indicates that the context information should be used during translation memory lookups. Thus, it is not displayed. - - - - - - - - - Represents a translation proposal from a translation memory or other resource. - - - - - Represents a previous version of the target element. - - - - - Represents a rejected version of the target element. - - - - - Represents a translation to be used for reference purposes only, for example from a related product or a different language. - - - - - Represents a proposed translation that was used for the translation of the trans-unit, possibly modified. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Values for the attribute 'coord'. - - - - - - - - Version values: 1.0 and 1.1 are allowed for backward compatibility. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/L10NSharp.Windows.Forms.Tests/TestXliff/xliff-core-1.2-transitional.xsd b/src/L10NSharp.Windows.Forms.Tests/TestXliff/xliff-core-1.2-transitional.xsd deleted file mode 100644 index 850cfb8..0000000 --- a/src/L10NSharp.Windows.Forms.Tests/TestXliff/xliff-core-1.2-transitional.xsd +++ /dev/null @@ -1,2261 +0,0 @@ - - - - - - - - - - - - - - Values for the attribute 'context-type'. - - - - - Indicates a database content. - - - - - Indicates the content of an element within an XML document. - - - - - Indicates the name of an element within an XML document. - - - - - Indicates the line number from the sourcefile (see context-type="sourcefile") where the <source> is found. - - - - - Indicates a the number of parameters contained within the <source>. - - - - - Indicates notes pertaining to the parameters in the <source>. - - - - - Indicates the content of a record within a database. - - - - - Indicates the name of a record within a database. - - - - - Indicates the original source file in the case that multiple files are merged to form the original file from which the XLIFF file is created. This differs from the original <file> attribute in that this sourcefile is one of many that make up that file. - - - - - - - Values for the attribute 'count-type'. - - - - - Indicates the count units are items that are used X times in a certain context; example: this is a reusable text unit which is used 42 times in other texts. - - - - - Indicates the count units are translation units existing already in the same document. - - - - - Indicates a total count. - - - - - - - Values for the attribute 'ctype' when used other elements than <ph> or <x>. - - - - - Indicates a run of bolded text. - - - - - Indicates a run of text in italics. - - - - - Indicates a run of underlined text. - - - - - Indicates a run of hyper-text. - - - - - - - Values for the attribute 'ctype' when used with <ph> or <x>. - - - - - Indicates a inline image. - - - - - Indicates a page break. - - - - - Indicates a line break. - - - - - - - - - - - - Values for the attribute 'datatype'. - - - - - Indicates Active Server Page data. - - - - - Indicates C source file data. - - - - - Indicates Channel Definition Format (CDF) data. - - - - - Indicates ColdFusion data. - - - - - Indicates C++ source file data. - - - - - Indicates C-Sharp data. - - - - - Indicates strings from C, ASM, and driver files data. - - - - - Indicates comma-separated values data. - - - - - Indicates database data. - - - - - Indicates portions of document that follows data and contains metadata. - - - - - Indicates portions of document that precedes data and contains metadata. - - - - - Indicates data from standard UI file operations dialogs (e.g., Open, Save, Save As, Export, Import). - - - - - Indicates standard user input screen data. - - - - - Indicates HyperText Markup Language (HTML) data - document instance. - - - - - Indicates content within an HTML document’s <body> element. - - - - - Indicates Windows INI file data. - - - - - Indicates Interleaf data. - - - - - Indicates Java source file data (extension '.java'). - - - - - Indicates Java property resource bundle data. - - - - - Indicates Java list resource bundle data. - - - - - Indicates JavaScript source file data. - - - - - Indicates JScript source file data. - - - - - Indicates information relating to formatting. - - - - - Indicates LISP source file data. - - - - - Indicates information relating to margin formats. - - - - - Indicates a file containing menu. - - - - - Indicates numerically identified string table. - - - - - Indicates Maker Interchange Format (MIF) data. - - - - - Indicates that the datatype attribute value is a MIME Type value and is defined in the mime-type attribute. - - - - - Indicates GNU Machine Object data. - - - - - Indicates Message Librarian strings created by Novell's Message Librarian Tool. - - - - - Indicates information to be displayed at the bottom of each page of a document. - - - - - Indicates information to be displayed at the top of each page of a document. - - - - - Indicates a list of property values (e.g., settings within INI files or preferences dialog). - - - - - Indicates Pascal source file data. - - - - - Indicates Hypertext Preprocessor data. - - - - - Indicates plain text file (no formatting other than, possibly, wrapping). - - - - - Indicates GNU Portable Object file. - - - - - Indicates dynamically generated user defined document. e.g. Oracle Report, Crystal Report, etc. - - - - - Indicates Windows .NET binary resources. - - - - - Indicates Windows .NET Resources. - - - - - Indicates Rich Text Format (RTF) data. - - - - - Indicates Standard Generalized Markup Language (SGML) data - document instance. - - - - - Indicates Standard Generalized Markup Language (SGML) data - Document Type Definition (DTD). - - - - - Indicates Scalable Vector Graphic (SVG) data. - - - - - Indicates VisualBasic Script source file. - - - - - Indicates warning message. - - - - - Indicates Windows (Win32) resources (i.e. resources extracted from an RC script, a message file, or a compiled file). - - - - - Indicates Extensible HyperText Markup Language (XHTML) data - document instance. - - - - - Indicates Extensible Markup Language (XML) data - document instance. - - - - - Indicates Extensible Markup Language (XML) data - Document Type Definition (DTD). - - - - - Indicates Extensible Stylesheet Language (XSL) data. - - - - - Indicates XUL elements. - - - - - - - Values for the attribute 'mtype'. - - - - - Indicates the marked text is an abbreviation. - - - - - ISO-12620 2.1.8: A term resulting from the omission of any part of the full term while designating the same concept. - - - - - ISO-12620 2.1.8.1: An abbreviated form of a simple term resulting from the omission of some of its letters (e.g. 'adj.' for 'adjective'). - - - - - ISO-12620 2.1.8.4: An abbreviated form of a term made up of letters from the full form of a multiword term strung together into a sequence pronounced only syllabically (e.g. 'radar' for 'radio detecting and ranging'). - - - - - ISO-12620: A proper-name term, such as the name of an agency or other proper entity. - - - - - ISO-12620 2.1.18.1: A recurrent word combination characterized by cohesion in that the components of the collocation must co-occur within an utterance or series of utterances, even though they do not necessarily have to maintain immediate proximity to one another. - - - - - ISO-12620 2.1.5: A synonym for an international scientific term that is used in general discourse in a given language. - - - - - Indicates the marked text is a date and/or time. - - - - - ISO-12620 2.1.15: An expression used to represent a concept based on a statement that two mathematical expressions are, for instance, equal as identified by the equal sign (=), or assigned to one another by a similar sign. - - - - - ISO-12620 2.1.7: The complete representation of a term for which there is an abbreviated form. - - - - - ISO-12620 2.1.14: Figures, symbols or the like used to express a concept briefly, such as a mathematical or chemical formula. - - - - - ISO-12620 2.1.1: The concept designation that has been chosen to head a terminological record. - - - - - ISO-12620 2.1.8.3: An abbreviated form of a term consisting of some of the initial letters of the words making up a multiword term or the term elements making up a compound term when these letters are pronounced individually (e.g. 'BSE' for 'bovine spongiform encephalopathy'). - - - - - ISO-12620 2.1.4: A term that is part of an international scientific nomenclature as adopted by an appropriate scientific body. - - - - - ISO-12620 2.1.6: A term that has the same or nearly identical orthographic or phonemic form in many languages. - - - - - ISO-12620 2.1.16: An expression used to represent a concept based on mathematical or logical relations, such as statements of inequality, set relationships, Boolean operations, and the like. - - - - - ISO-12620 2.1.17: A unit to track object. - - - - - Indicates the marked text is a name. - - - - - ISO-12620 2.1.3: A term that represents the same or a very similar concept as another term in the same language, but for which interchangeability is limited to some contexts and inapplicable in others. - - - - - ISO-12620 2.1.17.2: A unique alphanumeric designation assigned to an object in a manufacturing system. - - - - - Indicates the marked text is a phrase. - - - - - ISO-12620 2.1.18: Any group of two or more words that form a unit, the meaning of which frequently cannot be deduced based on the combined sense of the words making up the phrase. - - - - - Indicates the marked text should not be translated. - - - - - ISO-12620 2.1.12: A form of a term resulting from an operation whereby non-Latin writing systems are converted to the Latin alphabet. - - - - - Indicates that the marked text represents a segment. - - - - - ISO-12620 2.1.18.2: A fixed, lexicalized phrase. - - - - - ISO-12620 2.1.8.2: A variant of a multiword term that includes fewer words than the full form of the term (e.g. 'Group of Twenty-four' for 'Intergovernmental Group of Twenty-four on International Monetary Affairs'). - - - - - ISO-12620 2.1.17.1: Stock keeping unit, an inventory item identified by a unique alphanumeric designation assigned to an object in an inventory control system. - - - - - ISO-12620 2.1.19: A fixed chunk of recurring text. - - - - - ISO-12620 2.1.13: A designation of a concept by letters, numerals, pictograms or any combination thereof. - - - - - ISO-12620 2.1.2: Any term that represents the same or a very similar concept as the main entry term in a term entry. - - - - - ISO-12620 2.1.18.3: Phraseological unit in a language that expresses the same semantic content as another phrase in that same language. - - - - - Indicates the marked text is a term. - - - - - ISO-12620 2.1.11: A form of a term resulting from an operation whereby the characters of one writing system are represented by characters from another writing system, taking into account the pronunciation of the characters converted. - - - - - ISO-12620 2.1.10: A form of a term resulting from an operation whereby the characters of an alphabetic writing system are represented by characters from another alphabetic writing system. - - - - - ISO-12620 2.1.8.5: An abbreviated form of a term resulting from the omission of one or more term elements or syllables (e.g. 'flu' for 'influenza'). - - - - - ISO-12620 2.1.9: One of the alternate forms of a term. - - - - - - - Values for the attribute 'restype'. - - - - - Indicates a Windows RC AUTO3STATE control. - - - - - Indicates a Windows RC AUTOCHECKBOX control. - - - - - Indicates a Windows RC AUTORADIOBUTTON control. - - - - - Indicates a Windows RC BEDIT control. - - - - - Indicates a bitmap, for example a BITMAP resource in Windows. - - - - - Indicates a button object, for example a BUTTON control Windows. - - - - - Indicates a caption, such as the caption of a dialog box. - - - - - Indicates the cell in a table, for example the content of the <td> element in HTML. - - - - - Indicates check box object, for example a CHECKBOX control in Windows. - - - - - Indicates a menu item with an associated checkbox. - - - - - Indicates a list box, but with a check-box for each item. - - - - - Indicates a color selection dialog. - - - - - Indicates a combination of edit box and listbox object, for example a COMBOBOX control in Windows. - - - - - Indicates an initialization entry of an extended combobox DLGINIT resource block. (code 0x1234). - - - - - Indicates an initialization entry of a combobox DLGINIT resource block (code 0x0403). - - - - - Indicates a UI base class element that cannot be represented by any other element. - - - - - Indicates a context menu. - - - - - Indicates a Windows RC CTEXT control. - - - - - Indicates a cursor, for example a CURSOR resource in Windows. - - - - - Indicates a date/time picker. - - - - - Indicates a Windows RC DEFPUSHBUTTON control. - - - - - Indicates a dialog box. - - - - - Indicates a Windows RC DLGINIT resource block. - - - - - Indicates an edit box object, for example an EDIT control in Windows. - - - - - Indicates a filename. - - - - - Indicates a file dialog. - - - - - Indicates a footnote. - - - - - Indicates a font name. - - - - - Indicates a footer. - - - - - Indicates a frame object. - - - - - Indicates a XUL grid element. - - - - - Indicates a groupbox object, for example a GROUPBOX control in Windows. - - - - - Indicates a header item. - - - - - Indicates a heading, such has the content of <h1>, <h2>, etc. in HTML. - - - - - Indicates a Windows RC HEDIT control. - - - - - Indicates a horizontal scrollbar. - - - - - Indicates an icon, for example an ICON resource in Windows. - - - - - Indicates a Windows RC IEDIT control. - - - - - Indicates keyword list, such as the content of the Keywords meta-data in HTML, or a K footnote in WinHelp RTF. - - - - - Indicates a label object. - - - - - Indicates a label that is also a HTML link (not necessarily a URL). - - - - - Indicates a list (a group of list-items, for example an <ol> or <ul> element in HTML). - - - - - Indicates a listbox object, for example an LISTBOX control in Windows. - - - - - Indicates an list item (an entry in a list). - - - - - Indicates a Windows RC LTEXT control. - - - - - Indicates a menu (a group of menu-items). - - - - - Indicates a toolbar containing one or more tope level menus. - - - - - Indicates a menu item (an entry in a menu). - - - - - Indicates a XUL menuseparator element. - - - - - Indicates a message, for example an entry in a MESSAGETABLE resource in Windows. - - - - - Indicates a calendar control. - - - - - Indicates an edit box beside a spin control. - - - - - Indicates a catch all for rectangular areas. - - - - - Indicates a standalone menu not necessarily associated with a menubar. - - - - - Indicates a pushbox object, for example a PUSHBOX control in Windows. - - - - - Indicates a Windows RC PUSHBUTTON control. - - - - - Indicates a radio button object. - - - - - Indicates a menuitem with associated radio button. - - - - - Indicates raw data resources for an application. - - - - - Indicates a row in a table. - - - - - Indicates a Windows RC RTEXT control. - - - - - Indicates a user navigable container used to show a portion of a document. - - - - - Indicates a generic divider object (e.g. menu group separator). - - - - - Windows accelerators, shortcuts in resource or property files. - - - - - Indicates a UI control to indicate process activity but not progress. - - - - - Indicates a splitter bar. - - - - - Indicates a Windows RC STATE3 control. - - - - - Indicates a window for providing feedback to the users, like 'read-only', etc. - - - - - Indicates a string, for example an entry in a STRINGTABLE resource in Windows. - - - - - Indicates a layers of controls with a tab to select layers. - - - - - Indicates a display and edits regular two-dimensional tables of cells. - - - - - Indicates a XUL textbox element. - - - - - Indicates a UI button that can be toggled to on or off state. - - - - - Indicates an array of controls, usually buttons. - - - - - Indicates a pop up tool tip text. - - - - - Indicates a bar with a pointer indicating a position within a certain range. - - - - - Indicates a control that displays a set of hierarchical data. - - - - - Indicates a URI (URN or URL). - - - - - Indicates a Windows RC USERBUTTON control. - - - - - Indicates a user-defined control like CONTROL control in Windows. - - - - - Indicates the text of a variable. - - - - - Indicates version information about a resource like VERSIONINFO in Windows. - - - - - Indicates a vertical scrollbar. - - - - - Indicates a graphical window. - - - - - - - Values for the attribute 'size-unit'. - - - - - Indicates a size in 8-bit bytes. - - - - - Indicates a size in Unicode characters. - - - - - Indicates a size in columns. Used for HTML text area. - - - - - Indicates a size in centimeters. - - - - - Indicates a size in dialog units, as defined in Windows resources. - - - - - Indicates a size in 'font-size' units (as defined in CSS). - - - - - Indicates a size in 'x-height' units (as defined in CSS). - - - - - Indicates a size in glyphs. A glyph is considered to be one or more combined Unicode characters that represent a single displayable text character. Sometimes referred to as a 'grapheme cluster' - - - - - Indicates a size in inches. - - - - - Indicates a size in millimeters. - - - - - Indicates a size in percentage. - - - - - Indicates a size in pixels. - - - - - Indicates a size in point. - - - - - Indicates a size in rows. Used for HTML text area. - - - - - - - Values for the attribute 'state'. - - - - - Indicates the terminating state. - - - - - Indicates only non-textual information needs adaptation. - - - - - Indicates both text and non-textual information needs adaptation. - - - - - Indicates only non-textual information needs review. - - - - - Indicates both text and non-textual information needs review. - - - - - Indicates that only the text of the item needs to be reviewed. - - - - - Indicates that the item needs to be translated. - - - - - Indicates that the item is new. For example, translation units that were not in a previous version of the document. - - - - - Indicates that changes are reviewed and approved. - - - - - Indicates that the item has been translated. - - - - - - - Values for the attribute 'state-qualifier'. - - - - - Indicates an exact match. An exact match occurs when a source text of a segment is exactly the same as the source text of a segment that was translated previously. - - - - - Indicates a fuzzy match. A fuzzy match occurs when a source text of a segment is very similar to the source text of a segment that was translated previously (e.g. when the difference is casing, a few changed words, white-space discripancy, etc.). - - - - - Indicates a match based on matching IDs (in addition to matching text). - - - - - Indicates a translation derived from a glossary. - - - - - Indicates a translation derived from existing translation. - - - - - Indicates a translation derived from machine translation. - - - - - Indicates a translation derived from a translation repository. - - - - - Indicates a translation derived from a translation memory. - - - - - Indicates the translation is suggested by machine translation. - - - - - Indicates that the item has been rejected because of incorrect grammar. - - - - - Indicates that the item has been rejected because it is incorrect. - - - - - Indicates that the item has been rejected because it is too long or too short. - - - - - Indicates that the item has been rejected because of incorrect spelling. - - - - - Indicates the translation is suggested by translation memory. - - - - - - - Values for the attribute 'unit'. - - - - - Refers to words. - - - - - Refers to pages. - - - - - Refers to <trans-unit> elements. - - - - - Refers to <bin-unit> elements. - - - - - Refers to glyphs. - - - - - Refers to <trans-unit> and/or <bin-unit> elements. - - - - - Refers to the occurrences of instances defined by the count-type value. - - - - - Refers to characters. - - - - - Refers to lines. - - - - - Refers to sentences. - - - - - Refers to paragraphs. - - - - - Refers to segments. - - - - - Refers to placeables (inline elements). - - - - - - - Values for the attribute 'priority'. - - - - - Highest priority. - - - - - High priority. - - - - - High priority, but not as important as 2. - - - - - High priority, but not as important as 3. - - - - - Medium priority, but more important than 6. - - - - - Medium priority, but less important than 5. - - - - - Low priority, but more important than 8. - - - - - Low priority, but more important than 9. - - - - - Low priority. - - - - - Lowest priority. - - - - - - - - - This value indicates that all properties can be reformatted. This value must be used alone. - - - - - This value indicates that no properties should be reformatted. This value must be used alone. - - - - - - - - - - - - - This value indicates that all information in the coord attribute can be modified. - - - - - This value indicates that the x information in the coord attribute can be modified. - - - - - This value indicates that the y information in the coord attribute can be modified. - - - - - This value indicates that the cx information in the coord attribute can be modified. - - - - - This value indicates that the cy information in the coord attribute can be modified. - - - - - This value indicates that all the information in the font attribute can be modified. - - - - - This value indicates that the name information in the font attribute can be modified. - - - - - This value indicates that the size information in the font attribute can be modified. - - - - - This value indicates that the weight information in the font attribute can be modified. - - - - - This value indicates that the information in the css-style attribute can be modified. - - - - - This value indicates that the information in the style attribute can be modified. - - - - - This value indicates that the information in the exstyle attribute can be modified. - - - - - - - - - - - - - Indicates that the context is informational in nature, specifying for example, how a term should be translated. Thus, should be displayed to anyone editing the XLIFF document. - - - - - Indicates that the context-group is used to specify where the term was found in the translatable source. Thus, it is not displayed. - - - - - Indicates that the context information should be used during translation memory lookups. Thus, it is not displayed. - - - - - - - - - Represents a translation proposal from a translation memory or other resource. - - - - - Represents a previous version of the target element. - - - - - Represents a rejected version of the target element. - - - - - Represents a translation to be used for reference purposes only, for example from a related product or a different language. - - - - - Represents a proposed translation that was used for the translation of the trans-unit, possibly modified. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Values for the attribute 'coord'. - - - - - - - - Version values: 1.0 and 1.1 are allowed for backward compatibility. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/L10NSharp.Windows.Forms.Tests/XliffLocalizationManagerTests.cs b/src/L10NSharp.Windows.Forms.Tests/XliffLocalizationManagerTests.cs index af21be3..d048c94 100644 --- a/src/L10NSharp.Windows.Forms.Tests/XliffLocalizationManagerTests.cs +++ b/src/L10NSharp.Windows.Forms.Tests/XliffLocalizationManagerTests.cs @@ -162,7 +162,7 @@ public void TestMappingLanguageCodesToAvailable_AmbiguousOptions_PromptsUser([Va { LocalizationManager.SetUILanguage("en", true); LocalizationManagerInternalWinforms.LoadedManagers.Clear(); - using (var folder = new TempFolder()) + using (var folder = new L10NSharp.Tests.TempFolder()) { var installedFolder = Path.Combine(folder.Path, "installed"); // ReSharper disable once AssignNullToNotNullAttribute diff --git a/src/L10NSharp.Windows.Forms/L10NExtender.resx b/src/L10NSharp.Windows.Forms/L10NExtender.resx index ae50817..d58980a 100644 --- a/src/L10NSharp.Windows.Forms/L10NExtender.resx +++ b/src/L10NSharp.Windows.Forms/L10NExtender.resx @@ -117,7 +117,4 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - False - \ No newline at end of file diff --git a/src/L10NSharp.Windows.Forms/L10NSharp.Windows.Forms.csproj b/src/L10NSharp.Windows.Forms/L10NSharp.Windows.Forms.csproj index 7392e83..42be91a 100644 --- a/src/L10NSharp.Windows.Forms/L10NSharp.Windows.Forms.csproj +++ b/src/L10NSharp.Windows.Forms/L10NSharp.Windows.Forms.csproj @@ -65,9 +65,6 @@ Form - - Form - UserControl diff --git a/src/L10NSharp.Windows.Forms/Properties/Resources.resx b/src/L10NSharp.Windows.Forms/Properties/Resources.resx deleted file mode 100644 index f26f49d..0000000 --- a/src/L10NSharp.Windows.Forms/Properties/Resources.resx +++ /dev/null @@ -1,152 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - - ..\Resources\bing.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\Copy_Translation.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\Copy_Translation (toolbar).png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\Google.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\Move_Next.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\Move_Previous.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\Move_down.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\Move_up.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\Move.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - - ..\Resources\SelectAllRows.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - \ No newline at end of file diff --git a/src/L10NSharp.Windows.Forms/Resources/Copy_Translation (toolbar).png b/src/L10NSharp.Windows.Forms/Resources/Copy_Translation (toolbar).png deleted file mode 100644 index 6dc60d81ea84527375d8a517096112b872ea729a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1416 zcmb`GUr19?9LK*`ckk}*yk^bm*bHa?aQ0Uu6I#O7)Jb3=TBMZKV-zUXdqo&QpwOP8 zz!!_6q{qU9UVG6u3&IR@b92u9^UrpZt>2lgO^IT|d-zFP zlcxrNH?=x!9Su9V5|TuoE*WQANt`op(^`0A=h z)}Wi9A2TC#2I)N{*nS##Nmg5PveTo)*NjLc5D115iz(o>rRZ#~MrFB}(nnT)V!F^_2O7FUGvB^nb-R70u}4R_iD!-6)QE#qR{VXh-+#eZcMS1$ zDieuEU>T>QF&sOwWdm0;lx3uIq=GF6XlOJkm52 zi}(p z8t`g01gfjqIWKg@g_*KR&+tFbpyoq1f)S8GMJWZIoe$#EkeSPAh3Ux{)U>w_DnWvZ zpdN1kQ_mf#($5RXzzkYmQ4Rls8`JM@WbP5WDft@JFiAJ-^Il;({jJ_yAMU7lbMr0h NZ*6LGjM}f<`vt_!4AB4p diff --git a/src/L10NSharp.Windows.Forms/Resources/Copy_Translation.png b/src/L10NSharp.Windows.Forms/Resources/Copy_Translation.png deleted file mode 100644 index 4b154986debdfb123429d5f3129424ea5c93b9e9..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 490 zcmeAS@N?(olHy`uVBq!ia0vp^oIuRQ!3HGLSWET+DaPU;cPEB*=VV?2Ic!PZ?k)`f zL2$v|<&%LToCO|{#S9GG!XV7ZFl&wkP)n_+i(`m{Bx4a{??1->|Nk>+gseIC^XE@X zRu(1(24>dPx7LJ&0X4$`qei|NHOh{Rejq?{AKN4N}Pj zQgC6uE92e?W{j*H0+X0I1Q|FuIi;l}Wm;fHF@Y4oI1F+;#UHeW8`SzaS_wU~fzkdDmO=y262$BUm9K_HGoc*7Xm5YI$PnLmQK#oCKN|52@ ztLF?R8iEXPlLRESb3`PR8CZD4802N87|b=e85Dpa%gDl709SNmn$=VWMz#z-_J0hT zQj84OAHHP}7ZJ#Bi4mH}0178$9M6vM<(6o3R{=H6qSxb3GOOaX`% XdSCx28}b1x3h=qLvjZ!pM+e&_yCO=H`CS*7;^Gr@io9obNmD^FHtMz7K^RArJ`SR4P?T zUS8hCg z*J`zm27_U27eH%kYg1=uXCI%>r#BOTwcjoTf-DZ~PXe=fjbJdyc64+!_w@AiM*(VT zYRZO&hRh7Z&|Y5t*@^y9~l`Lqmq)6 z;$~)MY+|uk6bOdV_RxZwav5YNvSR3KACKX9b~;KgNC^OJHk-Y$urQZWtJM|V-QC9c z_;?JPW)TXpP+vZ`Q(L&)9_&qw=a{h(0FTFm_V)HlN~hBea^k6IK7$)wqqtdn7N;dg z@IMjBApl;l7jCy3TnlE3V3qle}ghHWcb(hNp zlgTtm_4f8oR99CQ|8jbvd-efWFUe7GG7CH&FNOh0<|Y82&ljmq0E|ZCB&E@41{)e0 zR1C8Rw;xO(J#8QE-co?3=?DYTyJ_MRe*AR7=?>spl?;4dI07&{Jglb_3PlAsQ)5Cx z0-le4#><)S=xbvcKf*F?!_%%ZY;0`6;c$Rks!A%33r`49%4@D9F!<0=%%yVe;KF`tKA)M6_D1c5Z8PBPz+|a%FH13*NZo13$n&F031g@xT_+6vAOarycAB|@Pv o#?C7%D^v6H^W%X)AjZyr0LJuX@|xd){Qv*}07*qoM6N<$g6&6fdH?_b diff --git a/src/L10NSharp.Windows.Forms/Resources/Move.png b/src/L10NSharp.Windows.Forms/Resources/Move.png deleted file mode 100644 index 5731d8f92dfb25bf34c1486877b17b8c05664a54..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1307 zcmeAS@N?(olHy`uVBq!ia0vp^LO?9Q!3HFy+4N(86k~CayA#8@b22Z19JVBHcNd2L zAh=-f^2tCE&H|6fVg?3oVGw3ym^DWND9B#o>FdgVi&I3{LRzmOK97NcWwxh_V~B+y z;{=xc-#`^32F%$q;s3G&Gyaq6VHR`^-@pB2c=7l(x-daL6S|6@-+wZgcxf@TOt1bw zb3-rDE@ND@XX^i7KYlZSTmmxW$M;_h=Ds=%w;$bLcz5A9gQ%nsLwZ0lBf5p?d=`)) zy0$6|zyJPX`2FV(!>?aJ`uA^!Z@<1V{E`07@cJnO!_1An|I_{P8^!{1$=`o}8D4&Q z%JA*m4~DN_zcGCI@)d}I^p9^0AAY}NczhI;yzv7Tuy=m_V7Phl0mJw2-+^BI!SL<- z4+bt_4u)H2A2OUv*qa;e928&V=#7ne9+M)!hBJ?KSya@#by?GG4c=0A} zQ7_(#NUtq=Qt_vSO0`z2v9V<(X{|}tq}}v6FMn7!vwS;m-_G~V?9AIc=aPK^tK9++ z80b$7k`EGgnmXNIUF_uK*zjOqFUH@6ZFpdF>zt|VG+8v7%A@b$w>oV_vE zEX+%;6T7>@a5jK={G`}>AlBYYU|Z%o@klI;(k4(S0ijk)R*`Nd&>;Uylr=g;&KIlI zl9)>ZKmHeB*GFx!wdHLZV*;*QMzBRibRYE@5HoXW=J0UG(wDhq*+e#U^O-nwEDl|z zY0>;N0;e^nnk3f$0Hy{Qa<)|gkU*FO+W2B>1%XJFsMms|NFCWcO_|Py-=qm>V6u_3 zA1j~GQPIoT8K{~8u4$B6gG#BTkgOtC5b&7{mI1VofS-Ic5*CZ!R?deWnZf?gE_ zQShdxf*`1%LT`$gDELt=SgQ$bdXYBS@3*_o+a@(%&NBOU=gn_s-n_XvnN0@+0|5ZR z%vfrQ)-KZSP9MGBP7g`6u-U2fDCTqF68-pQ#?vV{;(7S$(QUH$ua2Fc1$OiZWw>|0 z5AZH!Qm4;Fd)Wu?G0q&vA-`6cxc&u426sc1`f>MS>%Opf+L;Bo{PhhEM*0!p1zdj6 z&Z`Y9zx(OVQwGXfj*MUWH=AzJw1}Fpz zX&1n4SQ98Z$d-StVWVO}lDu#n<_4&Lc{~hk{MzRPov|cJ710H#Q(lcScKHErSJeVc zvKvC_`_sDxNL8>X8l%t|MVT^{D^s&X0N1$+iJ(T+_G4uglAo^@4n)Gv`X-oYkb6#A zRn0*~Wn0+@u((CvCb((BGRc8N`o8if`QrJr+?mN4D3npBbeg6>SIbc3UF2+#vj&p@ z%h15NN~?~tVxiWs1Pw**=!q8jMR6E-J+K$`+smI2!`NjX(vZ^5Dj>UiSk z;`>~8PY9+ilWNdxADArwY5)y=y>Pwq4;CA>0G%C@ZQJl1PEN4U-XI3|0PAZd+`1I1 z=No7H>0B%yi6)2371Z_T jfrZ2GrF>rU`CGl4=(#8HEBk|YBEp{XE z)7O>#8n-k*Kik|pUbh$+Sfo8&978G?83kD0{|2fU>VOfO2Nvy_`v2FD-wfZs{bcz0 z{U^hZ@4pyoGFq^zWx-|uNVBf33d7%je;I!K`oWOuREbR)SPZKHAe(>x{l)O|%TtD% z7auTia&zJ|fC-xn$l1UD{9*X^?FYm6@820Xxj3*XLv_KNEffAD`}xoHy8v&KG;UF9GNBR@Pmmgo@nxzz^7*6dwjiDYR5Yq#S8AT<97+9Y2F?@LO1#B}e%^(Xg t3;+p&4UrOJV1B~IASo}2)n<^oVFG&OCf&16S-u$L9Zy$3mvv4FO#t+st2+Py diff --git a/src/L10NSharp.Windows.Forms/Resources/Move_up.png b/src/L10NSharp.Windows.Forms/Resources/Move_up.png deleted file mode 100644 index d39a96b043ad512dbf1c3bd7e13d5081115ea33c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1148 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`oCO|{#S9GG!XV7ZFl&wkP>{XE z)7O>#8n-mRfHlWEj!*^$7HLlx$B+s}Mgf-hzkw=-I$*@*ftee7|DQX0nc>{&D-5Ui zpTVh)37Y{kH}w90{p=mXUzu+V&mTT#Fmp2fk4+s&48s7h=I8Gi{z!jf5Rl+uFbdUR zc=q5KPD5DGO@0m3EM&mS@a-2T0|WDa1~p@Ou#$7DZ!oCps{Frw`3{PA;GAU#X8gZ* z{V{`ymlgvv3p2y--@h5IJ-p0t@7fcFZ{NN%ynFSD0c41PhycTtQ&-{o;4b*~Z8HH!^6$M#mT{NY10D+XHPo@!va&VYk&s89S%1j#isynYR|%^ z|7>h*4BXsY44hmX3_rjBWN6ImfXl;m0~r{B2$E#yWM^PyVPW6`YUbqRWcdE=2eKX% zHdX^Txqt>RvoT2W$}w1&nK69-`W;0RG6$=(7VVk(|JRS-K%0Mpoev6=nv52#YLN{a ZqU=8lD@+P+D$fKt-_zC4Wt~$(69CRfkI4W4 diff --git a/src/L10NSharp.Windows.Forms/Resources/SelectAllRows.png b/src/L10NSharp.Windows.Forms/Resources/SelectAllRows.png deleted file mode 100644 index 560a458a4fa378ed65f905848f2d9831f256af0c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3191 zcmV--42biIP)KLZ*U+IBfRsybQWXdwQbLP>6pAqfylh#{fb6;Z(vMMVS~$e@S=j*ftg6;Uhf59&ghTmgWD0l;*T zI709Y^p6lP1rIRMx#05C~cW=H_Aw*bJ-5DT&Z2n+x)QHX^p z00esgV8|mQcmRZ%02D^@S3L16t`O%c004NIvOKvYIYoh62rY33S640`D9%Y2D-rV&neh&#Q1i z007~1e$oCcFS8neI|hJl{-P!B1ZZ9hpmq0)X0i`JwE&>$+E?>%_LC6RbVIkUx0b+_+BaR3cnT7Zv!AJxW zizFb)h!jyGOOZ85F;a?DAXP{m@;!0_IfqH8(HlgRxt7s3}k3K`kFu>>-2Q$QMFfPW!La{h336o>X zu_CMttHv6zR;&ZNiS=X8v3CR#fknUxHUxJ0uoBa_M6WNWeqIg~6QE69c9o#eyhGvpiOA@W-aonk<7r1(?fC{oI5N*U!4 zfg=2N-7=cNnjjOr{yriy6mMFgG#l znCF=fnQv8CDz++o6_Lscl}eQ+l^ZHARH>?_s@|##Rr6KLRFA1%Q+=*RRWnoLsR`7U zt5vFIcfW3@?wFpwUVxrVZ>QdQz32KIeJ}k~{cZZE^+ya? z2D1z#2HOnI7(B%_ac?{wFUQ;QQA1tBKtrWrm0_3Rgps+?Jfqb{jYbcQX~taRB;#$y zZN{S}1|}gUOHJxc?wV3fxuz+mJ4`!F$IZ;mqRrNsHJd##*D~ju=bP7?-?v~|cv>vB zsJ6IeNwVZxrdjT`yl#bBIa#GxRa#xMMy;K#CDyyGyQdMSxlWT#tDe?p!?5wT$+oGt z8L;Kp2HUQ-ZMJ=3XJQv;x5ci*?vuTfeY$;({XGW_huIFR9a(?@3)XSs8O^N5RyOM=TTmp(3=8^+zpz2r)C z^>JO{deZfso3oq3?Wo(Y?l$ge?uXo;%ru`Vo>?<<(8I_>;8Eq#KMS9gFl*neeosSB zfoHYnBQIkwkyowPu(zdms`p{<7e4kra-ZWq<2*OsGTvEV%s0Td$hXT+!*8Bnh2KMe zBmZRodjHV?r+_5^X9J0WL4jKW`}lf%A-|44I@@LTvf1rHjG(ze6+w@Jt%Bvjts!X0 z?2xS?_ve_-kiKB_KiJlZ$9G`c^=E@oNG)mWWaNo-3TIW8)$Hg0Ub-~8?KhvJ>$ z3*&nim@mj(aCxE5!t{lw7O5^0EIO7zOo&c6l<+|iDySBWCGrz@C5{St!X3hAA}`T4 z(TLbXTq+(;@<=L8dXnssyft|w#WSTW<++3>sgS%(4NTpeI-VAqb|7ssJvzNHgOZVu zaYCvgO_R1~>SyL=cFU|~g|hy|Zi}}s9+d~lYqOB71z9Z$wnC=pR9Yz4DhIM>Wmjgu z&56o6maCpC&F##y%G;1PobR9i?GnNg;gYtchD%p19a!eQtZF&3JaKv33gZ<8D~47E ztUS1iwkmDaPpj=$m#%)jCVEY4fnLGNg2A-`YwHVD3gv};>)hAvT~AmqS>Lr``i7kw zJ{5_It`yrBmlc25DBO7E8;5VoznR>Ww5hAaxn$2~(q`%A-YuS64wkBy=9dm`4cXeX z4c}I@?e+FW+b@^RDBHV(wnMq2zdX3SWv9u`%{xC-q*U}&`cyXV(%rRT*Z6MH?i+i& z_B8C(+grT%{XWUQ+f@NoP1R=AW&26{v-dx)iK^-Nmiuj8txj!m?Z*Ss1N{dh4z}01 z)YTo*JycSU)+_5r4#yw9{+;i4Ee$peRgIj+;v;ZGdF1K$3E%e~4LaI(jC-u%2h$&R z9cLXcYC@Xwnns&bn)_Q~Te?roKGD|d-g^8;+aC{{G(1^(O7m37Y1-+6)01cN&y1aw zoqc{T`P^XJqPBbIW6s}d4{z_f5Om?vMgNQEJG?v2T=KYd^0M3I6IZxbny)%vZR&LD zJpPl@Psh8QyPB@KTx+@RdcC!KX7}kEo;S|j^u2lU7XQ}Oo;f|;z4Ll+_r>@1-xl3| zawq-H%e&ckC+@AhPrP6BKT#_XdT7&;F71j}Joy zkC~6lh7E@6o;W@^IpRNZ{ptLtL(gQ-CY~4mqW;US7Zxvm_|@yz&e53Bp_lTPlfP|z zrTyx_>lv@x#=^!PzR7qqF<$gm`|ZJZ+;<)Cqu&ot2z=0000WV@Og>004R=004l4008;_004mL004C`008P>0026e000+nl3&F} z0004^Nklfgc5Qd-79>WD_K1>th)QK8Y&iqOE6L91oAg*u%3DJT`992~~ z(5MF}iJjQHGsD5HTc@1JNUJ@J=9zci-Km)w+r%!wi#Hb)it~^;W0f0eW~8_7bq;H1 zIB$G-*{SVb7d2aZh#F1|?~U9Wb!TMG$h?s|C3i;V!FlE5=LyiE1kBGbfTDAn!*Z=G zSH^N}ELTdJLFR9Ss<@jG_UkiF-X>+T2Hd|oWr2bkh=Ld6{m<9H^8(<#2OvJ1qpFA+ zPosd7$q!T%5#`w^JDG28>V7Q8iSRUN>NJ zIxAnH`=rNo8lz^kn~l2wRcJk`BU*G{EE5_JA0TRoL6Ri2+d<_MRRHheSO2w4wQaZY d9$UuW0RY@=BiSNd051Rl002ovPDHLkV1gl=>UsbG diff --git a/src/L10NSharp.Windows.Forms/Resources/bing.png b/src/L10NSharp.Windows.Forms/Resources/bing.png deleted file mode 100644 index 91884f3f60da91f140d7acdf002525887400f168..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1161 zcmbVLUr1A76#sqe=GNT5OxD_z9vo6n1@%z#Wy+TBAqf+rha~&ssIUTkZG?M@o~$Rw zYT#2rNIew_wg;CzQIzPr1P5d|GM-#Pd9opZkP@7_7p*={wv z%>b;SjzAYl2eYY$&i(6ZF9|Ww)!v4&bVHUtcHQhaI{?(~VHSwRT?85jLnnjAkF_qR z`(XY_{b@k)gaWPI$94;c@_kFZ`ILbQL6-kVLb>)@Wp@>bPTy#VREALr{1+*IGAQ{~ zCsw*Bdl|~ArX3$%u7>{ltyBgrXgT-zhL^qMwU@ZL!h4?dRO-5Cl(Ck38Kn9>5X#kQ z>Y>avMmRh8iK!`-p(UanLa-gC`rToc#Q>~oWHAc#`Rd^Jn&GzZl;BE!3o}bUF!E{@ zU-H`$6GB8M!}SrdgEG*2)$FXn$Qd^*CTh*vB9KdIQJpP-tqJR!1%w~3U_SRt4-%s> zQVB(RcDYe|H8T#pyQ{;RJaC1!uS*7Lz5iKaltt3O3n1&Inmu-fR*G7Zd7(+UV!UR= z*(oV)CV?Z3MyZph%RmiG%5ZdWt&-{v=}=i(o21TVq?a~z{3|a~g4oZ<;M1(^fz{gs zaFB0r8J6{f`#^O2c}~jWkr0zJ?{VVc+7Q&jEe7{d8GSwnO~C>yHHNxDi*Tyl)EiAbjBP?{qF!FZkn z>6^$lI`JRBFmcf?9fJ?@Ae{ot&JnI}f^J(a%NbPP9Nm7@lRejcnDJ1sGceY6e&{#W C%)|5m diff --git a/src/L10NSharp.Windows.Forms/UIComponents/LocalizeItemDlg.Designer.cs b/src/L10NSharp.Windows.Forms/UIComponents/LocalizeItemDlg.Designer.cs deleted file mode 100644 index 52712f6..0000000 --- a/src/L10NSharp.Windows.Forms/UIComponents/LocalizeItemDlg.Designer.cs +++ /dev/null @@ -1,1061 +0,0 @@ -namespace L10NSharp.Windows.Forms.UIComponents -{ - partial class LocalizeItemDlg - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.components = new System.ComponentModel.Container(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle(); - this._textBoxTgtTranslation = new System.Windows.Forms.TextBox(); - this._labelStringId = new System.Windows.Forms.Label(); - this._buttonOK = new System.Windows.Forms.Button(); - this._buttonCancel = new System.Windows.Forms.Button(); - this._labelStringIdValue = new System.Windows.Forms.Label(); - this._groupBoxComment = new System.Windows.Forms.GroupBox(); - this._textBoxComment = new System.Windows.Forms.TextBox(); - this._groupBoxImage = new System.Windows.Forms.GroupBox(); - this._pictureImage = new System.Windows.Forms.PictureBox(); - this.splitContainer = new System.Windows.Forms.SplitContainer(); - this._treeView = new System.Windows.Forms.TreeView(); - this._toolStripLeftSide = new System.Windows.Forms.ToolStrip(); - this._labelGroups = new System.Windows.Forms.ToolStripLabel(); - this._buttonMoveNext = new L10NSharp.Windows.Forms.UIComponents.XButton(); - this._grid = new L10NSharp.Windows.Forms.UIComponents.LmGrid(); - this._colId = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this._colSourceText = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this._colTargetText = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this._colSrcToolTip = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this._colTgtToolTip = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this._colComments = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this._buttonMovePrev = new L10NSharp.Windows.Forms.UIComponents.XButton(); - this._toolStripRightSide = new System.Windows.Forms.ToolStrip(); - this._buttonBingTranslator = new System.Windows.Forms.ToolStripSplitButton(); - this._menuTranslateUsingBing = new System.Windows.Forms.ToolStripMenuItem(); - this._menuEditSourceAndTranslate = new System.Windows.Forms.ToolStripMenuItem(); - this._comboTargetLang = new System.Windows.Forms.ToolStripComboBox(); - this._labelTargetLang = new System.Windows.Forms.ToolStripLabel(); - this._comboSourceLang = new System.Windows.Forms.ToolStripComboBox(); - this._labelSourceLang = new System.Windows.Forms.ToolStripLabel(); - this._tableLayout = new System.Windows.Forms.TableLayoutPanel(); - this._panelIdentifier = new System.Windows.Forms.Panel(); - this.btnCopyToolTip = new L10NSharp.Windows.Forms.UIComponents.XButton(); - this.btnCopyShortcutKeys = new L10NSharp.Windows.Forms.UIComponents.XButton(); - this.btnCopyText = new L10NSharp.Windows.Forms.UIComponents.XButton(); - this._panelTargetText = new System.Windows.Forms.Panel(); - this._groupBoxTgtTranslation = new System.Windows.Forms.GroupBox(); - this._labelTgtShortcutKeys = new System.Windows.Forms.Label(); - this._shortcutKeysDropDown = new L10NSharp.Windows.Forms.UIComponents.ShortcutKeysDropDown(); - this._labelTgtToolTip = new System.Windows.Forms.Label(); - this._textBoxTgtToolTip = new System.Windows.Forms.TextBox(); - this._panelSourceText = new System.Windows.Forms.Panel(); - this._groupBoxSrcTranslation = new System.Windows.Forms.GroupBox(); - this._textBoxSrcTranslation = new System.Windows.Forms.TextBox(); - this._textBoxSrcShortcutKeys = new System.Windows.Forms.TextBox(); - this._labelSrcShortcutKeys = new System.Windows.Forms.Label(); - this._labelSrcToolTip = new System.Windows.Forms.Label(); - this._textBoxSrcToolTip = new System.Windows.Forms.TextBox(); - this._panelButtons = new System.Windows.Forms.Panel(); - this._howToDistribute = new System.Windows.Forms.LinkLabel(); - this._buttonFallbackLanguages = new System.Windows.Forms.Button(); - this.toolStrip = new System.Windows.Forms.ToolStrip(); - this.tbbCopy = new System.Windows.Forms.ToolStripDropDownButton(); - this.mnuCopyText = new System.Windows.Forms.ToolStripMenuItem(); - this.mnuCopyToolTip = new System.Windows.Forms.ToolStripMenuItem(); - this.mnuCopyShortcutKeys = new System.Windows.Forms.ToolStripMenuItem(); - this.toolStripMenuItem1 = new System.Windows.Forms.ToolStripSeparator(); - this.mnuCopyAll = new System.Windows.Forms.ToolStripMenuItem(); - this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator(); - this.tbbGoogleTranslate = new System.Windows.Forms.ToolStripButton(); - this.toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator(); - this.tcboSearch = new System.Windows.Forms.ToolStripComboBox(); - this.tblblSearch = new System.Windows.Forms.ToolStripLabel(); - this._tooltip = new System.Windows.Forms.ToolTip(this.components); - this._statusStrip = new System.Windows.Forms.StatusStrip(); - this._labelCount = new System.Windows.Forms.ToolStripStatusLabel(); - this._progressBar = new System.Windows.Forms.ToolStripProgressBar(); - this._groupBoxComment.SuspendLayout(); - this._groupBoxImage.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this._pictureImage)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.splitContainer)).BeginInit(); - this.splitContainer.Panel1.SuspendLayout(); - this.splitContainer.Panel2.SuspendLayout(); - this.splitContainer.SuspendLayout(); - this._toolStripLeftSide.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this._grid)).BeginInit(); - this._toolStripRightSide.SuspendLayout(); - this._tableLayout.SuspendLayout(); - this._panelIdentifier.SuspendLayout(); - this._panelTargetText.SuspendLayout(); - this._groupBoxTgtTranslation.SuspendLayout(); - this._panelSourceText.SuspendLayout(); - this._groupBoxSrcTranslation.SuspendLayout(); - this._panelButtons.SuspendLayout(); - this.toolStrip.SuspendLayout(); - this._statusStrip.SuspendLayout(); - this.SuspendLayout(); - // - // _textBoxTgtTranslation - // - this._textBoxTgtTranslation.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this._textBoxTgtTranslation.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this._textBoxTgtTranslation.Location = new System.Drawing.Point(6, 18); - this._textBoxTgtTranslation.Multiline = true; - this._textBoxTgtTranslation.Name = "_textBoxTgtTranslation"; - this._textBoxTgtTranslation.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; - this._textBoxTgtTranslation.Size = new System.Drawing.Size(314, 37); - this._textBoxTgtTranslation.TabIndex = 0; - // - // _labelStringId - // - this._labelStringId.AutoSize = true; - this._labelStringId.BackColor = System.Drawing.Color.Transparent; - this._labelStringId.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this._labelStringId.Location = new System.Drawing.Point(6, 14); - this._labelStringId.Name = "_labelStringId"; - this._labelStringId.Size = new System.Drawing.Size(93, 15); - this._labelStringId.TabIndex = 0; - this._labelStringId.Text = "Item Identifier:"; - // - // _buttonOK - // - this._buttonOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this._buttonOK.DialogResult = System.Windows.Forms.DialogResult.OK; - this._buttonOK.Location = new System.Drawing.Point(662, 7); - this._buttonOK.Name = "_buttonOK"; - this._buttonOK.Size = new System.Drawing.Size(75, 26); - this._buttonOK.TabIndex = 1; - this._buttonOK.Text = "OK"; - this._buttonOK.UseVisualStyleBackColor = true; - // - // _buttonCancel - // - this._buttonCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this._buttonCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; - this._buttonCancel.Location = new System.Drawing.Point(743, 7); - this._buttonCancel.Name = "_buttonCancel"; - this._buttonCancel.Size = new System.Drawing.Size(75, 26); - this._buttonCancel.TabIndex = 2; - this._buttonCancel.Text = "Cancel"; - this._buttonCancel.UseVisualStyleBackColor = true; - // - // _labelStringIdValue - // - this._labelStringIdValue.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this._labelStringIdValue.AutoEllipsis = true; - this._labelStringIdValue.BackColor = System.Drawing.Color.Transparent; - this._labelStringIdValue.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this._labelStringIdValue.ForeColor = System.Drawing.Color.MediumBlue; - this._labelStringIdValue.Location = new System.Drawing.Point(18, 32); - this._labelStringIdValue.Name = "_labelStringIdValue"; - this._labelStringIdValue.Size = new System.Drawing.Size(240, 32); - this._labelStringIdValue.TabIndex = 1; - this._labelStringIdValue.Text = "#"; - // - // _groupBoxComment - // - this._groupBoxComment.Controls.Add(this._textBoxComment); - this._groupBoxComment.Dock = System.Windows.Forms.DockStyle.Fill; - this._groupBoxComment.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this._groupBoxComment.Location = new System.Drawing.Point(3, 257); - this._groupBoxComment.Margin = new System.Windows.Forms.Padding(3, 3, 3, 0); - this._groupBoxComment.Name = "_groupBoxComment"; - this._groupBoxComment.Padding = new System.Windows.Forms.Padding(5, 3, 2, 2); - this._groupBoxComment.Size = new System.Drawing.Size(326, 70); - this._groupBoxComment.TabIndex = 1; - this._groupBoxComment.TabStop = false; - this._groupBoxComment.Text = "Comment"; - // - // _textBoxComment - // - this._textBoxComment.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this._textBoxComment.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this._textBoxComment.Location = new System.Drawing.Point(5, 19); - this._textBoxComment.Multiline = true; - this._textBoxComment.Name = "_textBoxComment"; - this._textBoxComment.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; - this._textBoxComment.Size = new System.Drawing.Size(315, 46); - this._textBoxComment.TabIndex = 0; - // - // _groupBoxImage - // - this._groupBoxImage.Controls.Add(this._pictureImage); - this._groupBoxImage.Dock = System.Windows.Forms.DockStyle.Right; - this._groupBoxImage.Location = new System.Drawing.Point(264, 0); - this._groupBoxImage.Name = "_groupBoxImage"; - this._groupBoxImage.Size = new System.Drawing.Size(62, 68); - this._groupBoxImage.TabIndex = 2; - this._groupBoxImage.TabStop = false; - // - // _pictureImage - // - this._pictureImage.Location = new System.Drawing.Point(6, 14); - this._pictureImage.Name = "_pictureImage"; - this._pictureImage.Size = new System.Drawing.Size(50, 50); - this._pictureImage.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage; - this._pictureImage.TabIndex = 14; - this._pictureImage.TabStop = false; - // - // splitContainer - // - this.splitContainer.BackColor = System.Drawing.Color.Transparent; - this.splitContainer.Dock = System.Windows.Forms.DockStyle.Fill; - this.splitContainer.Location = new System.Drawing.Point(0, 0); - this.splitContainer.Name = "splitContainer"; - // - // splitContainer.Panel1 - // - this.splitContainer.Panel1.Controls.Add(this._treeView); - this.splitContainer.Panel1.Controls.Add(this._toolStripLeftSide); - this.splitContainer.Panel1.Padding = new System.Windows.Forms.Padding(8, 7, 0, 0); - // - // splitContainer.Panel2 - // - this.splitContainer.Panel2.Controls.Add(this._buttonMoveNext); - this.splitContainer.Panel2.Controls.Add(this._grid); - this.splitContainer.Panel2.Controls.Add(this._buttonMovePrev); - this.splitContainer.Panel2.Controls.Add(this._toolStripRightSide); - this.splitContainer.Panel2.Controls.Add(this._tableLayout); - this.splitContainer.Panel2.Padding = new System.Windows.Forms.Padding(0, 7, 5, 0); - this.splitContainer.Size = new System.Drawing.Size(826, 456); - this.splitContainer.SplitterDistance = 269; - this.splitContainer.SplitterWidth = 6; - this.splitContainer.TabIndex = 0; - // - // _treeView - // - this._treeView.AllowDrop = true; - this._treeView.Dock = System.Windows.Forms.DockStyle.Fill; - this._treeView.HideSelection = false; - this._treeView.Location = new System.Drawing.Point(8, 37); - this._treeView.Name = "_treeView"; - this._treeView.Size = new System.Drawing.Size(261, 419); - this._treeView.TabIndex = 1; - this._treeView.BeforeSelect += new System.Windows.Forms.TreeViewCancelEventHandler(this.HandleTreeViewBeforeSelect); - // - // _toolStripLeftSide - // - this._toolStripLeftSide.AutoSize = false; - this._toolStripLeftSide.BackColor = System.Drawing.Color.LightSteelBlue; - this._toolStripLeftSide.GripStyle = System.Windows.Forms.ToolStripGripStyle.Hidden; - this._toolStripLeftSide.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - this._labelGroups}); - this._toolStripLeftSide.Location = new System.Drawing.Point(8, 7); - this._toolStripLeftSide.Name = "_toolStripLeftSide"; - this._toolStripLeftSide.Size = new System.Drawing.Size(261, 30); - this._toolStripLeftSide.TabIndex = 0; - this._toolStripLeftSide.Text = "toolStrip2"; - // - // _labelGroups - // - this._labelGroups.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this._labelGroups.Name = "_labelGroups"; - this._labelGroups.Size = new System.Drawing.Size(50, 27); - this._labelGroups.Text = "Groups:"; - // - // _buttonMoveNext - // - this._buttonMoveNext.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this._buttonMoveNext.BackColor = System.Drawing.Color.Transparent; - this._buttonMoveNext.CanBeChecked = false; - this._buttonMoveNext.Checked = false; - this._buttonMoveNext.DrawEmpty = false; - this._buttonMoveNext.DrawLeftArrowButton = false; - this._buttonMoveNext.DrawRightArrowButton = false; - this._buttonMoveNext.Font = new System.Drawing.Font("Marlett", 9F); - this._buttonMoveNext.Image = global::L10NSharp.Properties.Resources.kimidMoveNext; - this._buttonMoveNext.Location = new System.Drawing.Point(403, 133); - this._buttonMoveNext.Name = "_buttonMoveNext"; - this._buttonMoveNext.Size = new System.Drawing.Size(20, 20); - this._buttonMoveNext.TabIndex = 2; - this._tooltip.SetToolTip(this._buttonMoveNext, "Move to next localizable string"); - this._buttonMoveNext.Visible = false; - this._buttonMoveNext.Click += new System.EventHandler(this._buttonMoveNext_Click); - // - // _grid - // - this._grid.AllowUserToAddRows = false; - this._grid.AllowUserToDeleteRows = false; - this._grid.AllowUserToOrderColumns = true; - this._grid.AllowUserToResizeRows = false; - this._grid.AutoSizeRowsMode = System.Windows.Forms.DataGridViewAutoSizeRowsMode.AllCellsExceptHeaders; - this._grid.BackgroundColor = System.Drawing.SystemColors.Window; - this._grid.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; - this._grid.ClipboardCopyMode = System.Windows.Forms.DataGridViewClipboardCopyMode.Disable; - this._grid.ColumnHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.None; - dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; - dataGridViewCellStyle1.BackColor = System.Drawing.SystemColors.Control; - dataGridViewCellStyle1.Font = new System.Drawing.Font("Segoe UI Semibold", 8.25F, System.Drawing.FontStyle.Bold); - dataGridViewCellStyle1.ForeColor = System.Drawing.SystemColors.WindowText; - dataGridViewCellStyle1.SelectionBackColor = System.Drawing.SystemColors.Highlight; - dataGridViewCellStyle1.SelectionForeColor = System.Drawing.SystemColors.HighlightText; - dataGridViewCellStyle1.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this._grid.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle1; - this._grid.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.DisableResizing; - this._grid.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { - this._colId, - this._colSourceText, - this._colTargetText, - this._colSrcToolTip, - this._colTgtToolTip, - this._colComments}); - this._grid.DrawTextBoxEditControlBorder = false; - this._grid.EditMode = System.Windows.Forms.DataGridViewEditMode.EditOnEnter; - this._grid.Font = new System.Drawing.Font("Segoe UI Semibold", 8.25F, System.Drawing.FontStyle.Bold); - this._grid.FullRowFocusRectangleColor = System.Drawing.SystemColors.ControlDark; - this._grid.GridColor = System.Drawing.Color.FromArgb(((int)(((byte)(225)))), ((int)(((byte)(225)))), ((int)(((byte)(225))))); - this._grid.IsDirty = true; - this._grid.Location = new System.Drawing.Point(13, 370); - this._grid.MultiSelect = false; - this._grid.Name = "_grid"; - this._grid.PaintFullRowFocusRectangle = true; - this._grid.PaintHeaderAcrossFullGridWidth = true; - this._grid.RowHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.None; - this._grid.RowHeadersWidth = 22; - this._grid.RowHeadersWidthSizeMode = System.Windows.Forms.DataGridViewRowHeadersWidthSizeMode.DisableResizing; - this._grid.SelectedCellBackColor = System.Drawing.Color.Empty; - this._grid.SelectedCellForeColor = System.Drawing.Color.Empty; - this._grid.SelectedRowBackColor = System.Drawing.Color.Empty; - this._grid.SelectedRowForeColor = System.Drawing.Color.Empty; - this._grid.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; - this._grid.ShowWaterMarkWhenDirty = false; - this._grid.Size = new System.Drawing.Size(514, 63); - this._grid.TabIndex = 1; - this._grid.TextBoxEditControlBorderColor = System.Drawing.Color.Silver; - this._grid.VirtualMode = true; - this._grid.WaterMark = "!"; - this._grid.CurrentRowChanged += new System.EventHandler(this.HandleGridCurrentRowChanged); - this._grid.CellFormatting += new System.Windows.Forms.DataGridViewCellFormattingEventHandler(this.HandleGridCellFormatting); - this._grid.CellMouseEnter += new System.Windows.Forms.DataGridViewCellEventHandler(this.HandleGridCellMouseEnter); - this._grid.CellMouseLeave += new System.Windows.Forms.DataGridViewCellEventHandler(this.HandleGridCellMouseLeave); - this._grid.CellPainting += new System.Windows.Forms.DataGridViewCellPaintingEventHandler(this.HandleGridCellPainting); - this._grid.CellValueNeeded += new System.Windows.Forms.DataGridViewCellValueEventHandler(this.HandleGridCellValueNeeded); - this._grid.CellValuePushed += new System.Windows.Forms.DataGridViewCellValueEventHandler(this.HandleGridCellValuePushed); - this._grid.ColumnHeaderMouseClick += new System.Windows.Forms.DataGridViewCellMouseEventHandler(this.HandleColumnHeaderMouseClick); - // - // _colId - // - this._colId.HeaderText = "Identifier"; - this._colId.Name = "_colId"; - this._colId.ReadOnly = true; - // - // _colSourceText - // - this._colSourceText.HeaderText = "#"; - this._colSourceText.Name = "_colSourceText"; - this._colSourceText.ReadOnly = true; - // - // _colTargetText - // - this._colTargetText.HeaderText = "#"; - this._colTargetText.Name = "_colTargetText"; - // - // _colSrcToolTip - // - this._colSrcToolTip.HeaderText = "#"; - this._colSrcToolTip.Name = "_colSrcToolTip"; - this._colSrcToolTip.ReadOnly = true; - // - // _colTgtToolTip - // - this._colTgtToolTip.HeaderText = "#"; - this._colTgtToolTip.Name = "_colTgtToolTip"; - // - // _colComments - // - this._colComments.HeaderText = "Comments"; - this._colComments.Name = "_colComments"; - // - // _buttonMovePrev - // - this._buttonMovePrev.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this._buttonMovePrev.BackColor = System.Drawing.Color.Transparent; - this._buttonMovePrev.CanBeChecked = false; - this._buttonMovePrev.Checked = false; - this._buttonMovePrev.DrawEmpty = false; - this._buttonMovePrev.DrawLeftArrowButton = false; - this._buttonMovePrev.DrawRightArrowButton = false; - this._buttonMovePrev.Font = new System.Drawing.Font("Marlett", 9F); - this._buttonMovePrev.Image = global::L10NSharp.Properties.Resources.kimidMovePrevious; - this._buttonMovePrev.Location = new System.Drawing.Point(403, 107); - this._buttonMovePrev.Name = "_buttonMovePrev"; - this._buttonMovePrev.Size = new System.Drawing.Size(20, 20); - this._buttonMovePrev.TabIndex = 1; - this._tooltip.SetToolTip(this._buttonMovePrev, "Move to previous localizable string"); - this._buttonMovePrev.Visible = false; - this._buttonMovePrev.Click += new System.EventHandler(this._buttonMovePrev_Click); - // - // _toolStripRightSide - // - this._toolStripRightSide.AutoSize = false; - this._toolStripRightSide.BackColor = System.Drawing.Color.LightSteelBlue; - this._toolStripRightSide.GripStyle = System.Windows.Forms.ToolStripGripStyle.Hidden; - this._toolStripRightSide.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - this._buttonBingTranslator, - this._comboTargetLang, - this._labelTargetLang, - this._comboSourceLang, - this._labelSourceLang}); - this._toolStripRightSide.Location = new System.Drawing.Point(0, 7); - this._toolStripRightSide.Name = "_toolStripRightSide"; - this._toolStripRightSide.Size = new System.Drawing.Size(546, 30); - this._toolStripRightSide.TabIndex = 2; - this._toolStripRightSide.Text = "toolStrip1"; - // - // _buttonBingTranslator - // - this._buttonBingTranslator.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; - this._buttonBingTranslator.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - this._menuTranslateUsingBing, - this._menuEditSourceAndTranslate}); - this._buttonBingTranslator.Enabled = false; - this._buttonBingTranslator.Image = global::L10NSharp.Properties.Resources.kimidBing; - this._buttonBingTranslator.ImageTransparentColor = System.Drawing.Color.Magenta; - this._buttonBingTranslator.Margin = new System.Windows.Forms.Padding(7, 1, 5, 2); - this._buttonBingTranslator.Name = "_buttonBingTranslator"; - this._buttonBingTranslator.Size = new System.Drawing.Size(32, 27); - this._buttonBingTranslator.ToolTipText = "Translate Using Bing"; - this._buttonBingTranslator.ButtonClick += new System.EventHandler(this.HandleTranslatorServiceButtonClick); - // - // _menuTranslateUsingBing - // - this._menuTranslateUsingBing.Name = "_menuTranslateUsingBing"; - this._menuTranslateUsingBing.Size = new System.Drawing.Size(265, 22); - this._menuTranslateUsingBing.Text = "Translate Using Bing"; - this._menuTranslateUsingBing.Click += new System.EventHandler(this.HandleTranslatorServiceButtonClick); - // - // _menuEditSourceAndTranslate - // - this._menuEditSourceAndTranslate.Name = "_menuEditSourceAndTranslate"; - this._menuEditSourceAndTranslate.Size = new System.Drawing.Size(265, 22); - this._menuEditSourceAndTranslate.Text = "Edit Source && Translate Using Bing..."; - this._menuEditSourceAndTranslate.Click += new System.EventHandler(this.HandleEditSourceBeforeTranslatingUsingBing); - // - // _comboTargetLang - // - this._comboTargetLang.Alignment = System.Windows.Forms.ToolStripItemAlignment.Right; - this._comboTargetLang.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this._comboTargetLang.Margin = new System.Windows.Forms.Padding(1, 0, 8, 0); - this._comboTargetLang.Name = "_comboTargetLang"; - this._comboTargetLang.Size = new System.Drawing.Size(130, 30); - this._comboTargetLang.SelectedIndexChanged += new System.EventHandler(this.HandleTargetLangChanged); - // - // _labelTargetLang - // - this._labelTargetLang.Alignment = System.Windows.Forms.ToolStripItemAlignment.Right; - this._labelTargetLang.Margin = new System.Windows.Forms.Padding(8, 1, 0, 2); - this._labelTargetLang.Name = "_labelTargetLang"; - this._labelTargetLang.Size = new System.Drawing.Size(98, 27); - this._labelTargetLang.Text = "Target Language:"; - // - // _comboSourceLang - // - this._comboSourceLang.Alignment = System.Windows.Forms.ToolStripItemAlignment.Right; - this._comboSourceLang.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this._comboSourceLang.Name = "_comboSourceLang"; - this._comboSourceLang.Size = new System.Drawing.Size(130, 30); - this._comboSourceLang.SelectedIndexChanged += new System.EventHandler(this.HandleSourceLangChanged); - // - // _labelSourceLang - // - this._labelSourceLang.Alignment = System.Windows.Forms.ToolStripItemAlignment.Right; - this._labelSourceLang.Margin = new System.Windows.Forms.Padding(5, 1, 0, 2); - this._labelSourceLang.Name = "_labelSourceLang"; - this._labelSourceLang.Size = new System.Drawing.Size(101, 27); - this._labelSourceLang.Text = "Source Language:"; - // - // _tableLayout - // - this._tableLayout.ColumnCount = 1; - this._tableLayout.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); - this._tableLayout.Controls.Add(this._panelIdentifier, 0, 0); - this._tableLayout.Controls.Add(this._groupBoxComment, 0, 3); - this._tableLayout.Controls.Add(this._panelTargetText, 0, 2); - this._tableLayout.Controls.Add(this._panelSourceText, 0, 1); - this._tableLayout.Location = new System.Drawing.Point(13, 36); - this._tableLayout.Margin = new System.Windows.Forms.Padding(0); - this._tableLayout.Name = "_tableLayout"; - this._tableLayout.RowCount = 4; - this._tableLayout.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 74F)); - this._tableLayout.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 45F)); - this._tableLayout.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 55F)); - this._tableLayout.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 72F)); - this._tableLayout.Size = new System.Drawing.Size(332, 327); - this._tableLayout.TabIndex = 0; - // - // _panelIdentifier - // - this._panelIdentifier.Controls.Add(this.btnCopyToolTip); - this._panelIdentifier.Controls.Add(this._labelStringIdValue); - this._panelIdentifier.Controls.Add(this.btnCopyShortcutKeys); - this._panelIdentifier.Controls.Add(this.btnCopyText); - this._panelIdentifier.Controls.Add(this._labelStringId); - this._panelIdentifier.Controls.Add(this._groupBoxImage); - this._panelIdentifier.Dock = System.Windows.Forms.DockStyle.Fill; - this._panelIdentifier.Location = new System.Drawing.Point(3, 3); - this._panelIdentifier.Name = "_panelIdentifier"; - this._panelIdentifier.Size = new System.Drawing.Size(326, 68); - this._panelIdentifier.TabIndex = 0; - // - // btnCopyToolTip - // - this.btnCopyToolTip.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.btnCopyToolTip.BackColor = System.Drawing.Color.Transparent; - this.btnCopyToolTip.CanBeChecked = false; - this.btnCopyToolTip.Checked = false; - this.btnCopyToolTip.DrawEmpty = false; - this.btnCopyToolTip.DrawLeftArrowButton = false; - this.btnCopyToolTip.DrawRightArrowButton = false; - this.btnCopyToolTip.Font = new System.Drawing.Font("Marlett", 9F); - this.btnCopyToolTip.Image = global::L10NSharp.Properties.Resources.kimidCopyTranslation; - this.btnCopyToolTip.Location = new System.Drawing.Point(128, 6); - this.btnCopyToolTip.Name = "btnCopyToolTip"; - this.btnCopyToolTip.Size = new System.Drawing.Size(11, 15); - this.btnCopyToolTip.TabIndex = 5; - this._tooltip.SetToolTip(this.btnCopyToolTip, "Copy Source Tool Tip to Target (Ctrl+Alt+O)"); - this.btnCopyToolTip.Visible = false; - this.btnCopyToolTip.Click += new System.EventHandler(this.btnCopyToolTip_Click); - // - // btnCopyShortcutKeys - // - this.btnCopyShortcutKeys.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.btnCopyShortcutKeys.BackColor = System.Drawing.Color.Transparent; - this.btnCopyShortcutKeys.CanBeChecked = false; - this.btnCopyShortcutKeys.Checked = false; - this.btnCopyShortcutKeys.DrawEmpty = false; - this.btnCopyShortcutKeys.DrawLeftArrowButton = false; - this.btnCopyShortcutKeys.DrawRightArrowButton = false; - this.btnCopyShortcutKeys.Font = new System.Drawing.Font("Marlett", 9F); - this.btnCopyShortcutKeys.Image = global::L10NSharp.Properties.Resources.kimidCopyTranslation; - this.btnCopyShortcutKeys.Location = new System.Drawing.Point(187, 6); - this.btnCopyShortcutKeys.Name = "btnCopyShortcutKeys"; - this.btnCopyShortcutKeys.Size = new System.Drawing.Size(11, 15); - this.btnCopyShortcutKeys.TabIndex = 7; - this._tooltip.SetToolTip(this.btnCopyShortcutKeys, "Copy Source Shortcut Keys to Target (Ctrl+Alt+S)"); - this.btnCopyShortcutKeys.Visible = false; - this.btnCopyShortcutKeys.Click += new System.EventHandler(this.btnCopyShortcutKeys_Click); - // - // btnCopyText - // - this.btnCopyText.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.btnCopyText.BackColor = System.Drawing.Color.Transparent; - this.btnCopyText.CanBeChecked = false; - this.btnCopyText.Checked = false; - this.btnCopyText.DrawEmpty = false; - this.btnCopyText.DrawLeftArrowButton = false; - this.btnCopyText.DrawRightArrowButton = false; - this.btnCopyText.Font = new System.Drawing.Font("Marlett", 9F); - this.btnCopyText.Image = global::L10NSharp.Properties.Resources.kimidCopyTranslation; - this.btnCopyText.Location = new System.Drawing.Point(155, 6); - this.btnCopyText.Name = "btnCopyText"; - this.btnCopyText.Size = new System.Drawing.Size(11, 13); - this.btnCopyText.TabIndex = 6; - this._tooltip.SetToolTip(this.btnCopyText, "Copy Source Translation to Target (Ctrl+Alt+T)"); - this.btnCopyText.Visible = false; - this.btnCopyText.Click += new System.EventHandler(this.btnCopyText_Click); - // - // _panelTargetText - // - this._panelTargetText.Controls.Add(this._groupBoxTgtTranslation); - this._panelTargetText.Dock = System.Windows.Forms.DockStyle.Fill; - this._panelTargetText.Location = new System.Drawing.Point(3, 158); - this._panelTargetText.Name = "_panelTargetText"; - this._panelTargetText.Size = new System.Drawing.Size(326, 93); - this._panelTargetText.TabIndex = 4; - // - // _groupBoxTgtTranslation - // - this._groupBoxTgtTranslation.Controls.Add(this._labelTgtShortcutKeys); - this._groupBoxTgtTranslation.Controls.Add(this._shortcutKeysDropDown); - this._groupBoxTgtTranslation.Controls.Add(this._labelTgtToolTip); - this._groupBoxTgtTranslation.Controls.Add(this._textBoxTgtToolTip); - this._groupBoxTgtTranslation.Controls.Add(this._textBoxTgtTranslation); - this._groupBoxTgtTranslation.Dock = System.Windows.Forms.DockStyle.Fill; - this._groupBoxTgtTranslation.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this._groupBoxTgtTranslation.Location = new System.Drawing.Point(0, 0); - this._groupBoxTgtTranslation.Name = "_groupBoxTgtTranslation"; - this._groupBoxTgtTranslation.Size = new System.Drawing.Size(326, 93); - this._groupBoxTgtTranslation.TabIndex = 0; - this._groupBoxTgtTranslation.TabStop = false; - // - // _labelTgtShortcutKeys - // - this._labelTgtShortcutKeys.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this._labelTgtShortcutKeys.AutoSize = true; - this._labelTgtShortcutKeys.BackColor = System.Drawing.Color.Transparent; - this._labelTgtShortcutKeys.Enabled = false; - this._labelTgtShortcutKeys.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this._labelTgtShortcutKeys.Location = new System.Drawing.Point(113, 66); - this._labelTgtShortcutKeys.Name = "_labelTgtShortcutKeys"; - this._labelTgtShortcutKeys.Size = new System.Drawing.Size(79, 13); - this._labelTgtShortcutKeys.TabIndex = 3; - this._labelTgtShortcutKeys.Text = "Shortcut &Keys:"; - // - // _shortcutKeysDropDown - // - this._shortcutKeysDropDown.AlignDropToLeft = false; - this._shortcutKeysDropDown.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this._shortcutKeysDropDown.BackColor = System.Drawing.SystemColors.Window; - this._shortcutKeysDropDown.Location = new System.Drawing.Point(198, 61); - this._shortcutKeysDropDown.Name = "_shortcutKeysDropDown"; - this._shortcutKeysDropDown.Padding = new System.Windows.Forms.Padding(1); - this._shortcutKeysDropDown.ShortcutKeys = System.Windows.Forms.Keys.None; - this._shortcutKeysDropDown.ShortcutKeysAsString = "None"; - this._shortcutKeysDropDown.Size = new System.Drawing.Size(122, 22); - this._shortcutKeysDropDown.TabIndex = 4; - // - // _labelTgtToolTip - // - this._labelTgtToolTip.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this._labelTgtToolTip.AutoSize = true; - this._labelTgtToolTip.BackColor = System.Drawing.Color.Transparent; - this._labelTgtToolTip.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this._labelTgtToolTip.Location = new System.Drawing.Point(6, 66); - this._labelTgtToolTip.Name = "_labelTgtToolTip"; - this._labelTgtToolTip.Size = new System.Drawing.Size(49, 13); - this._labelTgtToolTip.TabIndex = 1; - this._labelTgtToolTip.Text = "&Tool Tip:"; - // - // _textBoxTgtToolTip - // - this._textBoxTgtToolTip.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this._textBoxTgtToolTip.BackColor = System.Drawing.SystemColors.Window; - this._textBoxTgtToolTip.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this._textBoxTgtToolTip.Location = new System.Drawing.Point(62, 61); - this._textBoxTgtToolTip.Name = "_textBoxTgtToolTip"; - this._textBoxTgtToolTip.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; - this._textBoxTgtToolTip.Size = new System.Drawing.Size(45, 22); - this._textBoxTgtToolTip.TabIndex = 2; - // - // _panelSourceText - // - this._panelSourceText.Controls.Add(this._groupBoxSrcTranslation); - this._panelSourceText.Dock = System.Windows.Forms.DockStyle.Fill; - this._panelSourceText.Location = new System.Drawing.Point(3, 77); - this._panelSourceText.Name = "_panelSourceText"; - this._panelSourceText.Size = new System.Drawing.Size(326, 75); - this._panelSourceText.TabIndex = 5; - // - // _groupBoxSrcTranslation - // - this._groupBoxSrcTranslation.BackColor = System.Drawing.Color.Transparent; - this._groupBoxSrcTranslation.Controls.Add(this._textBoxSrcTranslation); - this._groupBoxSrcTranslation.Controls.Add(this._textBoxSrcShortcutKeys); - this._groupBoxSrcTranslation.Controls.Add(this._labelSrcShortcutKeys); - this._groupBoxSrcTranslation.Controls.Add(this._labelSrcToolTip); - this._groupBoxSrcTranslation.Controls.Add(this._textBoxSrcToolTip); - this._groupBoxSrcTranslation.Dock = System.Windows.Forms.DockStyle.Fill; - this._groupBoxSrcTranslation.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this._groupBoxSrcTranslation.Location = new System.Drawing.Point(0, 0); - this._groupBoxSrcTranslation.Name = "_groupBoxSrcTranslation"; - this._groupBoxSrcTranslation.Size = new System.Drawing.Size(326, 75); - this._groupBoxSrcTranslation.TabIndex = 0; - this._groupBoxSrcTranslation.TabStop = false; - this._groupBoxSrcTranslation.Paint += new System.Windows.Forms.PaintEventHandler(this.HandleGroupSrcTranslationPaint); - // - // _textBoxSrcTranslation - // - this._textBoxSrcTranslation.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this._textBoxSrcTranslation.BorderStyle = System.Windows.Forms.BorderStyle.None; - this._textBoxSrcTranslation.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this._textBoxSrcTranslation.ForeColor = System.Drawing.Color.Black; - this._textBoxSrcTranslation.Location = new System.Drawing.Point(6, 18); - this._textBoxSrcTranslation.Multiline = true; - this._textBoxSrcTranslation.Name = "_textBoxSrcTranslation"; - this._textBoxSrcTranslation.ReadOnly = true; - this._textBoxSrcTranslation.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; - this._textBoxSrcTranslation.Size = new System.Drawing.Size(314, 23); - this._textBoxSrcTranslation.TabIndex = 0; - // - // _textBoxSrcShortcutKeys - // - this._textBoxSrcShortcutKeys.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this._textBoxSrcShortcutKeys.BorderStyle = System.Windows.Forms.BorderStyle.None; - this._textBoxSrcShortcutKeys.Enabled = false; - this._textBoxSrcShortcutKeys.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this._textBoxSrcShortcutKeys.Location = new System.Drawing.Point(198, 50); - this._textBoxSrcShortcutKeys.Name = "_textBoxSrcShortcutKeys"; - this._textBoxSrcShortcutKeys.ReadOnly = true; - this._textBoxSrcShortcutKeys.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; - this._textBoxSrcShortcutKeys.Size = new System.Drawing.Size(122, 15); - this._textBoxSrcShortcutKeys.TabIndex = 4; - // - // _labelSrcShortcutKeys - // - this._labelSrcShortcutKeys.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this._labelSrcShortcutKeys.AutoSize = true; - this._labelSrcShortcutKeys.BackColor = System.Drawing.Color.Transparent; - this._labelSrcShortcutKeys.Enabled = false; - this._labelSrcShortcutKeys.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this._labelSrcShortcutKeys.Location = new System.Drawing.Point(113, 50); - this._labelSrcShortcutKeys.Name = "_labelSrcShortcutKeys"; - this._labelSrcShortcutKeys.Size = new System.Drawing.Size(79, 13); - this._labelSrcShortcutKeys.TabIndex = 3; - this._labelSrcShortcutKeys.Text = "Shortcut Keys:"; - // - // _labelSrcToolTip - // - this._labelSrcToolTip.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this._labelSrcToolTip.AutoSize = true; - this._labelSrcToolTip.BackColor = System.Drawing.Color.Transparent; - this._labelSrcToolTip.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this._labelSrcToolTip.Location = new System.Drawing.Point(6, 50); - this._labelSrcToolTip.Name = "_labelSrcToolTip"; - this._labelSrcToolTip.Size = new System.Drawing.Size(49, 13); - this._labelSrcToolTip.TabIndex = 1; - this._labelSrcToolTip.Text = "Tool Tip:"; - // - // _textBoxSrcToolTip - // - this._textBoxSrcToolTip.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this._textBoxSrcToolTip.BorderStyle = System.Windows.Forms.BorderStyle.None; - this._textBoxSrcToolTip.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this._textBoxSrcToolTip.Location = new System.Drawing.Point(62, 50); - this._textBoxSrcToolTip.Name = "_textBoxSrcToolTip"; - this._textBoxSrcToolTip.ReadOnly = true; - this._textBoxSrcToolTip.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; - this._textBoxSrcToolTip.Size = new System.Drawing.Size(45, 15); - this._textBoxSrcToolTip.TabIndex = 2; - // - // _panelButtons - // - this._panelButtons.BackColor = System.Drawing.Color.Transparent; - this._panelButtons.Controls.Add(this._howToDistribute); - this._panelButtons.Controls.Add(this._buttonFallbackLanguages); - this._panelButtons.Controls.Add(this._buttonCancel); - this._panelButtons.Controls.Add(this._buttonOK); - this._panelButtons.Dock = System.Windows.Forms.DockStyle.Bottom; - this._panelButtons.Location = new System.Drawing.Point(0, 456); - this._panelButtons.Name = "_panelButtons"; - this._panelButtons.Size = new System.Drawing.Size(826, 41); - this._panelButtons.TabIndex = 1; - // - // _howToDistribute - // - this._howToDistribute.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this._howToDistribute.AutoSize = true; - this._howToDistribute.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this._howToDistribute.Location = new System.Drawing.Point(392, 12); - this._howToDistribute.Name = "_howToDistribute"; - this._howToDistribute.Size = new System.Drawing.Size(248, 17); - this._howToDistribute.TabIndex = 3; - this._howToDistribute.TabStop = true; - this._howToDistribute.Text = "How to distribute your translation work"; - this._howToDistribute.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this._howToDistribute_LinkClicked); - // - // _buttonFallbackLanguages - // - this._buttonFallbackLanguages.Location = new System.Drawing.Point(8, 7); - this._buttonFallbackLanguages.Name = "_buttonFallbackLanguages"; - this._buttonFallbackLanguages.Size = new System.Drawing.Size(156, 26); - this._buttonFallbackLanguages.TabIndex = 0; - this._buttonFallbackLanguages.Text = "&Fallback Languages..."; - this._buttonFallbackLanguages.UseVisualStyleBackColor = true; - this._buttonFallbackLanguages.Visible = false; - this._buttonFallbackLanguages.Click += new System.EventHandler(this._buttonFallbackLanguages_Click); - // - // toolStrip - // - this.toolStrip.GripStyle = System.Windows.Forms.ToolStripGripStyle.Hidden; - this.toolStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.tbbCopy, - this.toolStripSeparator2, - this.tbbGoogleTranslate, - this.toolStripSeparator3, - this.tcboSearch, - this.tblblSearch}); - this.toolStrip.Location = new System.Drawing.Point(0, 0); - this.toolStrip.Name = "toolStrip"; - this.toolStrip.Size = new System.Drawing.Size(809, 25); - this.toolStrip.TabIndex = 0; - this.toolStrip.Text = "toolStrip1"; - this.toolStrip.Visible = false; - // - // tbbCopy - // - this.tbbCopy.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.mnuCopyText, - this.mnuCopyToolTip, - this.mnuCopyShortcutKeys, - this.toolStripMenuItem1, - this.mnuCopyAll}); - this.tbbCopy.Image = global::L10NSharp.Properties.Resources.kimidCopyTranslationBig; - this.tbbCopy.ImageTransparentColor = System.Drawing.Color.Magenta; - this.tbbCopy.Margin = new System.Windows.Forms.Padding(5, 1, 0, 2); - this.tbbCopy.Name = "tbbCopy"; - this.tbbCopy.Size = new System.Drawing.Size(64, 22); - this.tbbCopy.Text = "Copy"; - this.tbbCopy.Visible = false; - // - // mnuCopyText - // - this.mnuCopyText.Name = "mnuCopyText"; - this.mnuCopyText.ShortcutKeys = ((System.Windows.Forms.Keys)(((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Alt) - | System.Windows.Forms.Keys.T))); - this.mnuCopyText.Size = new System.Drawing.Size(329, 22); - this.mnuCopyText.Text = "Copy Source Translation to Target"; - this.mnuCopyText.Click += new System.EventHandler(this.btnCopyText_Click); - // - // mnuCopyToolTip - // - this.mnuCopyToolTip.Name = "mnuCopyToolTip"; - this.mnuCopyToolTip.ShortcutKeys = ((System.Windows.Forms.Keys)(((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Alt) - | System.Windows.Forms.Keys.O))); - this.mnuCopyToolTip.Size = new System.Drawing.Size(329, 22); - this.mnuCopyToolTip.Text = "Copy Source Tool Tip to Target"; - this.mnuCopyToolTip.Click += new System.EventHandler(this.btnCopyToolTip_Click); - // - // mnuCopyShortcutKeys - // - this.mnuCopyShortcutKeys.Name = "mnuCopyShortcutKeys"; - this.mnuCopyShortcutKeys.ShortcutKeys = ((System.Windows.Forms.Keys)(((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Alt) - | System.Windows.Forms.Keys.S))); - this.mnuCopyShortcutKeys.Size = new System.Drawing.Size(329, 22); - this.mnuCopyShortcutKeys.Text = "Copy Source Shortcut Keys to Target"; - this.mnuCopyShortcutKeys.Click += new System.EventHandler(this.btnCopyShortcutKeys_Click); - // - // toolStripMenuItem1 - // - this.toolStripMenuItem1.Name = "toolStripMenuItem1"; - this.toolStripMenuItem1.Size = new System.Drawing.Size(326, 6); - // - // mnuCopyAll - // - this.mnuCopyAll.Name = "mnuCopyAll"; - this.mnuCopyAll.ShortcutKeys = ((System.Windows.Forms.Keys)(((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Alt) - | System.Windows.Forms.Keys.A))); - this.mnuCopyAll.Size = new System.Drawing.Size(329, 22); - this.mnuCopyAll.Text = "Copy All"; - this.mnuCopyAll.Click += new System.EventHandler(this.mnuCopyAll_Click); - // - // toolStripSeparator2 - // - this.toolStripSeparator2.Name = "toolStripSeparator2"; - this.toolStripSeparator2.Size = new System.Drawing.Size(6, 25); - // - // tbbGoogleTranslate - // - this.tbbGoogleTranslate.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; - this.tbbGoogleTranslate.Enabled = false; - this.tbbGoogleTranslate.Image = global::L10NSharp.Properties.Resources.kimidGoogle; - this.tbbGoogleTranslate.ImageTransparentColor = System.Drawing.Color.Magenta; - this.tbbGoogleTranslate.Margin = new System.Windows.Forms.Padding(5, 1, 0, 2); - this.tbbGoogleTranslate.Name = "tbbGoogleTranslate"; - this.tbbGoogleTranslate.Size = new System.Drawing.Size(23, 22); - this.tbbGoogleTranslate.ToolTipText = "Use Google Translator"; - this.tbbGoogleTranslate.Visible = false; - this.tbbGoogleTranslate.Click += new System.EventHandler(this.HandleTranslatorServiceButtonClick); - // - // toolStripSeparator3 - // - this.toolStripSeparator3.Name = "toolStripSeparator3"; - this.toolStripSeparator3.Size = new System.Drawing.Size(6, 25); - // - // tcboSearch - // - this.tcboSearch.Alignment = System.Windows.Forms.ToolStripItemAlignment.Right; - this.tcboSearch.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; - this.tcboSearch.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; - this.tcboSearch.Margin = new System.Windows.Forms.Padding(3, 0, 1, 0); - this.tcboSearch.Name = "tcboSearch"; - this.tcboSearch.Size = new System.Drawing.Size(170, 23); - this.tcboSearch.Visible = false; - this.tcboSearch.Enter += new System.EventHandler(this.tcboSearch_Enter); - this.tcboSearch.KeyDown += new System.Windows.Forms.KeyEventHandler(this.tcboSearch_KeyDown); - // - // tblblSearch - // - this.tblblSearch.Alignment = System.Windows.Forms.ToolStripItemAlignment.Right; - this.tblblSearch.Margin = new System.Windows.Forms.Padding(3, 1, 0, 2); - this.tblblSearch.Name = "tblblSearch"; - this.tblblSearch.Size = new System.Drawing.Size(45, 22); - this.tblblSearch.Text = "Search:"; - this.tblblSearch.Visible = false; - // - // _statusStrip - // - this._statusStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - this._labelCount, - this._progressBar}); - this._statusStrip.Location = new System.Drawing.Point(0, 497); - this._statusStrip.Name = "_statusStrip"; - this._statusStrip.Size = new System.Drawing.Size(826, 22); - this._statusStrip.TabIndex = 2; - this._statusStrip.Text = "statusStrip1"; - // - // _labelCount - // - this._labelCount.BackColor = System.Drawing.Color.Transparent; - this._labelCount.Margin = new System.Windows.Forms.Padding(0, 3, 5, 2); - this._labelCount.Name = "_labelCount"; - this._labelCount.Size = new System.Drawing.Size(806, 17); - this._labelCount.Spring = true; - this._labelCount.Text = "#"; - this._labelCount.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; - // - // _progressBar - // - this._progressBar.Alignment = System.Windows.Forms.ToolStripItemAlignment.Right; - this._progressBar.Name = "_progressBar"; - this._progressBar.Overflow = System.Windows.Forms.ToolStripItemOverflow.Never; - this._progressBar.Size = new System.Drawing.Size(200, 16); - this._progressBar.Style = System.Windows.Forms.ProgressBarStyle.Continuous; - this._progressBar.Visible = false; - // - // LocalizeItemDlg - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.BackColor = System.Drawing.SystemColors.Control; - this.ClientSize = new System.Drawing.Size(826, 519); - this.Controls.Add(this.splitContainer); - this.Controls.Add(this._panelButtons); - this.Controls.Add(this._statusStrip); - this.Controls.Add(this.toolStrip); - this.DoubleBuffered = true; - this.MaximizeBox = false; - this.MinimizeBox = false; - this.Name = "LocalizeItemDlg"; - this.ShowIcon = false; - this.ShowInTaskbar = false; - this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide; - this.StartPosition = System.Windows.Forms.FormStartPosition.Manual; - this.Text = "Localize User Interface (L10NSharp)"; - this.Load += new System.EventHandler(this.LocalizeItemDlg_Load); - this._groupBoxComment.ResumeLayout(false); - this._groupBoxComment.PerformLayout(); - this._groupBoxImage.ResumeLayout(false); - ((System.ComponentModel.ISupportInitialize)(this._pictureImage)).EndInit(); - this.splitContainer.Panel1.ResumeLayout(false); - this.splitContainer.Panel2.ResumeLayout(false); - ((System.ComponentModel.ISupportInitialize)(this.splitContainer)).EndInit(); - this.splitContainer.ResumeLayout(false); - this._toolStripLeftSide.ResumeLayout(false); - this._toolStripLeftSide.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)(this._grid)).EndInit(); - this._toolStripRightSide.ResumeLayout(false); - this._toolStripRightSide.PerformLayout(); - this._tableLayout.ResumeLayout(false); - this._panelIdentifier.ResumeLayout(false); - this._panelIdentifier.PerformLayout(); - this._panelTargetText.ResumeLayout(false); - this._groupBoxTgtTranslation.ResumeLayout(false); - this._groupBoxTgtTranslation.PerformLayout(); - this._panelSourceText.ResumeLayout(false); - this._groupBoxSrcTranslation.ResumeLayout(false); - this._groupBoxSrcTranslation.PerformLayout(); - this._panelButtons.ResumeLayout(false); - this._panelButtons.PerformLayout(); - this.toolStrip.ResumeLayout(false); - this.toolStrip.PerformLayout(); - this._statusStrip.ResumeLayout(false); - this._statusStrip.PerformLayout(); - this.ResumeLayout(false); - this.PerformLayout(); - - } - - #endregion - - private System.Windows.Forms.TextBox _textBoxTgtTranslation; - private System.Windows.Forms.Label _labelStringId; - private System.Windows.Forms.Button _buttonOK; - private System.Windows.Forms.Button _buttonCancel; - private System.Windows.Forms.Label _labelStringIdValue; - private System.Windows.Forms.GroupBox _groupBoxComment; - private System.Windows.Forms.TextBox _textBoxComment; - private System.Windows.Forms.GroupBox _groupBoxImage; - private System.Windows.Forms.PictureBox _pictureImage; - private System.Windows.Forms.SplitContainer splitContainer; - private System.Windows.Forms.Panel _panelButtons; - private System.Windows.Forms.TreeView _treeView; - private System.Windows.Forms.ToolStrip toolStrip; - private System.Windows.Forms.Label _labelSrcToolTip; - private System.Windows.Forms.GroupBox _groupBoxSrcTranslation; - private System.Windows.Forms.TextBox _textBoxSrcToolTip; - private System.Windows.Forms.TextBox _textBoxSrcShortcutKeys; - private System.Windows.Forms.Label _labelSrcShortcutKeys; - private System.Windows.Forms.GroupBox _groupBoxTgtTranslation; - private System.Windows.Forms.Label _labelTgtShortcutKeys; - private System.Windows.Forms.Label _labelTgtToolTip; - private System.Windows.Forms.TextBox _textBoxTgtToolTip; - private System.Windows.Forms.ToolStripButton tbbGoogleTranslate; - private System.Windows.Forms.TextBox _textBoxSrcTranslation; - private System.Windows.Forms.TableLayoutPanel _tableLayout; - private System.Windows.Forms.Panel _panelIdentifier; - private ShortcutKeysDropDown _shortcutKeysDropDown; - private XButton btnCopyToolTip; - private XButton btnCopyText; - private System.Windows.Forms.ToolTip _tooltip; - private XButton btnCopyShortcutKeys; - private System.Windows.Forms.ToolStripDropDownButton tbbCopy; - private System.Windows.Forms.ToolStripMenuItem mnuCopyText; - private System.Windows.Forms.ToolStripMenuItem mnuCopyToolTip; - private System.Windows.Forms.ToolStripMenuItem mnuCopyShortcutKeys; - private System.Windows.Forms.ToolStripSeparator toolStripMenuItem1; - private System.Windows.Forms.ToolStripMenuItem mnuCopyAll; - private System.Windows.Forms.ToolStripSeparator toolStripSeparator2; - private System.Windows.Forms.ToolStripSeparator toolStripSeparator3; - private System.Windows.Forms.ToolStripComboBox tcboSearch; - private System.Windows.Forms.ToolStripLabel tblblSearch; - private System.Windows.Forms.StatusStrip _statusStrip; - private System.Windows.Forms.ToolStripStatusLabel _labelCount; - private System.Windows.Forms.Button _buttonFallbackLanguages; - private XButton _buttonMovePrev; - private XButton _buttonMoveNext; - private System.Windows.Forms.Panel _panelTargetText; - private System.Windows.Forms.Panel _panelSourceText; - private LmGrid _grid; - private System.Windows.Forms.ToolStripProgressBar _progressBar; - private System.Windows.Forms.ToolStrip _toolStripRightSide; - private System.Windows.Forms.ToolStripComboBox _comboTargetLang; - private System.Windows.Forms.ToolStripLabel _labelTargetLang; - private System.Windows.Forms.ToolStripComboBox _comboSourceLang; - private System.Windows.Forms.ToolStripLabel _labelSourceLang; - private System.Windows.Forms.ToolStrip _toolStripLeftSide; - private System.Windows.Forms.ToolStripLabel _labelGroups; - private System.Windows.Forms.ToolStripSplitButton _buttonBingTranslator; - private System.Windows.Forms.ToolStripMenuItem _menuTranslateUsingBing; - private System.Windows.Forms.ToolStripMenuItem _menuEditSourceAndTranslate; - private System.Windows.Forms.DataGridViewTextBoxColumn _colId; - private System.Windows.Forms.DataGridViewTextBoxColumn _colSourceText; - private System.Windows.Forms.DataGridViewTextBoxColumn _colTargetText; - private System.Windows.Forms.DataGridViewTextBoxColumn _colSrcToolTip; - private System.Windows.Forms.DataGridViewTextBoxColumn _colTgtToolTip; - private System.Windows.Forms.DataGridViewTextBoxColumn _colComments; - private System.Windows.Forms.LinkLabel _howToDistribute; - } -} diff --git a/src/L10NSharp.Windows.Forms/UIComponents/LocalizeItemDlg.cs b/src/L10NSharp.Windows.Forms/UIComponents/LocalizeItemDlg.cs deleted file mode 100644 index add7542..0000000 --- a/src/L10NSharp.Windows.Forms/UIComponents/LocalizeItemDlg.cs +++ /dev/null @@ -1,912 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Linq; -using System.Drawing; -using System.Text; -using System.Windows.Forms; -//using L10NSharp.Properties; -using L10NSharp.Windows.Forms.Properties; -using L10NSharp; - -namespace L10NSharp.Windows.Forms.UIComponents -{ - /// ---------------------------------------------------------------------------------------- - public partial class LocalizeItemDlg : Form - { - public static Font DefaultDisplayFont { get; set; } - - /// ------------------------------------------------------------------------------------ - public delegate void StringsLocalizedHandler(ILocalizationManager localizationManager); - /// ------------------------------------------------------------------------------------ - public delegate string SetDialogSettingsHandler(LocalizeItemDlg dlg); - /// ------------------------------------------------------------------------------------ - public delegate void SaveDialogSettingsHandler(LocalizeItemDlg dlg, string settings); - /// ------------------------------------------------------------------------------------ - public static event SetDialogSettingsHandler SetDialogSettings; - /// ------------------------------------------------------------------------------------ - public static event SaveDialogSettingsHandler SaveDialogSettings; - /// ------------------------------------------------------------------------------------ - public static event StringsLocalizedHandler StringsLocalized; - - private readonly LocalizeItemDlgViewModel _viewModel; - private readonly ILocalizationManagerInternal _callingManager; - private int _tmpSplitDistance; - private DateTime _timeToGiveUpLookingForTranslator; - - - /// ------------------------------------------------------------------------------------ - internal static DialogResult ShowDialog(ILocalizationManagerInternal callingManager, - IComponent component, bool runInReadonlyMode, IWin32Window owner = null) - { - if (callingManager != null && !callingManager.CanCustomizeLocalizations) - runInReadonlyMode = true; - - var viewModel = new LocalizeItemDlgViewModel(runInReadonlyMode); - - var id = (callingManager == null ? viewModel.GetObjIdFromAnyCache(component) : - callingManager.ComponentCache.FirstOrDefault(kvp => kvp.Key == component).Value); - - using (var dlg = new LocalizeItemDlg(viewModel, id, callingManager)) - { - if (owner != null) - dlg.StartPosition = FormStartPosition.CenterParent; - return dlg.ShowDialog(owner); - } - } - - /// ------------------------------------------------------------------------------------ - internal static DialogResult ShowDialog(ILocalizationManagerInternal callingManager, - string id, bool runInReadonlyMode, IWin32Window owner = null) - { - if (callingManager != null && !callingManager.CanCustomizeLocalizations) - runInReadonlyMode = true; - - var viewModel = new LocalizeItemDlgViewModel(runInReadonlyMode); - - using (var dlg = new LocalizeItemDlg(viewModel, id, callingManager)) - { - if (owner != null) - dlg.StartPosition = FormStartPosition.CenterParent; - return dlg.ShowDialog(owner); - } - } - - #region Constrution/initialization - /// ------------------------------------------------------------------------------------ - private LocalizeItemDlg() - { - if (DefaultDisplayFont == null) - DefaultDisplayFont = SystemFonts.MenuFont; - - InitializeComponent(); - } - - /// ------------------------------------------------------------------------------------ - private LocalizeItemDlg(LocalizeItemDlgViewModel viewModel, string id, - ILocalizationManagerInternal callingManager) : this() - { - _viewModel = viewModel; - _callingManager = callingManager; - - Initialize(); - - if (id == null) - return; - - var node = _viewModel.FindNode(id, _treeView.Nodes); - if (node == null) - return; - - _viewModel.CurrentNode = node; - _treeView.SelectedNode = node; - UpdateSingleItemView(); - } - - /// ------------------------------------------------------------------------------------ - private void Initialize() - { - _tableLayout.Dock = DockStyle.Fill; - _grid.Dock = DockStyle.Fill; - - _tableLayout.BringToFront(); - _grid.BringToFront(); - - _toolStripLeftSide.Renderer = new NoToolStripBorderRenderer(); - _toolStripRightSide.Renderer = new NoToolStripBorderRenderer(); - - InitializeColorsAndFonts(); - - GetDialogBoxSettings(); - - _comboSourceLang.Items.AddRange(LocalizationManagerInternal.GetUILanguages(true).ToArray()); - _comboTargetLang.Items.AddRange(LocalizationManagerInternal.GetUILanguages(false).ToArray()); - _comboSourceLang.ComboBox.DisplayMember = "NativeName"; - _comboTargetLang.ComboBox.DisplayMember = "NativeName"; - - UpdateLanguageSensitiveControls(); - _viewModel.LoadTreeNodes(_treeView); - _labelCount.Text = _viewModel.GetNumberOfTranslatedItemsString(); - _grid.MultiSelect = true; - UpdateGridSortGlyph(); - } - - /// ------------------------------------------------------------------------------------ - private void InitializeColorsAndFonts() - { - _textBoxSrcTranslation.BackColor = PaintingHelper.CalculateColor(SystemColors.Control, Color.White, 140); - _textBoxSrcToolTip.BackColor = _textBoxSrcTranslation.BackColor; - _textBoxSrcShortcutKeys.BackColor = _textBoxSrcTranslation.BackColor; - btnCopyText.BackColor = _textBoxSrcTranslation.BackColor; - btnCopyToolTip.BackColor = _textBoxSrcTranslation.BackColor; - btnCopyShortcutKeys.BackColor = _textBoxSrcTranslation.BackColor; - - _grid.Font = DefaultDisplayFont; - _grid.ColumnHeadersDefaultCellStyle.Font = DefaultDisplayFont; - _shortcutKeysDropDown.Font = DefaultDisplayFont; - _textBoxSrcTranslation.Font = DefaultDisplayFont; - _colSrcToolTip.DefaultCellStyle.Font = DefaultDisplayFont; - _colTgtToolTip.DefaultCellStyle.Font = DefaultDisplayFont; - _treeView.Font = DefaultDisplayFont; - _textBoxSrcToolTip.Font = new Font(DefaultDisplayFont.FontFamily, - _textBoxSrcToolTip.Font.SizeInPoints, FontStyle.Regular); - } - - /// ------------------------------------------------------------------------------------ - /// - /// Get the splitter position from the caller. - /// - /// ------------------------------------------------------------------------------------ - protected override void OnShown(EventArgs e) - { - base.OnShown(e); - - if (_tmpSplitDistance > 0) - splitContainer.SplitterDistance = _tmpSplitDistance; - - _grid.AutoResizeColumnHeadersHeight(); - _grid.ColumnHeadersHeight += 8; - - _grid.Visible = (_grid.RowCount > 0); - _tableLayout.Visible = (_grid.RowCount == 0); - - _treeView.AfterSelect -= HandleTreeViewAfterSelect; - _treeView.AfterSelect += HandleTreeViewAfterSelect; - _viewModel.SetNodeColors(); - Activate(); - - if (_viewModel.CurrentNode == null && _treeView.Nodes.Count > 0) - { - _treeView.Nodes[0].Expand(); - Application.DoEvents(); - HandleTreeViewAfterSelect(null, new TreeViewEventArgs(_treeView.Nodes[0])); - } - - if (_viewModel.BingTranslator != null) - { - _buttonBingTranslator.Enabled = true; - return; - } - - // Attempt to enable the translator button for 5 seconds. - _timeToGiveUpLookingForTranslator = DateTime.Now.AddSeconds(5d); - Application.Idle += HandleCheckingForTranslator; - } - - /// ------------------------------------------------------------------------------------ - void HandleCheckingForTranslator(object sender, EventArgs e) - { - _buttonBingTranslator.Enabled = - (_viewModel.BingTranslator != null && _viewModel.CurrentNode != null); - - if (_buttonBingTranslator.Enabled || DateTime.Now >= _timeToGiveUpLookingForTranslator) - Application.Idle -= HandleCheckingForTranslator; - } - - #endregion - - #region Misc. updating methods - /// ------------------------------------------------------------------------------------ - private void UpdateLanguageSensitiveControls() - { - var ci = L10NCultureInfo.GetCultureInfo(_viewModel.SrcLangId); - _comboSourceLang.SelectedItem = ci; - _comboSourceLang.ToolTipText = ci.DisplayName; - _groupBoxSrcTranslation.Text = _colSourceText.HeaderText = ci.NativeName; - _colSrcToolTip.HeaderText = string.Format("{0} Tooltip", ci.NativeName); - - ci = L10NCultureInfo.GetCultureInfo(_viewModel.TgtLangId); - _comboTargetLang.SelectedItem = ci; - _comboTargetLang.ToolTipText = ci.DisplayName; - _groupBoxTgtTranslation.Text = _colTargetText.HeaderText = ci.NativeName; - _colTgtToolTip.HeaderText = string.Format("{0} Tooltip", ci.NativeName); - } - - /// ------------------------------------------------------------------------------------ - private void UpdateViewAfterSavingChange() - { - _viewModel.SetNodeColors(); - _labelCount.Text = _viewModel.GetNumberOfTranslatedItemsString(); - } - - #endregion - - #region Methods for updating and saving changes in the single-item view - /// ------------------------------------------------------------------------------------ - private void ResetSingleItemView() - { - _buttonBingTranslator.Enabled = - (_viewModel.BingTranslator != null && _viewModel.CurrentNode != null); - - _groupBoxImage.Visible = false; - - _labelSrcToolTip.Enabled = _labelTgtToolTip.Enabled = false; - _textBoxSrcToolTip.Enabled = _textBoxTgtToolTip.Enabled = false; - _labelSrcShortcutKeys.Enabled = _labelTgtShortcutKeys.Enabled = false; - _textBoxSrcShortcutKeys.Enabled = _shortcutKeysDropDown.Enabled = false; - _groupBoxComment.Enabled = _groupBoxSrcTranslation.Enabled = _groupBoxTgtTranslation.Enabled = false; - _labelStringId.Enabled = false; - - _labelStringIdValue.Text = string.Empty; - _textBoxSrcTranslation.Text = string.Empty; - _textBoxTgtTranslation.Text = string.Empty; - _textBoxSrcToolTip.Text = string.Empty; - _textBoxTgtToolTip.Text = string.Empty; - _textBoxSrcShortcutKeys.Text = string.Empty; - _textBoxComment.Text = string.Empty; - } - - /// ------------------------------------------------------------------------------------ - private void UpdateSingleItemView() - { - UtilsWinforms.SetWindowRedraw(this, false, false); - - ResetSingleItemView(); - - if (_viewModel.CurrentNode == null || _viewModel.CurrentNode.Id == null) - { - UtilsWinforms.SetWindowRedraw(this, true, true); - return; - } - - _textBoxTgtTranslation.Enabled = _textBoxTgtToolTip.Enabled = _groupBoxTgtTranslation.Enabled = - (_viewModel.CurrentNode.Id != null && !_viewModel.TgtLangId.StartsWith(LocalizationManager.kDefaultLang)); - - _groupBoxComment.Enabled = _groupBoxSrcTranslation.Enabled = (_viewModel.CurrentNode.Id != null); - - _labelStringId.Enabled = (_viewModel.CurrentNode.Id != null); - _labelStringIdValue.Text = _viewModel.CurrentNode.Id; - _textBoxSrcTranslation.Text = _viewModel.CurrentNodeSourceText; - _textBoxTgtTranslation.Text = _viewModel.CurrentNodeTargetText; - _textBoxSrcToolTip.Text = _viewModel.CurrentNodeSourceToolTip; - _textBoxTgtToolTip.Text = _viewModel.CurrentNodeTargetToolTip; - _textBoxSrcShortcutKeys.Text = _viewModel.CurrentNodeSourceShortcutKeys; - _shortcutKeysDropDown.ShortcutKeysAsString = _viewModel.CurrentNodeTargetShortcutKeys; - _textBoxComment.Text = _viewModel.CurrentNodeComment; - - //btnCopyText.Enabled = (txtSrcTranslation.Text != string.Empty); - //btnCopyToolTip.Enabled = (txtSrcToolTip.Text != string.Empty); - //btnCopyShortcutKeys.Enabled = (txtSrcShortcutKeys.Text != string.Empty); - - _textBoxSrcTranslation.Text = _textBoxSrcTranslation.Text.Replace( - LocalizedStringCache.s_literalNewline, Environment.NewLine); - - _textBoxTgtTranslation.Text = _textBoxTgtTranslation.Text.Replace( - LocalizedStringCache.s_literalNewline, Environment.NewLine); - - _textBoxTgtTranslation.SelectAll(); - var component = _viewModel.GetFirstObjectForId(); - - if (component != null) - UpdateSingleItemViewForComponent(component); - - var fnt = _viewModel.GetFontForObject(component); - - _textBoxSrcTranslation.Font = fnt; - _textBoxTgtTranslation.Font = fnt; - _colSourceText.DefaultCellStyle.Font = fnt; - _colTargetText.DefaultCellStyle.Font = fnt; - - UtilsWinforms.SetWindowRedraw(this, true, true); - } - - /// ------------------------------------------------------------------------------------ - private void UpdateSingleItemViewForComponent(IComponent component) - { - var img = _viewModel.GetObjectsImage(component); - if (img != null) - { - _pictureImage.Image = img; - _groupBoxImage.Visible = true; - } - - if (component is Control) - { - _labelSrcToolTip.Enabled = _labelTgtToolTip.Enabled = true; - _textBoxSrcToolTip.Enabled = _textBoxTgtToolTip.Enabled = true; - } - else if (component is ToolStripItem) - { - _labelSrcToolTip.Enabled = _labelTgtToolTip.Enabled = true; - _textBoxSrcToolTip.Enabled = _textBoxTgtToolTip.Enabled = true; - - if (component is ToolStripMenuItem) - { - _labelSrcShortcutKeys.Enabled = _labelTgtShortcutKeys.Enabled = true; - _textBoxSrcShortcutKeys.Enabled = _shortcutKeysDropDown.Enabled = true; - } - } - } - - /// ------------------------------------------------------------------------------------ - private void SaveChangesFromSingleItemView() - { - var node = _viewModel.CurrentNode; - - if (_grid.Visible || node == null) - return; - - var locInfo = new LocalizingInfoWinforms(node.Id); - locInfo.Text = _textBoxTgtTranslation.Text.Trim(); - locInfo.ToolTipText = _textBoxTgtToolTip.Text.Trim(); - locInfo.ShortcutKeys = _shortcutKeysDropDown.Text.Trim(); - locInfo.Comment = _textBoxComment.Text.Trim(); - - _viewModel.SaveChangesInMemory(locInfo); - UpdateViewAfterSavingChange(); - } - - #endregion - - #region Methods for handling the form closing - /// ------------------------------------------------------------------------------------ - /// - /// Allow delegates to save some settings. - /// - /// ------------------------------------------------------------------------------------ - protected override void OnFormClosing(FormClosingEventArgs e) - { - base.OnFormClosing(e); - - SaveDialogBoxSettings(); - - if (DialogResult != DialogResult.OK) - { - if (e.CloseReason == CloseReason.None || !_viewModel.GetIsDirty()) - return; - - var result = MessageBox.Show(this, "Would you like to save your changes?", - Application.ProductName, MessageBoxButtons.YesNoCancel); - - if (result != DialogResult.Yes) - { - e.Cancel = (result == DialogResult.Cancel); - return; - } - } - - if (!_grid.Visible) - SaveChangesFromSingleItemView(); - else if (_grid.IsCurrentCellInEditMode) - _grid.EndEdit(DataGridViewDataErrorContexts.Commit); - - if (_viewModel.Save()) - { - foreach (var manager in _viewModel.GetModifiedManagers()) - FireStringsLocalizedEvent(manager); - } - } - - /// ------------------------------------------------------------------------------------ - internal static void FireStringsLocalizedEvent(ILocalizationManager lm) - { - StringsLocalized?.Invoke(lm); - } - - #endregion - - #region Saving and Getting Settings - /// ------------------------------------------------------------------------------------ - private void SaveDialogBoxSettings() - { - var bldr = new StringBuilder(); - bldr.AppendFormat("{0},", _viewModel.SrcLangId); - bldr.AppendFormat("{0},", _viewModel.TgtLangId); - bldr.AppendFormat("{0},", Bounds.X); - bldr.AppendFormat("{0},", Bounds.Y); - bldr.AppendFormat("{0},", Bounds.Width); - bldr.AppendFormat("{0},", Bounds.Height); - bldr.AppendFormat("{0},", splitContainer.SplitterDistance); - bldr.AppendFormat("{0},", (int)_viewModel.GridSortField); - - if (_viewModel.GridSortOrder == SortOrder.None) - bldr.AppendFormat("{0},", 0); - else - bldr.AppendFormat("{0},", _viewModel.GridSortOrder == SortOrder.Ascending ? 1 : 2); - - foreach (DataGridViewColumn col in _grid.Columns) - bldr.AppendFormat("{0},", col.Width); - - var allSettings = bldr.ToString().TrimEnd(','); - - if (SaveDialogSettings != null) - SaveDialogSettings(this, allSettings); - - Settings.Default.LocalizationDialogSettings = allSettings; - Settings.Default.Save(); - } - - /// ------------------------------------------------------------------------------------ - private void GetDialogBoxSettings() - { - var allSettings = (SetDialogSettings != null ? SetDialogSettings(this) : - Settings.Default.LocalizationDialogSettings); - - if (string.IsNullOrEmpty(allSettings)) - return; - - var settings = allSettings.Split(','); - if (settings.Length < 9) - return; - - try - { - if (_viewModel.SrcLangId == _viewModel.TgtLangId) - { - var srcLangId = settings[0]; - var tgtLangId = settings[1]; - _viewModel.SetLanguageIds(srcLangId, tgtLangId); - } - } - catch - { - _viewModel.SetLanguageIds(null, null); - } - - try - { - var bounds = Bounds; - int value; - - if (int.TryParse(settings[2], out value)) - bounds.X = value; - if (int.TryParse(settings[3], out value)) - bounds.Y = value; - if (int.TryParse(settings[4], out value)) - bounds.Width = value; - if (int.TryParse(settings[5], out value)) - bounds.Height = value; - - Bounds = bounds; - - if (int.TryParse(settings[6], out value)) - _tmpSplitDistance = value; - if (int.TryParse(settings[7], out value)) - _viewModel.GridSortField = (NodeComparer.SortField)value; - if (int.TryParse(settings[8], out value)) - _viewModel.GridSortOrder = (value == 2 ? SortOrder.Descending : SortOrder.Ascending); - - int i = 9; - foreach (DataGridViewColumn col in _grid.Columns) - { - if (i == settings.Length) - return; - - if (int.TryParse(settings[i++], out value)) - col.Width = value; - } - } - catch { } - } - - #endregion - - #region Methods for kicking off a translation - /// ------------------------------------------------------------------------------------ - /// - /// Translate the source text using Bing translating service. - /// - /// ------------------------------------------------------------------------------------ - private void HandleTranslatorServiceButtonClick(object sender, EventArgs e) - { - Dictionary> nodesToTranslate = null; - - if (!_grid.Visible) - { - nodesToTranslate = new Dictionary>(); - nodesToTranslate[0] = _treeView.SelectedNode as LocTreeNode; - } - else - { - if (_grid.IsCurrentCellInEditMode) - { - _grid.EndEdit(DataGridViewDataErrorContexts.Commit); - _grid.CurrentCell = _grid[0, _grid.CurrentCellAddress.Y]; - } - - nodesToTranslate = _grid.SelectedRows.Cast().OrderBy(r => r.Index) - .ToDictionary(r => r.Index, r => _viewModel.AllLeafNodesShowingInGrid[r.Index]); - } - - TranslateSelectedItems(nodesToTranslate); - } - - /// ------------------------------------------------------------------------------------ - private void TranslateSelectedItems(IDictionary> nodesToTranslate) - { - if (nodesToTranslate == null || nodesToTranslate.Count == 0) - return; - - _progressBar.Visible = true; - _progressBar.Maximum = nodesToTranslate.Count; - _progressBar.Value = 0; - Cursor = Cursors.WaitCursor; - - _viewModel.Translate(nodesToTranslate, (progressBarValue, translatedNodeIndex) => - { - _progressBar.Value = progressBarValue; - - if (_grid.Visible) - _grid.InvalidateRow(translatedNodeIndex); - else - UpdateSingleItemView(); - - _labelCount.Text = _viewModel.GetNumberOfTranslatedItemsString(); - }); - - while (_viewModel.TranslatorBusy) - Application.DoEvents(); - - _progressBar.Visible = false; - _viewModel.SetNodeColors(); - Cursor = Cursors.Default; - } - - #endregion - - #region TreeView event handlers - /// ------------------------------------------------------------------------------------ - /// - /// Update the string cache for the node the user is leaving. - /// - /// ------------------------------------------------------------------------------------ - private void HandleTreeViewBeforeSelect(object sender, TreeViewCancelEventArgs e) - { - SaveChangesFromSingleItemView(); - } - - /// ------------------------------------------------------------------------------------ - /// - /// Update the right side of the dialog with the information for the node just selected. - /// - /// ------------------------------------------------------------------------------------ - private void HandleTreeViewAfterSelect(object sender, TreeViewEventArgs e) - { - var node = e.Node as LocTreeNode; - - _grid.RowCount = 0; - - if (node == null) - return; - - Cursor = Cursors.WaitCursor; - _viewModel.CurrentNode = node; - _grid.RowCount = _viewModel.AllLeafNodesShowingInGrid.Count; - _grid.Visible = (_grid.RowCount > 0); - _tableLayout.Visible = (_grid.RowCount == 0); - UpdateSingleItemView(); - _grid.AutoResizeRows(DataGridViewAutoSizeRowsMode.AllCellsExceptHeaders); - Cursor = Cursors.Default; - } - - #endregion - - #region Event handlers for for copying, moving from item to item and for searching - /// ------------------------------------------------------------------------------------ - /// - /// Handles the Click event of the btnCopyText control. - /// - /// ------------------------------------------------------------------------------------ - private void btnCopyText_Click(object sender, EventArgs e) - { - //txtTgtTranslation.Text = txtSrcTranslation.Text; - //txtTgtTranslation.SelectAll(); - //txtTgtTranslation.Focus(); - } - - /// ------------------------------------------------------------------------------------ - /// - /// Handles the Click event of the btnCopyToolTip control. - /// - /// ------------------------------------------------------------------------------------ - private void btnCopyToolTip_Click(object sender, EventArgs e) - { - //txtTgtToolTip.Text = txtSrcToolTip.Text; - //txtTgtToolTip.SelectAll(); - //txtTgtToolTip.Focus(); - } - - /// ------------------------------------------------------------------------------------ - /// - /// Handles the Click event of the btnCopyShortcutKeys control. - /// - /// ------------------------------------------------------------------------------------ - private void btnCopyShortcutKeys_Click(object sender, EventArgs e) - { - //shortcutKeysDropDown.ShortcutKeysAsString = txtSrcShortcutKeys.Text; - } - - /// ------------------------------------------------------------------------------------ - /// - /// Handles the Click event of the mnuCopyAll control. - /// - /// ------------------------------------------------------------------------------------ - private void mnuCopyAll_Click(object sender, EventArgs e) - { - //txtTgtTranslation.Text = txtSrcTranslation.Text; - //txtTgtToolTip.Text = txtSrcToolTip.Text; - //shortcutKeysDropDown.ShortcutKeysAsString = txtSrcShortcutKeys.Text; - } - - /// ------------------------------------------------------------------------------------ - /// - /// Handles the KeyDown event of the tcboSearch control. - /// - /// ------------------------------------------------------------------------------------ - private void tcboSearch_KeyDown(object sender, KeyEventArgs e) - { - if (e.KeyCode != Keys.Enter) - return; - - var text = tcboSearch.Text.Trim(); - if (text == string.Empty) - return; - - if (tcboSearch.Items.Contains(text)) - tcboSearch.Items.Remove(text); - - tcboSearch.Items.Insert(0, text); - tcboSearch.Text = text; - tcboSearch.SelectAll(); - - // TODO: Do search - } - - /// ------------------------------------------------------------------------------------ - private void tcboSearch_Enter(object sender, EventArgs e) - { - tcboSearch.SelectAll(); - } - - /// ------------------------------------------------------------------------------------ - /// - /// Move to the previous leaf node in the tree. - /// - /// ------------------------------------------------------------------------------------ - private void _buttonMovePrev_Click(object sender, EventArgs e) - { - //int i = _leafNodes.IndexOf(tvGroups.SelectedNode as LocTreeNode); - //if (i - 1 >= 0) - // tvGroups.SelectedNode = _leafNodes[i - 1]; - } - - /// ------------------------------------------------------------------------------------ - /// - /// Move to the next leaf node in the tree. - /// - /// ------------------------------------------------------------------------------------ - private void _buttonMoveNext_Click(object sender, EventArgs e) - { - //int i = _leafNodes.IndexOf(tvGroups.SelectedNode as LocTreeNode); - //if (i >= 0 && i + 1 < _leafNodes.Count) - // tvGroups.SelectedNode = _leafNodes[i + 1]; - } - - #endregion - - #region Language ComboBox event handlers - /// ------------------------------------------------------------------------------------ - private void HandleEditSourceBeforeTranslatingUsingBing(object sender, EventArgs e) - { - _viewModel.ShowEditSourceBeforeTranslatingDlg(this); - } - - /// ------------------------------------------------------------------------------------ - private void HandleSourceLangChanged(object sender, EventArgs e) - { - SaveChangesFromSingleItemView(); - _viewModel.SrcLangId = ((L10NCultureInfo)_comboSourceLang.SelectedItem).Name; - UpdateLanguageSensitiveControls(); - UpdateSingleItemView(); - _viewModel.SetNodeColors(); - } - - /// ------------------------------------------------------------------------------------ - private void HandleTargetLangChanged(object sender, EventArgs e) - { - SaveChangesFromSingleItemView(); - _viewModel.TgtLangId = ((L10NCultureInfo)_comboTargetLang.SelectedItem).Name; - UpdateLanguageSensitiveControls(); - UpdateSingleItemView(); - _viewModel.SetNodeColors(); - } - - #endregion - - #region Grid event handlers - /// ------------------------------------------------------------------------------------ - private void HandleGridCellPainting(object sender, DataGridViewCellPaintingEventArgs e) - { - if (e.ColumnIndex == -1 && e.RowIndex == -1) - { - // Draw an icon in the upper, left cell where the user can click to select all the rows. - e.Paint(e.CellBounds, e.PaintParts); - e.Handled = true; - var img = Resources.SelectAllRows; - var rc = new Rectangle(0, 0, img.Width, img.Height); - rc.X = e.CellBounds.X + (int)(Math.Round((e.CellBounds.Width - img.Width) / 2f, MidpointRounding.AwayFromZero)); - rc.Y = e.CellBounds.Y + (int)(Math.Round((e.CellBounds.Height - img.Height) / 2f, MidpointRounding.AwayFromZero)); - e.Graphics.DrawImage(img, rc); - } - } - - /// ------------------------------------------------------------------------------------ - private void HandleGridCellMouseEnter(object sender, DataGridViewCellEventArgs e) - { - if (e.ColumnIndex == -1 && e.RowIndex == -1) - { - var pt = PointToClient(MousePosition); - pt.Y += (SystemInformation.CaptionHeight + Cursor.Size.Height - 3); - _tooltip.Show("Select All Rows", this, pt); - } - } - - /// ------------------------------------------------------------------------------------ - private void HandleGridCellMouseLeave(object sender, DataGridViewCellEventArgs e) - { - if (e.ColumnIndex == -1 && e.RowIndex == -1) - _tooltip.Hide(_grid); - } - - /// ------------------------------------------------------------------------------------ - private void HandleGridCurrentRowChanged(object sender, EventArgs e) - { - _viewModel.SetCurrentNodeFromGridIndex(_grid.CurrentCellAddress.Y); - } - - /// ------------------------------------------------------------------------------------ - private void HandleGridCellFormatting(object sender, DataGridViewCellFormattingEventArgs e) - { - var gridNodes = _viewModel.AllLeafNodesShowingInGrid; - - if (gridNodes == null || e.RowIndex >= gridNodes.Count || e.ColumnIndex < 1 || e.ColumnIndex > 2) - return; - - var node = gridNodes[e.RowIndex]; - var objInfo = node.Manager.ComponentCache.FirstOrDefault(kvp => kvp.Value == node.Id); - e.CellStyle.Font = _viewModel.GetFontForObject(objInfo.Key); - } - - /// ------------------------------------------------------------------------------------ - private void HandleGridCellValueNeeded(object sender, DataGridViewCellValueEventArgs e) - { - var parentNode = _treeView.SelectedNode as LocTreeNode; - - switch (e.ColumnIndex) - { - case 0: e.Value = _viewModel.GetStringIdForGridIndex(e.RowIndex, parentNode.Name); break; - case 1: e.Value = _viewModel.GetSourceTextForGridIndex(e.RowIndex); break; - case 2: e.Value = _viewModel.GetTargetTextForGridIndex(e.RowIndex); break; - case 3: e.Value = _viewModel.GetSourceToolTipForGridIndex(e.RowIndex); break; - case 4: e.Value = _viewModel.GetTargetToolTipForGridIndex(e.RowIndex); break; - case 5: e.Value = _viewModel.GetCommentForGridIndex(e.RowIndex); break; - default: e.Value = null; break; - } - } - - /// ------------------------------------------------------------------------------------ - private void HandleGridCellValuePushed(object sender, DataGridViewCellValueEventArgs e) - { - if (_viewModel.AllLeafNodesShowingInGrid == null || e.RowIndex >= _viewModel.AllLeafNodesShowingInGrid.Count) - return; - - var locInfo = new LocalizingInfoWinforms(_viewModel.CurrentNode.Id); - locInfo.UpdateFields = UpdateFields.None; - switch (e.ColumnIndex) - { - case 2: - locInfo.Text = (e.Value as string) ?? string.Empty; - locInfo.UpdateFields = UpdateFields.Text; - break; - - case 4: - locInfo.ToolTipText = (e.Value as string) ?? string.Empty; - locInfo.UpdateFields = UpdateFields.ToolTip; - break; - - case 5: - locInfo.Comment = (e.Value as string) ?? string.Empty; - locInfo.UpdateFields = UpdateFields.Comment; - break; - - default: return; - } - - _viewModel.SaveChangesInMemory(locInfo); - UpdateViewAfterSavingChange(); - } - - /// ------------------------------------------------------------------------------------ - private void HandleColumnHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e) - { - var sortColumn = (int)_viewModel.GridSortField; - - if (sortColumn != e.ColumnIndex) - _viewModel.GridSortOrder = SortOrder.Ascending; - else - { - _viewModel.GridSortOrder = (_grid.Columns[sortColumn].HeaderCell.SortGlyphDirection == SortOrder.Ascending ? - SortOrder.Descending : SortOrder.Ascending); - } - - _viewModel.GridSortField = (NodeComparer.SortField)e.ColumnIndex; - UpdateGridSortGlyph(); - _viewModel.SortGridNodes(); - _viewModel.SetCurrentNodeFromGridIndex(_grid.CurrentCellAddress.Y); - _grid.Invalidate(); - } - - /// ------------------------------------------------------------------------------------ - private void UpdateGridSortGlyph() - { - var sortColumn = (int)_viewModel.GridSortField; - - foreach (DataGridViewColumn col in _grid.Columns) - col.HeaderCell.SortGlyphDirection = SortOrder.None; - - _grid.Columns[sortColumn].HeaderCell.SortGlyphDirection = _viewModel.GridSortOrder; - } - - #endregion - - /// ------------------------------------------------------------------------------------ - private void _buttonFallbackLanguages_Click(object sender, EventArgs e) - { - // TODO: Uncomment this button and test to see if the fallback system works. - using (var dlg = new FallbackLanguagesDlg()) - { - if (dlg.ShowDialog(this) == DialogResult.OK) - LocalizationManagerInternal.FallbackLanguageIds = dlg.FallbackLanguageIds.ToList(); - } - } - - /// ------------------------------------------------------------------------------------ - /// - /// Paint a faint line between the source translation and the source tooltip and - /// shortcut keys text boxes. - /// - /// ------------------------------------------------------------------------------------ - private void HandleGroupSrcTranslationPaint(object sender, PaintEventArgs e) - { - using (var pen = new Pen(PaintingHelper.CalculateColor(Color.Black, Color.White, 45))) - { - e.Graphics.DrawLine(pen, _textBoxSrcTranslation.Left, _textBoxSrcTranslation.Bottom + 5, - _textBoxSrcTranslation.Right - 1, _textBoxSrcTranslation.Bottom + 5); - } - } - - private void _howToDistribute_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) - { - using (var dlg = new HowToDistributeDialog(LocalizationManager.EmailForSubmissions, - _callingManager.GetPathForLanguage(_viewModel.TgtLangId, true))) - { - dlg.ShowDialog(); - } - } - - private void LocalizeItemDlg_Load(object sender, EventArgs e) - { - - } - } -} diff --git a/src/L10NSharp.Windows.Forms/UIComponents/LocalizeItemDlg.resx b/src/L10NSharp.Windows.Forms/UIComponents/LocalizeItemDlg.resx deleted file mode 100644 index dd8299f..0000000 --- a/src/L10NSharp.Windows.Forms/UIComponents/LocalizeItemDlg.resx +++ /dev/null @@ -1,156 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - 506, 11 - - - 111, 17 - - - True - - - True - - - True - - - True - - - True - - - True - - - 329, 17 - - - 17, 17 - - - 214, 17 - - - 41 - - \ No newline at end of file diff --git a/src/L10NSharp.Windows.Forms/UIComponents/LocalizeItemDlgViewModel.cs b/src/L10NSharp.Windows.Forms/UIComponents/LocalizeItemDlgViewModel.cs deleted file mode 100644 index af3ba82..0000000 --- a/src/L10NSharp.Windows.Forms/UIComponents/LocalizeItemDlgViewModel.cs +++ /dev/null @@ -1,592 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Drawing; -using System.Linq; -using System.Windows.Forms; -using L10NSharp.Translators; -using L10NSharp; - -namespace L10NSharp.Windows.Forms.UIComponents -{ - internal class LocalizeItemDlgViewModel - { - private bool _runInReadonlyMode; - private readonly Color _untranslatedNodeColor = Color.Peru; - private string _tgtLangId; - private string _srcLangId; - private LocTreeNode _currentNode; - private TreeNodeCollection _allNodes; - private BackgroundWorker _translationWorker; - - public List> AllLeafNodesShowingInGrid { get; private set; } - public List> AllLeafNodes { get; private set; } - public List> EnabledManagers; - private readonly Dictionary, HashSet> _modifiedManagersAndLanguages = - new Dictionary, HashSet>(); - public ITranslator BingTranslator { get; private set; } - public NodeComparer.SortField GridSortField { get; set; } - public SortOrder GridSortOrder { get; set; } - - /// ------------------------------------------------------------------------------------ - public LocalizeItemDlgViewModel(bool runInReadonlyMode) - { - _runInReadonlyMode = runInReadonlyMode; - AllLeafNodesShowingInGrid = new List>(); - SetLanguageIds(null, null); - } - - /// ------------------------------------------------------------------------------------ - public void SetLanguageIds(string srcLangId, string tgtLangId) - { - _srcLangId = srcLangId ?? LocalizationManagerInternal.FallbackLanguageIds.ToArray()[0]; - _tgtLangId = tgtLangId ?? LocalizationManager.UILanguageId; - CreateTranslator(); - } - - #region Properties - /// ------------------------------------------------------------------------------------ - public string SrcLangId - { - get { return _srcLangId; } - set - { - _srcLangId = value; - CreateTranslator(); - } - } - - /// ------------------------------------------------------------------------------------ - public string TgtLangId - { - get { return _tgtLangId; } - set - { - _tgtLangId = value; - CreateTranslator(); - } - } - - /// ------------------------------------------------------------------------------------ - public LocTreeNode CurrentNode - { - get { return _currentNode; } - set - { - _currentNode = value; - - AllLeafNodesShowingInGrid = (_currentNode == null || _currentNode.FirstNode == null ? - new List>() : GetLeafNodesOfNode(_currentNode).ToList()); - - SortGridNodes(); - } - } - - /// ------------------------------------------------------------------------------------ - public void SetCurrentNodeFromGridIndex(int index) - { - if (index >= 0 && index < AllLeafNodesShowingInGrid.Count) - _currentNode = AllLeafNodesShowingInGrid[index]; - } - - /// ------------------------------------------------------------------------------------ - public string CurrentNodeSourceText - { - get { return (_currentNode != null ? _currentNode.GetText(_srcLangId) : null); } - } - - /// ------------------------------------------------------------------------------------ - public string CurrentNodeTargetText - { - get - { - if (_currentNode == null) - return null; - - return (_currentNode.GetTranslatedText(_tgtLangId) ?? _currentNode.GetText(_tgtLangId)); - } - } - - /// ------------------------------------------------------------------------------------ - public string CurrentNodeSourceToolTip - { - get { return (_currentNode != null ? _currentNode.GetToolTip(_srcLangId) : null); } - } - - /// ------------------------------------------------------------------------------------ - public string CurrentNodeTargetToolTip - { - get - { - if (_currentNode == null) - return null; - - return (_currentNode.GetTranslatedToolTip(_tgtLangId) ?? _currentNode.GetToolTip(_tgtLangId)); - } - } - - /// ------------------------------------------------------------------------------------ - public string CurrentNodeSourceShortcutKeys - { - get { return (_currentNode != null ? _currentNode.GetShortcutKeys(_srcLangId) : null); } - } - - /// ------------------------------------------------------------------------------------ - public string CurrentNodeTargetShortcutKeys - { - get - { - if (_currentNode == null) - return null; - - return (_currentNode.GetTranslatedShortcutKeys(_tgtLangId) ?? _currentNode.GetShortcutKeys(_tgtLangId)); - } - } - - /// ------------------------------------------------------------------------------------ - public string CurrentNodeComment - { - get { return (_currentNode != null ? _currentNode.GetComment() : null); } - } - - /// ------------------------------------------------------------------------------------ - public bool TranslatorBusy - { - get { return (_translationWorker != null && _translationWorker.IsBusy); } - } - - #endregion - - /// ------------------------------------------------------------------------------------ - private void CreateTranslator() - { - var worker = new BackgroundWorker(); - worker.DoWork += delegate { BingTranslator = new BingTranslator(_srcLangId, _tgtLangId); }; - worker.RunWorkerAsync(); - } - - /// ------------------------------------------------------------------------------------ - public void LoadTreeNodes(TreeView treeVw) - { - AllLeafNodes = new List>(); - - EnabledManagers = LocalizationManagerInternal.LoadedManagers.Values - .OrderBy(lm => lm.Name).Cast>().ToList(); - - foreach (var lm in EnabledManagers) - { - _runInReadonlyMode |= !lm.CanCustomizeLocalizations; - var node = new LocTreeNode(lm, lm.Name, null, lm.Name); - treeVw.Nodes.Add(node); - var childNodes = node.Nodes; - - lm.StringCache.LoadGroupNodes(childNodes); - AllLeafNodes.AddRange(lm.StringCache.LeafNodeList); - _allNodes = treeVw.Nodes; - } - } - - /// ------------------------------------------------------------------------------------ - /// - /// Finds the node in the specified node collection having the specified id. If a - /// node cannot be found, then each nodes node collection will be searched, and so on. - /// - /// ------------------------------------------------------------------------------------ - public LocTreeNode FindNode(string id, TreeNodeCollection nodeCollection) - { - if (id == null) - return null; - - foreach (LocTreeNode node in nodeCollection) - { - if (node.Id == id) - return node; - - var nd = FindNode(id, node.Nodes); - if (nd != null) - return nd; - } - - return null; - } - - /// ------------------------------------------------------------------------------------ - public bool GetIsDirty() - { - return (AllLeafNodes.Any(n => n.GetHasModifications(true))); - } - - /// ------------------------------------------------------------------------------------ - public IEnumerable> GetModifiedManagers( - string langId = null) => - _modifiedManagersAndLanguages.Where(m => m.Value.Contains( - langId ?? LocalizationManager.UILanguageId)).Select(m => m.Key); - - /// ------------------------------------------------------------------------------------ - public bool Save() - { - if (_runInReadonlyMode) - return false; - - var stringsLocalized = false; - - foreach (var node in AllLeafNodes.Where(n => n.SavedTranslationInfo.Count > 0)) - { - stringsLocalized = true; - - foreach (var locInfo in node.SavedTranslationInfo.Values) - node.Manager.StringCache.UpdateLocalizedInfo(locInfo); - - // Update each object with the specified id, with the localized string(s). - foreach (var component in GetComponentsForId(node.Manager, node.Id).Where(o => o != null)) - node.Manager.ApplyLocalization(component); - } - - foreach (var lm in _modifiedManagersAndLanguages.Keys) - { - lm.PrepareToCustomizeLocalizations(); - lm.SaveIfDirty(_modifiedManagersAndLanguages[lm]); - - // If saving fails, the LocalizationManagerInternal will record the problem . - _runInReadonlyMode |= !lm.CanCustomizeLocalizations; - } - - return stringsLocalized; - } - - /// ------------------------------------------------------------------------------------ - /// - /// Saves localization changes. - /// - /// ------------------------------------------------------------------------------------ - public void SaveChangesInMemory(LocalizingInfoWinforms locInfo) - { - if (locInfo?.Id == null || locInfo.UpdateFields == UpdateFields.None) - return; - - SaveChangesInMemory(CurrentNode, locInfo); - } - - /// ------------------------------------------------------------------------------------ - public void SaveChangesInMemory(LocTreeNode node, LocalizingInfoWinforms locInfo) - { - if (locInfo?.Id == null || locInfo.UpdateFields == UpdateFields.None || _tgtLangId == _srcLangId) - { - return; - } - - if (locInfo.Text == (node.GetText(_tgtLangId) ?? string.Empty) && - locInfo.ToolTipText == (node.GetToolTip(_tgtLangId) ?? string.Empty) && - locInfo.ShortcutKeys == (node.GetShortcutKeys(_tgtLangId) ?? string.Empty)) - { - return; - } - - locInfo.LangId = _tgtLangId; - - if (!_modifiedManagersAndLanguages.TryGetValue(node.Manager, out var modifiedLangIds)) - { - _modifiedManagersAndLanguages[node.Manager] = modifiedLangIds = new HashSet(); - } - modifiedLangIds.Add(_tgtLangId); - - if (!node.SavedTranslationInfo.ContainsKey(_tgtLangId)) - node.SavedTranslationInfo[_tgtLangId] = locInfo; - else - { - if ((locInfo.UpdateFields & UpdateFields.Text) == UpdateFields.Text) - node.SavedTranslationInfo[_tgtLangId].Text = (locInfo.Text == string.Empty ? null : locInfo.Text); - - if ((locInfo.UpdateFields & UpdateFields.ToolTip) == UpdateFields.ToolTip) - node.SavedTranslationInfo[_tgtLangId].ToolTipText = (locInfo.ToolTipText == string.Empty ? null : locInfo.ToolTipText); - - if ((locInfo.UpdateFields & UpdateFields.ShortcutKeys) == UpdateFields.ShortcutKeys) - node.SavedTranslationInfo[_tgtLangId].ShortcutKeys = (locInfo.ShortcutKeys == string.Empty ? null : locInfo.ShortcutKeys); - - if ((locInfo.UpdateFields & UpdateFields.Comment) == UpdateFields.Comment) - node.SavedComment = (locInfo.Comment == string.Empty ? null : locInfo.Comment); - - node.SavedTranslationInfo[_tgtLangId].UpdateFields |= locInfo.UpdateFields; - } - } - - /// ------------------------------------------------------------------------------------ - private IEnumerable GetComponentsForId(ILocalizationManagerInternal lm, string id) - { - return lm.ComponentCache.Where(kvp => kvp.Value == id).Select(kvp => kvp.Key); - } - - /// ------------------------------------------------------------------------------------ - public string GetNumberOfTranslatedItemsString() - { - int numStringsTranslated = EnabledManagers.Sum(lm => AllLeafNodes.Count(n => - (n.GetHasModifications(false) || lm.StringCache.DoTranslationsExist(TgtLangId, n.Id)))); - - return $"{numStringsTranslated} of {AllLeafNodes.Count} Items Translated"; - } - - /// ------------------------------------------------------------------------------------ - /// - /// Goes through each loaded LocalizationManagerInternal, looking for the one whose component - /// cache contains the specified component. When it's found, that component's id is returned. - /// - /// ------------------------------------------------------------------------------------ - public string GetObjIdFromAnyCache(IComponent component) - { - if (component != null) - { - foreach (var manager in LocalizationManagerInternal.LoadedManagers.Values) - { - string id; - if (manager.ComponentCache.TryGetValue(component, out id)) - return id; - } - } - - return null; - } - - /// ------------------------------------------------------------------------------------ - /// - /// Attempts to get the image for the specified object, if one exists. - /// - /// ------------------------------------------------------------------------------------ - public Image GetObjectsImage(object obj) - { - var img = Utils.GetProperty(obj, "Image") as Image; - if (img != null) - return img; - - var imgList = Utils.GetProperty(obj, "ImageList") as ImageList; - if (imgList != null) - { - var index = Utils.GetProperty(obj, "ImageIndex"); - if (index != null && index is int) - { - int i = (int)index; - if (i >= 0 && i < imgList.Images.Count) - return imgList.Images[i]; - } - } - - return null; - } - - /// ------------------------------------------------------------------------------------ - public Font GetFontForObject(object obj) - { - return (obj == null ? null : - Utils.GetProperty(obj, "Font") as Font) ?? LocalizeItemDlg.DefaultDisplayFont; - } - - /// ------------------------------------------------------------------------------------ - public IComponent GetFirstObjectForId() - { - return CurrentNode.Manager.ComponentCache.FirstOrDefault(k => k.Value == CurrentNode.Id).Key; - } - - /// ------------------------------------------------------------------------------------ - public void Translate(IDictionary> nodesToTranslate, - Action progressAction) - { - _translationWorker = new BackgroundWorker(); - _translationWorker.WorkerReportsProgress = true; - _translationWorker.WorkerSupportsCancellation = true; - _translationWorker.DoWork += HandleTranslateItems; - - if (progressAction != null) - { - _translationWorker.ProgressChanged += ((sender, args) => - progressAction(args.ProgressPercentage, (int)args.UserState)); - } - - _translationWorker.RunWorkerAsync(nodesToTranslate); - } - - /// ------------------------------------------------------------------------------------ - private void HandleTranslateItems(object sender, DoWorkEventArgs e) - { - var worker = sender as BackgroundWorker; - var nodesToTranslate = e.Argument as IDictionary>; - int i = 0; - - foreach (var kvp in nodesToTranslate) - { - var node = kvp.Value; - var locInfo = new LocalizingInfoWinforms(node.Id); - locInfo.UpdateFields = UpdateFields.None; - locInfo.LangId = TgtLangId; - - var text = node.GetText(SrcLangId); - if (!string.IsNullOrEmpty(text)) - { - text = (BingTranslator.TranslateText(text) ?? string.Empty).Trim(); - if (text != string.Empty) - { - locInfo.Text = text; - locInfo.UpdateFields |= UpdateFields.Text; - } - } - - text = node.GetToolTip(SrcLangId); - if (!string.IsNullOrEmpty(text)) - { - text = (BingTranslator.TranslateText(text) ?? string.Empty).Trim(); - if (text != string.Empty) - { - locInfo.ToolTipText = text; - locInfo.UpdateFields |= UpdateFields.ToolTip; - } - } - - if (locInfo.UpdateFields != UpdateFields.None) - { - SaveChangesInMemory(node, locInfo); - worker.ReportProgress(++i, kvp.Key); - } - } - } - - /// ------------------------------------------------------------------------------------ - private IEnumerable> GetLeafNodesOfNode(LocTreeNode node) - { - foreach (var childNode in node.Nodes.Cast>()) - { - if (AllLeafNodes.Contains(childNode)) - yield return childNode; - else - { - foreach (var leafNode in GetLeafNodesOfNode(childNode)) - yield return leafNode; - } - } - } - - /// ------------------------------------------------------------------------------------ - public string GetStringIdForGridIndex(int index, string prefixToRemove) - { - if (index >= AllLeafNodesShowingInGrid.Count || index < 0) - return null; - - var node = AllLeafNodesShowingInGrid[index]; - var id = node.Id; - if (!string.IsNullOrEmpty(prefixToRemove)) - id = id.Replace(prefixToRemove, string.Empty).Trim('.'); - return id; - } - - /// ------------------------------------------------------------------------------------ - public void SortGridNodes() - { - AllLeafNodesShowingInGrid.Sort( - new NodeComparer(_srcLangId, _tgtLangId, GridSortOrder, GridSortField)); - } - - #region Methods for returning various grid fields for a specified index - /// ------------------------------------------------------------------------------------ - public string GetSourceTextForGridIndex(int index) - { - return (index >= AllLeafNodesShowingInGrid.Count ? null : - AllLeafNodesShowingInGrid[index].GetText(_srcLangId)); - } - - /// ------------------------------------------------------------------------------------ - public string GetTargetTextForGridIndex(int index) - { - if (index >= AllLeafNodesShowingInGrid.Count) - return null; - - return (AllLeafNodesShowingInGrid[index].GetTranslatedText(_tgtLangId) ?? - AllLeafNodesShowingInGrid[index].GetText(_tgtLangId)); - } - - /// ------------------------------------------------------------------------------------ - public string GetSourceToolTipForGridIndex(int index) - { - return (index >= AllLeafNodesShowingInGrid.Count ? null : - AllLeafNodesShowingInGrid[index].GetToolTip(_srcLangId)); - } - - /// ------------------------------------------------------------------------------------ - public string GetTargetToolTipForGridIndex(int index) - { - if (index >= AllLeafNodesShowingInGrid.Count) - return null; - - return (AllLeafNodesShowingInGrid[index].GetTranslatedToolTip(_tgtLangId) ?? - AllLeafNodesShowingInGrid[index].GetToolTip(_tgtLangId)); - } - - /// ------------------------------------------------------------------------------------ - public string GetCommentForGridIndex(int index) - { - return (index >= AllLeafNodesShowingInGrid.Count ? null : - AllLeafNodesShowingInGrid[index].GetComment()); - } - - #endregion - - #region Methods for setting node colors - /// ------------------------------------------------------------------------------------ - public Color SetNodeColors() - { - return SetNodeColors(_allNodes); - } - - /// ------------------------------------------------------------------------------------ - /// - /// Sets the color of the specified node (and all its parents) based on whether or - /// not the node represents a localization entry for which translations exist - /// (other than for the default, that is). - /// - /// ------------------------------------------------------------------------------------ - private Color SetNodeColors(TreeNodeCollection nodeCollection) - { - if (nodeCollection == null) - return Color.Empty; - - var clrParent = Color.Empty; - - foreach (LocTreeNode node in nodeCollection) - { - if (node.Nodes.Count > 0) - { - clrParent = SetNodeColors(node.Nodes); - node.ForeColor = clrParent; - } - else if (node.Id != null) - { - if (node.SavedTranslationInfo != null || - node.Manager.StringCache.DoTranslationsExist(_tgtLangId, node.Id)) - { - node.ForeColor = SystemColors.WindowText; - } - else - { - node.ForeColor = _untranslatedNodeColor; - if (clrParent == Color.Empty) - clrParent = _untranslatedNodeColor; - } - } - } - - return clrParent; - } - - #endregion - - /// ------------------------------------------------------------------------------------ - public void ShowEditSourceBeforeTranslatingDlg(IWin32Window parent) - { - if (BingTranslator == null) - return; - - using (var dlg = new EditSourceBeforeTranslatingDlg(CurrentNodeSourceText, - _srcLangId, _tgtLangId, "Bing", BingTranslator)) - { - dlg.ShowDialog(parent); - } - } - } - -} diff --git a/src/L10NSharp.Windows.Forms/XLiffUtils/XliffLocalizationManagerWinforms.cs b/src/L10NSharp.Windows.Forms/XLiffUtils/XliffLocalizationManagerWinforms.cs index ad17c3d..d40cff0 100644 --- a/src/L10NSharp.Windows.Forms/XLiffUtils/XliffLocalizationManagerWinforms.cs +++ b/src/L10NSharp.Windows.Forms/XLiffUtils/XliffLocalizationManagerWinforms.cs @@ -6,9 +6,7 @@ using System.Linq; using System.Reflection; using System.Windows.Forms; -using L10NSharp.Windows.Forms.UIComponents; using L10NSharp.XLiffUtils; -using L10NSharp; namespace L10NSharp.Windows.Forms.XLiffUtils { @@ -104,9 +102,6 @@ public void RegisterComponentForLocalizing(LocalizingInfoWinforms info, ComponentCache.Add(component, id); else { - // If this is the first time this object has passed this way, then - // prepare it to be available for end-user localization. - PrepareComponentForRuntimeLocalization(component); ComponentCache.Add(component, id); // Make it available for the config dialog to localize. StringCache.UpdateLocalizedInfo(info); @@ -122,98 +117,6 @@ public void RegisterComponentForLocalizing(LocalizingInfoWinforms info, #endif } } - - /// ------------------------------------------------------------------------------------ - /// - /// Prepares the specified component for runtime localization by subscribing to a - /// mouse down event that will monitor whether or not to show the localization - /// dialog box. - /// - /// ------------------------------------------------------------------------------------ - private void PrepareComponentForRuntimeLocalization(IComponent component) - { - var toolStripItem = component as ToolStripItem; - if (toolStripItem != null) - { - toolStripItem.MouseDown += HandleToolStripItemMouseDown; - toolStripItem.Disposed += HandleToolStripItemDisposed; - return; - } - - // For component that are part of an owning parent control that needs to - // do some special handling when the user wants to localize, we need - // the parent to subscribe to the mouse event, but we don't want to - // subscribe once per column/page, so we first unsubscribe and then - // subscribe. It's a little ugly, but there doesn't seem to be a better way: - // http://stackoverflow.com/questions/399648/preventing-same-event-handler-assignment-multiple-times - - var ctrl = component as Control; - if (ctrl != null) - { - ctrl.Disposed += HandleControlDisposed; - - TabPage tpg = ctrl as TabPage; - if (tpg != null && tpg.Parent is TabControl) - { - tpg.Parent.MouseDown -= HandleControlMouseDown; - tpg.Parent.MouseDown += HandleControlMouseDown; - tpg.Parent.Disposed -= HandleControlDisposed; - tpg.Parent.Disposed += HandleControlDisposed; - tpg.Disposed += HandleTabPageDisposed; - return; - } - - ctrl.MouseDown += HandleControlMouseDown; - return; - } - - var columnHeader = component as ColumnHeader; - if (columnHeader != null && columnHeader.ListView != null) - { - columnHeader.ListView.Disposed -= HandleListViewDisposed; - columnHeader.ListView.Disposed += HandleListViewDisposed; - columnHeader.ListView.ColumnClick -= HandleListViewColumnHeaderClicked; - columnHeader.ListView.ColumnClick += HandleListViewColumnHeaderClicked; - columnHeader.Disposed += HandleListViewColumnDisposed; - } - - var dataGridViewColumn = component as DataGridViewColumn; - if (dataGridViewColumn != null && dataGridViewColumn.DataGridView != null) - { - dataGridViewColumn.DataGridView.CellMouseDown -= HandleDataGridViewCellMouseDown; - dataGridViewColumn.DataGridView.CellMouseDown += HandleDataGridViewCellMouseDown; - dataGridViewColumn.DataGridView.Disposed -= HandleDataGridViewDisposed; - dataGridViewColumn.DataGridView.Disposed += HandleDataGridViewDisposed; - dataGridViewColumn.Disposed += HandleColumnDisposed; - } - } - #endregion - - #region Methods for showing localization dialog box - /// ------------------------------------------------------------------------------------ - public void ShowLocalizationDialogBox(bool runInReadonlyMode, IWin32Window owner = null) - { - LocalizeItemDlg.ShowDialog(this, "", runInReadonlyMode, owner); - } - - /// ------------------------------------------------------------------------------------ - public static void ShowLocalizationDialogBox(IComponent component, - IWin32Window owner = null) - { - if (owner == null) - owner = (component as Control)?.FindForm(); - TipDialog.ShowAltShiftClickTip(owner); - LocalizeItemDlg.ShowDialog(LocalizationManagerInternal.GetLocalizationManagerForComponent(component), - component, false, owner); - } - - /// ------------------------------------------------------------------------------------ - public static void ShowLocalizationDialogBox(string id, IWin32Window owner = null) - { - TipDialog.ShowAltShiftClickTip(owner); - LocalizeItemDlg.ShowDialog(LocalizationManagerInternal.GetLocalizationManagerForString(id), id, false, owner); - } - #endregion #region Non static methods for getting localized strings @@ -252,8 +155,6 @@ public void ApplyLocalizationsToILocalizableComponent(LocalizingInfoWinforms loc { foreach (var component in ComponentCache.Keys) ApplyLocalization(component); - - LocalizeItemDlg.FireStringsLocalizedEvent(this); } /// ------------------------------------------------------------------------------------ /// @@ -463,217 +364,10 @@ private bool ApplyLocalizationsToDataGridViewColumn(DataGridViewColumn col, stri #endregion - #region Mouse down, handle destroyed, and dispose handlers - /// ------------------------------------------------------------------------------------ - /// - /// Handles Ctrl-Shift-Click on ToolStripItems; - /// - /// ------------------------------------------------------------------------------------ - internal void HandleToolStripItemMouseDown(object sender, MouseEventArgs e) - { - if (!DoHandleMouseDown) - return; - - // Make sure all drop-downs are closed that are in the - // chain of menu items for this item. - Form owningForm = null; - if (sender is ToolStripDropDownItem tsddi) - { - owningForm = tsddi.Owner?.FindForm(); - while (tsddi != null) - { - tsddi.DropDown.Close(); - - if (tsddi.Owner is ContextMenuStrip menuStrip) - menuStrip.Close(); - - tsddi = tsddi.OwnerItem as ToolStripDropDownItem; - } - } - - LocalizeItemDlg.ShowDialog(this, (IComponent)sender, false, - owningForm); - } - - private static bool DoHandleMouseDown => - LocalizationManager.EnableClickingOnControlToBringUpLocalizationDialog && - Control.ModifierKeys == (Keys.Alt | Keys.Shift); - public Icon ApplicationIcon { get => _applicationIcon; set => _applicationIcon = value; } - - /// ------------------------------------------------------------------------------------ - /// - /// Handles the tool strip item disposed. - /// - /// ------------------------------------------------------------------------------------ - private void HandleToolStripItemDisposed(object sender, EventArgs e) - { - if (sender is ToolStripItem item) - { - item.MouseDown -= HandleToolStripItemMouseDown; - item.Disposed -= HandleToolStripItemDisposed; - - ComponentCache.Remove(item); - } - } - - /// ------------------------------------------------------------------------------------ - /// - /// Handles Alt-Shift-Click on controls. - /// - /// ------------------------------------------------------------------------------------ - internal void HandleControlMouseDown(object sender, MouseEventArgs e) - { - if (!DoHandleMouseDown) - return; - - var ctrl = sender as Control; - - if (ctrl is TabControl tabControl) - { - for (int i = 0; i < tabControl.TabPages.Count; i++) - { - if (tabControl.GetTabRect(i).Contains(e.Location)) - { - ctrl = tabControl.TabPages[i]; - break; - } - } - } - - var lm = LocalizationManagerInternal.GetLocalizationManagerForComponent(ctrl); - - LocalizationManager.OnLaunchingLocalizationDialog(lm); - LocalizeItemDlg.ShowDialog(lm, ctrl, false, ctrl?.FindForm()); - LocalizationManager.OnClosingLocalizationDialog(lm); - } - - /// ------------------------------------------------------------------------------------ - /// - /// When controls get destroyed, do a little clean-up. - /// - /// ------------------------------------------------------------------------------------ - internal void HandleControlDisposed(object sender, EventArgs e) - { - var ctrl = sender as Control; - if (ctrl == null) - return; - - ctrl.Disposed -= HandleControlDisposed; - ctrl.MouseDown -= HandleControlMouseDown; - - ComponentCache.Remove(ctrl); - } - - /// ------------------------------------------------------------------------------------ - /// - /// When a TabPage gets disposed, remove reference to it from the object cache. - /// - /// ------------------------------------------------------------------------------------ - internal void HandleTabPageDisposed(object sender, EventArgs e) - { - if (!(sender is TabPage tabPage)) - return; - - tabPage.Disposed -= HandleTabPageDisposed; - ComponentCache.Remove(tabPage); - } - - /// ------------------------------------------------------------------------------------ - /// - /// When DataGridView controls get disposed, do a little clean-up. - /// - /// ------------------------------------------------------------------------------------ - internal void HandleDataGridViewDisposed(object sender, EventArgs e) - { - if (!(sender is DataGridView grid)) - return; - - grid.Disposed -= HandleControlDisposed; - grid.CellMouseDown -= HandleDataGridViewCellMouseDown; - - ComponentCache.Remove(grid); - } - - /// ------------------------------------------------------------------------------------ - /// - /// Handles ListView column header clicks. Unfortunately, even if the localization - /// dialog box is shown, this click on the header will not get eaten (like it does - /// for other controls). Therefore, if clicking on the column header sorts the column, - /// that sorting will take place after the dialog box is closed. - /// - /// ------------------------------------------------------------------------------------ - internal void HandleListViewColumnHeaderClicked(object sender, ColumnClickEventArgs e) - { - if (!DoHandleMouseDown) - return; - - if (sender is ListView lv && ComponentCache.ContainsKey(lv.Columns[e.Column])) - LocalizeItemDlg.ShowDialog(this, lv.Columns[e.Column], false, - lv.FindForm()); - } - - /// ------------------------------------------------------------------------------------ - /// - /// When ListView controls get disposed, do a little clean-up. - /// - /// ------------------------------------------------------------------------------------ - internal void HandleListViewDisposed(object sender, EventArgs e) - { - if (!(sender is ListView lv)) - return; - - lv.Disposed -= HandleListViewDisposed; - lv.ColumnClick -= HandleListViewColumnHeaderClicked; - } - - /// ------------------------------------------------------------------------------------ - /// - /// When ListView ColumnHeader controls get disposed, remove the reference to it from the - /// object cache. - /// - /// ------------------------------------------------------------------------------------ - internal void HandleListViewColumnDisposed(object sender, EventArgs e) - { - if (!(sender is ColumnHeader column)) - return; - - column.Disposed -= HandleListViewColumnDisposed; - ComponentCache.Remove(column); - } - - /// ------------------------------------------------------------------------------------ - internal void HandleDataGridViewCellMouseDown(object sender, DataGridViewCellMouseEventArgs e) - { - if (!DoHandleMouseDown) - return; - - if (sender is DataGridView grid && e.RowIndex < 0 && - ComponentCache.ContainsKey(grid.Columns[e.ColumnIndex])) - { - LocalizeItemDlg.ShowDialog(this, grid.Columns[e.ColumnIndex], false, - grid.FindForm()); - } - } - - /// ------------------------------------------------------------------------------------ - /// - /// When DataGridViewColumn controls get disposed, remove the reference to it from the - /// object cache. - /// - /// ------------------------------------------------------------------------------------ - internal void HandleColumnDisposed(object sender, EventArgs e) - { - if (!(sender is DataGridViewColumn column)) - return; - - column.Disposed -= HandleColumnDisposed; - ComponentCache.Remove(column); - } - #endregion } } diff --git a/src/L10NSharp/L10NSharp.csproj b/src/L10NSharp/L10NSharp.csproj index 84ac35f..9399c47 100644 --- a/src/L10NSharp/L10NSharp.csproj +++ b/src/L10NSharp/L10NSharp.csproj @@ -1,4 +1,4 @@ - + L10NSharp L10NSharp is a .NET localization library. It collects strings which need localization when your application first runs and saves them in a XLIFF file. diff --git a/src/L10NSharp/Properties/Resources.resx b/src/L10NSharp/Properties/Resources.resx deleted file mode 100644 index f26f49d..0000000 --- a/src/L10NSharp/Properties/Resources.resx +++ /dev/null @@ -1,152 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - - ..\Resources\bing.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\Copy_Translation.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\Copy_Translation (toolbar).png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\Google.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\Move_Next.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\Move_Previous.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\Move_down.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\Move_up.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\Move.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - - ..\Resources\SelectAllRows.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - \ No newline at end of file diff --git a/src/L10NSharp/Resources/Copy_Translation (toolbar).png b/src/L10NSharp/Resources/Copy_Translation (toolbar).png deleted file mode 100644 index 6dc60d81ea84527375d8a517096112b872ea729a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1416 zcmb`GUr19?9LK*`ckk}*yk^bm*bHa?aQ0Uu6I#O7)Jb3=TBMZKV-zUXdqo&QpwOP8 zz!!_6q{qU9UVG6u3&IR@b92u9^UrpZt>2lgO^IT|d-zFP zlcxrNH?=x!9Su9V5|TuoE*WQANt`op(^`0A=h z)}Wi9A2TC#2I)N{*nS##Nmg5PveTo)*NjLc5D115iz(o>rRZ#~MrFB}(nnT)V!F^_2O7FUGvB^nb-R70u}4R_iD!-6)QE#qR{VXh-+#eZcMS1$ zDieuEU>T>QF&sOwWdm0;lx3uIq=GF6XlOJkm52 zi}(p z8t`g01gfjqIWKg@g_*KR&+tFbpyoq1f)S8GMJWZIoe$#EkeSPAh3Ux{)U>w_DnWvZ zpdN1kQ_mf#($5RXzzkYmQ4Rls8`JM@WbP5WDft@JFiAJ-^Il;({jJ_yAMU7lbMr0h NZ*6LGjM}f<`vt_!4AB4p diff --git a/src/L10NSharp/Resources/Copy_Translation.png b/src/L10NSharp/Resources/Copy_Translation.png deleted file mode 100644 index 4b154986debdfb123429d5f3129424ea5c93b9e9..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 490 zcmeAS@N?(olHy`uVBq!ia0vp^oIuRQ!3HGLSWET+DaPU;cPEB*=VV?2Ic!PZ?k)`f zL2$v|<&%LToCO|{#S9GG!XV7ZFl&wkP)n_+i(`m{Bx4a{??1->|Nk>+gseIC^XE@X zRu(1(24>dPx7LJ&0X4$`qei|NHOh{Rejq?{AKN4N}Pj zQgC6uE92e?W{j*H0+X0I1Q|FuIi;l}Wm;fHF@Y4oI1F+;#UHeW8`SzaS_wU~fzkdDmO=y262$BUm9K_HGoc*7Xm5YI$PnLmQK#oCKN|52@ ztLF?R8iEXPlLRESb3`PR8CZD4802N87|b=e85Dpa%gDl709SNmn$=VWMz#z-_J0hT zQj84OAHHP}7ZJ#Bi4mH}0178$9M6vM<(6o3R{=H6qSxb3GOOaX`% XdSCx28}b1x3h=qLvjZ!pM+e&_yCO=H`CS*7;^Gr@io9obNmD^FHtMz7K^RArJ`SR4P?T zUS8hCg z*J`zm27_U27eH%kYg1=uXCI%>r#BOTwcjoTf-DZ~PXe=fjbJdyc64+!_w@AiM*(VT zYRZO&hRh7Z&|Y5t*@^y9~l`Lqmq)6 z;$~)MY+|uk6bOdV_RxZwav5YNvSR3KACKX9b~;KgNC^OJHk-Y$urQZWtJM|V-QC9c z_;?JPW)TXpP+vZ`Q(L&)9_&qw=a{h(0FTFm_V)HlN~hBea^k6IK7$)wqqtdn7N;dg z@IMjBApl;l7jCy3TnlE3V3qle}ghHWcb(hNp zlgTtm_4f8oR99CQ|8jbvd-efWFUe7GG7CH&FNOh0<|Y82&ljmq0E|ZCB&E@41{)e0 zR1C8Rw;xO(J#8QE-co?3=?DYTyJ_MRe*AR7=?>spl?;4dI07&{Jglb_3PlAsQ)5Cx z0-le4#><)S=xbvcKf*F?!_%%ZY;0`6;c$Rks!A%33r`49%4@D9F!<0=%%yVe;KF`tKA)M6_D1c5Z8PBPz+|a%FH13*NZo13$n&F031g@xT_+6vAOarycAB|@Pv o#?C7%D^v6H^W%X)AjZyr0LJuX@|xd){Qv*}07*qoM6N<$g6&6fdH?_b diff --git a/src/L10NSharp/Resources/Move.png b/src/L10NSharp/Resources/Move.png deleted file mode 100644 index 5731d8f92dfb25bf34c1486877b17b8c05664a54..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1307 zcmeAS@N?(olHy`uVBq!ia0vp^LO?9Q!3HFy+4N(86k~CayA#8@b22Z19JVBHcNd2L zAh=-f^2tCE&H|6fVg?3oVGw3ym^DWND9B#o>FdgVi&I3{LRzmOK97NcWwxh_V~B+y z;{=xc-#`^32F%$q;s3G&Gyaq6VHR`^-@pB2c=7l(x-daL6S|6@-+wZgcxf@TOt1bw zb3-rDE@ND@XX^i7KYlZSTmmxW$M;_h=Ds=%w;$bLcz5A9gQ%nsLwZ0lBf5p?d=`)) zy0$6|zyJPX`2FV(!>?aJ`uA^!Z@<1V{E`07@cJnO!_1An|I_{P8^!{1$=`o}8D4&Q z%JA*m4~DN_zcGCI@)d}I^p9^0AAY}NczhI;yzv7Tuy=m_V7Phl0mJw2-+^BI!SL<- z4+bt_4u)H2A2OUv*qa;e928&V=#7ne9+M)!hBJ?KSya@#by?GG4c=0A} zQ7_(#NUtq=Qt_vSO0`z2v9V<(X{|}tq}}v6FMn7!vwS;m-_G~V?9AIc=aPK^tK9++ z80b$7k`EGgnmXNIUF_uK*zjOqFUH@6ZFpdF>zt|VG+8v7%A@b$w>oV_vE zEX+%;6T7>@a5jK={G`}>AlBYYU|Z%o@klI;(k4(S0ijk)R*`Nd&>;Uylr=g;&KIlI zl9)>ZKmHeB*GFx!wdHLZV*;*QMzBRibRYE@5HoXW=J0UG(wDhq*+e#U^O-nwEDl|z zY0>;N0;e^nnk3f$0Hy{Qa<)|gkU*FO+W2B>1%XJFsMms|NFCWcO_|Py-=qm>V6u_3 zA1j~GQPIoT8K{~8u4$B6gG#BTkgOtC5b&7{mI1VofS-Ic5*CZ!R?deWnZf?gE_ zQShdxf*`1%LT`$gDELt=SgQ$bdXYBS@3*_o+a@(%&NBOU=gn_s-n_XvnN0@+0|5ZR z%vfrQ)-KZSP9MGBP7g`6u-U2fDCTqF68-pQ#?vV{;(7S$(QUH$ua2Fc1$OiZWw>|0 z5AZH!Qm4;Fd)Wu?G0q&vA-`6cxc&u426sc1`f>MS>%Opf+L;Bo{PhhEM*0!p1zdj6 z&Z`Y9zx(OVQwGXfj*MUWH=AzJw1}Fpz zX&1n4SQ98Z$d-StVWVO}lDu#n<_4&Lc{~hk{MzRPov|cJ710H#Q(lcScKHErSJeVc zvKvC_`_sDxNL8>X8l%t|MVT^{D^s&X0N1$+iJ(T+_G4uglAo^@4n)Gv`X-oYkb6#A zRn0*~Wn0+@u((CvCb((BGRc8N`o8if`QrJr+?mN4D3npBbeg6>SIbc3UF2+#vj&p@ z%h15NN~?~tVxiWs1Pw**=!q8jMR6E-J+K$`+smI2!`NjX(vZ^5Dj>UiSk z;`>~8PY9+ilWNdxADArwY5)y=y>Pwq4;CA>0G%C@ZQJl1PEN4U-XI3|0PAZd+`1I1 z=No7H>0B%yi6)2371Z_T jfrZ2GrF>rU`CGl4=(#8HEBk|YBEp{XE z)7O>#8n-k*Kik|pUbh$+Sfo8&978G?83kD0{|2fU>VOfO2Nvy_`v2FD-wfZs{bcz0 z{U^hZ@4pyoGFq^zWx-|uNVBf33d7%je;I!K`oWOuREbR)SPZKHAe(>x{l)O|%TtD% z7auTia&zJ|fC-xn$l1UD{9*X^?FYm6@820Xxj3*XLv_KNEffAD`}xoHy8v&KG;UF9GNBR@Pmmgo@nxzz^7*6dwjiDYR5Yq#S8AT<97+9Y2F?@LO1#B}e%^(Xg t3;+p&4UrOJV1B~IASo}2)n<^oVFG&OCf&16S-u$L9Zy$3mvv4FO#t+st2+Py diff --git a/src/L10NSharp/Resources/Move_up.png b/src/L10NSharp/Resources/Move_up.png deleted file mode 100644 index d39a96b043ad512dbf1c3bd7e13d5081115ea33c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1148 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`oCO|{#S9GG!XV7ZFl&wkP>{XE z)7O>#8n-mRfHlWEj!*^$7HLlx$B+s}Mgf-hzkw=-I$*@*ftee7|DQX0nc>{&D-5Ui zpTVh)37Y{kH}w90{p=mXUzu+V&mTT#Fmp2fk4+s&48s7h=I8Gi{z!jf5Rl+uFbdUR zc=q5KPD5DGO@0m3EM&mS@a-2T0|WDa1~p@Ou#$7DZ!oCps{Frw`3{PA;GAU#X8gZ* z{V{`ymlgvv3p2y--@h5IJ-p0t@7fcFZ{NN%ynFSD0c41PhycTtQ&-{o;4b*~Z8HH!^6$M#mT{NY10D+XHPo@!va&VYk&s89S%1j#isynYR|%^ z|7>h*4BXsY44hmX3_rjBWN6ImfXl;m0~r{B2$E#yWM^PyVPW6`YUbqRWcdE=2eKX% zHdX^Txqt>RvoT2W$}w1&nK69-`W;0RG6$=(7VVk(|JRS-K%0Mpoev6=nv52#YLN{a ZqU=8lD@+P+D$fKt-_zC4Wt~$(69CRfkI4W4 diff --git a/src/L10NSharp/Resources/SelectAllRows.png b/src/L10NSharp/Resources/SelectAllRows.png deleted file mode 100644 index 560a458a4fa378ed65f905848f2d9831f256af0c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3191 zcmV--42biIP)KLZ*U+IBfRsybQWXdwQbLP>6pAqfylh#{fb6;Z(vMMVS~$e@S=j*ftg6;Uhf59&ghTmgWD0l;*T zI709Y^p6lP1rIRMx#05C~cW=H_Aw*bJ-5DT&Z2n+x)QHX^p z00esgV8|mQcmRZ%02D^@S3L16t`O%c004NIvOKvYIYoh62rY33S640`D9%Y2D-rV&neh&#Q1i z007~1e$oCcFS8neI|hJl{-P!B1ZZ9hpmq0)X0i`JwE&>$+E?>%_LC6RbVIkUx0b+_+BaR3cnT7Zv!AJxW zizFb)h!jyGOOZ85F;a?DAXP{m@;!0_IfqH8(HlgRxt7s3}k3K`kFu>>-2Q$QMFfPW!La{h336o>X zu_CMttHv6zR;&ZNiS=X8v3CR#fknUxHUxJ0uoBa_M6WNWeqIg~6QE69c9o#eyhGvpiOA@W-aonk<7r1(?fC{oI5N*U!4 zfg=2N-7=cNnjjOr{yriy6mMFgG#l znCF=fnQv8CDz++o6_Lscl}eQ+l^ZHARH>?_s@|##Rr6KLRFA1%Q+=*RRWnoLsR`7U zt5vFIcfW3@?wFpwUVxrVZ>QdQz32KIeJ}k~{cZZE^+ya? z2D1z#2HOnI7(B%_ac?{wFUQ;QQA1tBKtrWrm0_3Rgps+?Jfqb{jYbcQX~taRB;#$y zZN{S}1|}gUOHJxc?wV3fxuz+mJ4`!F$IZ;mqRrNsHJd##*D~ju=bP7?-?v~|cv>vB zsJ6IeNwVZxrdjT`yl#bBIa#GxRa#xMMy;K#CDyyGyQdMSxlWT#tDe?p!?5wT$+oGt z8L;Kp2HUQ-ZMJ=3XJQv;x5ci*?vuTfeY$;({XGW_huIFR9a(?@3)XSs8O^N5RyOM=TTmp(3=8^+zpz2r)C z^>JO{deZfso3oq3?Wo(Y?l$ge?uXo;%ru`Vo>?<<(8I_>;8Eq#KMS9gFl*neeosSB zfoHYnBQIkwkyowPu(zdms`p{<7e4kra-ZWq<2*OsGTvEV%s0Td$hXT+!*8Bnh2KMe zBmZRodjHV?r+_5^X9J0WL4jKW`}lf%A-|44I@@LTvf1rHjG(ze6+w@Jt%Bvjts!X0 z?2xS?_ve_-kiKB_KiJlZ$9G`c^=E@oNG)mWWaNo-3TIW8)$Hg0Ub-~8?KhvJ>$ z3*&nim@mj(aCxE5!t{lw7O5^0EIO7zOo&c6l<+|iDySBWCGrz@C5{St!X3hAA}`T4 z(TLbXTq+(;@<=L8dXnssyft|w#WSTW<++3>sgS%(4NTpeI-VAqb|7ssJvzNHgOZVu zaYCvgO_R1~>SyL=cFU|~g|hy|Zi}}s9+d~lYqOB71z9Z$wnC=pR9Yz4DhIM>Wmjgu z&56o6maCpC&F##y%G;1PobR9i?GnNg;gYtchD%p19a!eQtZF&3JaKv33gZ<8D~47E ztUS1iwkmDaPpj=$m#%)jCVEY4fnLGNg2A-`YwHVD3gv};>)hAvT~AmqS>Lr``i7kw zJ{5_It`yrBmlc25DBO7E8;5VoznR>Ww5hAaxn$2~(q`%A-YuS64wkBy=9dm`4cXeX z4c}I@?e+FW+b@^RDBHV(wnMq2zdX3SWv9u`%{xC-q*U}&`cyXV(%rRT*Z6MH?i+i& z_B8C(+grT%{XWUQ+f@NoP1R=AW&26{v-dx)iK^-Nmiuj8txj!m?Z*Ss1N{dh4z}01 z)YTo*JycSU)+_5r4#yw9{+;i4Ee$peRgIj+;v;ZGdF1K$3E%e~4LaI(jC-u%2h$&R z9cLXcYC@Xwnns&bn)_Q~Te?roKGD|d-g^8;+aC{{G(1^(O7m37Y1-+6)01cN&y1aw zoqc{T`P^XJqPBbIW6s}d4{z_f5Om?vMgNQEJG?v2T=KYd^0M3I6IZxbny)%vZR&LD zJpPl@Psh8QyPB@KTx+@RdcC!KX7}kEo;S|j^u2lU7XQ}Oo;f|;z4Ll+_r>@1-xl3| zawq-H%e&ckC+@AhPrP6BKT#_XdT7&;F71j}Joy zkC~6lh7E@6o;W@^IpRNZ{ptLtL(gQ-CY~4mqW;US7Zxvm_|@yz&e53Bp_lTPlfP|z zrTyx_>lv@x#=^!PzR7qqF<$gm`|ZJZ+;<)Cqu&ot2z=0000WV@Og>004R=004l4008;_004mL004C`008P>0026e000+nl3&F} z0004^Nklfgc5Qd-79>WD_K1>th)QK8Y&iqOE6L91oAg*u%3DJT`992~~ z(5MF}iJjQHGsD5HTc@1JNUJ@J=9zci-Km)w+r%!wi#Hb)it~^;W0f0eW~8_7bq;H1 zIB$G-*{SVb7d2aZh#F1|?~U9Wb!TMG$h?s|C3i;V!FlE5=LyiE1kBGbfTDAn!*Z=G zSH^N}ELTdJLFR9Ss<@jG_UkiF-X>+T2Hd|oWr2bkh=Ld6{m<9H^8(<#2OvJ1qpFA+ zPosd7$q!T%5#`w^JDG28>V7Q8iSRUN>NJ zIxAnH`=rNo8lz^kn~l2wRcJk`BU*G{EE5_JA0TRoL6Ri2+d<_MRRHheSO2w4wQaZY d9$UuW0RY@=BiSNd051Rl002ovPDHLkV1gl=>UsbG diff --git a/src/L10NSharp/Resources/bing.png b/src/L10NSharp/Resources/bing.png deleted file mode 100644 index 91884f3f60da91f140d7acdf002525887400f168..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1161 zcmbVLUr1A76#sqe=GNT5OxD_z9vo6n1@%z#Wy+TBAqf+rha~&ssIUTkZG?M@o~$Rw zYT#2rNIew_wg;CzQIzPr1P5d|GM-#Pd9opZkP@7_7p*={wv z%>b;SjzAYl2eYY$&i(6ZF9|Ww)!v4&bVHUtcHQhaI{?(~VHSwRT?85jLnnjAkF_qR z`(XY_{b@k)gaWPI$94;c@_kFZ`ILbQL6-kVLb>)@Wp@>bPTy#VREALr{1+*IGAQ{~ zCsw*Bdl|~ArX3$%u7>{ltyBgrXgT-zhL^qMwU@ZL!h4?dRO-5Cl(Ck38Kn9>5X#kQ z>Y>avMmRh8iK!`-p(UanLa-gC`rToc#Q>~oWHAc#`Rd^Jn&GzZl;BE!3o}bUF!E{@ zU-H`$6GB8M!}SrdgEG*2)$FXn$Qd^*CTh*vB9KdIQJpP-tqJR!1%w~3U_SRt4-%s> zQVB(RcDYe|H8T#pyQ{;RJaC1!uS*7Lz5iKaltt3O3n1&Inmu-fR*G7Zd7(+UV!UR= z*(oV)CV?Z3MyZph%RmiG%5ZdWt&-{v=}=i(o21TVq?a~z{3|a~g4oZ<;M1(^fz{gs zaFB0r8J6{f`#^O2c}~jWkr0zJ?{VVc+7Q&jEe7{d8GSwnO~C>yHHNxDi*Tyl)EiAbjBP?{qF!FZkn z>6^$lI`JRBFmcf?9fJ?@Ae{ot&JnI}f^J(a%NbPP9Nm7@lRejcnDJ1sGceY6e&{#W C%)|5m From 134510c40cba3eb9810232169214d585aed29886 Mon Sep 17 00:00:00 2001 From: Ariel Rorabaugh Date: Wed, 6 Aug 2025 18:46:32 -0400 Subject: [PATCH 17/25] Add create method w/o icon to LocalizationManagerWinforms --- .../LocalizationManagerWinforms.cs | 54 +++++++++++++++++++ src/L10NSharp/LocalizationManager.cs | 3 -- src/SampleApp/Program.cs | 2 + 3 files changed, 56 insertions(+), 3 deletions(-) diff --git a/src/L10NSharp.Windows.Forms/LocalizationManagerWinforms.cs b/src/L10NSharp.Windows.Forms/LocalizationManagerWinforms.cs index b193f4f..987483b 100644 --- a/src/L10NSharp.Windows.Forms/LocalizationManagerWinforms.cs +++ b/src/L10NSharp.Windows.Forms/LocalizationManagerWinforms.cs @@ -68,6 +68,60 @@ public static ILocalizationManager Create(string desiredUiLangId, namespaceBeginnings); } + /// ------------------------------------------------------------------------------------ + /// + /// Creates a new instance of a localization manager for the specified application id. + /// If a localization manager has already been created for the specified id, then + /// that is returned. + /// + /// The language code of the desired UI language. If + /// there are no translations for that ID, a message is displayed and the UI language + /// falls back to the default. + /// The application Id (e.g. 'Pa' for Phonology Assistant). + /// This should be a unique name that identifies the manager for an assembly or + /// application. May include an optional file extension, which will be stripped off but + /// used to correctly set the "original" attribute when persisting an XLIFF file. The + /// base portion must still be unique (i.e., it is not valid to create a LM for + /// "Blah.exe" and another for "Blah.dll"). + /// The application's name. This will appear to the user + /// in the localization dialog box as a parent item in the tree. + /// + /// The full folder path of the original l10n + /// files installed with the application. + /// The path, relative to + /// %localappdata%, where your application stores user settings (e.g., "SIL\SayMore"). + /// A folder named "localizations" will be created there. + /// This will be used in UI that helps the translator + /// know what to do with their work + /// A list of namespace beginnings indicating + /// what types to scan for localized string calls. For example, to only scan + /// types found in Pa.exe and assuming all types in that assembly begin with + /// 'Pa', then this value would only contain the string 'Pa'. + /// MethodInfo objects representing + /// additional methods that should be regarded as calls to get localizations. If the method + /// is named "Localize", the extractor will attempt to parse its signature as an extension + /// method with the parameters (this string s, string separateId="", string comment=""). + /// Otherwise, it will be treated like a L10nSharp GetString method if its signature + /// matches one of the following: (string stringId, string englishText), + /// (string stringId, string englishText, string comment), or + /// (string stringId, string englishText, string comment, string englishToolTipText, + /// string englishShortcutKey, IComponent component). + public new static ILocalizationManager Create(string desiredUiLangId, + string appId, string appName, string appVersion, string directoryOfInstalledFiles, + string relativeSettingPathForLocalizationFolder, + string emailForSubmissions, + string[] namespaceBeginnings, + IEnumerable additionalLocalizationMethods = null) + { + LocalizationManager.TranslationMemoryKind = TranslationMemory.XLiff; + LocalizationManager.EmailForSubmissions = emailForSubmissions; + return LocalizationManagerInternalWinforms.CreateXliff(desiredUiLangId, + appId, appName, appVersion, directoryOfInstalledFiles, + relativeSettingPathForLocalizationFolder, null, + additionalLocalizationMethods, + namespaceBeginnings); + } + public static string GetLocalizedToolTipForControl(Control ctrl) { switch (LocalizationManager.TranslationMemoryKind) diff --git a/src/L10NSharp/LocalizationManager.cs b/src/L10NSharp/LocalizationManager.cs index 0b5fe48..c542646 100644 --- a/src/L10NSharp/LocalizationManager.cs +++ b/src/L10NSharp/LocalizationManager.cs @@ -83,7 +83,6 @@ public class LocalizationManager /// The path, relative to /// %appdata%, where your application stores user settings (e.g., "SIL\SayMore"). /// A folder named "localizations" will be created there. - /// /// This will be used in UI that helps the translator /// know what to do with their work /// A list of namespace beginnings indicating @@ -135,7 +134,6 @@ public static ILocalizationManager Create(TranslationMemory kind, string desired /// The path, relative to /// %appdata%, where your application stores user settings (e.g., "SIL\SayMore"). /// A folder named "localizations" will be created there. - /// /// This will be used in UI that helps the translator /// know what to do with their work /// MethodInfo objects representing @@ -195,7 +193,6 @@ public static ILocalizationManager Create(TranslationMemory kind, string desired /// The path, relative to /// %localappdata%, where your application stores user settings (e.g., "SIL\SayMore"). /// A folder named "localizations" will be created there. - /// /// This will be used in UI that helps the translator /// know what to do with their work /// A list of namespace beginnings indicating diff --git a/src/SampleApp/Program.cs b/src/SampleApp/Program.cs index 735b73d..bc64640 100644 --- a/src/SampleApp/Program.cs +++ b/src/SampleApp/Program.cs @@ -87,6 +87,7 @@ private static void SetUpLocalization(bool useAdditionalMethodInfo, bool useTmx) "SampleApp.exe", "SampleApp", Application.ProductVersion, directoryOfInstalledLocFiles, "MyCompany/L10NSharpSample", + Resources.Icon, //replace with your icon "sampleappLocalizations@nowhere.com", new[] { "SampleApp" }, typeof(Program) @@ -99,6 +100,7 @@ private static void SetUpLocalization(bool useAdditionalMethodInfo, bool useTmx) "SampleApp.exe", "SampleApp", Application.ProductVersion, directoryOfInstalledLocFiles, "MyCompany/L10NSharpSample", + Resources.Icon, //replace with your icon "sampleappLocalizations@nowhere.com", new[] { "SampleApp" }); } From d1c92fd700e5113e0931c28c8e09956f8b99be48 Mon Sep 17 00:00:00 2001 From: Ariel Rorabaugh Date: Wed, 13 Aug 2025 16:36:59 -0400 Subject: [PATCH 18/25] Add CHANGELOG and remove deprecated create methods --- CHANGELOG.md | 66 ++++++++++++++++ src/L10NSharp/LocalizationManager.cs | 111 --------------------------- 2 files changed, 66 insertions(+), 111 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ba7deb7..4832bad 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,72 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ## [Unreleased] +### Changed + +- BREAKING CHANGE: Move code that depends on Windows.Forms or System.Drawing into an L10NSharp.Windows.Forms namespace. Rename L10NSharp.UI as L10NSharp.Windows.Forms.UIComponents. Move L10NExtender out of UI subfolder into L10NSharp.Windows.Forms. Move Winforms related tests to L10NSharp.Windows.Forms.Tests. Change the folder for L10NSharp tests to match its namespace L10NSharp.Tests. + + Classes that contain some properties or methods that depend on Windows.Forms are split into Winforms-dependent and Winforms-independent classes. The Winforms-dependent classes subclass the Winforms-independent ones and can be found in the L10NSharp.Windows.Forms namespace. (e.g. LocalizationManagerWinforms in the L10NSharp.Windows.Forms namespace is a subclass of LocalizationManager in the L10NSharp namespace.) + + To handle Windows forms related objects, call the Winforms versions of these classes and methods (e.g. LocalizationManagerWinforms.Create() instead of LocalizationManager.Create()). Each affected interface or class and its affected properties and methods are listed below. + + - Split ILocalizationManagerInternal into ILocalizationManagerInternal and ILocalizationManagerInternalWinforms. + + MOVED: The properties ToolTipCtrls, LocalizableComponents, and ApplicationIcon; and the method RegisterComponentForLocalizing are moved to ILocalizationManagerInternalWinforms. + + - Split ILocalizedStringCache into ILocalizedStringCache and ILocalizedStringCacheWinforms. + + MOVED: The property LeafNodeList, and the methods GetShortcutKeys and LoadGroupNodes are moved to ILocalizedStringCacheWinforms. + + - Split LocalizationManager into LocalizationManager and LocalizationManagerWinforms. + + CHANGED: Remove static designation from LocalizationManager class in order for LocalizationManagerWinforms to subclass it and share its properties. + + MOVED: The method GetLocalisedToolTipForControl as well as the non-obsolete Create methods that contain an Icon argument are moved to LocalizationManagerWinforms. (The two obsolete Create methods, which included a TranslationMemory argument are removed.) + + - Split LocalizationManagerInternal into LocalizationManagerInternal and LocalizationManagerInternalWinforms. + + CHANGED: Remove static designation from LocalizationManagerInternal class in order for LocalizationManagerInternalWinforms to subclass it and share its s_loadedManagers property. + + CHANGED: Use different handling for ChooseFallbackLanguage in LocalizationManagerInternal that omits use of a Windows forms dialog for choosing the fallback. Retain original Winforms-dependent handling for ChooseFallbackLanguage in LocalizationManagerInternalWinforms. + + CHANGED: Use different handling for GetString in LocalizationManagerInternal that omits handling of Winforms objects and methods. Retain original Winforms-dependent handling of GetString in LocalizationManagerInternalWinforms. + + MOVED: The methods GetLocalizationManagerForComponent, GetLocalizationManagerForString, GetLocalizedToolTipForControl, GetRealTopLevelControl, and the non-deprecated Create methods with an Icon argument are moved to LocalizationManagerInternalWinforms. Deprecated Create methods are retained in LocalizationManagerWinforms with the Icon argument removed. + + - Split LocalizingInfo into LocalizingInfo and LocalizingInfoWinforms. + + CHANGED: Make private properties protected. LocalizingInfo returns null for Id while LocalizingInfoWinforms retains method to make an Id from a winforms component. + + MOVED: The get methods for ShortcutKeys and Id properties are moved to LocalizingInfoWinforms, since they involve winforms components; LocalizingInfo will return null for ShortcutKeys and Id. The methods UpdateTextFromObject, CreateIdIfMissing, MakeId, MakeIdForCtrl, MakeIdForColumnHeader, MakeIdForDataGridViewColumn, GetIdPrefix, OwningFormName and GetCategory are moved to LocalizingInfoWinforms + + - Split Utils into Utils and UtilsWinforms. + + MOVED: The methods SendMessage, SendMessageWindows and SetWindowRedraw are moved to UtilsWinforms. + + - Split XliffLocalizationManager into XliffLocalizationManager and XliffLocalizationManagerWinforms. + + MOVED: The following are moved to XliffLocalizationManagerWinforms: + + - The properties ApplicationIcon, ToolTipCtrls, LocalizableComponents and StringCache. + - The methods RegisterComponentForLocalizing, GetShortcutKeyFromStringCache, ApplyLocalizationToIlocalizableComponent, ReapplyLocalizationsToAllComponents, RefreshTooltips, ApplyLocalization, ApplyLocalizationsToILocalizableComponent, ApplyLocalizationsToControl, ApplyLocalizedToolTipToControl, HandleToolTipRefChanged, HandleToolTipRefDestroyed, ApplyLocalizationsToToolStripItem, ApplyLocalizationToListViewColumnHeader, and ApplyLocalizationToDataGridViewColumn. + + - Split XliffLocalizedStringCache into XliffLocalizedStringCacheWinforms and XliffLocalizedStringCache. + + MOVED: The LeafNodeList property and the methods LoadGroupNodes and GetShortcutKeys are moved to XliffLocalizedStringCacheWinforms. + +### Removed + +- BREAKING CHANGE: Remove code related to doing one's own localization at runtime. Also remove obsolete create methods from LocalizationManager. + + In particular: + + - Remove the LocalizeItemDlg designer, cs, resx, and viewmodel. + - Remove ShowLocalizationDialogBox from LocalizationManager and LocalizationManagerInternal. + - Remove the following runtime-localization related methods from XliffLocalizationManager: + PrepareComponentForRuntimeLocalization, HandleToolStripItemMouseDown, DoHandleMouseDown, HandeToolStripItemDisposed, HandleControlMouseDouwn, HandleControlDisposed, HandleTabPageDisposed, HandleDataGridViewDisposed, HandleListViewColumnHeaderClicked, HandleListViewDisposed, HandleListViewColumnDisposed, HandleDataGridViewCellMouseDown, HandleColumnDisposed, and ShowLocalizationDialogBox. + - Remove obsolete Create methods from LocalizationManager. These are the two Create methods that included a TranslationMemory argument. + + ## [8.0.0] - 2025-03-12 ### Changed diff --git a/src/L10NSharp/LocalizationManager.cs b/src/L10NSharp/LocalizationManager.cs index c542646..b2656df 100644 --- a/src/L10NSharp/LocalizationManager.cs +++ b/src/L10NSharp/LocalizationManager.cs @@ -59,117 +59,6 @@ public class LocalizationManager public static string EmailForSubmissions { get; set; } - /// ------------------------------------------------------------------------------------ - /// - /// Creates a new instance of a localization manager for the specified application id. - /// If a localization manager has already been created for the specified id, then - /// that is returned. - /// - /// Translation memory type to use - /// The language code of the desired UI language. If - /// there are no translations for that ID, a message is displayed and the UI language - /// falls back to the default. - /// The application Id (e.g. 'Pa' for Phonology Assistant). - /// This should be a unique name that identifies the manager for an assembly or - /// application. May include an optional file extension, which will be stripped off but - /// used to correctly set the "original" attribute when persisting an XLIFF file. The - /// base portion must still be unique (i.e., it is not valid to create a LM for - /// "Blah.exe" and another for "Blah.dll"). - /// The application's name. This will appear to the user - /// in the localization dialog box as a parent item in the tree. - /// - /// The full folder path of the original l10n - /// files installed with the application. - /// The path, relative to - /// %appdata%, where your application stores user settings (e.g., "SIL\SayMore"). - /// A folder named "localizations" will be created there. - /// This will be used in UI that helps the translator - /// know what to do with their work - /// A list of namespace beginnings indicating - /// what types to scan for localized string calls. For example, to only scan - /// types found in Pa.exe and assuming all types in that assembly begin with - /// 'Pa', then this value would only contain the string 'Pa'. - /// ------------------------------------------------------------------------------------ - [Obsolete("Use the overload without `TranslationMemory kind` parameter.")] - public static ILocalizationManager Create(TranslationMemory kind, string desiredUiLangId, - string appId, string appName, string appVersion, string directoryOfInstalledFiles, - string relativeSettingPathForLocalizationFolder, - string emailForSubmissions, params string[] namespaceBeginnings) - { - if (kind != TranslationMemory.XLiff) - { - throw new ArgumentException($@"Unknown translation memory kind {kind}. Only XLiff - is supported.", - nameof(kind)); - } - - return Create(desiredUiLangId, - appId, appName, appVersion, directoryOfInstalledFiles, - relativeSettingPathForLocalizationFolder, - emailForSubmissions, - namespaceBeginnings); - } - - /// ------------------------------------------------------------------------------------ - /// - /// Creates a new instance of a localization manager for the specified application id. - /// If a localization manager has already been created for the specified id, then - /// that is returned. - /// - /// Translation memory type to use - /// The language code of the desired UI language. If - /// there are no translations for that ID, a message is displayed and the UI language - /// falls back to the default. - /// The application Id (e.g. 'Pa' for Phonology Assistant). - /// This should be a unique name that identifies the manager for an assembly or - /// application. May include an optional file extension, which will be stripped off but - /// used to correctly set the "original" attribute when persisting an XLIFF file. The - /// base portion must still be unique (i.e., it is not valid to create a LM for - /// "Blah.exe" and another for "Blah.dll"). - /// The application's name. This will appear to the user - /// in the localization dialog box as a parent item in the tree. - /// - /// The full folder path of the original l10n - /// files installed with the application. - /// The path, relative to - /// %appdata%, where your application stores user settings (e.g., "SIL\SayMore"). - /// A folder named "localizations" will be created there. - /// This will be used in UI that helps the translator - /// know what to do with their work - /// MethodInfo objects representing - /// additional methods that should be regarded as calls to get localizations. If the method - /// is named "Localize", the extractor will attempt to parse its signature as an extension - /// method with the parameters (this string s, string separateId="", string comment=""). - /// Otherwise, it will be treated like a L10nSharp GetString method if its signature - /// matches one of the following: (string stringId, string englishText), - /// (string stringId, string englishText, string comment), or - /// (string stringId, string englishText, string comment, string englishToolTipText, - /// string englishShortcutKey, IComponent component). - /// A list of namespace beginnings indicating - /// what types to scan for localized string calls. For example, to only scan - /// types found in Pa.exe and assuming all types in that assembly begin with - /// 'Pa', then this value would only contain the string 'Pa'. - /// ------------------------------------------------------------------------------------ - [Obsolete("Use the overload without `TranslationMemory kind` parameter.")] - public static ILocalizationManager Create(TranslationMemory kind, string desiredUiLangId, - string appId, string appName, string appVersion, string directoryOfInstalledFiles, - string relativeSettingPathForLocalizationFolder, - string emailForSubmissions, - IEnumerable additionalLocalizationMethods, - params string[] namespaceBeginnings) - { - if (kind != TranslationMemory.XLiff) - { - throw new ArgumentException($@"Unknown translation memory kind {kind}. Only XLiff - is supported.", - nameof(kind)); - } - - return Create(desiredUiLangId, appId, appName, appVersion, directoryOfInstalledFiles, - relativeSettingPathForLocalizationFolder, emailForSubmissions, - namespaceBeginnings, additionalLocalizationMethods); - } - /// ------------------------------------------------------------------------------------ /// /// Creates a new instance of a localization manager for the specified application id. From 836fb9642b2365ef054b8f006a783c27d33beb2d Mon Sep 17 00:00:00 2001 From: Ariel Rorabaugh Date: Wed, 13 Aug 2025 17:13:42 -0400 Subject: [PATCH 19/25] Cleanup - Remove unused duplicate properties and commented method in XliffLocalizedStringCacheWinforms. - Fix access modifier for IsDesiredUiCultureAvailable in LocalizationManagerInternal. - Remove unneeded duplicate RemoveManager method in LocalizationManagerInternalWinforms --- CHANGELOG.md | 2 ++ .../ILocalizationManagerInternalWinforms.cs | 1 - .../LocalizationManagerInternalWinforms.cs | 8 ------- .../XliffLocalizedStringCacheWinforms.cs | 24 ------------------- src/L10NSharp/LocalizationManagerInternal.cs | 2 +- 5 files changed, 3 insertions(+), 34 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4832bad..07ee98d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,6 +26,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - Split ILocalizationManagerInternal into ILocalizationManagerInternal and ILocalizationManagerInternalWinforms. + CHANGED: ILocalizationManagerInternalWinforms\ declares a new StringCache object of type ILocalizedStringCacheWinforms\, while ILocalizationManagerInternal\ has a StringCache object of type ILocalizedStringCache\. + MOVED: The properties ToolTipCtrls, LocalizableComponents, and ApplicationIcon; and the method RegisterComponentForLocalizing are moved to ILocalizationManagerInternalWinforms. - Split ILocalizedStringCache into ILocalizedStringCache and ILocalizedStringCacheWinforms. diff --git a/src/L10NSharp.Windows.Forms/ILocalizationManagerInternalWinforms.cs b/src/L10NSharp.Windows.Forms/ILocalizationManagerInternalWinforms.cs index e035eed..8f9640b 100644 --- a/src/L10NSharp.Windows.Forms/ILocalizationManagerInternalWinforms.cs +++ b/src/L10NSharp.Windows.Forms/ILocalizationManagerInternalWinforms.cs @@ -6,7 +6,6 @@ using System.ComponentModel; using System.Drawing; using System.Windows.Forms; -using L10NSharp; namespace L10NSharp.Windows.Forms { diff --git a/src/L10NSharp.Windows.Forms/LocalizationManagerInternalWinforms.cs b/src/L10NSharp.Windows.Forms/LocalizationManagerInternalWinforms.cs index 8d569e7..c9acb77 100644 --- a/src/L10NSharp.Windows.Forms/LocalizationManagerInternalWinforms.cs +++ b/src/L10NSharp.Windows.Forms/LocalizationManagerInternalWinforms.cs @@ -30,14 +30,6 @@ internal class LocalizationManagerInternalWinforms : LocalizationManagerInter return dlg.SelectedLanguage; } }; - internal new static void RemoveManager(string id) - { - if (LoadedManagers.ContainsKey(id)) - { - LoadedManagers.Remove(id); - PreviouslyLoadedManagers.Add(id); - } - } #region Static methods for creating a LocalizationManagerInternal private static ILocalizationManager Create(string desiredUiLangId, string appId, diff --git a/src/L10NSharp.Windows.Forms/XLiffUtils/XliffLocalizedStringCacheWinforms.cs b/src/L10NSharp.Windows.Forms/XLiffUtils/XliffLocalizedStringCacheWinforms.cs index 5a915b3..6f33d80 100644 --- a/src/L10NSharp.Windows.Forms/XLiffUtils/XliffLocalizedStringCacheWinforms.cs +++ b/src/L10NSharp.Windows.Forms/XLiffUtils/XliffLocalizedStringCacheWinforms.cs @@ -12,20 +12,6 @@ internal class XliffLocalizedStringCacheWinforms : XliffLocalizedStringCache, IL { public List> LeafNodeList { get; private set; } - //internal XliffLocalizationManagerWinforms OwningManager { get; private set; } - private XLiffDocument DefaultXliffDocument { get; set; } // matches LanguageManager.kDefaultLanguage - - /// - /// Record the xliff document loaded for each language. Use this with care...XLiff documents are only - /// loaded as needed, so unless _unloadedXliffDocuments is empty, XliffDocuments won't necessarily - /// contain the one you want or have a complete list of keys. This class has its own GetDocument, - /// TryGetDocument, and AvailableLangKeys which should usually be used instead. To help enforce this, - /// XliffDocuments should be kept private, and any access to it should go through methods that - /// take lazy loading of Xliff documents into account. - /// - private readonly ConcurrentDictionary XliffDocuments = new ConcurrentDictionary(); - - private readonly ConcurrentDictionary _unloadedXliffDocuments = new ConcurrentDictionary(); #region Loading methods @@ -50,16 +36,6 @@ public Keys GetShortcutKeys(string langId, string id) return ShortcutKeysEditor.KeysFromString(keys); } - /*/// ------------------------------------------------------------------------------------ - /// - /// Gets the localized tooltip text for the specified id and suffix. - /// - /// ------------------------------------------------------------------------------------ - public string GetShortcutKeysText(string langId, string id) - { - return GetValueForExactLangAndId(langId, id + kShortcutSuffix, false); - }*/ - #endregion #region Methods for loading a tree node collection with all the localizable strings. diff --git a/src/L10NSharp/LocalizationManagerInternal.cs b/src/L10NSharp/LocalizationManagerInternal.cs index 074291e..f1244e8 100644 --- a/src/L10NSharp/LocalizationManagerInternal.cs +++ b/src/L10NSharp/LocalizationManagerInternal.cs @@ -88,7 +88,7 @@ protected static ILocalizationManager Create(string desiredUiLangId, string appI return lm; } - public static bool IsDesiredUiCultureAvailable(string desiredUiLangId) + protected static bool IsDesiredUiCultureAvailable(string desiredUiLangId) { if (IsLocalizationAvailable(desiredUiLangId)) return true; From 0a13495f2899bf9152fa8d2731a1b1b31de711ba Mon Sep 17 00:00:00 2001 From: Ariel Rorabaugh Date: Wed, 13 Aug 2025 17:34:59 -0400 Subject: [PATCH 20/25] Update README --- README.md | 40 ++++++++++++++++++++++++++-------------- 1 file changed, 26 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 9ba722c..9631382 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,9 @@ ## Overview -L10NSharp is a .NET localization library for Windows Forms applications. It collects strings which -need localization when your application first runs and saves them in a translation memory file. It -can also dynamically collect strings at runtime. +L10NSharp is a .NET localization library. It collects strings which need localization when your +application first runs and saves them in a translation memory file. + +L10NSharp.Windows.Forms builds on L10NSharp and should be used for localization of Windows Forms applications. L10NSharp works with XLIFF files as translation memory. @@ -12,10 +13,24 @@ L10NSharp works with XLIFF files as translation memory. [![NuGet version (L10NSharp)](https://img.shields.io/nuget/v/L10NSharp.svg?style=flat-square)](https://www.nuget.org/packages/L10NSharp/) -L10NSharp is provided as a [nuget package](https://www.nuget.org/packages/L10NSharp). +L10NSharp and L10NSharp.Windows.Forms are provided as [nuget packages](https://www.nuget.org/packages/L10NSharp). -To use L10NSharp in your application, simply call the `Create` method on `LocalizationManager`, -passing the location of the translation memory files and some other information: +To use L10NSharp in your application, call the `Create` method on `LocalizationManager`, +passing the location of the translation memory XLIFF files and some other information: + +```csharp +using (var lm = LocalizationManager.Create(lang, "SampleApp", + "SampleApp", productVersion, directoryOfInstalledXliffFiles, "MyCompany/L10NSharpSample", + "sample@example.com", "SampleApp") +{ + // existing code to run the application +} +``` + +To use L10NSharp.Windows.Forms in your Windows forms application, you can call the `Create` method +on `LocalizationManagerWinforms` instead, passing the location of the translation memory XLIFF +files and the other information as above. Note that the `Create` for Windows forms applications can +optionally include an additional icon argument: ```csharp using (var lm = LocalizationManager.Create(lang, "SampleApp", @@ -39,8 +54,10 @@ or `es/Whatever.xlf`). ### Selecting a Language If an exact match for the requested language is not available, L10NSharp will try to find the best available language. For example, if the client -requests `es` but only `Whatever.es-ES.xlf` is available, `Whatever.es-ES.xlf` will be loaded automatically, and vice versa. However, if the client -requests `es` and both `Whatever.es-ES.xlf` and `Whatever.es-MX.xlf` are available, or if no `Whatever.es[-details].xlf` is available, a dialog will +requests `es` but only `Whatever.es-ES.xlf` is available, `Whatever.es-ES.xlf` will be loaded automatically, and vice versa. + +In L10NSharp.Windows.Forms, if the client +requests `es` and both `Whatever.es-ES.xlf` and `Whatever.es-MX.xlf` are available, or if no `Whatever.es[-details].xlf` is available, a Windows forms dialog will inform the user that the selected language is not available and prompt the user to select from the available languages. ## Thread safety @@ -51,14 +68,9 @@ attempted to make the various varieties of `GetString` thread-safe,. ## L10NSharpExtender -To localize a Windows Forms form or control, simply add the `L10NSharpExtender`. It will +To localize a Windows Forms form or control, simply add the `L10NSharpExtender` from L10NSharp.Windows.Forms. It will automatically collect all the localizable strings on your form or control and its children. -## Localizing Within the Application - -L10NSharp provides a dialog for translating terms while running the application. The dialog can be -launched by Alt-Shift-clicking a Windows Forms element. - ## Upgrading to a newer version The [migration](https://github.com/sillsdev/l10nsharp/wiki/Migration) guide describes the From 1e6a6c15fcee27e62ee55e9ff2752032b54cf53c Mon Sep 17 00:00:00 2001 From: Ariel Rorabaugh Date: Thu, 14 Aug 2025 09:26:52 -0400 Subject: [PATCH 21/25] Update CHANGELOG & CreateXliff method Add another CreateXliff method to LocalizationManagerInternalWinforms that does not take an Icon argument. --- CHANGELOG.md | 12 +++- .../LocalizationManagerInternalWinforms.cs | 61 +++++++++++++++++++ 2 files changed, 70 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 07ee98d..b318cb2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -36,9 +36,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - Split LocalizationManager into LocalizationManager and LocalizationManagerWinforms. - CHANGED: Remove static designation from LocalizationManager class in order for LocalizationManagerWinforms to subclass it and share its properties. + CHANGED: Remove static designation from the LocalizationManager class in order for LocalizationManagerWinforms to subclass it and share its properties. - MOVED: The method GetLocalisedToolTipForControl as well as the non-obsolete Create methods that contain an Icon argument are moved to LocalizationManagerWinforms. (The two obsolete Create methods, which included a TranslationMemory argument are removed.) + CHANGED: The Icon argument is removed from the Create methods in LocalizationManager. Create methods for LocalizationManagerWinforms are available with and without the Icon argument. (The two obsolete create methods in LocalizationManager, which included a TranslationMemory argument, are removed.) + + MOVED: The method GetLocalisedToolTipForControl is moved to LocalizationManagerWinforms. - Split LocalizationManagerInternal into LocalizationManagerInternal and LocalizationManagerInternalWinforms. @@ -48,7 +50,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/). CHANGED: Use different handling for GetString in LocalizationManagerInternal that omits handling of Winforms objects and methods. Retain original Winforms-dependent handling of GetString in LocalizationManagerInternalWinforms. - MOVED: The methods GetLocalizationManagerForComponent, GetLocalizationManagerForString, GetLocalizedToolTipForControl, GetRealTopLevelControl, and the non-deprecated Create methods with an Icon argument are moved to LocalizationManagerInternalWinforms. Deprecated Create methods are retained in LocalizationManagerWinforms with the Icon argument removed. + CHANGED: Remove Icon argument from the CreateXliff method in LocalizationManagerInternal. CreateXliff methods in LocalizationManagerInternalWinforms are available with and without the Icon argument. + + CHANGED: In LocalizationManagerInternalWinforms, GetLocalizationManagerForComponent and GetLocalizationManagerForString, return type ILocalizationManagerInternalWinforms\ instead of ILocalizationManagerInternal\. + + MOVED: The methods GetLocalizedToolTipForControl, and GetRealTopLevelControl are moved to LocalizationManagerInternalWinforms. - Split LocalizingInfo into LocalizingInfo and LocalizingInfoWinforms. diff --git a/src/L10NSharp.Windows.Forms/LocalizationManagerInternalWinforms.cs b/src/L10NSharp.Windows.Forms/LocalizationManagerInternalWinforms.cs index c9acb77..0ed3ce6 100644 --- a/src/L10NSharp.Windows.Forms/LocalizationManagerInternalWinforms.cs +++ b/src/L10NSharp.Windows.Forms/LocalizationManagerInternalWinforms.cs @@ -133,6 +133,67 @@ public static ILocalizationManager CreateXliff(string desiredUiLangId, string ap namespaceBeginnings)); } + /// ------------------------------------------------------------------------------------ + /// + /// Creates a new instance of a localization manager for the specified application id. + /// If a localization manager has already been created for the specified id, then + /// that is returned. + /// + /// The language code of the desired UI language. If + /// there are no translations for that ID, a message is displayed and the UI language + /// falls back to the default. + /// The application Id (e.g. 'Pa' for Phonology Assistant). + /// This should be a unique name that identifies the manager for an assembly or + /// application. May include an optional file extension, which will be stripped off but + /// used to correctly set the "original" attribute when persisting an XLIFF file. The + /// base portion must still be unique (i.e., it is not valid to create a LM for + /// "Blah.exe" and another for "Blah.dll"). + /// The application's name. This will appear to the user + /// in the localization dialog box as a parent item in the tree. + /// + /// The full folder path of the original Xliff files + /// installed with the application. + /// The path, relative to + /// %appdata%, where your application stores user settings (e.g., "SIL\SayMore"). + /// A folder named "localizations" will be created there. + /// + /// MethodInfo objects representing + /// additional methods that should be regarded as calls to get localizations. If the method + /// is named "Localize", the extractor will attempt to parse its signature as an extension + /// method with the parameters (this string s, string separateId="", string comment=""). + /// Otherwise, it will be treated like a L10nSharp GetString method if its signature + /// matches one of the following: (string stringId, string englishText), + /// (string stringId, string englishText, string comment), or + /// (string stringId, string englishText, string comment, string englishToolTipText, + /// string englishShortcutKey, IComponent component). + /// A list of namespace beginnings indicating + /// what types to scan for localized string calls. For example, to only scan + /// types found in Pa.exe and assuming all types in that assembly begin with + /// 'Pa', then this value would only contain the string 'Pa'. + /// ------------------------------------------------------------------------------------ + public static ILocalizationManager CreateXliff(string desiredUiLangId, string appId, + string appName, string appVersion, string directoryOfInstalledXliffFiles, + string relativeSettingPathForLocalizationFolder, + IEnumerable additionalLocalizationMethods, + params string[] namespaceBeginnings) + { + if (string.IsNullOrWhiteSpace(appId)) + throw new ArgumentNullException(nameof(appId)); + var origExeExtension = Path.GetExtension(appId); + if (origExeExtension == string.Empty) + origExeExtension = ".dll"; + appId = Path.GetFileNameWithoutExtension(appId); + + return Create(desiredUiLangId, appId, appName, + relativeSettingPathForLocalizationFolder, + directoryOfWritableXliffFiles => + (ILocalizationManagerInternalWinforms)new XliffLocalizationManagerWinforms(appId, origExeExtension, appName, + appVersion, directoryOfInstalledXliffFiles, + directoryOfWritableXliffFiles, directoryOfWritableXliffFiles, + additionalLocalizationMethods, + namespaceBeginnings)); + } + /// ------------------------------------------------------------------------------------ internal new static ILocalizationManagerInternalWinforms GetLocalizationManagerForComponent( IComponent component) From 9a7bb09e1adaa30ad718dede65b5f35d1aea11f1 Mon Sep 17 00:00:00 2001 From: Ariel Rorabaugh Date: Thu, 14 Aug 2025 16:46:31 -0400 Subject: [PATCH 22/25] Cleanup static function naming --- .../XliffLocalizationManagerTests.cs | 2 +- .../LocalizationManagerInternalWinforms.cs | 10 +++++----- .../LocalizationManagerWinforms.cs | 18 ------------------ 3 files changed, 6 insertions(+), 24 deletions(-) diff --git a/src/L10NSharp.Windows.Forms.Tests/XliffLocalizationManagerTests.cs b/src/L10NSharp.Windows.Forms.Tests/XliffLocalizationManagerTests.cs index d048c94..d6bb49b 100644 --- a/src/L10NSharp.Windows.Forms.Tests/XliffLocalizationManagerTests.cs +++ b/src/L10NSharp.Windows.Forms.Tests/XliffLocalizationManagerTests.cs @@ -172,7 +172,7 @@ public void TestMappingLanguageCodesToAvailable_AmbiguousOptions_PromptsUser([Va AddChineseOfChinaTranslation(installedFolder); AddChineseOfTaiwanTranslation(installedFolder); var userPromptCount = 0; - LocalizationManagerInternalWinforms.ChooseFallbackLanguage = (langTag, icon) => + LocalizationManagerInternalWinforms.ChooseFallbackLanguageWinforms = (langTag, icon) => { userPromptCount++; Assert.That(langTag, Is.EqualTo("zh")); diff --git a/src/L10NSharp.Windows.Forms/LocalizationManagerInternalWinforms.cs b/src/L10NSharp.Windows.Forms/LocalizationManagerInternalWinforms.cs index 0ed3ce6..3fc5e48 100644 --- a/src/L10NSharp.Windows.Forms/LocalizationManagerInternalWinforms.cs +++ b/src/L10NSharp.Windows.Forms/LocalizationManagerInternalWinforms.cs @@ -22,7 +22,7 @@ internal class LocalizationManagerInternalWinforms : LocalizationManagerInter /// /// Function to choose a fallback language during construction. Overridable by unit tests. /// - internal new static Func ChooseFallbackLanguage = (desiredUiLangId, icon) => + internal static Func ChooseFallbackLanguageWinforms = (desiredUiLangId, icon) => { using (var dlg = new LanguageChoosingDialog(L10NCultureInfo.GetCultureInfo(desiredUiLangId), icon)) { @@ -62,7 +62,7 @@ private static ILocalizationManager Create(string desiredUiLangId, string appId, if (!LocalizationManagerInternalWinforms.IsDesiredUiCultureAvailable(desiredUiLangId)) { - desiredUiLangId = ChooseFallbackLanguage(desiredUiLangId, applicationIcon); + desiredUiLangId = ChooseFallbackLanguageWinforms(desiredUiLangId, applicationIcon); } L10NSharp.LocalizationManager.SetUILanguage(desiredUiLangId, false); @@ -195,14 +195,14 @@ public static ILocalizationManager CreateXliff(string desiredUiLangId, string ap } /// ------------------------------------------------------------------------------------ - internal new static ILocalizationManagerInternalWinforms GetLocalizationManagerForComponent( + internal static ILocalizationManagerInternalWinforms GetLocalizationManagerForComponentWinforms( IComponent component) { return (ILocalizationManagerInternalWinforms)LoadedManagers.Values.FirstOrDefault(lm => lm.ComponentCache.ContainsKey(component)); } /// ------------------------------------------------------------------------------------ - internal new static ILocalizationManagerInternalWinforms GetLocalizationManagerForString(string id) + internal static ILocalizationManagerInternalWinforms GetLocalizationManagerForStringWinforms(string id) { return (ILocalizationManagerInternalWinforms)LoadedManagers.Values.FirstOrDefault( lm => lm.StringCache.GetString(LocalizationManager.UILanguageId, id) != null); @@ -212,7 +212,7 @@ public static ILocalizationManager CreateXliff(string desiredUiLangId, string ap /// ------------------------------------------------------------------------------------ public static string GetLocalizedToolTipForControl(Control ctrl) { - var lm = LocalizationManagerInternalWinforms.GetLocalizationManagerForComponent(ctrl); + var lm = LocalizationManagerInternalWinforms.GetLocalizationManagerForComponentWinforms(ctrl); var topCtrl = GetRealTopLevelControl(ctrl); if (topCtrl == null || lm == null) return null; diff --git a/src/L10NSharp.Windows.Forms/LocalizationManagerWinforms.cs b/src/L10NSharp.Windows.Forms/LocalizationManagerWinforms.cs index 987483b..428a01b 100644 --- a/src/L10NSharp.Windows.Forms/LocalizationManagerWinforms.cs +++ b/src/L10NSharp.Windows.Forms/LocalizationManagerWinforms.cs @@ -154,23 +154,5 @@ public static string GetLocalizedToolTipForControl(Control ctrl) } } } - - /*/// - /// True (default) to throw if we try to get a string from a particular manager - /// and it has been disposed. When false, we will instead just return the English string, - /// or if none, the ID. This is useful in some apps (e.g., Bloom) which may - /// accidentally request a localized string during shutdown after disposing of - /// the localization managers. - /// - public static bool ThrowIfManagerDisposed = true; - - /// - /// True (default) to throw if we try to get a localized string before creating any localization managers. - /// This is to prevent an invalid state where language IDs get mapped incorrectly at the beginning and - /// then never get updated which can cause us to fail to return properly localized strings when requested (see BL-13245). - /// The fix is to ensure that a LocalizationManager is created before calling any localization methods. - /// Or, to maintain prior behavior, set this to false. - /// - public static bool StrictInitializationMode = true;*/ } } From 0c2fa6df67a2a792307a7d08b2b1f9acf09a0deb Mon Sep 17 00:00:00 2001 From: Ariel Rorabaugh Date: Thu, 14 Aug 2025 16:49:11 -0400 Subject: [PATCH 23/25] Fix static function call in XliffLocalizationManagerWinforms --- .../XLiffUtils/XliffLocalizationManagerWinforms.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/L10NSharp.Windows.Forms/XLiffUtils/XliffLocalizationManagerWinforms.cs b/src/L10NSharp.Windows.Forms/XLiffUtils/XliffLocalizationManagerWinforms.cs index d40cff0..2f3fbce 100644 --- a/src/L10NSharp.Windows.Forms/XLiffUtils/XliffLocalizationManagerWinforms.cs +++ b/src/L10NSharp.Windows.Forms/XLiffUtils/XliffLocalizationManagerWinforms.cs @@ -92,7 +92,7 @@ public void RegisterComponentForLocalizing(LocalizingInfoWinforms info, ComponentCache[component] = id; //somehow, we sometimes see "Msg: Index was outside the bounds of the array." else { - var lm = LocalizationManagerInternalWinforms.GetLocalizationManagerForString(id); + var lm = LocalizationManagerInternalWinforms.GetLocalizationManagerForStringWinforms(id); if (lm != null && lm != this) { lm.RegisterComponentForLocalizing(info, successAction); From 8071200de76caf7af71e285df095cac35e5cd69b Mon Sep 17 00:00:00 2001 From: Ariel Rorabaugh Date: Fri, 5 Sep 2025 10:04:16 -0400 Subject: [PATCH 24/25] Fix null-op apply localization method references. Also update comments and remove commented code. --- CHANGELOG.md | 13 +++-- .../LocalizationManagerTestsBase.cs | 26 ++++----- .../ILocalizableComponentTests.cs | 2 +- .../XliffLocalizationManagerTests.cs | 4 +- .../ILocalizationManagerInternalWinforms.cs | 4 ++ .../LocalizationManagerInternalWinforms.cs | 39 ++++++++++++- .../LocalizationManagerWinforms.cs | 42 ++++++++++++++ .../LocalizingInfoWinforms.cs | 27 ++------- .../XliffLocalizationManagerWinforms.cs | 7 ++- src/L10NSharp/ILocalizationManager.cs | 9 --- src/L10NSharp/ILocalizationManagerInternal.cs | 5 -- src/L10NSharp/LocalizationManager.cs | 40 +------------ src/L10NSharp/LocalizationManagerInternal.cs | 32 +---------- src/L10NSharp/LocalizingInfo.cs | 8 +-- .../XLiffUtils/XliffLocalizationManager.cs | 57 ------------------- .../XLiffUtils/XliffLocalizedStringCache.cs | 6 +- src/SampleApp/Form1.cs | 3 +- 17 files changed, 126 insertions(+), 198 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b318cb2..213e72d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,7 +28,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). CHANGED: ILocalizationManagerInternalWinforms\ declares a new StringCache object of type ILocalizedStringCacheWinforms\, while ILocalizationManagerInternal\ has a StringCache object of type ILocalizedStringCache\. - MOVED: The properties ToolTipCtrls, LocalizableComponents, and ApplicationIcon; and the method RegisterComponentForLocalizing are moved to ILocalizationManagerInternalWinforms. + MOVED: The properties ToolTipCtrls, LocalizableComponents, and ApplicationIcon; and the methods ApplyLocalization, ApplyLocalizationsToILocalizableComponent, ReapplyLocalizationsToAllComponents, and RegisterComponentForLocalizing are moved to ILocalizationManagerInternalWinforms. - Split ILocalizedStringCache into ILocalizedStringCache and ILocalizedStringCacheWinforms. @@ -39,8 +39,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/). CHANGED: Remove static designation from the LocalizationManager class in order for LocalizationManagerWinforms to subclass it and share its properties. CHANGED: The Icon argument is removed from the Create methods in LocalizationManager. Create methods for LocalizationManagerWinforms are available with and without the Icon argument. (The two obsolete create methods in LocalizationManager, which included a TranslationMemory argument, are removed.) + + CHANGED: SetUILanguage in LocalizationManager no longer reapplies localizations based on a reapplyLocalizationsToAllObjectsInAllManagers argument, since reapplying localizations is a Winforms method. SetUILanguage in LocalizationManagerWinforms retains this argument and reapplies localizations depending on its value. - MOVED: The method GetLocalisedToolTipForControl is moved to LocalizationManagerWinforms. + MOVED: The methods ReapplyLocalizationsToAllObjectsInAllManagers, ReapplyLocalizationsToAllObjects, and GetLocalisedToolTipForControl are moved to LocalizationManagerWinforms. - Split LocalizationManagerInternal into LocalizationManagerInternal and LocalizationManagerInternalWinforms. @@ -54,7 +56,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). CHANGED: In LocalizationManagerInternalWinforms, GetLocalizationManagerForComponent and GetLocalizationManagerForString, return type ILocalizationManagerInternalWinforms\ instead of ILocalizationManagerInternal\. - MOVED: The methods GetLocalizedToolTipForControl, and GetRealTopLevelControl are moved to LocalizationManagerInternalWinforms. + MOVED: The methods ReapplyLocalizationsToAllObjectsInAllManagers, ReapplyLocalizationsToAllObjects, GetLocalizedToolTipForControl, and GetRealTopLevelControl are moved to LocalizationManagerInternalWinforms. - Split LocalizingInfo into LocalizingInfo and LocalizingInfoWinforms. @@ -71,7 +73,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). MOVED: The following are moved to XliffLocalizationManagerWinforms: - The properties ApplicationIcon, ToolTipCtrls, LocalizableComponents and StringCache. - - The methods RegisterComponentForLocalizing, GetShortcutKeyFromStringCache, ApplyLocalizationToIlocalizableComponent, ReapplyLocalizationsToAllComponents, RefreshTooltips, ApplyLocalization, ApplyLocalizationsToILocalizableComponent, ApplyLocalizationsToControl, ApplyLocalizedToolTipToControl, HandleToolTipRefChanged, HandleToolTipRefDestroyed, ApplyLocalizationsToToolStripItem, ApplyLocalizationToListViewColumnHeader, and ApplyLocalizationToDataGridViewColumn. + - The methods RegisterComponentForLocalizing, GetShortcutKeyFromStringCache, ApplyLocalizationToIlocalizableComponent, ReapplyLocalizationsToAllComponents, RefreshToolips, ApplyLocalization, ApplyLocalizationsToILocalizableComponent, ApplyLocalizationsToControl, ApplyLocalizedToolTipToControl, HandleToolTipRefChanged, HandleToolTipRefDestroyed, ApplyLocalizationsToToolStripItem, ApplyLocalizationToListViewColumnHeader, and ApplyLocalizationToDataGridViewColumn. - Split XliffLocalizedStringCache into XliffLocalizedStringCacheWinforms and XliffLocalizedStringCache. @@ -83,12 +85,13 @@ and this project adheres to [Semantic Versioning](http://semver.org/). In particular: - - Remove the LocalizeItemDlg designer, cs, resx, and viewmodel. + - Remove the LocalizeItemDlg designer, cs, resx, and viewmodel. - Remove ShowLocalizationDialogBox from LocalizationManager and LocalizationManagerInternal. - Remove the following runtime-localization related methods from XliffLocalizationManager: PrepareComponentForRuntimeLocalization, HandleToolStripItemMouseDown, DoHandleMouseDown, HandeToolStripItemDisposed, HandleControlMouseDouwn, HandleControlDisposed, HandleTabPageDisposed, HandleDataGridViewDisposed, HandleListViewColumnHeaderClicked, HandleListViewDisposed, HandleListViewColumnDisposed, HandleDataGridViewCellMouseDown, HandleColumnDisposed, and ShowLocalizationDialogBox. - Remove obsolete Create methods from LocalizationManager. These are the two Create methods that included a TranslationMemory argument. + Also, remove RefreshToolTips from ILocalizationManager. All references were already to specific implementations of the method, and RefreshToolTips is not needed in the Winforms-free side of L10NSharp. ## [8.0.0] - 2025-03-12 diff --git a/src/L10NSharp.Tests/LocalizationManagerTestsBase.cs b/src/L10NSharp.Tests/LocalizationManagerTestsBase.cs index 76e46f7..9b40ab9 100644 --- a/src/L10NSharp.Tests/LocalizationManagerTestsBase.cs +++ b/src/L10NSharp.Tests/LocalizationManagerTestsBase.cs @@ -44,7 +44,7 @@ public void TearDownLocalizationManagers() LocalizationManager.UseLanguageCodeFolders = false; LocalizationManagerInternal.LoadedManagers.Clear(); LocalizationManagerInternal.MapToExistingLanguage.Clear(); - LocalizationManager.SetUILanguage(LocalizationManager.kDefaultLang, false); + LocalizationManager.SetUILanguage(LocalizationManager.kDefaultLang); } /// @@ -321,7 +321,7 @@ public string GetDynamicStringOrEnglish(string langId, string uiLangId) using(var folder = new TempFolder()) { SetupManager(folder, "ar"); - LocalizationManager.SetUILanguage(uiLangId, true); + LocalizationManager.SetUILanguage(uiLangId); return LocalizationManager.GetDynamicStringOrEnglish(AppId, "blahId", "blahInEnglishInCode", "comment", langId); } } @@ -472,7 +472,7 @@ public void SetupManager(TempFolder folder, string uiLanguageId = LocalizationMa AddFrenchTranslation(GetInstalledDirectory(folder)); AddSpanishTranslation(GetInstalledDirectory(folder)); - LocalizationManager.SetUILanguage(uiLanguageId, true); + LocalizationManager.SetUILanguage(uiLanguageId); var manager = CreateLocalizationManager(AppId, AppName, AppVersion, GetInstalledDirectory(folder), GetGeneratedDirectory(folder), GetUserModifiedDirectory(folder)); @@ -664,7 +664,7 @@ public void OrphanLogicUsedForArabic_ButNotIfFoundInEnglishTranslation() GetInstalledDirectory(folder), GetUserModifiedDirectory(folder), GetUserModifiedDirectory(folder)); LocalizationManagerInternal.LoadedManagers[AppId] = manager; - LocalizationManager.SetUILanguage("ar", false); + LocalizationManager.SetUILanguage("ar"); Assert.That(LocalizationManager.GetDynamicStringOrEnglish(AppId, "SuperClassMethod.TestId", null, null, "en"), Is.EqualTo("Title")); Assert.That(LocalizationManager.GetDynamicStringOrEnglish(AppId, "AnotherContext.AnotherDialog.TestId", null, null, "en"), Is.EqualTo("Title")); @@ -686,7 +686,7 @@ public void OrphanLogicNotUsed_WithWrongEnglishSource() GetInstalledDirectory(folder), GetUserModifiedDirectory(folder), GetUserModifiedDirectory(folder)); LocalizationManagerInternal.LoadedManagers[AppId] = manager; - LocalizationManager.SetUILanguage("ar", false); + LocalizationManager.SetUILanguage("ar"); Assert.That(LocalizationManager.GetDynamicStringOrEnglish(AppId, "SuperClassMethod.TestId", null, null, "en"), Is.EqualTo("Title")); Assert.That(LocalizationManager.GetDynamicStringOrEnglish(AppId, "AnotherContext.AnotherDialog.TestId", null, null, "en"), Is.EqualTo("Title")); @@ -779,7 +779,7 @@ public void TranslationWithNewlineReplacement_YieldsStandardizedNewline() doc.AddTransUnit(tuF); doc.Save(Path.Combine(folder.Path, LocalizationManager.GetTranslationFileNameForLanguage(AppId, "fr"))); - LocalizationManager.SetUILanguage("fr", true); + LocalizationManager.SetUILanguage("fr"); var manager = CreateLocalizationManager(AppId, AppName, AppVersion, GetInstalledDirectory(folder), GetGeneratedDirectory(folder), GetUserModifiedDirectory(folder)); LocalizationManagerInternal.LoadedManagers[AppId] = manager; @@ -804,7 +804,7 @@ public void TestInexactLanguageMatching() // unchanged UI language. Calling the method to set the fallback languages will // possibly change the UI language to something less (or more) specific, and // possibly have a longer fallback list. - LocalizationManager.SetUILanguage("es", true); + LocalizationManager.SetUILanguage("es"); Assert.AreEqual("es", LocalizationManager.UILanguageId); Assert.AreEqual(1, LocalizationManager.FallbackLanguageIds.Count()); Assert.AreEqual("en", LocalizationManager.FallbackLanguageIds.First()); @@ -814,7 +814,7 @@ public void TestInexactLanguageMatching() Assert.AreEqual(1, LocalizationManager.FallbackLanguageIds.Count()); Assert.AreEqual("en", LocalizationManager.FallbackLanguageIds.First()); - LocalizationManager.SetUILanguage("fr-FR", true); + LocalizationManager.SetUILanguage("fr-FR"); Assert.AreEqual("fr-FR", LocalizationManager.UILanguageId); Assert.AreEqual(1, LocalizationManager.FallbackLanguageIds.Count()); Assert.AreEqual("en", LocalizationManager.FallbackLanguageIds.First()); @@ -823,7 +823,7 @@ public void TestInexactLanguageMatching() Assert.AreEqual(1, LocalizationManager.FallbackLanguageIds.Count()); Assert.AreEqual("en", LocalizationManager.FallbackLanguageIds.First()); - LocalizationManager.SetUILanguage("en-GB", true); + LocalizationManager.SetUILanguage("en-GB"); Assert.AreEqual("en-GB", LocalizationManager.UILanguageId); Assert.AreEqual(1, LocalizationManager.FallbackLanguageIds.Count()); Assert.AreEqual("en", LocalizationManager.FallbackLanguageIds.First()); @@ -838,7 +838,7 @@ public void TestInexactLanguageMatching() Assert.AreEqual(1, LocalizationManager.FallbackLanguageIds.Count()); Assert.AreEqual("en", LocalizationManager.FallbackLanguageIds.First()); - LocalizationManager.SetUILanguage("en-GB", true); + LocalizationManager.SetUILanguage("en-GB"); Assert.AreEqual("en-GB", LocalizationManager.UILanguageId); Assert.AreEqual(1, LocalizationManager.FallbackLanguageIds.Count()); Assert.AreEqual("en", LocalizationManager.FallbackLanguageIds.First()); @@ -868,7 +868,7 @@ public void GetString_UsesFallbackLanguages() AddFrenchTranslation(GetInstalledDirectory(folder)); AddSpanishTranslation(GetInstalledDirectory(folder)); - LocalizationManager.SetUILanguage("ha", true); + LocalizationManager.SetUILanguage("ha"); var manager = CreateLocalizationManager(AppId, AppName, AppVersion, GetInstalledDirectory(folder), GetGeneratedDirectory(folder), GetUserModifiedDirectory(folder)); LocalizationManagerInternal.LoadedManagers[AppId] = manager; @@ -917,7 +917,7 @@ internal void AddOverSpecifiedSpanishTranslation(string folderPath) [Test] public void TestMappingLanguageCodesToAvailable() { - LocalizationManager.SetUILanguage("en", true); + LocalizationManager.SetUILanguage("en"); LocalizationManagerInternal.LoadedManagers.Clear(); using (var folder = new TempFolder()) { @@ -980,7 +980,7 @@ public void TestMappingLanguageCodesToAvailable() [Test] public void TestMappingLanguageCodesToAvailable_FindsSpecificGivenGeneric() { - LocalizationManager.SetUILanguage("en", true); + LocalizationManager.SetUILanguage("en"); LocalizationManagerInternal.LoadedManagers.Clear(); using (var folder = new TempFolder()) { diff --git a/src/L10NSharp.Windows.Forms.Tests/ILocalizableComponentTests.cs b/src/L10NSharp.Windows.Forms.Tests/ILocalizableComponentTests.cs index 195e5cb..fbc02dc 100644 --- a/src/L10NSharp.Windows.Forms.Tests/ILocalizableComponentTests.cs +++ b/src/L10NSharp.Windows.Forms.Tests/ILocalizableComponentTests.cs @@ -79,7 +79,7 @@ public void TestLocalizingALocalizableComponent() Assert.AreEqual("Fish-eating bird", locComponent.GetLocalizedStringFromMock(locComponent.BirdButton, "TestItem.Bird.Eagle")); // SUT2 - LocalizationManager.SetUILanguage("fr", true); + LocalizationManagerWinforms.SetUILanguage("fr", true); // Verify French Assert.AreEqual("C'est un corbeau", locComponent.GetLocalizedStringFromMock(locComponent.BirdButton, "TestItem.Bird.Crow")); diff --git a/src/L10NSharp.Windows.Forms.Tests/XliffLocalizationManagerTests.cs b/src/L10NSharp.Windows.Forms.Tests/XliffLocalizationManagerTests.cs index d6bb49b..10b220c 100644 --- a/src/L10NSharp.Windows.Forms.Tests/XliffLocalizationManagerTests.cs +++ b/src/L10NSharp.Windows.Forms.Tests/XliffLocalizationManagerTests.cs @@ -87,7 +87,7 @@ public void TearDownLocalizationManagers() LocalizationManager.UseLanguageCodeFolders = false; LocalizationManagerInternalWinforms.LoadedManagers.Clear(); LocalizationManagerInternalWinforms.MapToExistingLanguage.Clear(); - LocalizationManager.SetUILanguage(LocalizationManager.kDefaultLang, false); + LocalizationManagerWinforms.SetUILanguage(LocalizationManager.kDefaultLang, false); } private void AddEnglishTranslation(string folderPath, string appVersion) @@ -160,7 +160,7 @@ private void AddChineseOfTaiwanTranslation(string folderPath) [Test] public void TestMappingLanguageCodesToAvailable_AmbiguousOptions_PromptsUser([Values("zh-CN", "zh-TW")] string choice) { - LocalizationManager.SetUILanguage("en", true); + LocalizationManagerWinforms.SetUILanguage("en", true); LocalizationManagerInternalWinforms.LoadedManagers.Clear(); using (var folder = new L10NSharp.Tests.TempFolder()) { diff --git a/src/L10NSharp.Windows.Forms/ILocalizationManagerInternalWinforms.cs b/src/L10NSharp.Windows.Forms/ILocalizationManagerInternalWinforms.cs index 8f9640b..b9a0d4e 100644 --- a/src/L10NSharp.Windows.Forms/ILocalizationManagerInternalWinforms.cs +++ b/src/L10NSharp.Windows.Forms/ILocalizationManagerInternalWinforms.cs @@ -15,6 +15,10 @@ internal interface ILocalizationManagerInternalWinforms: ILocalizationManagerInt Dictionary> LocalizableComponents { get; } Icon ApplicationIcon { get; set; } + void ApplyLocalization(IComponent component); + void ApplyLocalizationsToILocalizableComponent(LocalizingInfoWinforms locInfo); + void ReapplyLocalizationsToAllComponents(); + void RegisterComponentForLocalizing(IComponent component, string id, string defaultText, string defaultTooltip, string defaultShortcutKeys, string comment); void RegisterComponentForLocalizing(LocalizingInfoWinforms info, diff --git a/src/L10NSharp.Windows.Forms/LocalizationManagerInternalWinforms.cs b/src/L10NSharp.Windows.Forms/LocalizationManagerInternalWinforms.cs index 3fc5e48..64a784f 100644 --- a/src/L10NSharp.Windows.Forms/LocalizationManagerInternalWinforms.cs +++ b/src/L10NSharp.Windows.Forms/LocalizationManagerInternalWinforms.cs @@ -65,7 +65,7 @@ private static ILocalizationManager Create(string desiredUiLangId, string appId, desiredUiLangId = ChooseFallbackLanguageWinforms(desiredUiLangId, applicationIcon); } - L10NSharp.LocalizationManager.SetUILanguage(desiredUiLangId, false); + LocalizationManagerWinforms.SetUILanguage(desiredUiLangId, false); L10NSharp.LocalizationManager.EnableClickingOnControlToBringUpLocalizationDialog = true; @@ -209,6 +209,43 @@ internal static ILocalizationManagerInternalWinforms GetLocalizationManagerFo } #endregion + + /// ------------------------------------------------------------------------------------ + /// + /// Reapplies the localizations to all objects in the localization manager's cache of + /// localized objects. + /// + /// ------------------------------------------------------------------------------------ + public static void ReapplyLocalizationsToAllObjectsInAllManagers() + { + if (LoadedManagers == null) + return; + + foreach (var lm in LoadedManagers.Values) + // ReapplyLocalizationsToAllComponents() is a no-op outside of Winforms. + // We only have something to do if lm is Winforms. + if(lm is ILocalizationManagerInternalWinforms) + ((ILocalizationManagerInternalWinforms)lm).ReapplyLocalizationsToAllComponents(); + } + + /// ------------------------------------------------------------------------------------ + /// + /// Reapplies the localizations to all objects in the localization manager's cache of + /// localized objects. + /// + /// ------------------------------------------------------------------------------------ + public static void ReapplyLocalizationsToAllObjects(string localizationManagerId) + { + if (LoadedManagers == null) + return; + + if (LoadedManagers.TryGetValue(localizationManagerId, out var lm)) + // ReapplyLocalizationsToAllComponents() is a no-op outside of Winforms. + // We only have something to do if lm is Winforms. + if (lm is ILocalizationManagerInternalWinforms) + ((ILocalizationManagerInternalWinforms)lm).ReapplyLocalizationsToAllComponents(); + } + /// ------------------------------------------------------------------------------------ public static string GetLocalizedToolTipForControl(Control ctrl) { diff --git a/src/L10NSharp.Windows.Forms/LocalizationManagerWinforms.cs b/src/L10NSharp.Windows.Forms/LocalizationManagerWinforms.cs index 428a01b..397f9e3 100644 --- a/src/L10NSharp.Windows.Forms/LocalizationManagerWinforms.cs +++ b/src/L10NSharp.Windows.Forms/LocalizationManagerWinforms.cs @@ -121,6 +121,48 @@ public static ILocalizationManager Create(string desiredUiLangId, additionalLocalizationMethods, namespaceBeginnings); } + public static void SetUILanguage(string langId, + bool reapplyLocalizationsToAllObjectsInAllManagers) + { + SetUILanguage(langId); + + if (reapplyLocalizationsToAllObjectsInAllManagers) + ReapplyLocalizationsToAllObjectsInAllManagers(); + } + + /// ------------------------------------------------------------------------------------ + /// + /// Reapplies the localizations to all objects in the localization manager's cache of + /// localized objects. + /// + /// ------------------------------------------------------------------------------------ + public static void ReapplyLocalizationsToAllObjectsInAllManagers() + { + switch (TranslationMemoryKind) + { + default: + case TranslationMemory.XLiff: + LocalizationManagerInternalWinforms.ReapplyLocalizationsToAllObjectsInAllManagers(); + break; + } + } + + /// ------------------------------------------------------------------------------------ + /// + /// Reapplies the localizations to all objects in the localization manager's cache of + /// localized objects. + /// + /// ------------------------------------------------------------------------------------ + public static void ReapplyLocalizationsToAllObjects(string localizationManagerId) + { + switch (TranslationMemoryKind) + { + default: + case TranslationMemory.XLiff: + LocalizationManagerInternalWinforms.ReapplyLocalizationsToAllObjects(localizationManagerId); + break; + } + } public static string GetLocalizedToolTipForControl(Control ctrl) { diff --git a/src/L10NSharp.Windows.Forms/LocalizingInfoWinforms.cs b/src/L10NSharp.Windows.Forms/LocalizingInfoWinforms.cs index 4a86628..3c866c6 100644 --- a/src/L10NSharp.Windows.Forms/LocalizingInfoWinforms.cs +++ b/src/L10NSharp.Windows.Forms/LocalizingInfoWinforms.cs @@ -6,21 +6,14 @@ namespace L10NSharp.Windows.Forms { /// ---------------------------------------------------------------------------------------- /// - /// This class is used to keep track of all the localization information (i.e. extended - /// properties of the LocalizationExtender) for a single object extended by the - /// LocalizationExtender. The type of object is either a Control or ToolStripItem and - /// the information kept track of is the text, tooltip, shortcut keys, localization - /// priority, comment and localization category. + /// This class extends LocalizingInfo and is used to determine and track localization information + /// (i.e. extended properties of the LocalizationExtender) that depends on the specific type of + /// Windows forms object being extended. It is used to get a component's ID, localization category, + /// or shortcut keys. /// /// ---------------------------------------------------------------------------------------- public class LocalizingInfoWinforms : LocalizingInfo { - //private string _id; - //private string _text; - //private string _shortcutKeys; - //private string _comment; - //private LocalizationCategory _category = LocalizationCategory.Unspecified; - #region Constructors /// ------------------------------------------------------------------------------------ /// @@ -153,18 +146,6 @@ private static string MakeIdForDataGridViewColumn(DataGridViewColumn col) null : GetIdFromText(col.HeaderText)); } - /*/// ------------------------------------------------------------------------------------ - public static string GetIdFromText(string text) - { - if (text.StartsWith(LocalizationManager.kL10NPrefix)) - text = text.Substring(LocalizationManager.kL10NPrefix.Length); - - int i = text.IndexOf("!", StringComparison.Ordinal); - //review: this is what David had, but I don't understand it (and the unit test fails with it) - //return (i < 0 ? string.Empty : text.Substring(0, i)); - return (i < 0 ? text : text.Substring(0, i)); - }*/ - /// ------------------------------------------------------------------------------------ /// /// Tries to get the name of the form that hosts the specified control. That name is diff --git a/src/L10NSharp.Windows.Forms/XLiffUtils/XliffLocalizationManagerWinforms.cs b/src/L10NSharp.Windows.Forms/XLiffUtils/XliffLocalizationManagerWinforms.cs index 2f3fbce..4329fa8 100644 --- a/src/L10NSharp.Windows.Forms/XLiffUtils/XliffLocalizationManagerWinforms.cs +++ b/src/L10NSharp.Windows.Forms/XLiffUtils/XliffLocalizationManagerWinforms.cs @@ -151,11 +151,12 @@ public void ApplyLocalizationsToILocalizableComponent(LocalizingInfoWinforms loc /// localized components. /// /// ------------------------------------------------------------------------------------ - public new void ReapplyLocalizationsToAllComponents() + public void ReapplyLocalizationsToAllComponents() { foreach (var component in ComponentCache.Keys) ApplyLocalization(component); } + /// ------------------------------------------------------------------------------------ /// /// Recreates the tooltip control and updates the tooltip text for each object having @@ -163,7 +164,7 @@ public void ApplyLocalizationsToILocalizableComponent(LocalizingInfoWinforms loc /// during runtime. /// /// ------------------------------------------------------------------------------------ - public new void RefreshToolTips() + public void RefreshToolTips() { foreach (var toolTipCtrl in ToolTipCtrls.Values) toolTipCtrl.Dispose(); @@ -187,7 +188,7 @@ public void ApplyLocalizationsToILocalizableComponent(LocalizingInfoWinforms loc /// Initializes the specified component. /// /// ------------------------------------------------------------------------------------ - public new void ApplyLocalization(IComponent component) + public void ApplyLocalization(IComponent component) { if (component == null) return; diff --git a/src/L10NSharp/ILocalizationManager.cs b/src/L10NSharp/ILocalizationManager.cs index a250fe2..987f67e 100644 --- a/src/L10NSharp/ILocalizationManager.cs +++ b/src/L10NSharp/ILocalizationManager.cs @@ -80,15 +80,6 @@ public interface ILocalizationManager: IDisposable bool DoesCustomizedTranslationExistForLanguage(string langId); - /// ------------------------------------------------------------------------------------ - /// - /// Recreates the tooltip control and updates the tooltip text for each object having - /// a tooltip. This is necessary sometimes when controls get moved from form to form - /// during runtime. - /// - /// ------------------------------------------------------------------------------------ - void RefreshToolTips(); - void PrepareToCustomizeLocalizations(); /// ------------------------------------------------------------------------------------ diff --git a/src/L10NSharp/ILocalizationManagerInternal.cs b/src/L10NSharp/ILocalizationManagerInternal.cs index aab4a89..29d3bce 100644 --- a/src/L10NSharp/ILocalizationManagerInternal.cs +++ b/src/L10NSharp/ILocalizationManagerInternal.cs @@ -10,11 +10,6 @@ internal interface ILocalizationManagerInternal: ILocalizationManager { Dictionary ComponentCache { get; } - void ApplyLocalization(IComponent component); - void ApplyLocalizationsToILocalizableComponent(LocalizingInfo locInfo); - - void ReapplyLocalizationsToAllComponents(); - string GetStringFromStringCache(string uiLangId, string id); void SaveIfDirty(ICollection langIdsToForceCreate); diff --git a/src/L10NSharp/LocalizationManager.cs b/src/L10NSharp/LocalizationManager.cs index b2656df..ff88225 100644 --- a/src/L10NSharp/LocalizationManager.cs +++ b/src/L10NSharp/LocalizationManager.cs @@ -151,8 +151,7 @@ public static void DeleteOldTranslationFiles(string appId, } /// ------------------------------------------------------------------------------------ - public static void SetUILanguage(string langId, - bool reapplyLocalizationsToAllObjectsInAllManagers) + public static void SetUILanguage(string langId) { if (UILanguageId == langId || string.IsNullOrEmpty(langId)) return; @@ -168,9 +167,6 @@ public static void SetUILanguage(string langId, LocalizationManagerInternal.SetAvailableFallbackLanguageIds(GetAvailableLocalizedLanguages()); break; } - - if (reapplyLocalizationsToAllObjectsInAllManagers) - ReapplyLocalizationsToAllObjectsInAllManagers(); } /// ------------------------------------------------------------------------------------ @@ -587,40 +583,6 @@ internal static string GetTranslationFileNameForLanguage(string appId, string la : $"{appId}.{langId}{fileExtension}"; } - /// ------------------------------------------------------------------------------------ - /// - /// Reapplies the localizations to all objects in the localization manager's cache of - /// localized objects. - /// - /// ------------------------------------------------------------------------------------ - public static void ReapplyLocalizationsToAllObjectsInAllManagers() - { - switch (TranslationMemoryKind) - { - default: - case TranslationMemory.XLiff: - LocalizationManagerInternal.ReapplyLocalizationsToAllObjectsInAllManagers(); - break; - } - } - - /// ------------------------------------------------------------------------------------ - /// - /// Reapplies the localizations to all objects in the localization manager's cache of - /// localized objects. - /// - /// ------------------------------------------------------------------------------------ - public static void ReapplyLocalizationsToAllObjects(string localizationManagerId) - { - switch (TranslationMemoryKind) - { - default: - case TranslationMemory.XLiff: - LocalizationManagerInternal.ReapplyLocalizationsToAllObjects(localizationManagerId); - break; - } - } - /// /// Merge the existing English l10n file into newly collected data and write the /// result to the temp directory. diff --git a/src/L10NSharp/LocalizationManagerInternal.cs b/src/L10NSharp/LocalizationManagerInternal.cs index f1244e8..59cdc84 100644 --- a/src/L10NSharp/LocalizationManagerInternal.cs +++ b/src/L10NSharp/LocalizationManagerInternal.cs @@ -81,7 +81,7 @@ protected static ILocalizationManager Create(string desiredUiLangId, string appI desiredUiLangId = ChooseFallbackLanguage(); } - LocalizationManager.SetUILanguage(desiredUiLangId, false); + LocalizationManager.SetUILanguage(desiredUiLangId); LocalizationManager.EnableClickingOnControlToBringUpLocalizationDialog = true; @@ -424,36 +424,6 @@ public static int StringCount(string lang) #endregion - /// ------------------------------------------------------------------------------------ - /// - /// Reapplies the localizations to all objects in the localization manager's cache of - /// localized objects. - /// - /// ------------------------------------------------------------------------------------ - public static void ReapplyLocalizationsToAllObjectsInAllManagers() - { - if (LoadedManagers == null) - return; - - foreach (var lm in LoadedManagers.Values) - lm.ReapplyLocalizationsToAllComponents(); - } - /// ------------------------------------------------------------------------------------ - /// - /// Reapplies the localizations to all objects in the localization manager's cache of - /// localized objects. - /// - /// ------------------------------------------------------------------------------------ - public static void ReapplyLocalizationsToAllObjects(string localizationManagerId) - { - if (LoadedManagers == null) - return; - - if (LoadedManagers.TryGetValue(localizationManagerId, out var lm)) - lm.ReapplyLocalizationsToAllComponents(); - } - - /// ------------------------------------------------------------------------------------ /// /// Gets the text for the specified component. The englishText is returned when the text diff --git a/src/L10NSharp/LocalizingInfo.cs b/src/L10NSharp/LocalizingInfo.cs index bfa1d58..9972eb6 100644 --- a/src/L10NSharp/LocalizingInfo.cs +++ b/src/L10NSharp/LocalizingInfo.cs @@ -92,11 +92,9 @@ internal enum UpdateFields /// ---------------------------------------------------------------------------------------- /// - /// This class is used to keep track of all the localization information (i.e. extended - /// properties of the LocalizationExtender) for a single object extended by the - /// LocalizationExtender. The type of object is either a Control or ToolStripItem and - /// the information kept track of is the text, tooltip, shortcut keys, localization - /// priority, comment and localization category. + /// This class is used to keep track, for a single object, of localization information that can + /// be determined without knowledge of Windows forms object types. It tracks text, + /// tooltip text, shortcut keys, localization priority, comment, and localization category. /// /// ---------------------------------------------------------------------------------------- public class LocalizingInfo diff --git a/src/L10NSharp/XLiffUtils/XliffLocalizationManager.cs b/src/L10NSharp/XLiffUtils/XliffLocalizationManager.cs index 505c00a..7a6a961 100644 --- a/src/L10NSharp/XLiffUtils/XliffLocalizationManager.cs +++ b/src/L10NSharp/XLiffUtils/XliffLocalizationManager.cs @@ -581,63 +581,6 @@ protected string GetTooltipFromStringCache(string uiLangId, string id) #endregion #region Methods that apply localizations to an object. - public void ApplyLocalizationsToILocalizableComponent(LocalizingInfo locInfo) - { - // Do nothing because we won't be dealing with an ILocalizableComponent outside of Winforms. - } - - /// ------------------------------------------------------------------------------------ - /// - /// Reapplies the localizations to all components in the localization manager's cache of - /// localized components. - /// - /// ------------------------------------------------------------------------------------ - public void ReapplyLocalizationsToAllComponents() - { - // Do nothing because we won't be dealing with an ILocalizableComponent outside of Winforms. - } - - /// ------------------------------------------------------------------------------------ - /// - /// Recreates the tooltip control and updates the tooltip text for each object having - /// a tooltip. This is necessary sometimes when controls get moved from form to form - /// during runtime. - /// - /// ------------------------------------------------------------------------------------ - public void RefreshToolTips() - { - // Do nothing because we know we won't be dealing with tooltips outside of Winforms. - } - - /// ------------------------------------------------------------------------------------ - /// - /// Initializes the specified component. - /// - /// ------------------------------------------------------------------------------------ - public void ApplyLocalization(IComponent component) - { - // Do nothing because we won't be dealing with an ILocalizableComponent outside of Winforms. - } - - /*/// ------------------------------------------------------------------------------------ - /// - /// Initializes the specified ILocalizableComponent. - /// - /// ------------------------------------------------------------------------------------ - internal void ApplyLocalizationsToLocalizableComponent( - ILocalizableComponent locComponent, Dictionary idToLocInfo) - { - if (locComponent == null) - return; - - foreach (var kvp in idToLocInfo) - { - var id = kvp.Key; - var locInfo = kvp.Value; - locComponent.ApplyLocalizationToString(locInfo.Component, id, GetLocalizedString(id, locInfo.Text)); - } - }*/ - protected static string UILanguageId => LocalizationManager.UILanguageId; #endregion diff --git a/src/L10NSharp/XLiffUtils/XliffLocalizedStringCache.cs b/src/L10NSharp/XLiffUtils/XliffLocalizedStringCache.cs index 8b98c99..93f6766 100644 --- a/src/L10NSharp/XLiffUtils/XliffLocalizedStringCache.cs +++ b/src/L10NSharp/XLiffUtils/XliffLocalizedStringCache.cs @@ -48,9 +48,9 @@ internal XliffLocalizedStringCache(ILocalizationManager owningManager, bool load } catch (Exception e) { - //MessageBox.Show("Error occurred reading localization file:" + Environment.NewLine + e.Message, - // Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Warning); - LocalizationManager.SetUILanguage(LocalizationManager.kDefaultLang, false); + Console.WriteLine("Error occurred reading localization file:"); + Console.WriteLine(e.Message); + LocalizationManager.SetUILanguage(LocalizationManager.kDefaultLang); } } else diff --git a/src/SampleApp/Form1.cs b/src/SampleApp/Form1.cs index 068a4f9..312c71d 100644 --- a/src/SampleApp/Form1.cs +++ b/src/SampleApp/Form1.cs @@ -2,6 +2,7 @@ using System.Drawing; using System.Windows.Forms; using L10NSharp; +using L10NSharp.Windows.Forms; using SampleApp.Properties; namespace SampleApp @@ -24,7 +25,7 @@ private void UpdateDynamicLabel() private void uiLanguageComboBox1_SelectedIndexChanged(object sender, EventArgs e) { Settings.Default.UserInterfaceLanguage = uiLanguageComboBox1.SelectedLanguage; - LocalizationManager.SetUILanguage(uiLanguageComboBox1.SelectedLanguage, true); + LocalizationManagerWinforms.SetUILanguage(uiLanguageComboBox1.SelectedLanguage, true); UpdateDynamicLabel(); } From a96ea73bfb7c169806c4b5854e6091a2f3b3705d Mon Sep 17 00:00:00 2001 From: Ariel Rorabaugh Date: Tue, 9 Sep 2025 15:58:37 -0400 Subject: [PATCH 25/25] Fix typo in Changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 213e72d..50673cd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -73,7 +73,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). MOVED: The following are moved to XliffLocalizationManagerWinforms: - The properties ApplicationIcon, ToolTipCtrls, LocalizableComponents and StringCache. - - The methods RegisterComponentForLocalizing, GetShortcutKeyFromStringCache, ApplyLocalizationToIlocalizableComponent, ReapplyLocalizationsToAllComponents, RefreshToolips, ApplyLocalization, ApplyLocalizationsToILocalizableComponent, ApplyLocalizationsToControl, ApplyLocalizedToolTipToControl, HandleToolTipRefChanged, HandleToolTipRefDestroyed, ApplyLocalizationsToToolStripItem, ApplyLocalizationToListViewColumnHeader, and ApplyLocalizationToDataGridViewColumn. + - The methods RegisterComponentForLocalizing, GetShortcutKeyFromStringCache, ApplyLocalizationToIlocalizableComponent, ReapplyLocalizationsToAllComponents, RefreshToolTips, ApplyLocalization, ApplyLocalizationsToILocalizableComponent, ApplyLocalizationsToControl, ApplyLocalizedToolTipToControl, HandleToolTipRefChanged, HandleToolTipRefDestroyed, ApplyLocalizationsToToolStripItem, ApplyLocalizationToListViewColumnHeader, and ApplyLocalizationToDataGridViewColumn. - Split XliffLocalizedStringCache into XliffLocalizedStringCacheWinforms and XliffLocalizedStringCache.