Browse Source

Added multilingual App Toolkit

Bart Reedijk 10 years ago
parent
commit
8cceffa16c

+ 14 - 0
Breda-Tour/Breda-Tour.csproj

@@ -88,15 +88,21 @@
     <Prefer32Bit>true</Prefer32Bit>
     <Prefer32Bit>true</Prefer32Bit>
     <UseDotNetNativeToolchain>true</UseDotNetNativeToolchain>
     <UseDotNetNativeToolchain>true</UseDotNetNativeToolchain>
   </PropertyGroup>
   </PropertyGroup>
+  <PropertyGroup Label="MultilingualAppToolkit">
+    <MultilingualAppToolkitVersion>4.0</MultilingualAppToolkitVersion>
+    <MultilingualFallbackLanguage>en-US</MultilingualFallbackLanguage>
+  </PropertyGroup>
   <ItemGroup>
   <ItemGroup>
     <!-- A reference to the entire .Net Framework and Windows SDK are automatically included -->
     <!-- A reference to the entire .Net Framework and Windows SDK are automatically included -->
     <Content Include="ApplicationInsights.config">
     <Content Include="ApplicationInsights.config">
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </Content>
     </Content>
+    <PRIResource Include="nl-NL\Resources.resw" />
     <None Include="project.json" />
     <None Include="project.json" />
     <Content Include="Storage\Routes\routes.json">
     <Content Include="Storage\Routes\routes.json">
       <CopyToOutputDirectory>Always</CopyToOutputDirectory>
       <CopyToOutputDirectory>Always</CopyToOutputDirectory>
     </Content>
     </Content>
+    <PRIResource Include="en-US\Resources.resw" />
   </ItemGroup>
   </ItemGroup>
   <ItemGroup>
   <ItemGroup>
     <Compile Include="App.xaml.cs">
     <Compile Include="App.xaml.cs">
@@ -182,12 +188,20 @@
   </ItemGroup>
   </ItemGroup>
   <ItemGroup>
   <ItemGroup>
     <Folder Include="Controller\" />
     <Folder Include="Controller\" />
+    <Folder Include="Storage\MultiLanguage\" />
     <Folder Include="View\" />
     <Folder Include="View\" />
   </ItemGroup>
   </ItemGroup>
+  <ItemGroup>
+    <XliffResource Include="MultilingualResources\Breda-Tour.nl-NL.xlf" />
+  </ItemGroup>
   <PropertyGroup Condition=" '$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' &lt; '14.0' ">
   <PropertyGroup Condition=" '$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' &lt; '14.0' ">
     <VisualStudioVersion>14.0</VisualStudioVersion>
     <VisualStudioVersion>14.0</VisualStudioVersion>
   </PropertyGroup>
   </PropertyGroup>
   <Import Project="$(MSBuildExtensionsPath)\Microsoft\WindowsXaml\v$(VisualStudioVersion)\Microsoft.Windows.UI.Xaml.CSharp.targets" />
   <Import Project="$(MSBuildExtensionsPath)\Microsoft\WindowsXaml\v$(VisualStudioVersion)\Microsoft.Windows.UI.Xaml.CSharp.targets" />
+  <Import Project="$(MSBuildExtensionsPath)\Microsoft\Multilingual App Toolkit\Microsoft.Multilingual.PriResources.targets" Label="MultilingualAppToolkit" Condition="Exists('$(MSBuildExtensionsPath)\Microsoft\Multilingual App Toolkit\Microsoft.Multilingual.PriResources.targets')" />
+  <Target Name="MATPrerequisite" BeforeTargets="PrepareForBuild" Condition="!Exists('$(MSBuildExtensionsPath)\Microsoft\Multilingual App Toolkit\Microsoft.Multilingual.PriResources.targets')" Label="MultilingualAppToolkit">
+    <Warning Text="$(MSBuildProjectFile) is Multilingual build enabled, but the Multilingual App Toolkit is unavailable during the build. If building with Visual Studio, please check to ensure that toolkit is properly installed." />
+  </Target>
   <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
   <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
        Other similar extension points exist, see Microsoft.Common.targets.
        Other similar extension points exist, see Microsoft.Common.targets.
   <Target Name="BeforeBuild">
   <Target Name="BeforeBuild">

+ 16 - 0
Breda-Tour/MultilingualResources/Breda-Tour.nl-NL.xlf

@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:oasis:names:tc:xliff:document:1.2 xliff-core-1.2-transitional.xsd">
+  <file datatype="xml" source-language="en-US" target-language="nl-NL" original="BREDA-TOUR/EN-US/RESOURCES.RESW" tool-id="MultilingualAppToolkit" product-name="n/a" product-version="n/a" build-num="n/a">
+    <header>
+      <tool tool-id="MultilingualAppToolkit" tool-name="Multilingual App Toolkit" tool-version="4.0.1517.0" tool-company="Microsoft" />
+    </header>
+    <body>
+      <group id="BREDA-TOUR/EN-US/RESOURCES.RESW" datatype="resx">
+        <trans-unit id="SettingsPagetxtSetupLanguage.Text" translate="yes" xml:space="preserve">
+          <source>Set up language</source>
+          <target state="translated" state-qualifier="mt-suggestion">Taal instellen</target>
+        </trans-unit>
+      </group>
+    </body>
+  </file>
+</xliff>

+ 1 - 1
Breda-Tour/SettingsScreen/SettingsPage.xaml

@@ -21,7 +21,7 @@
                 <TextBlock Style="{StaticResource SettingsHeaderStyle}" Foreground="White" Text="{StaticResource AppSettingsLanguageSettings}"></TextBlock>
                 <TextBlock Style="{StaticResource SettingsHeaderStyle}" Foreground="White" Text="{StaticResource AppSettingsLanguageSettings}"></TextBlock>
                 <ListViewItem>
                 <ListViewItem>
                     <StackPanel Margin="8,0,0,0">
                     <StackPanel Margin="8,0,0,0">
-                        <TextBlock FontSize="18" Text="Taal instellen" Foreground="White"></TextBlock>
+                        <TextBlock Name="txtSetupLanguage" x:Uid="SettingsPagetxtSetupLanguage" FontSize="18" Text="Taal instellen" Foreground="White"></TextBlock>
                         <TextBlock Margin="0,-1,0,0" FontSize="12" Foreground="White" Text="{StaticResource AppLanguageDutch}"></TextBlock>
                         <TextBlock Margin="0,-1,0,0" FontSize="12" Foreground="White" Text="{StaticResource AppLanguageDutch}"></TextBlock>
                     </StackPanel>
                     </StackPanel>
                 </ListViewItem>
                 </ListViewItem>

+ 2 - 2
Breda-Tour/SplashScreen/SplashPage.xaml

@@ -45,11 +45,11 @@
             <Button Style="{StaticResource SplashScreenLanguageButtonStyle}"
             <Button Style="{StaticResource SplashScreenLanguageButtonStyle}"
                     Content="{StaticResource AppLanguageDutch}"
                     Content="{StaticResource AppLanguageDutch}"
                     Margin="0,15,0,0"
                     Margin="0,15,0,0"
-                    Click="Button_Click"/>
+                    Click="Button_Dutch_Click"/>
             <Button Style="{StaticResource SplashScreenLanguageButtonStyle}"
             <Button Style="{StaticResource SplashScreenLanguageButtonStyle}"
                     Content="{StaticResource AppLanguageEnglish}"
                     Content="{StaticResource AppLanguageEnglish}"
                     Margin="0,10,0,0"
                     Margin="0,10,0,0"
-                    Click="Button_Click"/>
+                    Click="Button_English_Click"/>
         </StackPanel>
         </StackPanel>
 
 
         <!--Language selection-->
         <!--Language selection-->

+ 16 - 1
Breda-Tour/SplashScreen/SplashPage.xaml.cs

@@ -13,6 +13,7 @@ using Windows.UI.Xaml.Data;
 using Windows.UI.Xaml.Input;
 using Windows.UI.Xaml.Input;
 using Windows.UI.Xaml.Media;
 using Windows.UI.Xaml.Media;
 using Windows.UI.Xaml.Navigation;
 using Windows.UI.Xaml.Navigation;
+using Windows.Globalization;
 
 
 // The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238
 // The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238
 
 
@@ -37,6 +38,20 @@ namespace Breda_Tour.SplashScreen
         {
         {
             f.Navigate(typeof(MainPage));
             f.Navigate(typeof(MainPage));
         }
         }
-        
+
+        private void Button_English_Click(object sender, RoutedEventArgs e)
+        {
+            ApplicationLanguages.PrimaryLanguageOverride = "en-US";
+            Debug.WriteLine("my language is:" + ApplicationLanguages.ManifestLanguages.First());
+            f.Navigate(typeof(MainPage));
+        }
+
+        private void Button_Dutch_Click(object sender, RoutedEventArgs e)
+        {
+            ApplicationLanguages.PrimaryLanguageOverride = "nl-NL";
+            Debug.WriteLine("my language is:" + ApplicationLanguages.ManifestLanguages.First());
+            f.Navigate(typeof(MainPage));
+        }
+
     }
     }
 }
 }

+ 123 - 0
Breda-Tour/en-US/Resources.resw

@@ -0,0 +1,123 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+  <!-- 
+    Microsoft ResX Schema 
+    
+    Version 2.0
+    
+    The primary goals of this format is to allow a simple XML format 
+    that is mostly human readable. The generation and parsing of the 
+    various data types are done through the TypeConverter classes 
+    associated with the data types.
+    
+    Example:
+    
+    ... ado.net/XML headers & schema ...
+    <resheader name="resmimetype">text/microsoft-resx</resheader>
+    <resheader name="version">2.0</resheader>
+    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+        <value>[base64 mime encoded serialized .NET Framework object]</value>
+    </data>
+    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+        <comment>This is a comment</comment>
+    </data>
+                
+    There are any number of "resheader" rows that contain simple 
+    name/value pairs.
+    
+    Each data row contains a name, and value. The row also contains a 
+    type or mimetype. Type corresponds to a .NET class that support 
+    text/value conversion through the TypeConverter architecture. 
+    Classes that don't support this are serialized and stored with the 
+    mimetype set.
+    
+    The mimetype is used for serialized objects, and tells the 
+    ResXResourceReader how to depersist the object. This is currently not 
+    extensible. For a given mimetype the value must be set accordingly:
+    
+    Note - application/x-microsoft.net.object.binary.base64 is the format 
+    that the ResXResourceWriter will generate, however the reader can 
+    read any of the formats listed below.
+    
+    mimetype: application/x-microsoft.net.object.binary.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+            : and then encoded with base64 encoding.
+    
+    mimetype: application/x-microsoft.net.object.soap.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+            : and then encoded with base64 encoding.
+
+    mimetype: application/x-microsoft.net.object.bytearray.base64
+    value   : The object must be serialized into a byte array 
+            : using a System.ComponentModel.TypeConverter
+            : and then encoded with base64 encoding.
+    -->
+  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+    <xsd:element name="root" msdata:IsDataSet="true">
+      <xsd:complexType>
+        <xsd:choice maxOccurs="unbounded">
+          <xsd:element name="metadata">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" />
+              </xsd:sequence>
+              <xsd:attribute name="name" use="required" type="xsd:string" />
+              <xsd:attribute name="type" type="xsd:string" />
+              <xsd:attribute name="mimetype" type="xsd:string" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="assembly">
+            <xsd:complexType>
+              <xsd:attribute name="alias" type="xsd:string" />
+              <xsd:attribute name="name" type="xsd:string" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="data">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="resheader">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" />
+            </xsd:complexType>
+          </xsd:element>
+        </xsd:choice>
+      </xsd:complexType>
+    </xsd:element>
+  </xsd:schema>
+  <resheader name="resmimetype">
+    <value>text/microsoft-resx</value>
+  </resheader>
+  <resheader name="version">
+    <value>2.0</value>
+  </resheader>
+  <resheader name="reader">
+    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+  <resheader name="writer">
+    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+  <data name="SettingsPagetxtSetupLanguage.Text" xml:space="preserve">
+    <value>Set up language</value>
+  </data>
+</root>

+ 18 - 0
Breda-Tour/nl-NL/Resources.resw

@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+  <resheader name="resmimetype">
+    <value>text/microsoft-resx</value>
+  </resheader>
+  <resheader name="version">
+    <value>2.0</value>
+  </resheader>
+  <resheader name="reader">
+    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+  <resheader name="writer">
+    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+  <data name="SettingsPagetxtSetupLanguage.Text" xml:space="preserve">
+    <value>Taal instellen</value>
+  </data>
+</root>

+ 1 - 1
Breda-Tour/project.lock.json

@@ -11523,7 +11523,7 @@
       ]
       ]
     },
     },
     "Microsoft.ApplicationInsights.WindowsApps/1.0.0": {
     "Microsoft.ApplicationInsights.WindowsApps/1.0.0": {
-      "sha512": "NvBQnFeiFd0O1QdBz06UGApD7zn7ztVi7qO18IsM3EjiXRNgfrEBXB+azNm8XqLY8xGFAqh3HAuSd/wHZMe0XA==",
+      "sha512": "fNCAjIwvbTV+G0dT14bgM5tptsqeSaKQaCrlq7QknOq1Xdm8ZmgsDYddMgXkvykyKLjWyU6fKuOpj6fsQJy+wQ==",
       "type": "Package",
       "type": "Package",
       "files": [
       "files": [
         "[Content_Types].xml",
         "[Content_Types].xml",