-
Notifications
You must be signed in to change notification settings - Fork 459
Deprecate LocalizationResourceManager.SetCulture #766
Changes from 2 commits
bf01d6b
3ccc288
0f77e70
cac87cf
3d09b0e
68dc2d8
7ef57e9
bb42757
771c9b5
d603431
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,11 +3,12 @@ | |
using System.Globalization; | ||
using System.Resources; | ||
using System.Threading; | ||
using Xamarin.CommunityToolkit.ObjectModel; | ||
|
||
namespace Xamarin.CommunityToolkit.Helpers | ||
{ | ||
#if !NETSTANDARD1_0 | ||
public class LocalizationResourceManager : INotifyPropertyChanged | ||
public class LocalizationResourceManager : ObservableObject | ||
{ | ||
public static LocalizationResourceManager Current { get; } = new LocalizationResourceManager(); | ||
|
||
|
@@ -29,18 +30,15 @@ public string GetValue(string text) => | |
public string this[string text] => | ||
GetValue(text); | ||
|
||
public void SetCulture(CultureInfo language) | ||
[Obsolete("Use " + nameof(CurrentCulture) + " to set culture")] | ||
pictos marked this conversation as resolved.
Show resolved
Hide resolved
|
||
[EditorBrowsable(EditorBrowsableState.Never)] | ||
public void SetCulture(CultureInfo language) => CurrentCulture = language; | ||
|
||
public CultureInfo CurrentCulture | ||
{ | ||
currentCulture = language; | ||
Invalidate(); | ||
get => currentCulture; | ||
set => SetProperty(ref currentCulture, value, null); | ||
} | ||
|
||
public CultureInfo CurrentCulture => currentCulture; | ||
|
||
public event PropertyChangedEventHandler PropertyChanged; | ||
|
||
public void Invalidate() => | ||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(null)); | ||
Comment on lines
-50
to
-51
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @jfversluis can we just remove it? Or we should mark it as obsolete and editorbrowsablestate.never There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This method doesn't make sense anymore. Culture is stored in the private field, and when we change it, we always call It was needed earlier since culture was stored in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see what you're saying, I think it would make sense to first release a version where it's deprecated though. That way people will get a heads up that it is going away and gives them the opportunity to change their code at their pace instead of just dropping a breaking change over the fence that they have to deal with without any notice upfront. Does that make sense? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Makes sense, returned the method. When are we planning to remove everything that is marked as There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would say 1 version obsolete, next version it's gone :) |
||
} | ||
#endif | ||
} |
Uh oh!
There was an error while loading. Please reload this page.