Search code examples
xamarin.formslocalizationresx

Xamarin forms resx localization always return default language


My Xamarin forms resx localization always return default language after visual studio update.

Current version is visual studio 16.9.5 and I tried 16.10 Preview version but it had the same bug.

My AppResources.resx file setting

Build action: Embedded Resource
Custom tool: PublicResXFileCodeGenerator

and other AppResources.ko.resx and AppResources.ja.resx file setting

Build action: Embedded Resource

The workaround below has already been applied but not working to me. (https://github.com/xamarin/xamarin-android/issues/4664#issuecomment-632986668)

Please help me.. I spent almost two days into this bug..

---------------------------------- Add ---------------------------------------

My main project's name is 'Core'.

My resx files are in 'Core/Properties/' (ex] Core/Properties/AppResources.resx').

Default language is 'en' and I have also 'AppResources.ko.resx' and 'AppResources.ja.resx' in the same path as AppResources.resx.


Solution

  • I have solved this issue.

    The problem is from the latest visual studio version and the previous workaround (https://github.com/xamarin/xamarin-android/issues/4664#issuecomment-632986668)

    The previous workaround propose to modify Android project .csproj file as belows

     <Target Name="_ResolveSatellitePaths"
    DependsOnTargets="_ResolveAssemblies">
    <ResolveAssemblyReference
        AllowedAssemblyExtensions="$(AllowedReferenceAssemblyFileExtensions)"
        AssemblyFiles="@(ResolvedUserAssemblies)"
        AutoUnify="$(AutoUnifyAssemblyReferences)"
        FindDependencies="True"
        FindRelatedFiles="False"
        FindSatellites="True"
        SearchPaths="$(AssemblySearchPaths)"
        TargetFrameworkMoniker="$(TargetFrameworkMoniker)"
        TargetFrameworkMonikerDisplayName="$(TargetFrameworkMonikerDisplayName)"
        TargetFrameworkDirectories="$(TargetFrameworkDirectory)">
      <Output TaskParameter="SatelliteFiles" ItemName="_AndroidResolvedSatellitePaths"/>
    </ResolveAssemblyReference>
    

    But, after updating visual studio, this workaround has created the problem.

    I erased this code, and all works well!