Forum Xamarin.Forms

Is there a way to implement localization in Forms app ?

Alain91Alain91 USMember ✭✭
edited September 2017 in Xamarin.Forms

Hi !

Is there a way to implement localization in Forms app ?

I am looking on several websites, but nothing found except android only, ios only, ...

I found guides/xamarin-forms/advanced/localization/
but the .designer.cs is not created along with the resx file.

Thanks a lot for any help :)

Alain

Best Answer

  • Alain91Alain91 USMember ✭✭
    Accepted Answer

    I have just seen that I didn't tell that I use visual studio 2017, on windows platform.

    I just tried with Xamarin studio (MacOs, but perhaps under Windows too) and everything is going OK (!)

    I got ressources adding menu to my project and the .designer.cs is generated too..

    I will continue on the localization...

    Thanks a lot for your help !

    Alain

Answers

  • CharllieACharllieA USMember ✭✭

    Try go to project properties, Ressources, and click the blue centered message to create the resx file and the designer auto generated one.

  • Alain91Alain91 USMember ✭✭

    There are no > @CharllieA said:

    Try go to project properties, Ressources, and click the blue centered message to create the resx file and the designer auto generated one.

    There are no ressources item.

    Alain

  • CharllieACharllieA USMember ✭✭

    This item should only appears in the PCL project, not in iOS/Android/platform ones.

  • Alain91Alain91 USMember ✭✭

    CharllieA,

    Do you mean that I have to create ressources in PCL, then import them in the Forms app ?

  • MommMomm USMember ✭✭✭

    Yes, you need to create the resources file in the PCL and that's the right thing as you are developing for XF, so why do you need to have two files (one for each platform)?

  • CharllieACharllieA USMember ✭✭

    Your Xamarin.Forms project should be a PCL project, no ?

  • Alain91Alain91 USMember ✭✭

    @CharllieA said:
    Your Xamarin.Forms project should be a PCL project, no ?

    Yes, a portable project, using XAML forms.

  • CharllieACharllieA USMember ✭✭

    So as Momm said, you create Ressources in your PCL / Forms project, an use translations stored as text in Ressources from your Xamarin pages by writing Properties.Ressources.MyTranslation1, or with Converters from the XAML.

  • Alain91Alain91 USMember ✭✭
    Accepted Answer

    I have just seen that I didn't tell that I use visual studio 2017, on windows platform.

    I just tried with Xamarin studio (MacOs, but perhaps under Windows too) and everything is going OK (!)

    I got ressources adding menu to my project and the .designer.cs is generated too..

    I will continue on the localization...

    Thanks a lot for your help !

    Alain

  • CharllieACharllieA USMember ✭✭
    edited September 2017

    Great, I was speaking about Visual Studio (2017 or any) too, Xamarin Studio is deprecated

Sign In or Register to comment.