1
0
mirror of https://github.com/bitwarden/mobile.git synced 2024-12-24 16:38:22 +01:00

i18n extension

This commit is contained in:
Kyle Spearrin 2019-04-22 13:47:45 -04:00
parent b48c231500
commit c3fe3292ad
5 changed files with 17 additions and 17 deletions

View File

@ -4,7 +4,7 @@
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="Bit.App.Pages.LoginPage" x:Class="Bit.App.Pages.LoginPage"
xmlns:pages="clr-namespace:Bit.App.Pages" xmlns:pages="clr-namespace:Bit.App.Pages"
xmlns:i18n="clr-namespace:Bit.App.Utilities" xmlns:u="clr-namespace:Bit.App.Utilities"
xmlns:bv="clr-namespace:Bit.App.Controls.BoxedView" xmlns:bv="clr-namespace:Bit.App.Controls.BoxedView"
x:DataType="pages:LoginPageViewModel" x:DataType="pages:LoginPageViewModel"
Title="{Binding PageTitle}"> Title="{Binding PageTitle}">
@ -13,22 +13,22 @@
</ContentPage.BindingContext> </ContentPage.BindingContext>
<ContentPage.ToolbarItems> <ContentPage.ToolbarItems>
<ToolbarItem Icon="cogs.png" Text="{i18n:Translate LogIn}" Clicked="LogIn_Clicked" /> <ToolbarItem Icon="cogs.png" Text="{u:I18n LogIn}" Clicked="LogIn_Clicked" />
</ContentPage.ToolbarItems> </ContentPage.ToolbarItems>
<StackLayout> <StackLayout>
<bv:BoxedView HasUnevenRows="True" VerticalOptions="Start"> <bv:BoxedView HasUnevenRows="True" VerticalOptions="Start">
<bv:BoxedSection HeaderHeight="0"> <bv:BoxedSection HeaderHeight="0">
<bv:EntryCell Title="{i18n:Translate EmailAddress}" <bv:EntryCell Title="{u:I18n EmailAddress}"
ValueText="{Binding Email}" /> ValueText="{Binding Email}" />
<bv:EntryCell Title="{i18n:Translate MasterPassword}" <bv:EntryCell Title="{u:I18n MasterPassword}"
ValueText="{Binding MasterPassword}" ValueText="{Binding MasterPassword}"
IsPassword="True" IsPassword="True"
Button1Icon="cogs" Button1Icon="cogs"
Button1Command="{Binding ShowPasswordCommand}" /> Button1Command="{Binding ShowPasswordCommand}" />
</bv:BoxedSection> </bv:BoxedSection>
</bv:BoxedView> </bv:BoxedView>
<Button Text="{i18n:Translate GetPasswordHint}" VerticalOptions="EndAndExpand"></Button> <Button Text="{u:I18n GetPasswordHint}" VerticalOptions="EndAndExpand"></Button>
</StackLayout> </StackLayout>
</ContentPage> </ContentPage>

View File

@ -4,7 +4,7 @@
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="Bit.App.Pages.GeneratorPage" x:Class="Bit.App.Pages.GeneratorPage"
xmlns:pages="clr-namespace:Bit.App.Pages" xmlns:pages="clr-namespace:Bit.App.Pages"
xmlns:i18n="clr-namespace:Bit.App.Utilities" xmlns:u="clr-namespace:Bit.App.Utilities"
x:DataType="pages:GeneratorPageViewModel" x:DataType="pages:GeneratorPageViewModel"
Title="{Binding PageTitle}"> Title="{Binding PageTitle}">
<ContentPage.BindingContext> <ContentPage.BindingContext>
@ -18,7 +18,7 @@
HorizontalOptions="Center" HorizontalOptions="Center"
VerticalOptions="CenterAndExpand" /> VerticalOptions="CenterAndExpand" />
<Label <Label
Text="{i18n:Translate AttachmentLargeWarning, P1='10 MB'}" Text="{u:I18n AttachmentLargeWarning, P1='10 MB'}"
HorizontalOptions="Center" HorizontalOptions="Center"
VerticalOptions="CenterAndExpand" /> VerticalOptions="CenterAndExpand" />
<Label <Label

View File

@ -4,7 +4,7 @@
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="Bit.App.Pages.HomePage" x:Class="Bit.App.Pages.HomePage"
xmlns:pages="clr-namespace:Bit.App.Pages" xmlns:pages="clr-namespace:Bit.App.Pages"
xmlns:i18n="clr-namespace:Bit.App.Utilities" xmlns:u="clr-namespace:Bit.App.Utilities"
xmlns:android="clr-namespace:Xamarin.Forms.PlatformConfiguration.AndroidSpecific;assembly=Xamarin.Forms.Core" xmlns:android="clr-namespace:Xamarin.Forms.PlatformConfiguration.AndroidSpecific;assembly=Xamarin.Forms.Core"
x:DataType="pages:HomeViewModel" x:DataType="pages:HomeViewModel"
Title="{Binding PageTitle}"> Title="{Binding PageTitle}">
@ -19,12 +19,12 @@
<StackLayout VerticalOptions="CenterAndExpand"> <StackLayout VerticalOptions="CenterAndExpand">
<Image Source="logo.png" <Image Source="logo.png"
VerticalOptions="Center" /> VerticalOptions="Center" />
<Label Text="{i18n:Translate LoginOrCreateNewAccount}" <Label Text="{u:I18n LoginOrCreateNewAccount}"
class="text-lg" class="text-lg"
HorizontalTextAlignment="Center"></Label> HorizontalTextAlignment="Center"></Label>
<Button Text="{i18n:Translate LogIn}" <Button Text="{u:I18n LogIn}"
Clicked="LogIn_Clicked"></Button> Clicked="LogIn_Clicked"></Button>
<Button Text="{i18n:Translate CreateAccount}"></Button> <Button Text="{u:I18n CreateAccount}"></Button>
</StackLayout> </StackLayout>
</StackLayout> </StackLayout>

View File

@ -4,7 +4,7 @@
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="Bit.App.Pages.ViewPage" x:Class="Bit.App.Pages.ViewPage"
xmlns:pages="clr-namespace:Bit.App.Pages" xmlns:pages="clr-namespace:Bit.App.Pages"
xmlns:i18n="clr-namespace:Bit.App.Utilities" xmlns:u="clr-namespace:Bit.App.Utilities"
xmlns:bv="clr-namespace:Bit.App.Controls.BoxedView" xmlns:bv="clr-namespace:Bit.App.Controls.BoxedView"
x:DataType="pages:ViewPageViewModel" x:DataType="pages:ViewPageViewModel"
Title="{Binding PageTitle}"> Title="{Binding PageTitle}">
@ -13,14 +13,14 @@
</ContentPage.BindingContext> </ContentPage.BindingContext>
<ContentPage.ToolbarItems> <ContentPage.ToolbarItems>
<ToolbarItem Icon="cogs.png" Text="{i18n:Translate Edit}" /> <ToolbarItem Icon="cogs.png" Text="{u:I18n Edit}" />
</ContentPage.ToolbarItems> </ContentPage.ToolbarItems>
<bv:BoxedView HasUnevenRows="True"> <bv:BoxedView HasUnevenRows="True">
<bv:BoxedSection HeaderHeight="0"> <bv:BoxedSection HeaderHeight="0">
<bv:EntryCell Title="{i18n:Translate EmailAddress}" <bv:EntryCell Title="{u:I18n EmailAddress}"
ValueText="{Binding Email}" /> ValueText="{Binding Email}" />
<bv:EntryCell Title="{i18n:Translate MasterPassword}" <bv:EntryCell Title="{u:I18n MasterPassword}"
ValueText="{Binding MasterPassword}" ValueText="{Binding MasterPassword}"
IsPassword="True" IsPassword="True"
Button1Icon="cogs" Button1Icon="cogs"

View File

@ -7,11 +7,11 @@ using Xamarin.Forms.Xaml;
namespace Bit.App.Utilities namespace Bit.App.Utilities
{ {
[ContentProperty("Id")] [ContentProperty("Id")]
public class TranslateExtension : IMarkupExtension public class I18nExtension : IMarkupExtension
{ {
private II18nService _i18nService; private II18nService _i18nService;
public TranslateExtension() public I18nExtension()
{ {
_i18nService = ServiceContainer.Resolve<II18nService>("i18nService"); _i18nService = ServiceContainer.Resolve<II18nService>("i18nService");
} }