Skip to content

Commit

Permalink
Add support for English language, english localization, refactoring, …
Browse files Browse the repository at this point in the history
…UI tweaks
  • Loading branch information
Jeremie Corpinot committed May 1, 2017
1 parent 033b8fa commit 5556cec
Show file tree
Hide file tree
Showing 43 changed files with 2,177 additions and 2,375 deletions.
41 changes: 1 addition & 40 deletions Citations 365/Citations 365/App.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,50 +14,11 @@
<converters:TextVisibility x:Key="TextVisibility"/>
<converters:UpperText x:Key="UpperText"/>
<converters:LoadingVisibility x:Key="LoadingVisibility"/>
<converters:LowerText x:Key="LowerText"/>

<Color x:Key="SharedColor">#FF2980b9</Color>
<Color x:Key="FavoritedColor">#FFc0392b</Color>

<DataTemplate x:Key="QuoteTemplate">
<Grid Margin="40,25,40,25">
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="17"/>
</Grid.RowDefinitions>
<StackPanel Grid.Column="0" Grid.Row="0">
<TextBlock Text="{Binding Content}" FontWeight="Light" FontSize="20" TextWrapping="WrapWholeWords"/>
<TextBlock Text="{Binding Author, Converter={StaticResource UpperText}}" FontWeight="Bold" FontSize="14" TextWrapping="Wrap"/>
<TextBlock Text="{Binding Reference, Converter={StaticResource UpperText}}" FontWeight="Normal" FontSize="12" TextWrapping="WrapWholeWords"
Visibility="{Binding Reference, Converter={StaticResource TextVisibility}}"/>
</StackPanel>

<Rectangle Grid.Column="1"
Grid.Row="1"
Margin="0,7"
Fill="{Binding IsFavorite, Converter={StaticResource FavoriteColor}}"/>
</Grid>
</DataTemplate>

<DataTemplate x:Key="HeroQuoteTemplate">
<Grid Margin="0,25,0,25">
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="17"/>
</Grid.RowDefinitions>
<StackPanel Grid.Column="0" Grid.Row="0">
<TextBlock Text="{Binding Content}" FontWeight="Light" FontSize="38" TextWrapping="WrapWholeWords"/>
<TextBlock Text="{Binding Author, Converter={StaticResource UpperText}}" FontWeight="Bold" FontSize="14" TextWrapping="Wrap"/>
<TextBlock Text="{Binding Reference, Converter={StaticResource UpperText}}" FontWeight="Normal" FontSize="12" TextWrapping="WrapWholeWords"
Visibility="{Binding Reference, Converter={StaticResource TextVisibility}}"/>
</StackPanel>

<Rectangle Grid.Column="1"
Grid.Row="1"
Margin="0,7"
Fill="{Binding IsFavorite, Converter={StaticResource FavoriteColor}}"/>
</Grid>
</DataTemplate>

<Style x:Key="ListViewItemFill" TargetType="ListViewItem">
<Setter Property="HorizontalAlignment" Value="Stretch"/>
<Setter Property="VerticalContentAlignment" Value="Stretch" />
Expand Down
20 changes: 20 additions & 0 deletions Citations 365/Citations 365/App.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
using citations365.Data;
using citations365.Services;
using citations365.Views;
using System;
using System.Globalization;
using Windows.ApplicationModel;
using Windows.ApplicationModel.Activation;
using Windows.Foundation.Metadata;
using Windows.Globalization;
using Windows.Phone.UI.Input;
using Windows.Storage;
using Windows.UI.Core;
Expand Down Expand Up @@ -38,6 +41,8 @@ protected override void OnLaunched(LaunchActivatedEventArgs e) {
#endif
Frame rootFrame = Window.Current.Content as Frame;

if (DataSource == null) UpdateLanguage();

// Do not repeat app initialization when the Window already has content,
// just ensure that the window is active
if (rootFrame == null) {
Expand Down Expand Up @@ -152,5 +157,20 @@ private void UpdateBackButtonVisibility() {

SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = visibility;
}

public static void UpdateLanguage() {
var lang = Settings.GetLanguage();
ApplicationLanguages.PrimaryLanguageOverride = lang;

var culture = new CultureInfo(lang);
if (culture.CompareInfo.IndexOf(lang, "fr", CompareOptions.IgnoreCase) >= 0) {
DataSource = new Evene();
return;
}
if (culture.CompareInfo.IndexOf(lang, "en", CompareOptions.IgnoreCase) >= 0) {
DataSource = new Quotesondesign();
return;
}
}
}
}
Binary file not shown.
20 changes: 6 additions & 14 deletions Citations 365/Citations 365/Citations 365.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -105,37 +105,30 @@
<Compile Include="App.xaml.cs">
<DependentUpon>App.xaml</DependentUpon>
</Compile>
<Compile Include="Controllers\AuthorsController.cs" />
<Compile Include="Controllers\DetailAuthorController.cs" />
<Compile Include="Controllers\FavoritesController.cs" />
<Compile Include="Controllers\SearchController.cs" />
<Compile Include="Controllers\TodayController.cs" />
<Compile Include="Converters\EmptyViewVisibility.cs" />
<Compile Include="Converters\FavoriteColor.cs" />
<Compile Include="Converters\FavoriteColorIcon.cs" />
<Compile Include="Converters\FavoriteIcon.cs" />
<Compile Include="Converters\FavoriteSwypeColor.cs" />
<Compile Include="Converters\LoadingVisibility.cs" />
<Compile Include="Converters\LowerText.cs" />
<Compile Include="Converters\ShareSwypeColor.cs" />
<Compile Include="Converters\TextVisibility.cs" />
<Compile Include="Converters\UpperText.cs" />
<Compile Include="Data\Evene.cs" />
<Compile Include="Data\Quotesondesign.cs" />
<Compile Include="Data\SourceModel.cs" />
<Compile Include="Helpers\ImageHelper.cs" />
<Compile Include="Helpers\VisualTreeExtensions.cs" />
<Compile Include="HomePage_Mobile.xaml.cs">
<Compile Include="Views\HomePage_Mobile.xaml.cs">
<DependentUpon>HomePage_Mobile.xaml</DependentUpon>
</Compile>
<Compile Include="HomePage_Desktop.xaml.cs">
<Compile Include="Views\HomePage_Desktop.xaml.cs">
<DependentUpon>HomePage_Desktop.xaml</DependentUpon>
</Compile>
<Compile Include="Models\Author.cs" />
<Compile Include="Models\AuthorQuotesCollection.cs" />
<Compile Include="Models\ObservableKeyedCollection.cs" />
<Compile Include="Models\Quote.cs" />
<Compile Include="Models\SearchCollection.cs" />
<Compile Include="Models\TodayCollection.cs" />
<Compile Include="Models\UserSettings.cs" />
<Compile Include="Services\Events.cs" />
<Compile Include="Services\Formatter.cs" />
<Compile Include="Services\Wallpaper.cs" />
Expand Down Expand Up @@ -169,7 +162,6 @@
<Content Include="Assets\acorn.png" />
<Content Include="Assets\Backgrounds\colored_moutains.jpg" />
<Content Include="Assets\Backgrounds\man.jpg" />
<Content Include="Assets\Backgrounds\nasa.jpg" />
<Content Include="Assets\Backgrounds\woman.jpg" />
<Content Include="Assets\BadgeLogo.scale-100.png" />
<Content Include="Assets\BadgeLogo.scale-125.png" />
Expand Down Expand Up @@ -230,11 +222,11 @@
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</ApplicationDefinition>
<Page Include="HomePage_Mobile.xaml">
<Page Include="Views\HomePage_Mobile.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="HomePage_Desktop.xaml">
<Page Include="Views\HomePage_Desktop.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
Expand Down
128 changes: 0 additions & 128 deletions Citations 365/Citations 365/Controllers/AuthorsController.cs

This file was deleted.

Loading

0 comments on commit 5556cec

Please sign in to comment.