error : unknown identifier cultureinfo

Hi,

I'm trying to setup an internationalization system based on resx file in my xamarin forms application but I have the following error: unknown identifier cultureinfo when I use the method resourceManager.GetString(Text, CultureInfo.CurrentCulture).

Here is my TranslateExtension called in xaml:

namespace TestMongo.resources.localizations
{
[ContentProperty("Text")]
public class TranslateExtension : IMarkupExtension
{
const string ResourceId = "TestMongo.resources.localizations.LocalizationResource";
public string Text { get; set; }

    public object ProvideValue(IServiceProvider serviceProvider)  
    {  
        if (Text == null)  
            return null;  
        ResourceManager resourceManager = new ResourceManager(ResourceId, typeof(TranslateExtension).GetTypeInfo().Assembly);  

        return resourceManager.GetString(Text, CultureInfo.CurrentCulture);  
    }  
}  

}

Answers

  • tribaltribal USMember ✭✭✭

    Have you tried looking at the documentation for Localizing Xamarin Forms with RESX Resource Files

  • Duffman11Duffman11 BEMember ✭✭

    I followed the documentation, but I have a little issue : I don't have the associated disigner.cs class. And because of it I have this issue : Could not find any resources appropriate for the specified culture or the neutral culture. Make sure "TestMongo.resources.localizations.LocalizationResource.resources" was correctly embedded or linked into assembly "com.TestMongo.Android" at compile time

  • Duffman11Duffman11 BEMember ✭✭

    And i can't add this line : _Resx.LocalizationResource.Culture = ci; // set the RESX for resource localization
    _
    The compiler can't find the class Resx.

Sign In or Register to comment.