我在所有页脚页面都有一个项目多语言,<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:Forms"
x:Class="Forms.MainPage">
<ContentPage.Resources>
<ResourceDictionary>
<local:MyConverter x:Key="MyConverter"></local:MyConverter>
</ResourceDictionary>
</ContentPage.Resources>
<ScrollView Orientation="Vertical">
<StackLayout Padding="10,10,10,10">
<Label FontSize="20" FontAttributes="Bold">Cartão de Ponto</Label>
<Label>Nome:</Label>
<Label Text="{Binding Path=Pessoa.Nome}" />
<Label>CPF:</Label>
<Label Text="{Binding Path=Pessoa.CPF}" />
<Grid Padding="0" MinimumHeightRequest="40">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="70" />
<ColumnDefinition Width="35" />
<ColumnDefinition Width="60" />
<ColumnDefinition Width="60" />
<ColumnDefinition Width="60" />
</Grid.ColumnDefinitions>
<Label FontSize="10" Text="Data" FontAttributes="Bold" VerticalTextAlignment="End" />
<Label FontSize="10" Grid.Column="1" Text="Dia" FontAttributes="Bold" VerticalTextAlignment="End" />
<Label FontSize="10" Grid.Column="2" Text="Hora Entrada" FontAttributes="Bold" VerticalTextAlignment="End" />
<Label FontSize="10" Grid.Column="3" Text="Hora Saída" FontAttributes="Bold" VerticalTextAlignment="End" />
<Label FontSize="10" Grid.Column="4" Text="Horas Trabalhadas" HorizontalTextAlignment="End" FontAttributes="Bold" />
</Grid>
<!-- HeightRequest="0"-->
<ListView x:Name="lv1" ItemsSource="{Binding Path=Pontos}"
VerticalOptions="FillAndExpand"
HasUnevenRows="False"
>
<ListView.Header>
<StackLayout HeightRequest="0" />
</ListView.Header>
<!-- ItemTemplate -->
<ListView.Footer>
<StackLayout HeightRequest="0" />
</ListView.Footer>
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<ViewCell.View>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="70" />
<ColumnDefinition Width="35" />
<ColumnDefinition Width="60" />
<ColumnDefinition Width="60" />
<ColumnDefinition Width="60" />
</Grid.ColumnDefinitions>
<Label FontSize="12" Text="{Binding Path=Data, StringFormat='{0:dd/MM/yyyy}'}" />
<Label FontSize="12" Grid.Column="1" Text="{Binding Path=DiaSemana}" />
<Label FontSize="12" Grid.Column="2" Text="{Binding Path=HoraEntrada}" />
<Label FontSize="12" Grid.Column="3" Text="{Binding Path=HoraSaida}" />
<Label FontSize="12" Grid.Column="4" Text="{Binding Path=HorasTrabalhadas, Converter={StaticResource MyConverter}}}" />
</Grid>
</ViewCell.View>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
<!-- Why is this White space on screen? -->
<StackLayout Orientation="Horizontal">
<Label x:Name="lbl1" />
<Label>ms</Label>
</StackLayout>
<Button x:Name="ButtonPegaCartaoPonto" Text="Carregar" />
<Label></Label>
<Label></Label>
</StackLayout>
</ScrollView>
</ContentPage>
。
当我浏览网页中的网址时,网址如下:<select>
/es/privacy
。
现在我想删除特定语言的语言,英语。
如果我使用西班牙语/en/privacy
浏览隐私页面,但如果我使用英语/es/privacy
进行浏览。
这是我的/privacy
:
routing.yml
这是我的控制器:
privacy_lang:
path: /{_locale}/privacy
defaults: { _controller: AppBundle:Documents:privacy }
privacy:
path: /privacy
defaults: { _controller: AppBundle:Documents:privacy }
现在我的页面中的按钮转到隐私页面:
/**
* @Route("/privacy", name="privacy")
* @Method("GET")
*/
public function privacyAction(Request $request)
{
return $this->render('default/privacy.html.twig', [
'base_dir' => realpath($this->getParameter('kernel.root_dir').'/..').DIRECTORY_SEPARATOR,
]);
}
当用户使用英语浏览时,如何删除<a class="privacy enllac-lower" href="{{ path('privacy_lang') }}">Privacy Policy</a>
?
现在,如果我转到/en/
重定向到http://www.myweb.com/privacy
。