Xamarin Froms, Visual Studio 2017, String Localization

Hey guys

I was using so far Visual Studio 2015 to develop apps with Xamarin Forms, PCL

I recently downloaded Visual Studio 2017 for the same purpose

Unfortunately, I can't create a resources file(.resx) because I simply can't find this kind of file when I'm trying to add a new item to my project

I tried to add one from my existing projects, but i get the error "Build action 'PRIResource' is not supported by one or more of the project's targets"

Is there a new way to Localize strings in Visual Studio 2017?

Posts

  • HunumanHunuman GBMember ✭✭✭✭

    Hi @PanayiotisZinieris

    RESX files are still supported in VS2017, so it sounds like the Visual Studio template for RESX has not been installed on your machine.

    I am not sure which VS Workstream installs the RESX Template, but I think that it is in the .Net Desktop Development Workstream....

    I hope this points you in the right direction,

    Tim

  • N_BauaN_Baua INMember ✭✭✭✭✭
    edited June 2017

    Hi @PanayiotisZinieris ,

    Check the following URL.

    Hope this helps.

    Regards,
    N Baua

  • PanayiotisZinierisPanayiotisZinieris USMember ✭✭

    @Hunuman

    It is part of the localizing .NET applications, probably part of the .NET framework, once you install it

    @N_Baua

    My problem is that I don't have to ability to add a new .resx or .resw file from Visual Studio and if I do it manually I'm getting the error I mention before, "Build action 'PRIResource' is not supported by one or more of the project's targets"

    I tried to create a Xamarin Forms Share project and there everything works fine

    But I'm working on PCL project

  • N_BauaN_Baua INMember ✭✭✭✭✭

    @PanayiotisZinieris said:
    @N_Baua

    My problem is that I don't have to ability to add a new .resx or .resw file from Visual Studio and if I do it manually I'm getting the error I mention before, "Build action 'PRIResource' is not supported by one or more of the project's targets"

    That's weird as it should support, what MS has in its own wing.
    Okey, if you do not have options of .resx, try saving xml/JSON files with Key-Value pair for each view/module and bind that object in ctor of the said module. I've used this technique in one of my Core ASP.Net Generic handlers sometimes back its not the best approach I would say but it does work (as long as you do not have more than 5 languages for your interface, it works nice also it depends how many controls does have the resource keys bound to such values.)

    Hope this helps.

    Regards,
    N Baua

  • I just starting on Xamarin Forms one month ago, I have the same problem and I solved this on Visual Studio 2017 as following:

    new Visual C# **project > **Cross-Platform, on UI Technology** Xamarin.Forms** and finally in Code Sharing Strategy instead of Shared Project selecting a .NET Standard.

    Now I have available .resx files under Add > new element > Apple > Misc > Resources files

    Of course you have to migrate the content from older to the new project

    Hope this helps.

Sign In or Register to comment.