I'm following the exelent tutorial Link on Multilingual in Xamarin.Forms
Everything is working well but I have one issue.
In my application I'm using Navigation drawer by Syncfusion as I'm generating the menu Items in a ListView as seen below.
MainPage.xaml
MainPage.cs
The issue I'm having is that I don't understand how I'm supposed to use the helper class in the tutorial link above to translate the drawer menu items.
The line below is not working
Look at the attached images and you can see that the language in Settings page is set to (English) but the drawer menu items are not being translated.
Everything is working well but I have one issue.
In my application I'm using Navigation drawer by Syncfusion as I'm generating the menu Items in a ListView as seen below.
MainPage.xaml
XML:
<ListView x:Name="listView"
SelectionMode="Single"
RowHeight="70"
ItemSelected="listView_ItemSelected"
SeparatorColor="Transparent"
BackgroundColor="{DynamicResource Gray-ListView-Bg}">
<ListView.ItemTemplate>
<DataTemplate x:Name="dataTemplate">
<ViewCell x:Name="cellName">
<StackLayout Margin="32,10,0,0"
VerticalOptions="Center">
<Grid RowDefinitions="1*, Auto">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="50"/>
<ColumnDefinition Width="auto"/>
</Grid.ColumnDefinitions>
<Label Grid.Row="0"
Grid.Column="0"
HorizontalTextAlignment="Start"
HorizontalOptions="Start"
FontSize="25"
TextColor="{DynamicResource Gray-900}"
Text="{Binding ItemIcon}"
FontFamily="Material-Outlined"
Style="{StaticResource IconLabelStyle}"/>
<Label Grid.Row="0"
Grid.Column="1"
Margin="10,0,0,0"
FontSize="16"
TextColor="{DynamicResource Gray-900}"
Text="{Binding ItemName}"
FontFamily="Material"
HorizontalTextAlignment="Start"
HorizontalOptions="Start"/>
</Grid>
</StackLayout>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
MainPage.cs
C#:
private void drawerNavItems()
{
List<MenuItem> itemList = new List<MenuItem>();
itemList.Add(new MenuItem { ItemIcon = IconFont.LocationOn, ItemName = Lang.Map });
itemList.Add(new MenuItem { ItemIcon = IconFont.Report, ItemName = Lang.ErrorReport });
itemList.Add(new MenuItem { ItemIcon = IconFont.Settings, ItemName = Lang.Settings });
listView.ItemsSource = itemList;
}
The issue I'm having is that I don't understand how I'm supposed to use the helper class in the tutorial link above to translate the drawer menu items.
The line below is not working
XML:
Text="{helpers:Translate Binding ItemName}"
Look at the attached images and you can see that the language in Settings page is set to (English) but the drawer menu items are not being translated.
Attachments
Last edited: