Forum Xamarin.Forms

How to manage app localization ?



  • n.kuznetsovn.kuznetsov USUniversity ✭✭

    Thanks! This is useful. This is more or less what I am currently doing as well, actually. However, I'm currently stuck with Vernacular it seems.

  • dpedrinhadpedrinha DEMember ✭✭✭
    edited April 2016
  • KorayemKorayem EGMember ✭✭
    edited July 2016

    Update on how to localize your app in more cross-platform fashion

    Microsoft released Multilingual App Toolkit which now supports Xamarin.

    Prior to version 4, MAT only knew how to generate RESX files. That’s fine for Windows apps, but Android and iOS have their own formats. Android uses XML files in the folders for each language or local. The format is similar to the RESX format. For iOS, they store the string resources in text files, as key value pairs.

    It uses the industry standard XLIFF format for storing the translated resources and can import, export, and even machine translate your native text into other languages.

    For more info:

  • aisacaisac DEMember ✭✭

    Nice topic here,
    I've been trying to localize my app using the RESX files, but now I am facing this peculiar problem:

    I am using xamarin on VS2015 (Windows) I have a solution xamarin.forms shared with only android and iOS project no WP project.

    I am not able to add a resource file (RESX), I tried to create one on my android project and just copy and paste into my shared file, and.... it did not work.

    So my question is: How can I use the resource file on my project?

    @Korayem is it possible to use the MAT on xamarin.forms shared project?

  • dpedrinhadpedrinha DEMember ✭✭✭

    It's way too deprecated. As the tutorial I posted before, who references this example app.

  • aisacaisac DEMember ✭✭

    Also trying to find some sample that actually works

  • dpedrinhadpedrinha DEMember ✭✭✭

    @aisac said:
    Also trying to find some sample that actually works

    I managed to do it. Both samples are deprecated, but with a little peace of code from each one and a lot of tweaks it works.

    Check out this stackoverflow link where I put some of my experience.

    And let me know if you need help.

  • aisacaisac DEMember ✭✭

    thanks @dpedrinha I will check it out and test it asap.

    Thanks for the help

  • aisacaisac DEMember ✭✭

    @dpedrinha I see you had problems with windows phone, in my case I have issues with my resx files:
    most of the errors :

    1-Duplicate 'global::System.Diagnostics.DebuggerNonUserCodeAttribute' attribute

    2-Ambiguity between 'AppResources.resourceMan' and 'AppResources.resourceMan'

    I could not open the AppResources resx files, it shows the following error:
    Object reference not set to an instance of an object.

    I added all the resx files from:

    Any clue about those issues?

  • dpedrinhadpedrinha DEMember ✭✭✭

    @aisac No idea. But I recommend you create a project from scratch instead of using this ready code.

  • aisacaisac DEMember ✭✭
    edited August 2016

    I managed to fix it.
    I think avoiding to copy the resx files into my project and creating new ones instead solved my problem

  • batmacibatmaci DEMember ✭✭✭✭✭

    I tried this sample
    It works perfectly fine but it fails when I enable the option "Bundle assemblies into native code" in Android project. Does it anybody know a solution for it please?

  • anyone can guide me on how can i refresh the resx translation after changing culture?

  • DmitryBlackDmitryBlack RUMember ✭✭
    edited October 2017

    @RichardLawidjaja said:
    anyone can guide me on how can i refresh the resx translation after changing culture?

    It seems that no one knows how to do this, or this is some kind of esoteric knowledge available only to the initiated :) All write only how to set the interface language when the application starts, but nowhere could I find how to change it while the application is running. I'll have to deal with myself. If I do, I'll set an example.

  • @rmarinho said:
    sorry my post was wrong thought you were talking about Gps localization :p

    could you explain about gps localization. I've been searching a lot and i havn't find anything useful for xamarin android

  • DmitryBlackDmitryBlack RUMember ✭✭

    @DmitryBlack said:

    @RichardLawidjaja said:
    anyone can guide me on how can i refresh the resx translation after changing culture?

    I'll have to deal with myself. If I do, I'll set an example.

    This solution is work perfectly -

    The label text in XAML changes when the application localization changes on runtime:

    I can not do this only for the elements created in runtime:

    // create menu item
    gpItem = new MasterPageItem() { Icon = "learning.png", TargetType = typeof(LearningPage) };
    // create binding for vModel.Resources[LearningMenuItemText]
    Binding gpBinding = new Binding() { Source = vModel, Path = "Resources[LearningMenuItemText]" };
    // set binding to MasterPageItem.Title property
    gpItem.SetBinding(TitleProperty, gpBinding);


    // Adding menu items to menuList
    MenuList = new List()

    // Setting our list to be ItemSource for ListView in MainPage.xaml
    navigationDrawerList.ItemsSource = MenuList;


                <ListView x:Name="navigationDrawerList"
                  CachingStrategy = "RecycleElement"
                                <!-- Main design for our menu items -->
                                <StackLayout VerticalOptions="FillAndExpand"
                                    <Image Source="{Binding Icon}"
                         VerticalOptions="Center" />
                                    <Label Text="{Binding Title}"

    ListView items display a List() with binding to Icon and Title properties.

    But this code does not work, the Title does not change when change the application localization. I can not understand why.

  • DmitryBlackDmitryBlack RUMember ✭✭

    Fix my mistake:
    gpItem.SetBinding(MasterPageItem.TitleTextProperty, gpBinding);

Sign In or Register to comment.