Reputation: 454
In my solution I use a separate Class Library as a localization resource and in my views I use it by the following way:
<Application.Resources>
<ResourceDictionary>
...
<localization:LocalizedStrings x:Key="localizer"/>
</ResourceDictionary>
</Application.Resources>
...
<AppBarButton Icon="Back" Label="{Binding Strings.Back, Source={StaticResource localizer}}" Command="{Binding UpToEventViewCommand}"/>
How can I localize my toast notifications? I tried to use ms-resource Uri like in the tutorial (https://learn.microsoft.com/en-us/windows/uwp/design/shell/tiles-and-notifications/tile-toast-language-scale-contrast) but it doesn't work in this case.
Can I remap my-resource or use another way to localize my toast notifications?
UPDATE:
LocalizedStrings is like just a manager for my string resources:
public class LocalizedStrings
{
public LocalizedStrings() { }
private static readonly Strings LocalizedStringsResources = new Strings();
public Strings Strings => LocalizedStringsResources;
}
Upvotes: 2
Views: 96
Reputation: 86
You can acess your class like this
var localizer = Application.Current.Resources["localizer"] as LocalizedStrings;
And then access everything that you want
toast.Text = localizer.String.ToastText;
Upvotes: 0