Forum Xamarin.Android

How can I use Bengali in Xamarin android?

I am working on android App using Xamarin where i have some captions/inputs/ DropdownList/grid and i want all captions/inputs/ DropdownList/grid should be in Bengali.
Can any body help me with some example code?

Best Answer

  • MizanurRahman.0834MizanurRahman.0834 US ✭✭
    edited August 2017 Accepted Answer

    Create a folder name "values-bn". Under this folder create two resource files Strings and arrays. Strings file will contains all captions and arrays file will contain reference data in Bangla. Folder structure will be as following image:

    Write a SetLocale function:

    public void SetLocale(string language = "")
    {
    Locale locale = string.IsNullOrEmpty(language) ? new Locale("en-US") : new Locale(language);
    Locale.Default = locale;
    var config = new global::Android.Content.Res.Configuration();
    config.Locale = locale;
    var context = global::Android.App.Application.Context;
    context.Resources.UpdateConfiguration(config, context.Resources.DisplayMetrics);
    }

    Call SetLocale function like below that will set your selected language ("bn_BD") for the application:

    SetLocale("bn_BD");

    Hope, it will help you.

Answers

  • MizanurRahman.0834MizanurRahman.0834 USMember ✭✭
    edited August 2017 Accepted Answer

    Create a folder name "values-bn". Under this folder create two resource files Strings and arrays. Strings file will contains all captions and arrays file will contain reference data in Bangla. Folder structure will be as following image:

    Write a SetLocale function:

    public void SetLocale(string language = "")
    {
    Locale locale = string.IsNullOrEmpty(language) ? new Locale("en-US") : new Locale(language);
    Locale.Default = locale;
    var config = new global::Android.Content.Res.Configuration();
    config.Locale = locale;
    var context = global::Android.App.Application.Context;
    context.Resources.UpdateConfiguration(config, context.Resources.DisplayMetrics);
    }

    Call SetLocale function like below that will set your selected language ("bn_BD") for the application:

    SetLocale("bn_BD");

    Hope, it will help you.

  • hasibwahabhasibwahab USMember

    Thank you very much Mizanur,
    it is working fine.

  • @hasibwahab said:
    Thank you very much Mizanur,
    it is working fine.

    Thank you hasibwahab

Sign In or Register to comment.