You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Split L10NSharp to remove winforms dependency (#125)
* Remove Winforms dependency.
* Move UI code into WindowsForms/UI
* Split into two projects with only one dependent on winforms
* Update SampleApp csproj
* Cleanup & add ChooseFallbackLanguage in Winforms
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.
Change L10NSharpWinforms to L10NSharp.Windows.Forms
Change L10NSharpWinformsTests to L10NSharp.Windows.Forms.Tests
Change L10NSharpTests folder to L10NSharp.Tests
+semver:major
Copy file name to clipboardExpand all lines: CHANGELOG.md
+77Lines changed: 77 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,6 +16,83 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
16
16
17
17
## [Unreleased]
18
18
19
+
### Changed
20
+
21
+
- 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.
22
+
23
+
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.)
24
+
25
+
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.
26
+
27
+
- Split ILocalizationManagerInternal into ILocalizationManagerInternal and ILocalizationManagerInternalWinforms.
28
+
29
+
CHANGED: ILocalizationManagerInternalWinforms\<T> declares a new StringCache object of type ILocalizedStringCacheWinforms\<T>, while ILocalizationManagerInternal\<T> has a StringCache object of type ILocalizedStringCache\<T>.
30
+
31
+
MOVED: The properties ToolTipCtrls, LocalizableComponents, and ApplicationIcon; and the methods ApplyLocalization, ApplyLocalizationsToILocalizableComponent, ReapplyLocalizationsToAllComponents, and RegisterComponentForLocalizing are moved to ILocalizationManagerInternalWinforms.
32
+
33
+
- Split ILocalizedStringCache into ILocalizedStringCache and ILocalizedStringCacheWinforms.
34
+
35
+
MOVED: The property LeafNodeList, and the methods GetShortcutKeys and LoadGroupNodes are moved to ILocalizedStringCacheWinforms.
36
+
37
+
- Split LocalizationManager into LocalizationManager and LocalizationManagerWinforms.
38
+
39
+
CHANGED: Remove static designation from the LocalizationManager class in order for LocalizationManagerWinforms to subclass it and share its properties.
40
+
41
+
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.)
42
+
43
+
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.
44
+
45
+
MOVED: The methods ReapplyLocalizationsToAllObjectsInAllManagers, ReapplyLocalizationsToAllObjects, and GetLocalisedToolTipForControl are moved to LocalizationManagerWinforms.
46
+
47
+
- Split LocalizationManagerInternal into LocalizationManagerInternal and LocalizationManagerInternalWinforms.
48
+
49
+
CHANGED: Remove static designation from LocalizationManagerInternal class in order for LocalizationManagerInternalWinforms to subclass it and share its s_loadedManagers property.
50
+
51
+
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.
52
+
53
+
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.
54
+
55
+
CHANGED: Remove Icon argument from the CreateXliff method in LocalizationManagerInternal. CreateXliff methods in LocalizationManagerInternalWinforms are available with and without the Icon argument.
56
+
57
+
CHANGED: In LocalizationManagerInternalWinforms, GetLocalizationManagerForComponent and GetLocalizationManagerForString, return type ILocalizationManagerInternalWinforms\<T> instead of ILocalizationManagerInternal\<T>.
58
+
59
+
MOVED: The methods ReapplyLocalizationsToAllObjectsInAllManagers, ReapplyLocalizationsToAllObjects, GetLocalizedToolTipForControl, and GetRealTopLevelControl are moved to LocalizationManagerInternalWinforms.
60
+
61
+
- Split LocalizingInfo into LocalizingInfo and LocalizingInfoWinforms.
62
+
63
+
CHANGED: Make private properties protected. LocalizingInfo returns null for Id while LocalizingInfoWinforms retains method to make an Id from a winforms component.
64
+
65
+
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
66
+
67
+
- Split Utils into Utils and UtilsWinforms.
68
+
69
+
MOVED: The methods SendMessage, SendMessageWindows and SetWindowRedraw are moved to UtilsWinforms.
70
+
71
+
- Split XliffLocalizationManager into XliffLocalizationManager and XliffLocalizationManagerWinforms.
72
+
73
+
MOVED: The following are moved to XliffLocalizationManagerWinforms:
74
+
75
+
- The properties ApplicationIcon, ToolTipCtrls, LocalizableComponents and StringCache.
76
+
- The methods RegisterComponentForLocalizing, GetShortcutKeyFromStringCache, ApplyLocalizationToIlocalizableComponent, ReapplyLocalizationsToAllComponents, RefreshToolTips, ApplyLocalization, ApplyLocalizationsToILocalizableComponent, ApplyLocalizationsToControl, ApplyLocalizedToolTipToControl, HandleToolTipRefChanged, HandleToolTipRefDestroyed, ApplyLocalizationsToToolStripItem, ApplyLocalizationToListViewColumnHeader, and ApplyLocalizationToDataGridViewColumn.
77
+
78
+
- Split XliffLocalizedStringCache into XliffLocalizedStringCacheWinforms and XliffLocalizedStringCache.
79
+
80
+
MOVED: The LeafNodeList property and the methods LoadGroupNodes and GetShortcutKeys are moved to XliffLocalizedStringCacheWinforms.
81
+
82
+
### Removed
83
+
84
+
- BREAKING CHANGE: Remove code related to doing one's own localization at runtime. Also remove obsolete create methods from LocalizationManager.
85
+
86
+
In particular:
87
+
88
+
- Remove the LocalizeItemDlg designer, cs, resx, and viewmodel.
89
+
- Remove ShowLocalizationDialogBox from LocalizationManager and LocalizationManagerInternal.
90
+
- Remove the following runtime-localization related methods from XliffLocalizationManager:
- Remove obsolete Create methods from LocalizationManager. These are the two Create methods that included a TranslationMemory argument.
93
+
94
+
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.
using (varlm=LocalizationManager.Create(lang, "SampleApp",
@@ -39,8 +54,10 @@ or `es/Whatever.xlf`).
39
54
### Selecting a Language
40
55
41
56
Ifanexactmatchfor the requested language is not available, L10NSharp will try to find the best available language. For example, if the client
42
-
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
43
-
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
57
+
requests `es` but only `Whatever.es-ES.xlf` is available, `Whatever.es-ES.xlf` will be loaded automatically, and vice versa.
58
+
59
+
In L10NSharp.Windows.Forms, if the client
60
+
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
44
61
inform the user that the selected language is not available and prompt the user to select from the available languages.
45
62
46
63
## Thread safety
@@ -51,14 +68,9 @@ attempted to make the various varieties of `GetString` thread-safe,.
0 commit comments