feat(i18n): add Tr markup extension for XAML texts

{l:Tr Key} binds to Loc, so XAML texts follow a language switch.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
fraujulianandClaude Opus 5.5 committed 2026-11-26 09:20:46 +01:00
1 parent 527c378ccd
commit cf29d97bc4
1 file changed
+15
+15
View File
@@ -0,0 +1,15 @@
using System.Windows.Data;
using System.Windows.Markup;
using Radiosender.Services.Localization;
namespace Radiosender.Views;
// {l:Tr Key}: localized text that follows language switches. Keys: letters, digits, underscore.
[MarkupExtensionReturnType(typeof(string))]
public sealed class TrExtension(string key) : MarkupExtension
{
public string Key { get; } = key;
public override object ProvideValue(IServiceProvider serviceProvider) =>
new Binding($"[{Key}]") { Source = Loc.Instance, Mode = BindingMode.OneWay }.ProvideValue(serviceProvider);
}