WeahterInformation WP8:
authorGustavo Martin <gu.martinm@gmail.com>
Sun, 22 Jun 2014 07:05:17 +0000 (09:05 +0200)
committerGustavo Martin <gu.martinm@gmail.com>
Sun, 22 Jun 2014 07:05:17 +0000 (09:05 +0200)
1. Settings page.
2. Default language english.
3. Using MAT (Multilingual App Toolkit)

17 files changed:
WindowsPhone/WeatherInformation/WeatherInformation/App.xaml
WindowsPhone/WeatherInformation/WeatherInformation/App.xaml.cs
WindowsPhone/WeatherInformation/WeatherInformation/Properties/AssemblyInfo.cs
WindowsPhone/WeatherInformation/WeatherInformation/Properties/WMAppManifest.xml
WindowsPhone/WeatherInformation/WeatherInformation/Resources/AppResources.Designer.cs
WindowsPhone/WeatherInformation/WeatherInformation/Resources/AppResources.es.resx [new file with mode: 0644]
WindowsPhone/WeatherInformation/WeatherInformation/Resources/AppResources.es.xlf [new file with mode: 0644]
WindowsPhone/WeatherInformation/WeatherInformation/Resources/AppResources.qps-ploc.resx [new file with mode: 0644]
WindowsPhone/WeatherInformation/WeatherInformation/Resources/AppResources.qps-ploc.xlf [new file with mode: 0644]
WindowsPhone/WeatherInformation/WeatherInformation/Resources/AppResources.resx
WindowsPhone/WeatherInformation/WeatherInformation/SampleData/MainViewModelSampleData.xaml
WindowsPhone/WeatherInformation/WeatherInformation/SampleData/SettingsViewModelSampleData.xaml [deleted file]
WindowsPhone/WeatherInformation/WeatherInformation/SettingsPage.xaml
WindowsPhone/WeatherInformation/WeatherInformation/SettingsPage.xaml.cs
WindowsPhone/WeatherInformation/WeatherInformation/ViewModels/MainViewModel.cs
WindowsPhone/WeatherInformation/WeatherInformation/ViewModels/SettingsViewModel.cs
WindowsPhone/WeatherInformation/WeatherInformation/WeatherInformation.csproj

index 895af5e..d6d3d13 100644 (file)
@@ -1,12 +1,18 @@
 <Application
-    x:Class="WeatherInformation.App"
     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
     xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
-    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone">
+    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
+    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+    xmlns:ViewModels="clr-namespace:WeatherInformation.ViewModels" mc:Ignorable="d"
+    x:Class="WeatherInformation.App">
 
     <!--Recursos de la aplicación-->
     <Application.Resources>
+<!-- 
+       <SampleData:SettingsPageData x:Key="SettingsPageData" d:IsDataSource="True"/>
+        -->
         <local:LocalizedStrings xmlns:local="clr-namespace:WeatherInformation" x:Key="LocalizedStrings"/>
     </Application.Resources>
 
index 7b65355..754820d 100644 (file)
@@ -6,6 +6,8 @@ using System.Windows.Markup;
 using System.Windows.Navigation;
 using Microsoft.Phone.Controls;
 using Microsoft.Phone.Shell;
+using System.Threading; 
+using System.Globalization; 
 using WeatherInformation.Resources;
 using WeatherInformation.ViewModels;
 
@@ -13,6 +15,11 @@ namespace WeatherInformation
 {
     public partial class App : Application
     {
+        // Locale to force CurrentCulture to in InitializeLanguage(). 
+        // Use "qps-PLOC" to deploy pseudolocalized strings. 
+        // Use "" to let user Phone Language selection determine locale. 
+        // public static String appForceCulture = "qps-PLOC";
+        public static String appForceCulture = "en"; 
         private static MainViewModel viewModel = null;
         private static SettingsViewModel _settingsViewModel = null;
 
@@ -222,6 +229,15 @@ namespace WeatherInformation
         {
             try
             {
+                // Force CurrentUICulture to locale defined by appForceCulture.
+                // An empty string allows the user's Phone Language setting to 
+                // determine the locale.
+                //if (Debugger.IsAttached && String.IsNullOrWhiteSpace(appForceCulture) == false)
+                //{
+                //    Thread.CurrentThread.CurrentCulture = new CultureInfo(appForceCulture);
+                //    Thread.CurrentThread.CurrentUICulture = new CultureInfo(appForceCulture);
+                //}
+
                 // Establecer la fuente para que coincida con el idioma definido por
                 // Cadena de recursos ResourceLanguage para cada idioma admitido.
                 //
index 1181882..e310a8c 100644 (file)
@@ -34,4 +34,4 @@ using System.Resources;
 // mediante el carácter '*', como se muestra a continuación:
 [assembly: AssemblyVersion("1.0.0.0")]
 [assembly: AssemblyFileVersion("1.0.0.0")]
-[assembly: NeutralResourcesLanguageAttribute("es-ES")]
+[assembly: NeutralResourcesLanguageAttribute("en")]
index 6f0fb18..46b8cd5 100644 (file)
@@ -1,8 +1,9 @@
 <?xml version="1.0" encoding="utf-8"?>
 <Deployment xmlns="http://schemas.microsoft.com/windowsphone/2012/deployment" AppPlatformVersion="8.0">
-  <DefaultLanguage xmlns="" code="es-ES" />
+  <DefaultLanguage xmlns="" code="en" />
   <Languages xmlns="">
-    <Language code="en-US" />
+    <Language code="es" />
+    <Language code="qps-ploc" />
   </Languages>
   <App xmlns="" ProductID="{71d9693c-af50-4d7f-ac37-811ba1f1a0d7}" Title="WeatherInformation" RuntimeType="Silverlight" Version="1.0.0.0" Genre="apps.normal" Author="Gustavo Martin Morcuende" Description="Sample description" Publisher="gumartinm.name" PublisherID="{78440e1b-f001-4e24-a0ea-dce58b830f07}">
     <IconPath IsRelative="true" IsResource="false">Assets\ApplicationIcon.png</IconPath>
           <Count>0</Count>
           <BackgroundImageURI IsRelative="true" IsResource="false">Assets\Tiles\FlipCycleTileMedium.png</BackgroundImageURI>
           <Title>WeatherInformation</Title>
-          <BackContent>
-          </BackContent>
-          <BackBackgroundImageURI>
-          </BackBackgroundImageURI>
-          <BackTitle>
-          </BackTitle>
-          <DeviceLockImageURI>
-          </DeviceLockImageURI>
-          <HasLarge>
-          </HasLarge>
+          <BackContent></BackContent>
+          <BackBackgroundImageURI></BackBackgroundImageURI>
+          <BackTitle></BackTitle>
+          <DeviceLockImageURI></DeviceLockImageURI>
+          <HasLarge></HasLarge>
         </TemplateFlip>
       </PrimaryToken>
     </Tokens>
index 0600eb5..68019f7 100644 (file)
@@ -61,7 +61,7 @@ namespace WeatherInformation.Resources {
         }
         
         /// <summary>
-        ///   Busca una cadena traducida similar a agregar.
+        ///   Busca una cadena traducida similar a add.
         /// </summary>
         public static string AppBarButtonText {
             get {
@@ -70,7 +70,7 @@ namespace WeatherInformation.Resources {
         }
         
         /// <summary>
-        ///   Busca una cadena traducida similar a Elemento de menú.
+        ///   Busca una cadena traducida similar a Menu item.
         /// </summary>
         public static string AppBarMenuItemText {
             get {
@@ -79,7 +79,7 @@ namespace WeatherInformation.Resources {
         }
         
         /// <summary>
-        ///   Busca una cadena traducida similar a MI APLICACIÓN.
+        ///   Busca una cadena traducida similar a MY APPLICATION.
         /// </summary>
         public static string ApplicationTitle {
             get {
@@ -88,47 +88,74 @@ namespace WeatherInformation.Resources {
         }
         
         /// <summary>
-        ///   Busca una cadena traducida similar a Language.
+        ///   Busca una cadena traducida similar a LeftToRight.
         /// </summary>
-        public static string LanguageSettingsText {
+        public static string ResourceFlowDirection {
             get {
-                return ResourceManager.GetString("LanguageSettingsText", resourceCulture);
+                return ResourceManager.GetString("ResourceFlowDirection", resourceCulture);
             }
         }
         
         /// <summary>
-        ///   Busca una cadena traducida similar a LeftToRight.
+        ///   Busca una cadena traducida similar a en.
         /// </summary>
-        public static string ResourceFlowDirection {
+        public static string ResourceLanguage {
             get {
-                return ResourceManager.GetString("ResourceFlowDirection", resourceCulture);
+                return ResourceManager.GetString("ResourceLanguage", resourceCulture);
             }
         }
         
         /// <summary>
-        ///   Busca una cadena traducida similar a es-ES.
+        ///   Busca una cadena traducida similar a Language.
         /// </summary>
-        public static string ResourceLanguage {
+        public static string SettingsLanguageHeader {
             get {
-                return ResourceManager.GetString("ResourceLanguage", resourceCulture);
+                return ResourceManager.GetString("SettingsLanguageHeader", resourceCulture);
+            }
+        }
+        
+        /// <summary>
+        ///   Busca una cadena traducida similar a english.
+        /// </summary>
+        public static string SettingsLanguageSelectionEnglish {
+            get {
+                return ResourceManager.GetString("SettingsLanguageSelectionEnglish", resourceCulture);
             }
         }
         
         /// <summary>
-        ///   Busca una cadena traducida similar a Valor de propiedad en tiempo de ejecución de ejemplo.
+        ///   Busca una cadena traducida similar a spanish.
         /// </summary>
-        public static string SampleProperty {
+        public static string SettingsLanguageSelectionSpanish {
             get {
-                return ResourceManager.GetString("SampleProperty", resourceCulture);
+                return ResourceManager.GetString("SettingsLanguageSelectionSpanish", resourceCulture);
             }
         }
         
         /// <summary>
         ///   Busca una cadena traducida similar a Temperature units.
         /// </summary>
-        public static string TemperatureSettingsText {
+        public static string SettingsTemperatureUnitsHeader {
+            get {
+                return ResourceManager.GetString("SettingsTemperatureUnitsHeader", resourceCulture);
+            }
+        }
+        
+        /// <summary>
+        ///   Busca una cadena traducida similar a celsius.
+        /// </summary>
+        public static string SettingsTemperatureUnitsSelectionCentigrade {
+            get {
+                return ResourceManager.GetString("SettingsTemperatureUnitsSelectionCentigrade", resourceCulture);
+            }
+        }
+        
+        /// <summary>
+        ///   Busca una cadena traducida similar a fahrenheit.
+        /// </summary>
+        public static string SettingsTemperatureUnitsSelectionFahrenheit {
             get {
-                return ResourceManager.GetString("TemperatureSettingsText", resourceCulture);
+                return ResourceManager.GetString("SettingsTemperatureUnitsSelectionFahrenheit", resourceCulture);
             }
         }
     }
diff --git a/WindowsPhone/WeatherInformation/WeatherInformation/Resources/AppResources.es.resx b/WindowsPhone/WeatherInformation/WeatherInformation/Resources/AppResources.es.resx
new file mode 100644 (file)
index 0000000..621209a
--- /dev/null
@@ -0,0 +1,137 @@
+<?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="ResourceFlowDirection" xml:space="preserve">
+    <value>LeftToRight</value>
+    <comment>Controls the FlowDirection for all elements in the RootFrame. Set to the traditional direction of this resource file's language</comment>
+  </data>
+  <data name="ResourceLanguage" xml:space="preserve">
+    <value>es</value>
+    <comment>Controls the Language and ensures that the font for all elements in the RootFrame aligns with the app's language. Set to the language code of this resource file's language.</comment>
+  </data>
+  
+  
+  
+  
+  
+  
+  
+  
+  
+<data name="ApplicationTitle" xml:space="preserve"><value>MI APLICACIÓN</value></data><data name="AppBarButtonText" xml:space="preserve"><value>Agregar</value></data><data name="AppBarMenuItemText" xml:space="preserve"><value>Elemento de menú</value></data><data name="SettingsLanguageHeader" xml:space="preserve"><value>Idioma</value><comment>Text in settings page</comment></data><data name="SettingsTemperatureUnitsHeader" xml:space="preserve"><value>Unidades de temperatura</value><comment>Text in settings page</comment></data><data name="SettingsLanguageSelectionEnglish" xml:space="preserve"><value>inglés</value><comment>Settings page, select English language</comment></data><data name="SettingsLanguageSelectionSpanish" xml:space="preserve"><value>español</value><comment>Settings page, select Spanish language</comment></data><data name="SettingsTemperatureUnitsSelectionCentigrade" xml:space="preserve"><value>celsius</value><comment>Settings page, select tempereature units centigrade</comment></data><data name="SettingsTemperatureUnitsSelectionFahrenheit" xml:space="preserve"><value>fahrenheit</value><comment>Settings page, select temperature units fahrenheit</comment></data></root>
\ No newline at end of file
diff --git a/WindowsPhone/WeatherInformation/WeatherInformation/Resources/AppResources.es.xlf b/WindowsPhone/WeatherInformation/WeatherInformation/Resources/AppResources.es.xlf
new file mode 100644 (file)
index 0000000..6f829c2
--- /dev/null
@@ -0,0 +1,64 @@
+<?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" target-language="es" original="AppResources.resx" tool-id="MultilingualAppToolkit" product-name="WeatherInformation" product-version="1.0.0.0" build-num="0">
+    <header>
+      <tool tool-id="MultilingualAppToolkit" tool-name="Multilingual App Toolkit" tool-version="3.0.1200.0" tool-company="Microsoft" />
+    </header>
+    <body>
+      <group id="Resx">
+        <trans-unit id="Resx/ResourceFlowDirection" translate="yes" xml:space="preserve">
+          <source>LeftToRight</source>
+          <target state="translated">LeftToRight</target>
+          <note from="MultilingualBuild" annotates="source" priority="2">Controls the FlowDirection for all elements in the RootFrame. Set to the traditional direction of this resource file's language</note>
+          </trans-unit>
+        <trans-unit id="Resx/ResourceLanguage" translate="yes" xml:space="preserve">
+          <source>en</source>
+          <target state="translated">es</target>
+          <note from="MultilingualBuild" annotates="source" priority="2">Controls the Language and ensures that the font for all elements in the RootFrame aligns with the app's language. Set to the language code of this resource file's language.</note>
+          </trans-unit>
+        <trans-unit id="Resx/ApplicationTitle" translate="yes" xml:space="preserve">
+          <source>MY APPLICATION</source>
+          <target state="needs-review-translation" state-qualifier="mt-suggestion">MI APLICACIÓN</target>
+        </trans-unit>
+        <trans-unit id="Resx/AppBarButtonText" translate="yes" xml:space="preserve">
+          <source>add</source>
+          <target state="needs-review-translation" state-qualifier="mt-suggestion">Agregar</target>
+        </trans-unit>
+        <trans-unit id="Resx/AppBarMenuItemText" translate="yes" xml:space="preserve">
+          <source>Menu item</source>
+          <target state="needs-review-translation" state-qualifier="mt-suggestion">Elemento de menú</target>
+        </trans-unit>
+        <trans-unit id="Resx/SettingsLanguageHeader" translate="yes" xml:space="preserve">
+          <source>Language</source>
+          <target state="needs-review-translation" state-qualifier="mt-suggestion">Idioma</target>
+          <note from="MultilingualBuild" annotates="source" priority="2">Text in settings page</note>
+          </trans-unit>
+        <trans-unit id="Resx/SettingsTemperatureUnitsHeader" translate="yes" xml:space="preserve">
+          <source>Temperature units</source>
+          <target state="needs-review-translation" state-qualifier="mt-suggestion">Unidades de temperatura</target>
+          <note from="MultilingualBuild" annotates="source" priority="2">Text in settings page</note>
+          </trans-unit>
+        <trans-unit id="Resx/SettingsLanguageSelectionEnglish" translate="yes" xml:space="preserve">
+          <source>english</source>
+          <target state="needs-review-translation" state-qualifier="mt-suggestion">inglés</target>
+          <note from="MultilingualBuild" annotates="source" priority="2">Settings page, select English language</note>
+          </trans-unit>
+        <trans-unit id="Resx/SettingsLanguageSelectionSpanish" translate="yes" xml:space="preserve">
+          <source>spanish</source>
+          <target state="translated">español</target>
+          <note from="MultilingualBuild" annotates="source" priority="2">Settings page, select Spanish language</note>
+          </trans-unit>
+        <trans-unit id="Resx/SettingsTemperatureUnitsSelectionCentigrade" translate="yes" xml:space="preserve">
+          <source>celsius</source>
+          <target state="translated">celsius</target>
+          <note from="MultilingualBuild" annotates="source" priority="2">Settings page, select tempereature units centigrade</note>
+          </trans-unit>
+        <trans-unit id="Resx/SettingsTemperatureUnitsSelectionFahrenheit" translate="yes" xml:space="preserve">
+          <source>fahrenheit</source>
+          <target state="translated">fahrenheit</target>
+          <note from="MultilingualBuild" annotates="source" priority="2">Settings page, select temperature units fahrenheit</note>
+          </trans-unit>
+      </group>
+    </body>
+  </file>
+</xliff>
\ No newline at end of file
diff --git a/WindowsPhone/WeatherInformation/WeatherInformation/Resources/AppResources.qps-ploc.resx b/WindowsPhone/WeatherInformation/WeatherInformation/Resources/AppResources.qps-ploc.resx
new file mode 100644 (file)
index 0000000..a363470
--- /dev/null
@@ -0,0 +1,161 @@
+<?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="ResourceFlowDirection" xml:space="preserve">
+    <value>LeftToRight</value>
+    <comment>Controls the FlowDirection for all elements in the RootFrame. Set to the traditional direction of this resource file's language</comment>
+  </data>
+  <data name="ResourceLanguage" xml:space="preserve">
+    <value>qps-ploc</value>
+    <comment>Controls the Language and ensures that the font for all elements in the RootFrame aligns with the app's language. Set to the language code of this resource file's language.</comment>
+  </data>
+  <data name="ApplicationTitle" xml:space="preserve">
+    <value>[1BD7D][!!_МĮ ÀРĽÌĆÃČÌÓŇ_!!]</value>
+  </data>
+  <data name="AppBarButtonText" xml:space="preserve">
+    <value>[C3F82][!!_àġřéģàŕ_!!]</value>
+  </data>
+  <data name="AppBarMenuItemText" xml:space="preserve">
+    <value>[01F8F][!!_Êĺèmèиţô ðé мèйú_!!]</value>
+  </data>
+  <data name="SettingsLanguageHeader" xml:space="preserve">
+    <value>[D9E46][!!_Ļàйģûáğè_!!]</value>
+    <comment>Text in settings page</comment>
+  </data>
+  <data name="SettingsTemperatureUnitsHeader" xml:space="preserve">
+    <value>[27946][!!_Ţêmþêŗáτúřê ûиìтş_!!]</value>
+    <comment>Text in settings page</comment>
+  </data>
+  <data name="SettingsLanguageSelectionEnglish" xml:space="preserve">
+    <value>[6390E][!!_įиģľéş_!!]</value>
+    <comment>Settings page, select English language</comment>
+  </data>
+  <data name="SettingsLanguageSelectionSpanish" xml:space="preserve">
+    <value>[3FC2A][!!_éŝрáñóľ_!!]</value>
+    <comment>Settings page, select Spanish language</comment>
+  </data>
+  <data name="SettingsTemperatureUnitsSelectionCentigrade" xml:space="preserve">
+    <value>[EFA86][!!_ćęηťíğŕãďõ_!!]</value>
+    <comment>Settings page, select tempereature units centigrade</comment>
+  </data>
+  <data name="SettingsTemperatureUnitsSelectionFahrenheit" xml:space="preserve">
+    <value>[9AF14][!!_ƒáĥřêηĥęîţ_!!]</value>
+    <comment>Settings page, select temperature units fahrenheit</comment>
+  </data>
+</root>
\ No newline at end of file
diff --git a/WindowsPhone/WeatherInformation/WeatherInformation/Resources/AppResources.qps-ploc.xlf b/WindowsPhone/WeatherInformation/WeatherInformation/Resources/AppResources.qps-ploc.xlf
new file mode 100644 (file)
index 0000000..807e3b2
--- /dev/null
@@ -0,0 +1,64 @@
+<?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" target-language="qps-ploc" original="AppResources.resx" tool-id="MultilingualAppToolkit" product-name="WeatherInformation" product-version="1.0.0.0" build-num="0">
+    <header>
+      <tool tool-id="MultilingualAppToolkit" tool-name="Multilingual App Toolkit" tool-version="3.0.1200.0" tool-company="Microsoft" />
+    </header>
+    <body>
+      <group id="Resx">
+        <trans-unit id="Resx/ResourceFlowDirection" translate="yes" xml:space="preserve">
+          <source>LeftToRight</source>
+          <target state="translated">LeftToRight</target>
+          <note from="MultilingualBuild" annotates="source" priority="2">Controls the FlowDirection for all elements in the RootFrame. Set to the traditional direction of this resource file's language</note>
+          </trans-unit>
+        <trans-unit id="Resx/ResourceLanguage" translate="yes" xml:space="preserve">
+          <source>en</source>
+          <target state="translated">qps-ploc</target>
+          <note from="MultilingualBuild" annotates="source" priority="2">Controls the Language and ensures that the font for all elements in the RootFrame aligns with the app's language. Set to the language code of this resource file's language.</note>
+          </trans-unit>
+        <trans-unit id="Resx/ApplicationTitle" translate="yes" xml:space="preserve">
+          <source>MY APPLICATION</source>
+          <target state="needs-review-translation" state-qualifier="mt-suggestion">[1BD7D][!!_МĮ ÀРĽÌĆÃČÌÓŇ_!!]</target>
+        </trans-unit>
+        <trans-unit id="Resx/AppBarButtonText" translate="yes" xml:space="preserve">
+          <source>add</source>
+          <target state="needs-review-translation" state-qualifier="mt-suggestion">[C3F82][!!_àġřéģàŕ_!!]</target>
+        </trans-unit>
+        <trans-unit id="Resx/AppBarMenuItemText" translate="yes" xml:space="preserve">
+          <source>Menu item</source>
+          <target state="needs-review-translation" state-qualifier="mt-suggestion">[01F8F][!!_Êĺèmèиţô ðé мèйú_!!]</target>
+        </trans-unit>
+        <trans-unit id="Resx/SettingsTemperatureUnitsHeader" translate="yes" xml:space="preserve">
+          <source>Temperature units</source>
+          <target state="needs-review-translation" state-qualifier="mt-suggestion">[27946][!!_Ţêmþêŗáτúřê ûиìтş_!!]</target>
+          <note from="MultilingualBuild" annotates="source" priority="2">Text in settings page</note>
+          </trans-unit>
+        <trans-unit id="Resx/SettingsLanguageSelectionSpanish" translate="yes" xml:space="preserve">
+          <source>spanish</source>
+          <target state="needs-review-translation" state-qualifier="mt-suggestion">[3FC2A][!!_éŝрáñóľ_!!]</target>
+          <note from="MultilingualBuild" annotates="source" priority="2">Settings page, select Spanish language</note>
+          </trans-unit>
+        <trans-unit id="Resx/SettingsTemperatureUnitsSelectionFahrenheit" translate="yes" xml:space="preserve">
+          <source>fahrenheit</source>
+          <target state="needs-review-translation" state-qualifier="mt-suggestion">[9AF14][!!_ƒáĥřêηĥęîţ_!!]</target>
+          <note from="MultilingualBuild" annotates="source" priority="2">Settings page, select temperature units fahrenheit</note>
+          </trans-unit>
+        <trans-unit id="Resx/SettingsTemperatureUnitsSelectionCentigrade" translate="yes" xml:space="preserve">
+          <source>celsius</source>
+          <target state="needs-review-translation" state-qualifier="mt-suggestion">[EFA86][!!_ćęηťíğŕãďõ_!!]</target>
+          <note from="MultilingualBuild" annotates="source" priority="2">Settings page, select tempereature units centigrade</note>
+          </trans-unit>
+        <trans-unit id="Resx/SettingsLanguageSelectionEnglish" translate="yes" xml:space="preserve">
+          <source>english</source>
+          <target state="needs-review-translation" state-qualifier="mt-suggestion">[6390E][!!_įиģľéş_!!]</target>
+          <note from="MultilingualBuild" annotates="source" priority="2">Settings page, select English language</note>
+          </trans-unit>
+        <trans-unit id="Resx/SettingsLanguageHeader" translate="yes" xml:space="preserve">
+          <source>Language</source>
+          <target state="needs-review-translation" state-qualifier="mt-suggestion">[D9E46][!!_Ļàйģûáğè_!!]</target>
+          <note from="MultilingualBuild" annotates="source" priority="2">Text in settings page</note>
+          </trans-unit>
+      </group>
+    </body>
+  </file>
+</xliff>
\ No newline at end of file
index 10bd5a6..8adccab 100644 (file)
     <comment>Controls the FlowDirection for all elements in the RootFrame. Set to the traditional direction of this resource file's language</comment>
   </data>
   <data name="ResourceLanguage" xml:space="preserve">
-    <value>es-ES</value>
+    <value>en</value>
     <comment>Controls the Language and ensures that the font for all elements in the RootFrame aligns with the app's language. Set to the language code of this resource file's language.</comment>
   </data>
   <data name="ApplicationTitle" xml:space="preserve">
-    <value>MI APLICACIÓN</value>
-  </data>
-  <data name="SampleProperty" xml:space="preserve">
-    <value>Valor de propiedad en tiempo de ejecución de ejemplo</value>
+    <value>MY APPLICATION</value>
   </data>
   <data name="AppBarButtonText" xml:space="preserve">
-    <value>agregar</value>
+    <value>add</value>
   </data>
   <data name="AppBarMenuItemText" xml:space="preserve">
-    <value>Elemento de menú</value>
+    <value>Menu item</value>
   </data>
-  <data name="LanguageSettingsText" xml:space="preserve">
+  <data name="SettingsLanguageHeader" xml:space="preserve">
     <value>Language</value>
     <comment>Text in settings page</comment>
   </data>
-  <data name="TemperatureSettingsText" xml:space="preserve">
+  <data name="SettingsTemperatureUnitsHeader" xml:space="preserve">
     <value>Temperature units</value>
     <comment>Text in settings page</comment>
   </data>
+  <data name="SettingsLanguageSelectionEnglish" xml:space="preserve">
+    <value>english</value>
+    <comment>Settings page, select English language</comment>
+  </data>
+  <data name="SettingsLanguageSelectionSpanish" xml:space="preserve">
+    <value>spanish</value>
+    <comment>Settings page, select Spanish language</comment>
+  </data>
+  <data name="SettingsTemperatureUnitsSelectionCentigrade" xml:space="preserve">
+    <value>celsius</value>
+    <comment>Settings page, select tempereature units centigrade</comment>
+  </data>
+  <data name="SettingsTemperatureUnitsSelectionFahrenheit" xml:space="preserve">
+    <value>fahrenheit</value>
+    <comment>Settings page, select temperature units fahrenheit</comment>
+  </data>
 </root>
\ No newline at end of file
index 4c4241e..f284267 100644 (file)
@@ -1,8 +1,7 @@
 <vm:MainViewModel
     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
-    xmlns:vm="clr-namespace:WeatherInformation.ViewModels"
-    SampleProperty="Valor de propiedad Sample Text">
+    xmlns:vm="clr-namespace:WeatherInformation.ViewModels">
 
     <vm:MainViewModel.ForecastItems>
         <vm:ItemViewModel LineOne="MON" LineTwo="1" LineThree="15ºC" LineFour="10ºC" LineFive="/Assets/Tiles/IconicTileMediumLarge.png"/>
diff --git a/WindowsPhone/WeatherInformation/WeatherInformation/SampleData/SettingsViewModelSampleData.xaml b/WindowsPhone/WeatherInformation/WeatherInformation/SampleData/SettingsViewModelSampleData.xaml
deleted file mode 100644 (file)
index 9e6fa96..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-<vm:SettingsViewModel
-    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
-    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
-    xmlns:vm="clr-namespace:WeatherInformation.ViewModels">
-
-    <vm:SettingsViewModel.TemperatureUnitsSelection>
-        
-    </vm:SettingsViewModel.TemperatureUnitsSelection>
-    
-    <vm:SettingsViewModel.LanguageSelection>
-       
-    </vm:SettingsViewModel.LanguageSelection>
-
-</vm:SettingsViewModel>
\ No newline at end of file
index 599185a..53c373e 100644 (file)
@@ -1,5 +1,4 @@
 <phone:PhoneApplicationPage
-    x:Class="WeatherInformation.SettingsPage"
     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
     xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
@@ -7,60 +6,62 @@
     xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
     xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
     xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
+    xmlns:ViewModels="clr-namespace:WeatherInformation.ViewModels"
+    x:Class="WeatherInformation.SettingsPage"
     mc:Ignorable="d"
-    d:DataContext="{d:DesignData SampleData/SettingsViewModelSampleData.xaml}"
-    FontFamily="{StaticResource PhoneFontFamilyNormal}"
-    FontSize="{StaticResource PhoneFontSizeNormal}"
-    Foreground="{StaticResource PhoneForegroundBrush}"
     SupportedOrientations="PortraitOrLandscape"  Orientation="Portrait"
     shell:SystemTray.IsVisible="True">
+    
        <phone:PhoneApplicationPage.Resources>
-               <DataTemplate x:Key="StringTemplate">
-                       <StackPanel>
-                               <TextBlock Text="{Binding Mode=OneWay}"/>
-                       </StackPanel>
-               </DataTemplate>
-               <DataTemplate x:Key="StringTemplate1">
-                       <StackPanel>
-                               <TextBlock Text="{Binding Mode=OneWay}"/>
-                       </StackPanel>
-               </DataTemplate>
+               <ViewModels:SettingsViewModel x:Key="SettingsViewModelDataSource" d:IsDataSource="True"/>
        </phone:PhoneApplicationPage.Resources>
-
+       <phone:PhoneApplicationPage.FontFamily>
+               <StaticResource ResourceKey="PhoneFontFamilyNormal"/>
+       </phone:PhoneApplicationPage.FontFamily>
+       <phone:PhoneApplicationPage.FontSize>
+               <StaticResource ResourceKey="PhoneFontSizeNormal"/>
+       </phone:PhoneApplicationPage.FontSize>
+       <phone:PhoneApplicationPage.Foreground>
+               <StaticResource ResourceKey="PhoneForegroundBrush"/>
+       </phone:PhoneApplicationPage.Foreground>
     <!--LayoutRoot es la cuadrícula raíz donde se coloca todo el contenido de la página-->
-    <Grid x:Name="LayoutRoot" Background="Transparent">
-        <!-- Pivot -->
-        <phone:Pivot Title="WEATHER INFORMATION">
-            <!-- Elemento Pivot uno -->
-            <phone:PivotItem Header="settings">
-                <Grid VerticalAlignment="Top">
-                    <Grid.RowDefinitions>
-                        <RowDefinition Height="*" />
-                        <RowDefinition Height="*" />
-                    </Grid.RowDefinitions>
-                    <Grid.ColumnDefinitions>
-                        <ColumnDefinition Width="*" />
-                    </Grid.ColumnDefinitions>
-                    <StackPanel Grid.Column="0" Grid.Row="0" Orientation="Vertical">
-                        <TextBox x:Name="TemperatureUnitsText" Text="{Binding LocalizedResources.TemperatureSettingsText, Mode=OneWay, Source={StaticResource LocalizedStrings}}" HorizontalAlignment="Left" Background="Transparent" BorderBrush="Transparent" Foreground="#FFA4A2A2" />
-                        <toolkit:ListPicker x:Name="TemperatureUnitsSelection" ItemsSource="{Binding TemperatureUnitsSelection}">
-                        </toolkit:ListPicker>
-                    </StackPanel>
-                    <StackPanel Grid.Column="0" Grid.Row="1" Orientation="Vertical" VerticalAlignment="Center">
-                        <TextBox x:Name="LanguageTextBox" Text="{Binding LocalizedResources.LanguageSettingsText, Mode=OneWay, Source={StaticResource LocalizedStrings}}" HorizontalAlignment="Left" Background="Transparent" BorderBrush="Transparent" Foreground="#FFA4A2A2" />
-                        <toolkit:ListPicker x:Name="LanguageSelection" ItemsSource="{Binding LanguageSelection}">
-                        </toolkit:ListPicker>
-                    </StackPanel>
-                </Grid>
-            </phone:PivotItem>
+       <Grid x:Name="LayoutRoot" Background="Transparent" DataContext="{Binding Source={StaticResource SettingsViewModelDataSource}}">
+               <!-- Pivot -->
+               <phone:Pivot Title="WEATHER INFORMATION">
+                       <!-- Elemento Pivot uno -->
+                       <phone:PivotItem Header="settings">
+                               <Grid VerticalAlignment="Top">
+                                       <Grid.RowDefinitions>
+                                               <RowDefinition Height="*" />
+                                               <RowDefinition Height="*" />
+                                       </Grid.RowDefinitions>
+                                       <Grid.ColumnDefinitions>
+                                               <ColumnDefinition Width="*" />
+                                       </Grid.ColumnDefinitions>
+                                       <StackPanel Grid.Column="0" Grid.Row="0" Orientation="Vertical" VerticalAlignment="Center">
+                                               <TextBox x:Name="TemperatureUnitsHeader" Text="{Binding LocalizedResources.SettingsTemperatureUnitsHeader, Mode=OneWay, Source={StaticResource LocalizedStrings}}" HorizontalAlignment="Left" Background="Transparent" BorderBrush="Transparent" Foreground="#FFA4A2A2"/>
+                        <toolkit:ListPicker x:Name="TemperatureUnitsSelection" SelectedIndex="{Binding TemperaruteUnitsSelectionSetting, Mode=TwoWay}">
+                            <toolkit:ListPickerItem Content="{Binding LocalizedResources.SettingsTemperatureUnitsSelectionFahrenheit, Mode=OneWay, Source={StaticResource LocalizedStrings}}" />
+                                                       <toolkit:ListPickerItem Content="{Binding LocalizedResources.SettingsTemperatureUnitsSelectionCentigrade, Mode=OneWay, Source={StaticResource LocalizedStrings}}" />
+                                               </toolkit:ListPicker>
+                                       </StackPanel>
+                                       <StackPanel Grid.Column="0" Grid.Row="1" Orientation="Vertical" VerticalAlignment="Center">
+                                               <TextBox x:Name="LanguageHeader" Text="{Binding LocalizedResources.SettingsLanguageHeader, Mode=OneWay, Source={StaticResource LocalizedStrings}}" HorizontalAlignment="Left" Background="Transparent" BorderBrush="Transparent" Foreground="#FFA4A2A2" />
+                                               <toolkit:ListPicker x:Name="LanguageSelection" SelectedIndex="{Binding LanguageSelectionSetting, Mode=TwoWay}">
+                                                       <toolkit:ListPickerItem Content="{Binding LocalizedResources.SettingsLanguageSelectionEnglish, Mode=OneWay, Source={StaticResource LocalizedStrings}}"/>
+                                                       <toolkit:ListPickerItem Content="{Binding LocalizedResources.SettingsLanguageSelectionSpanish, Mode=OneWay, Source={StaticResource LocalizedStrings}}"/>
+                                               </toolkit:ListPicker>
+                                       </StackPanel>
+                               </Grid>
+                       </phone:PivotItem>
 
-            <!-- Elemento Pivot dos -->
-            <phone:PivotItem Header="notifications">
-                <Grid/>
-            </phone:PivotItem>
+                       <!-- Elemento Pivot dos -->
+                       <phone:PivotItem Header="notifications">
+                               <Grid/>
+                       </phone:PivotItem>
 
-        </phone:Pivot>
-        <phone:LongListSelector HorizontalAlignment="Left" Height="100" Margin="825,108,-445,0" VerticalAlignment="Top" Width="100"/>
-    </Grid>
+               </phone:Pivot>
+               <phone:LongListSelector HorizontalAlignment="Left" Height="100" Margin="825,108,-445,0" VerticalAlignment="Top" Width="100"/>
+       </Grid>
 
 </phone:PhoneApplicationPage>
\ No newline at end of file
index 61a8cb7..743aa4f 100644 (file)
@@ -9,6 +9,7 @@ using Microsoft.Phone.Controls;
 using Microsoft.Phone.Shell;
 using WeatherInformation.ViewModels;
 using System.IO.IsolatedStorage;
+using System.Collections;
 
 namespace WeatherInformation
 {
@@ -29,9 +30,14 @@ namespace WeatherInformation
 
         protected override void OnNavigatedTo(NavigationEventArgs e)
         {
-            if (!App.SettingsViewModel.IsDataLoaded)
+        }
+
+        private void TemperatureUnitsSelection_SelectionChanged(object sender, SelectionChangedEventArgs e)
+        {
+            IList units = e.AddedItems;
+            if (units.Count > 0)
             {
-                App.SettingsViewModel.LoadData();
+                var selectedUnit = units.Cast<string>().First<string>();
             }
         }
     }
index d801a70..2b0e1b8 100644 (file)
@@ -73,17 +73,6 @@ namespace WeatherInformation.ViewModels
             }
         }
 
-        /// <summary>
-        /// Propiedad de ejemplo que devuelve una cadena traducida
-        /// </summary>
-        public string LocalizedSampleProperty
-        {
-            get
-            {
-                return AppResources.SampleProperty;
-            }
-        }
-
         public bool IsDataLoaded
         {
             get;
index 6e82502..c960820 100644 (file)
 using System.Collections.Generic;
 using System.Collections.ObjectModel;
 using System.ComponentModel;
+using System.IO.IsolatedStorage;
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
+using WeatherInformation.Resources;
 
 namespace WeatherInformation.ViewModels
 {
     public class SettingsViewModel : INotifyPropertyChanged
     {
+        // Settings
+        private IsolatedStorageSettings settings;
+
+        // The key names of settings
+        private const string _languageSelectionSettingKeyName = "LanguageSelection";
+        private const string _temperatureUnitsSelectionSettingKeyName = "TemperatureUnitsSelection";
+
+        // The default value of ListPicker settings
+        private const int _listPickerSettingDefault = 0;
+
         public SettingsViewModel()
         {
-            this.TemperatureUnitsSelection = new List<string>();
-            this.LanguageSelection = new List<string>();
+            // You need to add a check to DesignerProperties.IsInDesignTool to that code since accessing
+            // IsolatedStorageSettings in Visual Studio or Expression Blend is invalid.
+            // see: http://stackoverflow.com/questions/7294461/unable-to-determine-application-identity-of-the-caller
+            if (!System.ComponentModel.DesignerProperties.IsInDesignTool)
+            {
+                // Get the settings for this application.
+                settings = IsolatedStorageSettings.ApplicationSettings;
+            }
         }
 
-        public List<string> TemperatureUnitsSelection { get; private set; }
-        public List<string> LanguageSelection { get; private set; }
+        /// <summary>
+        /// Property to get and set language selection Setting Key.
+        /// </summary>
+        public int LanguageSelectionSetting
+        {
+            get
+            {
+                return GetValueOrDefault<int>(_languageSelectionSettingKeyName, _listPickerSettingDefault);
+            }
+            set
+            {
+                if (AddOrUpdateValue(_languageSelectionSettingKeyName, value))
+                {
+                    Save();
+                }
+            }
+        }
 
-        public bool IsDataLoaded
+        /// <summary>
+        /// Property to get and set temperature units selection Setting Key.
+        /// </summary>
+        public int TemperaruteUnitsSelectionSetting
         {
-            get;
-            private set;
+            get
+            {
+                return GetValueOrDefault<int>(_temperatureUnitsSelectionSettingKeyName, _listPickerSettingDefault);
+            }
+            set
+            {
+                if (AddOrUpdateValue(_temperatureUnitsSelectionSettingKeyName, value))
+                {
+                    Save();
+                }
+            }
         }
 
         /// <summary>
-        /// Crear y agregar unos pocos objetos a la colección Items.
+        /// Get the current value of the setting, or if it is not found, set the 
+        /// setting to the default value.
         /// </summary>
-        public void LoadData()
+        /// <typeparam name="T"></typeparam>
+        /// <param name="Key"></param>
+        /// <param name="defaultValue"></param>
+        /// <returns></returns>
+        private T GetValueOrDefault<T>(string Key, T defaultValue)
         {
-            // TODO: How to do the same using StaticResources? :/ What the translator should do with this :(
-            // There must be some way to refernce static resources from here or something like that, otherwise
-            // the translator is going to complain A LOT!
-            TemperatureUnitsSelection.Add("fahrenheit");
-            TemperatureUnitsSelection.Add("centigrade");
+            T value;
 
-            LanguageSelection.Add("english");
-            LanguageSelection.Add("spanish");
+            // If the key exists, retrieve the value.
+            if (settings.Contains(Key))
+            {
+                value = (T)settings[Key];
+            }
+            // Otherwise, use the default value.
+            else
+            {
+                value = defaultValue;
+            }
+            return value;
+        }
+
+        /// <summary>
+        /// Update a setting value for application. If the setting does not
+        /// exist, then add the setting.
+        /// </summary>
+        /// <param name="Key"></param>
+        /// <param name="value"></param>
+        /// <returns></returns>
+        private bool AddOrUpdateValue(string Key, Object value)
+        {
+            bool valueChanged = false;
 
-            this.IsDataLoaded = true;
+            // If the key exists
+            if (settings.Contains(Key))
+            {
+                // If the value has changed
+                if (settings[Key] != value)
+                {
+                    // Store the new value
+                    settings[Key] = value;
+                    valueChanged = true;
+                }
+            }
+            // Otherwise create the key.
+            else
+            {
+                settings.Add(Key, value);
+                valueChanged = true;
+            }
+            return valueChanged;
+        }
+
+        /// <summary>
+        /// Save the settings.
+        /// </summary>
+        private void Save()
+        {
+            settings.Save();
         }
 
         public event PropertyChangedEventHandler PropertyChanged;
index 0b14d44..4d7bef3 100644 (file)
@@ -15,8 +15,7 @@
     <TargetFrameworkVersion>v8.0</TargetFrameworkVersion>
     <SilverlightVersion>$(TargetFrameworkVersion)</SilverlightVersion>
     <SilverlightApplication>true</SilverlightApplication>
-    <SupportedCultures>
-    </SupportedCultures>
+    <SupportedCultures>es;qps-ploc</SupportedCultures>
     <XapOutputs>true</XapOutputs>
     <GenerateSilverlightManifest>true</GenerateSilverlightManifest>
     <XapFilename>WeatherInformation_$(Configuration)_$(Platform).xap</XapFilename>
@@ -90,6 +89,9 @@
     <ErrorReport>prompt</ErrorReport>
     <WarningLevel>4</WarningLevel>
   </PropertyGroup>
+  <PropertyGroup Label="MultilingualAppToolkit">
+    <MultilingualAppToolkitVersion>3.0</MultilingualAppToolkitVersion>
+  </PropertyGroup>
   <ItemGroup>
     <Compile Include="App.xaml.cs">
       <DependentUpon>App.xaml</DependentUpon>
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
     </Page>
-    <DesignData Include="SampleData\SettingsViewModelSampleData.xaml">
-      <Generator>MSBuild:Compile</Generator>
-      <SubType>Designer</SubType>
-    </DesignData>
     <Page Include="SettingsPage.xaml">
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
     <Content Include="Toolkit.Content\ApplicationBar.Select.png" />
   </ItemGroup>
   <ItemGroup>
+    <EmbeddedResource Include="Resources\AppResources.es.resx">
+      <AutoGen>True</AutoGen>
+      <DesignTime>True</DesignTime>
+      <DependentUpon>AppResources.es.xlf</DependentUpon>
+      <culture>es</culture>
+    </EmbeddedResource>
+    <EmbeddedResource Include="Resources\AppResources.qps-ploc.resx">
+      <AutoGen>True</AutoGen>
+      <DesignTime>True</DesignTime>
+      <DependentUpon>AppResources.qps-ploc.xlf</DependentUpon>
+      <culture>qps-ploc</culture>
+    </EmbeddedResource>
     <EmbeddedResource Include="Resources\AppResources.resx">
       <Generator>PublicResXFileCodeGenerator</Generator>
       <LastGenOutput>AppResources.Designer.cs</LastGenOutput>
       <HintPath>..\packages\Newtonsoft.Json.6.0.3\lib\portable-net45+wp80+win8+wpa81\Newtonsoft.Json.dll</HintPath>
     </Reference>
   </ItemGroup>
+  <ItemGroup>
+    <XliffResource Include="Resources\AppResources.es.xlf">
+      <Generator>XliffResxGenerator</Generator>
+      <LastGenOutput>AppResources.es.resx</LastGenOutput>
+    </XliffResource>
+    <XliffResource Include="Resources\AppResources.qps-ploc.xlf">
+      <Generator>XliffResxGenerator</Generator>
+      <LastGenOutput>AppResources.qps-ploc.resx</LastGenOutput>
+    </XliffResource>
+  </ItemGroup>
   <Import Project="$(MSBuildExtensionsPath)\Microsoft\$(TargetFrameworkIdentifier)\$(TargetFrameworkVersion)\Microsoft.$(TargetFrameworkIdentifier).$(TargetFrameworkVersion).Overrides.targets" />
   <Import Project="$(MSBuildExtensionsPath)\Microsoft\$(TargetFrameworkIdentifier)\$(TargetFrameworkVersion)\Microsoft.$(TargetFrameworkIdentifier).CSharp.targets" />
+  <Import Project="$(MSBuildExtensionsPath)\Microsoft\Multilingual App Toolkit\Microsoft.Multilingual.ResxResources.targets" Label="MultilingualAppToolkit" />
   <!-- 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.
   <Target Name="BeforeBuild">