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
I'd like to suggest a modification to the GetValue(string text) method in the LocalizationResourceManager.
Current Behavior:
The method throws a NullReferenceException when a localized string isn't found:
return value ?? throw new NullReferenceException($"{nameof(text)}: {text} not found!");
when I use it in xaml like that: xmlns:loc="clr-namespace:LocalizationResourceManager.Maui;assembly=LocalizationResourceManager.Maui" <Label Text="{loc:Translate helloWorld}" />
Proposed Change:
Instead of throwing an exception, it might be more user-friendly to return a placeholder string:
return value ?? $"Text:{text}";
This approach would help avoid application crashes due to missing localization strings and instead display a placeholder, aiding in identifying the missing items.
I believe this change would enhance the overall usability of the library. Your feedback on this suggestion would be greatly appreciated.
Thank you!
The text was updated successfully, but these errors were encountered:
- Add SuppressTextNotFoundException setting to suppress/deactive throwing the text not found exception.
- Add option to set a placeholder text displayed if text is not found.
Hello,
I'd like to suggest a modification to the
GetValue(string text)
method in the LocalizationResourceManager.Current Behavior:
The method throws a NullReferenceException when a localized string isn't found:
return value ?? throw new NullReferenceException($"{nameof(text)}: {text} not found!");
when I use it in xaml like that:
xmlns:loc="clr-namespace:LocalizationResourceManager.Maui;assembly=LocalizationResourceManager.Maui"
<Label Text="{loc:Translate helloWorld}" />
Proposed Change:
Instead of throwing an exception, it might be more user-friendly to return a placeholder string:
return value ?? $"Text:{text}";
This approach would help avoid application crashes due to missing localization strings and instead display a placeholder, aiding in identifying the missing items.
I believe this change would enhance the overall usability of the library. Your feedback on this suggestion would be greatly appreciated.
Thank you!
The text was updated successfully, but these errors were encountered: