Page 1 of 1

localization inside a resource dictionary

Posted: 02 Oct 2023, 19:04
by samc
Hi,

We've been using the localization extension:

https://www.noesisengine.com/docs/App.A ... nsion.html

And so far it's been working well for us.

We did have one question - we haves several resource dictionaries declared in xaml (not user controls) that contain styling information, default buttons, and templates (for use in list controls). Many of these have strings we want to localize.

Is there a way to use loc extension in resource dictionaries like these? Or is there a recommendation on how best to make this work?

thanks,
sam

Re: localization inside a resource dictionary

Posted: 03 Oct 2023, 18:09
by sfernandez
Hi Sam,

The use case will be to use the Loc extension in elements of a template, right?
<ControlTemplate x:Key="Button" TargetType="Button">
  <StackPanel>
    <TextBlock Text="{noesis:Loc BtnHeader}"/>
    <ContentPresenter/>
  </StackPanel>
</ControlTemplate>
Do you need to use the localization extension in any other context in a ResourceDictionary? I want to confirm we cover all the situations.

Re: localization inside a resource dictionary

Posted: 03 Oct 2023, 19:12
by samc
The other case where we're using it is in data templates. Here's a snipped example from our project:
    <DataTemplate x:Key="NetworkGroupEntryTemplate">
        <Grid x:Name="Root">
                <StackPanel Orientation="Horizontal">
                    <TextBlock Text="{noesis:Loc Members}" Style="{StaticResource Text.Body}"/>
                </StackPanel>
        </Grid>
    </DataTemplate>
I'll check with our designers to see if they can think of any other examples, but i think data template is the main one.

thanks,
sam

Re: localization inside a resource dictionary

Posted: 03 Oct 2023, 19:39
by sfernandez
Ok, I did some tests and that scenario (using the loc extension inside templates - ControlTemplate or DataTemplate) is not supported with the current implementation.
Could you please report it in our bugtracker? We will provide a patch for you to try.