I have a simple console application (.NET Framework 4.6.1) where I'm trying to use multiple resx files by changing cultureinfo. Here is my code:
`static void Main( string[] args )
{
//default
Console.WriteLine( Resource.Hello );
Thread.CurrentThread.CurrentCulture = new CultureInfo( "fr-FR" );
Thread.CurrentThread.CurrentUICulture = new CultureInfo( "fr-FR" );
//french
Console.WriteLine( Resource.Hello );
Thread.CurrentThread.CurrentCulture = new CultureInfo( "hu-HU" );
Thread.CurrentThread.CurrentUICulture = new CultureInfo( "hu-HU" );
//hungarian
Console.WriteLine( Resource.Hello );
string res = Resource.ResourceManager.GetString( "Hello", CultureInfo.GetCultureInfo( "hu-HU" ) );
Console.WriteLine( res );
Console.ReadKey();
}`
My default culture is en-US. I have a single line in the resx files with the key "Hello". For some reason with fr-FR cultureinfo it works fine but the others got the fallback value.
Related part of the project csproj file:
<ItemGroup>
<EmbeddedResource Include="Properties\Resource.hu-HU.resx">
<DependentUpon>Resource.resx</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resource.fr-FR.resx">
<DependentUpon>Resource.resx</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resource.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resource.Designer.cs</LastGenOutput>
</ItemGroup>
I added all the resx files manually to my project and under Properties. Only the default has a designer.cs
Any ideas? Thanks for advance!