Localizing C# Project of FancyZones (FancyZonesEditor) (#199) (#1122)

* removed hardcoded strings from CanvasEditorWindow.xaml

* removed hardcoded strings from GridEditorWindow.xaml

* loc

* Localized MainWindow

* reverting MainWindow.xaml as it is not rendering the window as expected

* Changed the resource settings from internal to public

* the culture is set based on the culture of the system UI set in the system settings

* Removed the french resource files used for testing

* Localized canvasWindow and mainwindow

* Removed setting the UI culture explicitly as it would be implicitly set to the culture of system UI

* Removed redundant header file
This commit is contained in:
Alekhya 2020-01-21 12:02:31 -08:00 committed by GitHub
parent ba1a681aab
commit 45e3f02832
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 198 additions and 24 deletions

View File

@ -5,6 +5,7 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:Controls="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"
xmlns:local="clr-namespace:FancyZonesEditor"
xmlns:props="clr-namespace:FancyZonesEditor.Properties"
mc:Ignorable="d"
Title=""
Width="528"
@ -164,14 +165,14 @@
</Window.Resources>
<StackPanel>
<TextBlock Name="windowEditorDialogTitle" Text="Custom layout creator" Style="{StaticResource titleText}" />
<TextBlock Name="windowEditorDialogTitle" Text="{x:Static props:Resources.Custom_Layout_Creator}" Style="{StaticResource titleText}" />
<Button x:Name="newZoneButton" Width="496" Height="136" Style="{StaticResource newZoneButton}" Click="OnAddZone">
<StackPanel>
<TextBlock x:Name="newSoneName" Text="Add new zone" Style="{StaticResource templateTitleText}" />
<TextBlock x:Name="newSoneName" Text="{x:Static props:Resources.Add_zone}" Style="{StaticResource templateTitleText}" />
<TextBlock HorizontalAlignment="Center" Text="+" Margin="0,-40,0,0"/>
</StackPanel>
</Button>
<TextBlock Text="Name" Style="{StaticResource textLabel}" />
<TextBlock Text="{x:Static props:Resources.Name}" Style="{StaticResource textLabel}" />
<TextBox Text="{Binding Name}" Width="496" Style="{StaticResource textBox}" />
<!--
<StackPanel Orientation="Horizontal" Margin="0,8,0,0">
@ -182,8 +183,8 @@
</StackPanel>
-->
<StackPanel Orientation="Horizontal" Margin="0,12,0,16">
<Button Content="Cancel" Style="{StaticResource secondaryButton}" Click="OnCancel"/>
<Button Content="Save and apply" Style="{StaticResource primaryButton}" Click="OnSaveApplyTemplate" />
<Button Content="{x:Static props:Resources.Cancel}" Style="{StaticResource secondaryButton}" Click="OnCancel"/>
<Button Content="{x:Static props:Resources.Save_Apply}" Style="{StaticResource primaryButton}" Click="OnSaveApplyTemplate" />
</StackPanel>
</StackPanel>
</local:EditorWindow>

View File

@ -176,7 +176,7 @@
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<Generator>PublicResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
<None Include="Properties\Settings.settings">

View File

@ -5,6 +5,7 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:Controls="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"
xmlns:local="clr-namespace:FancyZonesEditor"
xmlns:props="clr-namespace:FancyZonesEditor.Properties"
mc:Ignorable="d"
Title=""
Width="528"
@ -163,10 +164,10 @@
</Window.Resources>
<StackPanel>
<TextBlock Name="windowEditorDialogTitle" Text="Custom table layout creator" Style="{StaticResource titleText}" />
<TextBlock Name="windowEditorDialogTitle" Text="{x:Static props:Resources.Custom_Table_Layout}" Style="{StaticResource titleText}" />
<TextBlock Text="Note: Hold down Shift Key to change orientation of splitter" Style="{StaticResource textLabel}" />
<TextBlock Text="Name" Style="{StaticResource textLabel}" />
<TextBlock Text="{x:Static props:Resources.Note_Custom_Table}" Style="{StaticResource textLabel}" />
<TextBlock Text="{x:Static props:Resources.Name}" Style="{StaticResource textLabel}" />
<TextBox Text="{Binding Name}" Width="494" Style="{StaticResource textBox}" />
<!--
<StackPanel Orientation="Horizontal" Margin="0,8,0,0">
@ -177,8 +178,8 @@
</StackPanel>
-->
<StackPanel Orientation="Horizontal" Margin="0,12,0,16">
<Button Content="Cancel" Style="{StaticResource secondaryButton}" Click="OnCancel" />
<Button Content="Save and apply" Style="{StaticResource primaryButton}" Click="OnSaveApplyTemplate" />
<Button Content="{x:Static props:Resources.Cancel}" Style="{StaticResource secondaryButton}" Click="OnCancel" />
<Button Content="{x:Static props:Resources.Save_Apply}" Style="{StaticResource primaryButton}" Click="OnSaveApplyTemplate" />
</StackPanel>
</StackPanel>
</local:EditorWindow>

View File

@ -7,6 +7,7 @@
xmlns:Controls="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"
xmlns:local="clr-namespace:FancyZonesEditor"
xmlns:Converters="clr-namespace:FancyZonesEditor.Converters"
xmlns:props="clr-namespace:FancyZonesEditor.Properties"
mc:Ignorable="d"
Title=""
Width="810"
@ -177,10 +178,10 @@
<StackPanel>
<TextBlock Name="dialog_Title" Text="Choose your layout" Style="{StaticResource titleText}" />
<TextBlock Name="dialog_Title" Text="{x:Static props:Resources.Choose_Layout}" Style="{StaticResource titleText}" />
<TabControl BorderThickness="0" x:Name="TemplateTab" SelectedIndex="{Binding IsCustomLayoutActive, Mode=OneWay, Converter={StaticResource BooleanToIntConverter}}">
<TabItem Header="Templates" Template="{StaticResource myTabs}">
<TabItem Header="{x:Static props:Resources.Templates}" Template="{StaticResource myTabs}">
<StackPanel>
<StackPanel Margin="0,15,0,8" Orientation="Horizontal" HorizontalAlignment="Center">
<Button x:Name="decrementZones" Width="40" Height="40" Content="-" Style="{StaticResource spinnerButton}" Click="DecrementZones_Click"/>
@ -232,7 +233,7 @@
</TabItem>
<TabItem Header="Custom" Template="{StaticResource myTabs}">
<TabItem Header="{x:Static props:Resources.Custom}" Template="{StaticResource myTabs}">
<StackPanel>
<ItemsControl ItemsSource="{Binding CustomModels}" Margin="8,8,0,0">
<ItemsControl.ItemsPanel>
@ -267,8 +268,8 @@
</ItemsControl>
<StackPanel Orientation="Horizontal" Margin="0,10,0,16">
<Button x:Name="EditCustomButton" Content="Edit selected layout" Padding="8" Style="{StaticResource secondaryButton}" Click="EditLayout_Click"/>
<Button x:Name="ApplyCustomButton" Content="Apply" Padding="8" Style="{StaticResource primaryButton}" Click="Apply_Click"/>
<Button x:Name="EditCustomButton" Content="{x:Static props:Resources.Edit_Selected_Layout}" Padding="8" Style="{StaticResource secondaryButton}" Click="EditLayout_Click"/>
<Button x:Name="ApplyCustomButton" Content="{x:Static props:Resources.Apply}" Padding="8" Style="{StaticResource primaryButton}" Click="Apply_Click"/>
</StackPanel>
</StackPanel>
</TabItem>

View File

@ -22,7 +22,7 @@ namespace FancyZonesEditor.Properties {
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
public class Resources {
private static global::System.Resources.ResourceManager resourceMan;
@ -36,7 +36,7 @@ namespace FancyZonesEditor.Properties {
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
public static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("FancyZonesEditor.Properties.Resources", typeof(Resources).Assembly);
@ -51,7 +51,7 @@ namespace FancyZonesEditor.Properties {
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
public static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
@ -59,5 +59,131 @@ namespace FancyZonesEditor.Properties {
resourceCulture = value;
}
}
/// <summary>
/// Looks up a localized string similar to Add new zone.
/// </summary>
public static string Add_zone {
get {
return ResourceManager.GetString("Add_zone", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Apply.
/// </summary>
public static string Apply {
get {
return ResourceManager.GetString("Apply", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Cancel.
/// </summary>
public static string Cancel {
get {
return ResourceManager.GetString("Cancel", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Choose your layout.
/// </summary>
public static string Choose_Layout {
get {
return ResourceManager.GetString("Choose_Layout", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Custom.
/// </summary>
public static string Custom {
get {
return ResourceManager.GetString("Custom", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Custom layout creator.
/// </summary>
public static string Custom_Layout_Creator {
get {
return ResourceManager.GetString("Custom_Layout_Creator", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Custom table layout creator.
/// </summary>
public static string Custom_Table_Layout {
get {
return ResourceManager.GetString("Custom_Table_Layout", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Edit selected layout.
/// </summary>
public static string Edit_Selected_Layout {
get {
return ResourceManager.GetString("Edit_Selected_Layout", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Name.
/// </summary>
public static string Name {
get {
return ResourceManager.GetString("Name", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Note: Hold down Shift Key to change orientation of splitter.
/// </summary>
public static string Note_Custom_Table {
get {
return ResourceManager.GetString("Note_Custom_Table", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Save and apply.
/// </summary>
public static string Save_Apply {
get {
return ResourceManager.GetString("Save_Apply", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Show space around zones.
/// </summary>
public static string Show_Space_Zones {
get {
return ResourceManager.GetString("Show_Space_Zones", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Space around zones.
/// </summary>
public static string Space_Around_Zones {
get {
return ResourceManager.GetString("Space_Around_Zones", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Templates.
/// </summary>
public static string Templates {
get {
return ResourceManager.GetString("Templates", resourceCulture);
}
}
}
}

View File

@ -46,7 +46,7 @@
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
@ -60,6 +60,7 @@
: 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">
@ -68,9 +69,10 @@
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
<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">
@ -85,9 +87,10 @@
<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" msdata:Ordinal="1" />
<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">
@ -109,9 +112,51 @@
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<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=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="Add_zone" xml:space="preserve">
<value>Add new zone</value>
</data>
<data name="Apply" xml:space="preserve">
<value>Apply</value>
</data>
<data name="Cancel" xml:space="preserve">
<value>Cancel</value>
</data>
<data name="Choose_Layout" xml:space="preserve">
<value>Choose your layout</value>
</data>
<data name="Custom" xml:space="preserve">
<value>Custom</value>
</data>
<data name="Custom_Layout_Creator" xml:space="preserve">
<value>Custom layout creator</value>
</data>
<data name="Custom_Table_Layout" xml:space="preserve">
<value>Custom table layout creator</value>
</data>
<data name="Edit_Selected_Layout" xml:space="preserve">
<value>Edit selected layout</value>
</data>
<data name="Name" xml:space="preserve">
<value>Name</value>
</data>
<data name="Note_Custom_Table" xml:space="preserve">
<value>Note: Hold down Shift Key to change orientation of splitter</value>
</data>
<data name="Save_Apply" xml:space="preserve">
<value>Save and apply</value>
</data>
<data name="Show_Space_Zones" xml:space="preserve">
<value>Show space around zones</value>
</data>
<data name="Space_Around_Zones" xml:space="preserve">
<value>Space around zones</value>
</data>
<data name="Templates" xml:space="preserve">
<value>Templates</value>
</data>
</root>