Skip to content

Commit a83d712

Browse files
committed
0.5.2 Critical fix for error introduced in 0.5.1
1 parent 5deca29 commit a83d712

34 files changed

+506
-513
lines changed

Demo.WPF/App.config

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<configuration>
3+
<startup>
4+
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" />
5+
</startup>
6+
</configuration>

Demo.WPF/App.xaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<Application x:Class="Demo.WPF.App"
2+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4+
xmlns:local="clr-namespace:Demo.WPF"
5+
StartupUri="Views\MainWindow.xaml">
6+
<Application.Resources>
7+
8+
</Application.Resources>
9+
</Application>
Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
using Rasyidf.Localization;
2-
2+
using System;
3+
using System.Collections.Generic;
4+
using System.Configuration;
5+
using System.Data;
6+
using System.Linq;
7+
using System.Threading.Tasks;
38
using System.Windows;
49

5-
namespace Localization.Demo
10+
namespace Demo.WPF
611
{
712
/// <summary>
813
/// Interaction logic for App.xaml
@@ -11,13 +16,10 @@ public partial class App : Application
1116
{
1217
protected override void OnStartup(StartupEventArgs e)
1318
{
14-
base.OnStartup(e);
15-
LocalizationService.Current.Initialize();
1619

17-
}
20+
base.OnStartup(e);
21+
LocalizationService.Current.Initialize();
1822

19-
void Application_Startup(object sender, StartupEventArgs e)
20-
{
2123
}
2224
}
23-
}
25+
}

Localization.Demo/Languages/UK-IT.json renamed to Demo.WPF/Assets/UK-IT.json

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"Id": 0,
2626
"Title": {
2727
"en-GB": "Demo Window",
28-
"it-IT": "Demo Window"
28+
"it-IT": "Finestra Demo"
2929
}
3030
},
3131
{
@@ -39,28 +39,28 @@
3939
"Id": 110,
4040
"Header": {
4141
"en-GB": "Quit",
42-
"it-IT": "Quit"
42+
"it-IT": "Smettere"
4343
}
4444
},
4545
{
4646
"Id": 12,
4747
"Header": {
4848
"en-GB": "Edit",
49-
"it-IT": "Edit"
49+
"it-IT": "editare"
5050
}
5151
},
5252
{
5353
"Id": 120,
5454
"Header": {
5555
"en-GB": "Cut",
56-
"it-IT": "Cut"
56+
"it-IT": "Tagliare"
5757
}
5858
},
5959
{
6060
"Id": 121,
6161
"Header": {
6262
"en-GB": "Copy",
63-
"it-IT": "Copy"
63+
"it-IT": "Copia"
6464
}
6565
},
6666
{
@@ -74,81 +74,81 @@
7474
"Id": 123,
7575
"Header": {
7676
"en-GB": "Option",
77-
"it-IT": "Option"
77+
"it-IT": "Incollare"
7878
}
7979
},
8080
{
8181
"Id": 13,
8282
"Header": {
8383
"en-GB": "View",
84-
"it-IT": "View"
84+
"it-IT": "Visualizza"
8585
}
8686
},
8787
{
8888
"Id": 130,
8989
"Header": {
9090
"en-GB": "Status Bar",
91-
"it-IT": "Status Bar"
91+
"it-IT": "barra di stato"
9292
}
9393
},
9494
{
9595
"Id": 14,
9696
"Header": {
9797
"en-GB": "Language",
98-
"it-IT": "Language"
98+
"it-IT": "Lingua"
9999
}
100100
},
101101
{
102102
"Id": 15,
103103
"Header": {
104-
"en-GB": "Help",
104+
"en-GB": "Aiuto",
105105
"it-IT": "Help"
106106
}
107107
},
108108
{
109109
"Id": 150,
110110
"Header": {
111111
"en-GB": "About",
112-
"it-IT": "About"
112+
"it-IT": "Su"
113113
}
114114
},
115115
{
116116
"Id": 21,
117117
"Text": {
118118
"en-GB": "This is rasyidf.localize demo program",
119-
"it-IT": "This is rasyidf.localize demo program"
119+
"it-IT": "Questo è rasyidf.localize programma demo"
120120
}
121121
},
122122
{
123123
"Id": 22,
124124
"Text": {
125125
"en-GB": "Select your language:",
126-
"it-IT": "Select your language:"
126+
"it-IT": "Seleziona la tua lingua:"
127127
}
128128
},
129129
{
130130
"Id": 24,
131131
"Text": {
132132
"en-GB": "Languages :",
133-
"it-IT": "Languages :"
133+
"it-IT": "Lingue :"
134134
}
135135
},
136136
{
137137
"Id": 510,
138138
"Content": {
139139
"en-GB": "Hello",
140-
"it-IT": "Hello"
140+
"it-IT": "Ciao"
141141
}
142142
},
143143
{
144144
"Id": 511,
145145
"Header": {
146146
"en-GB": "Hello World",
147-
"it-IT": "Hello World"
147+
"it-IT": "Salve, mondo"
148148
},
149149
"Text": {
150150
"en-GB": "this is a message",
151-
"it-IT": "this is a message"
151+
"it-IT": "questo è un messaggio"
152152
}
153153
}
154154
]
File renamed without changes.
File renamed without changes.
File renamed without changes.

Demo.WPF/Demo.WPF.csproj

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
4+
<PropertyGroup>
5+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
6+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
7+
<ProjectGuid>{7FB98588-C527-4174-8171-51AA2C1594EE}</ProjectGuid>
8+
<OutputType>WinExe</OutputType>
9+
<RootNamespace>Demo.WPF</RootNamespace>
10+
<AssemblyName>Demo.WPF</AssemblyName>
11+
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
12+
<FileAlignment>512</FileAlignment>
13+
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
14+
<WarningLevel>4</WarningLevel>
15+
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
16+
<Deterministic>true</Deterministic>
17+
</PropertyGroup>
18+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
19+
<PlatformTarget>AnyCPU</PlatformTarget>
20+
<DebugSymbols>true</DebugSymbols>
21+
<DebugType>full</DebugType>
22+
<Optimize>false</Optimize>
23+
<OutputPath>bin\Debug\</OutputPath>
24+
<DefineConstants>DEBUG;TRACE</DefineConstants>
25+
<ErrorReport>prompt</ErrorReport>
26+
<WarningLevel>4</WarningLevel>
27+
</PropertyGroup>
28+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
29+
<PlatformTarget>AnyCPU</PlatformTarget>
30+
<DebugType>pdbonly</DebugType>
31+
<Optimize>true</Optimize>
32+
<OutputPath>bin\Release\</OutputPath>
33+
<DefineConstants>TRACE</DefineConstants>
34+
<ErrorReport>prompt</ErrorReport>
35+
<WarningLevel>4</WarningLevel>
36+
</PropertyGroup>
37+
<ItemGroup>
38+
<Reference Include="System" />
39+
<Reference Include="System.Data" />
40+
<Reference Include="System.Xml" />
41+
<Reference Include="Microsoft.CSharp" />
42+
<Reference Include="System.Core" />
43+
<Reference Include="System.Xml.Linq" />
44+
<Reference Include="System.Data.DataSetExtensions" />
45+
<Reference Include="System.Net.Http" />
46+
<Reference Include="System.Xaml">
47+
<RequiredTargetFramework>4.0</RequiredTargetFramework>
48+
</Reference>
49+
<Reference Include="WindowsBase" />
50+
<Reference Include="PresentationCore" />
51+
<Reference Include="PresentationFramework" />
52+
</ItemGroup>
53+
<ItemGroup>
54+
<ApplicationDefinition Include="App.xaml">
55+
<Generator>MSBuild:Compile</Generator>
56+
<SubType>Designer</SubType>
57+
</ApplicationDefinition>
58+
<Page Include="Views\MainWindow.xaml">
59+
<Generator>MSBuild:Compile</Generator>
60+
<SubType>Designer</SubType>
61+
</Page>
62+
<Compile Include="App.xaml.cs">
63+
<DependentUpon>App.xaml</DependentUpon>
64+
<SubType>Code</SubType>
65+
</Compile>
66+
<Compile Include="Helpers\FrameExtensions.cs" />
67+
<Compile Include="Helpers\Observable.cs" />
68+
<Compile Include="Helpers\RelayCommand.cs" />
69+
<Compile Include="Helpers\WindowExtensions.cs" />
70+
<Compile Include="ViewModels\MainWindowViewModel.cs" />
71+
<Compile Include="Views\MainWindow.xaml.cs">
72+
<DependentUpon>MainWindow.xaml</DependentUpon>
73+
<SubType>Code</SubType>
74+
</Compile>
75+
</ItemGroup>
76+
<ItemGroup>
77+
<Compile Include="Properties\AssemblyInfo.cs">
78+
<SubType>Code</SubType>
79+
</Compile>
80+
<Compile Include="Properties\Resources.Designer.cs">
81+
<AutoGen>True</AutoGen>
82+
<DesignTime>True</DesignTime>
83+
<DependentUpon>Resources.resx</DependentUpon>
84+
</Compile>
85+
<Compile Include="Properties\Settings.Designer.cs">
86+
<AutoGen>True</AutoGen>
87+
<DependentUpon>Settings.settings</DependentUpon>
88+
<DesignTimeSharedInput>True</DesignTimeSharedInput>
89+
</Compile>
90+
<EmbeddedResource Include="Properties\Resources.resx">
91+
<Generator>ResXFileCodeGenerator</Generator>
92+
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
93+
</EmbeddedResource>
94+
<Content Include="Assets\jv-Latn-ID.json">
95+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
96+
</Content>
97+
<Content Include="Assets\UK-IT.json">
98+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
99+
</Content>
100+
<None Include="Properties\Settings.settings">
101+
<Generator>SettingsSingleFileGenerator</Generator>
102+
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
103+
</None>
104+
</ItemGroup>
105+
<ItemGroup>
106+
<None Include="App.config" />
107+
</ItemGroup>
108+
<ItemGroup>
109+
<ProjectReference Include="..\Localization\Rasyidf.Localization.csproj">
110+
<Project>{6c0438ef-c94d-4a3e-b14c-92575fecee6c}</Project>
111+
<Name>Rasyidf.Localization</Name>
112+
</ProjectReference>
113+
</ItemGroup>
114+
<ItemGroup>
115+
<Content Include="Assets\de-DE.xml">
116+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
117+
</Content>
118+
<Content Include="Assets\en-US.xml">
119+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
120+
</Content>
121+
<Content Include="Assets\id-ID.xml">
122+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
123+
</Content>
124+
</ItemGroup>
125+
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
126+
</Project>

Demo.WPF/Helpers/FrameExtensions.cs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
namespace System.Windows.Controls
2+
{
3+
public static class FrameExtensions
4+
{
5+
public static object GetDataContext(this Frame frame)
6+
{
7+
if (frame.Content is FrameworkElement element)
8+
{
9+
return element.DataContext;
10+
}
11+
12+
return null;
13+
}
14+
15+
public static void CleanNavigation(this Frame frame)
16+
{
17+
while (frame.CanGoBack)
18+
{
19+
frame.RemoveBackEntry();
20+
}
21+
}
22+
}
23+
}

Demo.WPF/Helpers/Observable.cs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
using System.ComponentModel;
2+
using System.Runtime.CompilerServices;
3+
4+
namespace Demo.WPF.Helpers
5+
{
6+
public class Observable : INotifyPropertyChanged
7+
{
8+
public event PropertyChangedEventHandler PropertyChanged;
9+
10+
protected void Set<T>(ref T storage, T value, [CallerMemberName]string propertyName = null)
11+
{
12+
if (Equals(storage, value))
13+
{
14+
return;
15+
}
16+
17+
storage = value;
18+
OnPropertyChanged(propertyName);
19+
}
20+
21+
protected void OnPropertyChanged(string propertyName) => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
22+
}
23+
}

0 commit comments

Comments
 (0)