3

Trying to use the globalization feature on Xamarin by following the guide, however can't find the Misc category nor the Resource File option in the dialog.

My Visual Studio is version 15.1 community version.

Steps I took:

  1. Right click on the common project
  2. Choose Add -> New Item
  3. On the dialog, left panel is showing Visual C# with 4 sub-categories: Code, Data, General and Cross Platform. Misc is not one of them.
  4. Tried type Resource in the search bar, no result

Anyone has this issue?

ipohfly
  • 1,959
  • 6
  • 30
  • 57
  • You can avoid the hassle of dealing with resx in Xamarin and use a simpler format: https://github.com/xleon/I18N-Portable – xleon Jun 13 '17 at 11:03
  • Just tried it, but doesn't work. The label is showing blank. Had added indexer like this : `public string username => username.Translate();` in the partial class – ipohfly Jun 14 '17 at 16:11
  • That´s because that code is wrong. It´s not an indexer. Check the docs please. Feel free to ask a new question with any issue because this is not the right place to do it. I´ll be glad to answer – xleon Jun 14 '17 at 17:05

1 Answers1

1

I was able to add .resx files manually to the project in Visual Studio 2017 Community Edition by doing the following:

  1. Create the .resx file in File Explorer
  2. In Visual Studio add existing file and choose the file you created
  3. Visual Studio detects the file as resx and creates .designer.cs file automatically

By doing this I was able to get localization working in my project by following the guide mentioned above and looking through the sample projects.

PS. In VS 2017 I noticed that if you edit the file with the resource editor some special characters did not work correctly. I would suggest using text editor to edit the resx files.

hamalaiv
  • 828
  • 2
  • 9
  • 18
  • 1
    This did not work for me using Visual Studio Community 2017 version 15.5.2, along with Xamarin version 4.8.0.753. The corresponding .designer.cs file was not created. The custom tool listed is ResXFileCodeGenerator. – Ray Goudie Dec 18 '17 at 17:49