Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 91519

Language support

$
0
0

I am trying to implement small concept language support in my application.I am getting following exceptions

1.When I try to create the resx file [Right click on project-->Add -->New File-->Misc-->Resource File-->Give Name -->Oke] As menctioned in developer.xamarin site I will get two file once you created the resouce file.But I am getting only one file [http://developer.xamarin.com/guides/cross-platform/xamarin-forms/localization/#incode].

2.When I try to save the file I am getting "Error in generating code in resource file " apart from nothing else I got error description in Tool Output.

I created a small content page having the following code

using System;

using Xamarin.Forms;
using System.Resources;
using System.Globalization;
using System.Reflection;
using laguageSupport;

namespace laguageSupport
{
public class Page2 : ContentPage
{
public Page2 ()
{
this.BackgroundColor = Color.Default;

        Entry someText = new Entry () {
            Placeholder="Vikram English"
        };

        someText.BackgroundColor = Color.Black;
        someText.HorizontalOptions = LayoutOptions.CenterAndExpand;

        Entry chooseLang = new Entry () {
            Placeholder="Type language"
        };

        chooseLang.BackgroundColor = Color.Black;
        chooseLang.HorizontalOptions = LayoutOptions.CenterAndExpand;


        Button btn = new Button () {
            Text="Change"
        };
        btn.HorizontalOptions = LayoutOptions.CenterAndExpand;

        btn.Clicked+=(object sender, EventArgs e) => {



        };


        Content = new StackLayout { 
            Children = {
                someText,chooseLang,btn


            }
        };
    }
}

}

In my resx file I have following code

<data name="Spanish_Button" xml:space="preserve">

Spanish
this is changed text when user type spanish and click on change

I want to display this spanish button on the button element when I click on it........................

3.

btn.Text=AppResource.Spanish_Button;//might work but I am not able to get the AppResource[showing red color]


Viewing all articles
Browse latest Browse all 91519

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>