Multiple languages

May 8, 2013 at 1:50 PM
Hello,
I am trying a basic example to use this extensions and I can not make it to work for other languages than "en".
I am pasting here the code from MainWindow.xaml
<Window x:Class="WpfApplication3.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:sys="clr-namespace:System;assembly=mscorlib"
        xmlns:Engine="clr-namespace:WPFLocalizeExtension.Engine;assembly=WPFLocalizeExtension"
        xmlns:Providers="clr-namespace:WPFLocalizeExtension.Providers;assembly=WPFLocalizeExtension"
        xmlns:lex="clr-namespace:WPFLocalizeExtension.Extensions;assembly=WPFLocalizeExtension"
        Engine:LocalizeDictionary.DesignCulture="fr"
        Providers:ResxLocalizationProvider.DefaultAssembly="WpfApplication3"
        Providers:ResxLocalizationProvider.DefaultDictionary="Language"
        Title="MainWindow" Height="350" Width="525">
    <StackPanel>
        <Label Content="{lex:Loc Key=res1}" />
        <Label Content="{lex:Loc Key=res2}" />
        <Label Content="{lex:Loc Key=res3}" />
        <Label Content="test" />
    </StackPanel>
</Window>
If I change fr to en it is working, but with fr it will display the content of the Language.resx and not the Language.fr.resx.

I also changed the code in csproj as follows:
    <EmbeddedResource Include="Properties\Resources.resx">
      <Generator>ResXFileCodeGenerator</Generator>
      <LastGenOutput>Resources.Designer.cs</LastGenOutput>
    </EmbeddedResource>
    <EmbeddedResource Include="Resources\Language.en.resx" >
        <SubType>Designer</SubType>
        <DependentUpon>Language.resx</DependentUpon>
    </EmbeddedResource>
    <EmbeddedResource Include="Resources\Language.fr.resx" >
         <SubType>Designer</SubType>
        <DependentUpon>Language.resx</DependentUpon>
    </EmbeddedResource>
    <EmbeddedResource Include="Resources\Language.resx">
      <Generator>PublicResXFileCodeGenerator</Generator>
      <LastGenOutput>Language.Designer.cs</LastGenOutput>
    </EmbeddedResource>
What am I doing wrong?

Thanks,
Dan
Coordinator
May 8, 2013 at 4:35 PM
May 9, 2013 at 7:54 AM
Thank you for you answer. I couldn't find anything in the assembly.cs that you mentioned. I also found a comment on a documentation section saying that in designer in WPF is working only the en.
To see the fr i added in code:
 LocalizeDictionary.Instance.Culture = CultureInfo.GetCultureInfo("fr");
It was the only way to make it work. Please let me know if it is another solution to see the fr or other language than en in designer.

Thanks,
Dan
Coordinator
May 16, 2013 at 8:51 PM
Hi,

the VS2012 designer has problems with multiple satellite assemblies. I already opened a forums discussion at Microsoft regarding this issue, but did get results yet.
I'll keep you informed (or just have a look at the progress of issue #9269.

Best regards,
Uwe