Namespace RentADeveloper.ResXLocalization.Avalonia

Classes

Argument

One format argument of LocalizeExtension, written as an <l:Argument> child element: <l:Localize Key="{x:Static res:StringsKeys.PeopleInvited}"><l:Argument Value="{Binding PeopleCount}" /></l:Localize>.

DesignTime

Hosts the DesignTime.Culture attached property, which selects the language the Avalonia XAML previewer shows. Set it on the root element: <Window ... l:DesignTime.Culture="de">.

LocalizeEnumConverter

Multi-value converter that localizes an enumeration value in a hand-written MultiBinding, for places where a markup extension such as LocalizeEnumExtension is not accepted, for example a Binding-typed property. The children of the MultiBinding are: 0, the refresh trigger <Binding Path="RefreshTriggeringRevision" Source="{x:Static core:Localizer.Current}" />, which re-runs the conversion on every change of RefreshTriggeringRevision; 1, the enumeration value; 2 and up, the format arguments, in order. The value is mapped to a resource key by EnumKeyBuilder, by default {KeyPrefix}{EnumTypeName}_{Value}.

LocalizeEnumExtension

XAML markup extension that localizes an enumeration value, re-resolving automatically on every change of the value and of RefreshTriggeringRevision of Current. The value is mapped to a resource key by EnumKeyBuilder, by default {KeyPrefix}{EnumTypeName}{Value}. Usage in XAML: {l:LocalizeEnum Value={Binding SortOrder}} (or the shorthand {l:LocalizeEnum {Binding SortOrder}}) for a bound value, {l:LocalizeEnum Value={Binding}} in an item template whose item is the enumeration value, or {l:LocalizeEnum Value={x:Static m:FileSortOrder.Ascending}} for a fixed member. When the resource value is a composite format string, supply its arguments as Argument child elements: <l:LocalizeEnum Value="{Binding SortOrder}" KeyPrefix="Count"><l:Argument Value="{Binding FileCount}" /></l:LocalizeEnum>.

LocalizeExtension

XAML markup extension that produces a binding to a localized string, re-resolving automatically on every change of RefreshTriggeringRevision of Current - a language switch, a new formatter, a new lookup-failure text builder or a change of the registered resource managers. Usage in XAML: {l:Localize {x:Static res:StringsKeys.Greeting}} for a typed key, {l:Localize Greeting} for a key-only lookup across all registered resource managers, or {l:Localize Key=Greeting, ResourceManager={x:Static res:StringsKeys.ResourceManager}} to scope the lookup to one file. A key chosen by the view model is bound: {l:Localize {Binding StatusKey}} or Key="{Binding StatusKey}"; bind a ResourceKey to keep the key compile-checked. When the resource value is a composite format string, supply its arguments as Argument child elements: <l:Localize Key="{x:Static res:StringsKeys.PeopleInvited}"><l:Argument Value="{Binding PeopleCount}" /></l:Localize>.