Troubles with localization in XAML using MarkupExtension

Hello community,

I have a problem with non working localization in my Xamarin application.
I took the guide developer.xamarin.com/guides/xamarin-forms/advanced/localization/ as template and implemented it like described there.
Unfortunately the TranslateExtension does not work in my MainPage.xaml
I import the namespace as needed (only partial shown):
xmlns:resources="clr-namespace:mealticker.Resources"
That's the way I bind the text to the Label:
Label Text="{Binding resources:Translate Username}"
When running the program, nothing is shown in the Label.
The long version described in the article is not compilable:
Label Text="{Binding resources:TranslateExtension Text=Username}"
Compilers output: No property, bindable property, or event found for 'resources:TranslateExtension Text', or mismatching type between value and property.
The RESX stuff itself is working properly because when using the resource in code, the right text is shown.
Label Text="{Binding PasswordLabel}"
I also experiencing a warning in the output during compilation which I can't resolve:
0xdef00522 - Resources found for language(s) 'de,en' but no resources found for default language(s): ''. Change the default language or qualify resources with the default language.

Please have a look to the sourcecode located here: github.com/markus-fischbacher/quantumverde.git

Any help is appreciated.

Regards,
Markus

Tagged:

Best Answer

  • ChaseFlorellChaseFlorell CA mod
    Accepted Answer

    The translate extension is separate from Binding

    <Label Text="{xaml:Translate PasswordLabel}" />
    

    Where xaml is the xmlns you defined at the top of your page and Translate is the Translation extension.

Answers

  • ChaseFlorellChaseFlorell CAInsider, University mod
    Accepted Answer

    The translate extension is separate from Binding

    <Label Text="{xaml:Translate PasswordLabel}" />
    

    Where xaml is the xmlns you defined at the top of your page and Translate is the Translation extension.

  • Maxx5600Maxx5600 ATMember

    Thank you very much :smiley:
    I would not have found that alone.

Sign In or Register to comment.