[mapguide-commits] r6268 - in trunk/Tools/Maestro: Maestro
Maestro.Base Maestro.Base/Commands
Maestro.Base/Commands/Conditions Maestro.Base/Properties
Maestro.Base/Resources Maestro.Base/UI
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Wed Nov 30 08:53:58 EST 2011
Author: jng
Date: 2011-11-30 05:53:57 -0800 (Wed, 30 Nov 2011)
New Revision: 6268
Added:
trunk/Tools/Maestro/Maestro.Base/Commands/Conditions/ActiveEditorTypeConditionEvaluator.cs
trunk/Tools/Maestro/Maestro.Base/Commands/TranslateLayoutCommand.cs
trunk/Tools/Maestro/Maestro.Base/Resources/edit-language.png
trunk/Tools/Maestro/Maestro.Base/UI/LabelLocalizationDialog.Designer.cs
trunk/Tools/Maestro/Maestro.Base/UI/LabelLocalizationDialog.cs
trunk/Tools/Maestro/Maestro.Base/UI/LabelLocalizationDialog.resx
Modified:
trunk/Tools/Maestro/Maestro.Base/Maestro.Base.addin
trunk/Tools/Maestro/Maestro.Base/Maestro.Base.csproj
trunk/Tools/Maestro/Maestro.Base/Properties/Resources.Designer.cs
trunk/Tools/Maestro/Maestro.Base/Properties/Resources.resx
trunk/Tools/Maestro/Maestro/changelog.txt
Log:
#1855: Add support for easy translation of Web Layouts and Application Definitions
Modified: trunk/Tools/Maestro/Maestro/changelog.txt
===================================================================
--- trunk/Tools/Maestro/Maestro/changelog.txt 2011-11-30 12:03:27 UTC (rev 6267)
+++ trunk/Tools/Maestro/Maestro/changelog.txt 2011-11-30 13:53:57 UTC (rev 6268)
@@ -1,6 +1,17 @@
4.0
---
+ - Support for localizing Web Layouts and Application Definitions
+ - Tiled maps will be converted to non-tiled maps when previewed in local mode.
+ - A whole assortment of API tweaks to improve general usability.
+ - Fix: Gracefully handle feature sources with no feature classes in the Layer Definition Editor
+ - Fix: Minor usability issue when creating Coordinate System Overrides.
+ - Fix: Resource Properties command bringing up XML header editor instead of properties dialog
+ - Fix: Bad data type serialization when saving configuration documents
+ - Fix: Bad data type deserialization when deserializing feature schema xml
+ - Fix: ResourceTypeRegistry not handling unsupported schema versions.
+ - Fix: Deleting a map group in a Map Definition does not do a deep recursive delete of all its children
+
4.0 RC1
-------
Copied: trunk/Tools/Maestro/Maestro.Base/Commands/Conditions/ActiveEditorTypeConditionEvaluator.cs (from rev 6265, trunk/Tools/Maestro/Maestro.Base/Commands/Conditions/ActiveEditorConditionEvaluator.cs)
===================================================================
--- trunk/Tools/Maestro/Maestro.Base/Commands/Conditions/ActiveEditorTypeConditionEvaluator.cs (rev 0)
+++ trunk/Tools/Maestro/Maestro.Base/Commands/Conditions/ActiveEditorTypeConditionEvaluator.cs 2011-11-30 13:53:57 UTC (rev 6268)
@@ -0,0 +1,49 @@
+#region Disclaimer / License
+// Copyright (C) 2010, Jackie Ng
+// http://trac.osgeo.org/mapguide/wiki/maestro, jumpinjackie at gmail.com
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+//
+#endregion
+using System;
+using System.Collections.Generic;
+using System.Text;
+using ICSharpCode.Core;
+using Maestro.Base.Editor;
+
+namespace Maestro.Base.Commands.Conditions
+{
+ internal class ActiveEditorTypeConditionEvaluator : IConditionEvaluator
+ {
+ public bool IsValid(object caller, Condition condition)
+ {
+ var types = condition.Properties["types"];
+ if (types != null)
+ {
+ var wb = Workbench.Instance;
+ if (wb != null)
+ {
+ if (wb.ActiveEditor != null)
+ {
+ var rtype = wb.ActiveEditor.EditorService.GetEditedResource().ResourceType.ToString();
+ var resTypes = new List<string>(types.Split(','));
+ return resTypes.Contains(rtype);
+ }
+ }
+ }
+ return false;
+ }
+ }
+}
Added: trunk/Tools/Maestro/Maestro.Base/Commands/TranslateLayoutCommand.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Base/Commands/TranslateLayoutCommand.cs (rev 0)
+++ trunk/Tools/Maestro/Maestro.Base/Commands/TranslateLayoutCommand.cs 2011-11-30 13:53:57 UTC (rev 6268)
@@ -0,0 +1,70 @@
+#region Disclaimer / License
+// Copyright (C) 2011, Jackie Ng
+// http://trac.osgeo.org/mapguide/wiki/maestro, jumpinjackie at gmail.com
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+//
+#endregion
+using System;
+using System.Collections.Generic;
+using System.Text;
+using ICSharpCode.Core;
+using System.Xml;
+using Maestro.Base.UI;
+using System.IO;
+using Maestro.Base.Editor;
+
+namespace Maestro.Base.Commands
+{
+ public class TranslateLayoutCommand : AbstractMenuCommand
+ {
+ public override void Run()
+ {
+ var wb = Workbench.Instance;
+ var ed = wb.ActiveEditor;
+
+ if (ed != null)
+ {
+ var rt = ed.EditorService.GetEditedResource().ResourceType;
+ if (rt == OSGeo.MapGuide.MaestroAPI.ResourceTypes.ApplicationDefinition ||
+ rt == OSGeo.MapGuide.MaestroAPI.ResourceTypes.WebLayout)
+ {
+
+ var doc = new XmlDocument();
+ doc.LoadXml(ed.GetXmlContent());
+
+ List<string> tags = new List<string>();
+ if (rt == OSGeo.MapGuide.MaestroAPI.ResourceTypes.WebLayout)
+ tags.AddRange(new string[] { "Title", "Tooltip", "Description", "Label", "Prompt" });
+ else if (rt == OSGeo.MapGuide.MaestroAPI.ResourceTypes.ApplicationDefinition)
+ tags.AddRange(new string[] { "Title", "Label", "Tooltip", "StatusText", "EmptyText" });
+ var diag = new LabelLocalizationDialog(doc, tags.ToArray());
+ if (diag.ShowDialog() == System.Windows.Forms.DialogResult.OK)
+ {
+ using (var ms = new MemoryStream())
+ {
+ doc.Save(ms);
+ ms.Position = 0L;
+ var txml = Encoding.UTF8.GetString(ms.GetBuffer());
+ ed.EditorService.UpdateResourceContent(txml);
+ ((ResourceEditorService)ed.EditorService).ReReadSessionResource();
+ ed.EditorService = ed.EditorService;
+ }
+ }
+ }
+ }
+ }
+ }
+}
Modified: trunk/Tools/Maestro/Maestro.Base/Maestro.Base.addin
===================================================================
--- trunk/Tools/Maestro/Maestro.Base/Maestro.Base.addin 2011-11-30 12:03:27 UTC (rev 6267)
+++ trunk/Tools/Maestro/Maestro.Base/Maestro.Base.addin 2011-11-30 13:53:57 UTC (rev 6268)
@@ -14,6 +14,7 @@
<ConditionEvaluator name="NotConnected" class="Maestro.Base.Commands.Conditions.NotConnectedConditionEvaluator" />
<ConditionEvaluator name="IsNotRoot" class="Maestro.Base.Commands.Conditions.SelectedRootItemConditionEvaluator" />
<ConditionEvaluator name="EditorFunction" class="Maestro.Base.Commands.Conditions.ActiveEditorConditionEvaluator" />
+ <ConditionEvaluator name="EditorOfType" class="Maestro.Base.Commands.Conditions.ActiveEditorTypeConditionEvaluator" />
<ConditionEvaluator name="CanClose" class="Maestro.Base.Commands.Conditions.CloseableDocumentConditionEvaluator" />
<ConditionEvaluator name="SelectedItem" class="Maestro.Base.Commands.Conditions.SelectedItemConditionEvaluator" />
<ConditionEvaluator name="CanPaste" class="Maestro.Base.Commands.Conditions.PasteConditionEvaluator" />
@@ -364,6 +365,13 @@
tooltip="${res:Menu_File_ValidateEditedResource}"
class="Maestro.Base.Commands.ValidateEditedResourceCommand" />
</Condition>
+ <Condition action="Disable" name="EditorOfType" types="WebLayout,ApplicationDefinition">
+ <ToolbarItem id="Translate"
+ icon="edit_language"
+ label="${res:Menu_Tools_Translate}"
+ tooltip="${res:Menu_Tools_Translate_Desc}"
+ class="Maestro.Base.Commands.TranslateLayoutCommand" />
+ </Condition>
<!--
Only needed if our custom drawn close buttons don't appear on document
tabs (I'm looking at you Mono). So far this isn't the case.
Modified: trunk/Tools/Maestro/Maestro.Base/Maestro.Base.csproj
===================================================================
--- trunk/Tools/Maestro/Maestro.Base/Maestro.Base.csproj 2011-11-30 12:03:27 UTC (rev 6267)
+++ trunk/Tools/Maestro/Maestro.Base/Maestro.Base.csproj 2011-11-30 13:53:57 UTC (rev 6268)
@@ -56,6 +56,7 @@
<Compile Include="Commands\CloseAllDocumentsCommand.cs" />
<Compile Include="Commands\Conditions\ActiveEditorConditionEvaluator.cs" />
<Compile Include="Commands\Conditions\CloseableDocumentConditionEvaluator.cs" />
+ <Compile Include="Commands\Conditions\ActiveEditorTypeConditionEvaluator.cs" />
<Compile Include="Commands\Conditions\CutCopyConditionEvaluator.cs" />
<Compile Include="Commands\Conditions\MultipleSelectedItemConditionEvaluator.cs" />
<Compile Include="Commands\Conditions\NotConnectedConditionEvaluator.cs" />
@@ -114,6 +115,7 @@
<Compile Include="Commands\Test\SelectFdoProviderCommand.cs" />
<Compile Include="Commands\Test\TestCommands.cs" />
<Compile Include="Commands\TipOfTheDayCommand.cs" />
+ <Compile Include="Commands\TranslateLayoutCommand.cs" />
<Compile Include="Commands\UserGuideCommand.cs" />
<Compile Include="Commands\ValidateEditedResourceCommand.cs" />
<Compile Include="Commands\XmlEditCommand.cs" />
@@ -263,6 +265,12 @@
</Compile>
<Compile Include="UI\BroadcastTextWriter.cs" />
<Compile Include="UI\ISiteExplorer.cs" />
+ <Compile Include="UI\LabelLocalizationDialog.cs">
+ <SubType>Form</SubType>
+ </Compile>
+ <Compile Include="UI\LabelLocalizationDialog.Designer.cs">
+ <DependentUpon>LabelLocalizationDialog.cs</DependentUpon>
+ </Compile>
<Compile Include="UI\MessageViewer.cs">
<SubType>UserControl</SubType>
</Compile>
@@ -393,6 +401,7 @@
</ItemGroup>
<ItemGroup>
<Content Include="Maestro.Base.addin" />
+ <None Include="Resources\edit-language.png" />
<None Include="Resources\box--pencil.png" />
<None Include="Resources\Contributors.txt" />
<None Include="Resources\edit.png" />
@@ -506,6 +515,9 @@
<DependentUpon>BoundsPicker.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
+ <EmbeddedResource Include="UI\LabelLocalizationDialog.resx">
+ <DependentUpon>LabelLocalizationDialog.cs</DependentUpon>
+ </EmbeddedResource>
<EmbeddedResource Include="UI\MessageViewer.resx">
<DependentUpon>MessageViewer.cs</DependentUpon>
<SubType>Designer</SubType>
Modified: trunk/Tools/Maestro/Maestro.Base/Properties/Resources.Designer.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Base/Properties/Resources.Designer.cs 2011-11-30 12:03:27 UTC (rev 6267)
+++ trunk/Tools/Maestro/Maestro.Base/Properties/Resources.Designer.cs 2011-11-30 13:53:57 UTC (rev 6268)
@@ -669,6 +669,13 @@
}
}
+ internal static System.Drawing.Bitmap edit_language {
+ get {
+ object obj = ResourceManager.GetObject("edit_language", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
/// <summary>
/// Looks up a localized string similar to Registered Editor: {0}.
/// </summary>
@@ -934,6 +941,15 @@
}
/// <summary>
+ /// Looks up a localized string similar to {0} items were successfully translated.
+ /// </summary>
+ internal static string ItemsTranslated {
+ get {
+ return ResourceManager.GetString("ItemsTranslated", resourceCulture);
+ }
+ }
+
+ /// <summary>
/// Looks up a localized string similar to Failed to keep session alive. This would happen if connectivity to the MapGuide Server has been lost (it has been stopped or restarted). Refresh the Site Explorer to create a new session. Also close any existing editors and re-open them..
/// </summary>
internal static string KeepAliveFailed {
@@ -1266,6 +1282,24 @@
}
/// <summary>
+ /// Looks up a localized string similar to Translate.
+ /// </summary>
+ internal static string Menu_Tools_Translate {
+ get {
+ return ResourceManager.GetString("Menu_Tools_Translate", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Translate this Layout.
+ /// </summary>
+ internal static string Menu_Tools_Translate_Desc {
+ get {
+ return ResourceManager.GetString("Menu_Tools_Translate_Desc", resourceCulture);
+ }
+ }
+
+ /// <summary>
/// Looks up a localized string similar to View.
/// </summary>
internal static string Menu_View {
Modified: trunk/Tools/Maestro/Maestro.Base/Properties/Resources.resx
===================================================================
--- trunk/Tools/Maestro/Maestro.Base/Properties/Resources.resx 2011-11-30 12:03:27 UTC (rev 6267)
+++ trunk/Tools/Maestro/Maestro.Base/Properties/Resources.resx 2011-11-30 13:53:57 UTC (rev 6268)
@@ -1079,4 +1079,16 @@
<data name="EditRawHeader" xml:space="preserve">
<value>Edit Raw Header XML</value>
</data>
+ <data name="ItemsTranslated" xml:space="preserve">
+ <value>{0} items were successfully translated</value>
+ </data>
+ <data name="edit_language" type="System.Resources.ResXFileRef, System.Windows.Forms">
+ <value>..\Resources\edit-language.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
+ </data>
+ <data name="Menu_Tools_Translate" xml:space="preserve">
+ <value>Translate</value>
+ </data>
+ <data name="Menu_Tools_Translate_Desc" xml:space="preserve">
+ <value>Translate this Layout</value>
+ </data>
</root>
\ No newline at end of file
Added: trunk/Tools/Maestro/Maestro.Base/Resources/edit-language.png
===================================================================
(Binary files differ)
Property changes on: trunk/Tools/Maestro/Maestro.Base/Resources/edit-language.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/Tools/Maestro/Maestro.Base/UI/LabelLocalizationDialog.Designer.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Base/UI/LabelLocalizationDialog.Designer.cs (rev 0)
+++ trunk/Tools/Maestro/Maestro.Base/UI/LabelLocalizationDialog.Designer.cs 2011-11-30 13:53:57 UTC (rev 6268)
@@ -0,0 +1,103 @@
+namespace Maestro.Base.UI
+{
+ partial class LabelLocalizationDialog
+ {
+ /// <summary>
+ /// Required designer variable.
+ /// </summary>
+ private System.ComponentModel.IContainer components = null;
+
+ /// <summary>
+ /// Clean up any resources being used.
+ /// </summary>
+ /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ /// <summary>
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ /// </summary>
+ private void InitializeComponent()
+ {
+ System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(LabelLocalizationDialog));
+ this.grdStrings = new System.Windows.Forms.DataGridView();
+ this.label1 = new System.Windows.Forms.Label();
+ this.btnApply = new System.Windows.Forms.Button();
+ this.btnCancel = new System.Windows.Forms.Button();
+ this.btnCheckAll = new System.Windows.Forms.Button();
+ ((System.ComponentModel.ISupportInitialize)(this.grdStrings)).BeginInit();
+ this.SuspendLayout();
+ //
+ // grdStrings
+ //
+ this.grdStrings.AllowUserToAddRows = false;
+ this.grdStrings.AllowUserToDeleteRows = false;
+ this.grdStrings.AllowUserToOrderColumns = true;
+ resources.ApplyResources(this.grdStrings, "grdStrings");
+ this.grdStrings.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
+ this.grdStrings.Name = "grdStrings";
+ //
+ // label1
+ //
+ resources.ApplyResources(this.label1, "label1");
+ this.label1.Name = "label1";
+ //
+ // btnApply
+ //
+ resources.ApplyResources(this.btnApply, "btnApply");
+ this.btnApply.DialogResult = System.Windows.Forms.DialogResult.Cancel;
+ this.btnApply.Name = "btnApply";
+ this.btnApply.UseVisualStyleBackColor = true;
+ this.btnApply.Click += new System.EventHandler(this.btnApply_Click);
+ //
+ // btnCancel
+ //
+ resources.ApplyResources(this.btnCancel, "btnCancel");
+ this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
+ this.btnCancel.Name = "btnCancel";
+ this.btnCancel.UseVisualStyleBackColor = true;
+ this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
+ //
+ // btnCheckAll
+ //
+ resources.ApplyResources(this.btnCheckAll, "btnCheckAll");
+ this.btnCheckAll.Name = "btnCheckAll";
+ this.btnCheckAll.UseVisualStyleBackColor = true;
+ this.btnCheckAll.Click += new System.EventHandler(this.btnCheckAll_Click);
+ //
+ // LabelLocalizationDialog
+ //
+ this.AcceptButton = this.btnApply;
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
+ this.CancelButton = this.btnCancel;
+ resources.ApplyResources(this, "$this");
+ this.ControlBox = false;
+ this.Controls.Add(this.btnCheckAll);
+ this.Controls.Add(this.btnCancel);
+ this.Controls.Add(this.btnApply);
+ this.Controls.Add(this.label1);
+ this.Controls.Add(this.grdStrings);
+ this.Name = "LabelLocalizationDialog";
+ ((System.ComponentModel.ISupportInitialize)(this.grdStrings)).EndInit();
+ this.ResumeLayout(false);
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.DataGridView grdStrings;
+ private System.Windows.Forms.Label label1;
+ private System.Windows.Forms.Button btnApply;
+ private System.Windows.Forms.Button btnCancel;
+ private System.Windows.Forms.Button btnCheckAll;
+ }
+}
\ No newline at end of file
Added: trunk/Tools/Maestro/Maestro.Base/UI/LabelLocalizationDialog.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Base/UI/LabelLocalizationDialog.cs (rev 0)
+++ trunk/Tools/Maestro/Maestro.Base/UI/LabelLocalizationDialog.cs 2011-11-30 13:53:57 UTC (rev 6268)
@@ -0,0 +1,160 @@
+#region Disclaimer / License
+// Copyright (C) 2011, Jackie Ng
+// http://trac.osgeo.org/mapguide/wiki/maestro, jumpinjackie at gmail.com
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+//
+#endregion
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Text;
+using System.Windows.Forms;
+using System.Xml;
+using ICSharpCode.Core;
+
+namespace Maestro.Base.UI
+{
+ public partial class LabelLocalizationDialog : Form
+ {
+ private LabelLocalizationDialog()
+ {
+ InitializeComponent();
+ }
+
+ private BindingList<LocalizableElement> _elements;
+
+ public LabelLocalizationDialog(XmlDocument doc, string[] localizableTags)
+ : this()
+ {
+ _elements = new BindingList<LocalizableElement>();
+ var items = new Dictionary<string, LocalizableElement>();
+ foreach (var tag in localizableTags)
+ {
+ XmlNodeList list = doc.GetElementsByTagName(tag);
+ foreach (XmlNode node in list)
+ {
+ if (items.ContainsKey(node.InnerText))
+ {
+ items[node.InnerText].AddNode(node);
+ }
+ else
+ {
+ var lel = new LocalizableElement(node);
+ items[node.InnerText] = lel;
+ _elements.Add(lel);
+ }
+ }
+ }
+ grdStrings.DataSource = _elements;
+ }
+
+ private void btnCancel_Click(object sender, EventArgs e)
+ {
+ this.DialogResult = DialogResult.Cancel;
+ }
+
+ private void btnApply_Click(object sender, EventArgs e)
+ {
+ int translated = 0;
+ foreach (var el in _elements)
+ {
+ translated += el.Apply();
+ }
+ MessageBox.Show(string.Format(Properties.Resources.ItemsTranslated, translated.ToString()));
+ this.DialogResult = DialogResult.OK;
+ }
+
+ private void btnCheckAll_Click(object sender, EventArgs e)
+ {
+ for (int i = 0; i < _elements.Count; i++)
+ {
+ _elements[i].Translate = true;
+ }
+ }
+ }
+
+ public class LocalizableElement : INotifyPropertyChanged
+ {
+ private List<XmlNode> _element;
+
+ public LocalizableElement(XmlNode el)
+ {
+ _element = new List<XmlNode>();
+ _element.Add(el);
+ this.Label = el.InnerText;
+ this.Translate = false;
+ }
+
+ public void AddNode(XmlNode node) { _element.Add(node); }
+
+ private bool _translate;
+
+ public bool Translate
+ {
+ get { return _translate; }
+ set
+ {
+ if (value.Equals(_translate))
+ return;
+
+ _translate = value;
+ OnPropertyChanged("Translate");
+ }
+ }
+
+ public string Label { get; private set; }
+
+ private string _translation;
+
+ public string Translation
+ {
+ get { return _translation; }
+ set
+ {
+ if (value == _translation)
+ return;
+
+ _translation = value;
+ OnPropertyChanged("Translation");
+ }
+ }
+
+ public int Apply()
+ {
+ int translated = 0;
+ if (Translate && !string.IsNullOrEmpty(Translation))
+ {
+ foreach (var el in _element)
+ {
+ el.InnerText = Translation;
+ translated++;
+ }
+ }
+ return translated;
+ }
+
+ private void OnPropertyChanged(string name)
+ {
+ var handler = this.PropertyChanged;
+ if (handler != null)
+ handler(this, new System.ComponentModel.PropertyChangedEventArgs(name));
+ }
+
+ public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;
+ }
+}
Added: trunk/Tools/Maestro/Maestro.Base/UI/LabelLocalizationDialog.resx
===================================================================
--- trunk/Tools/Maestro/Maestro.Base/UI/LabelLocalizationDialog.resx (rev 0)
+++ trunk/Tools/Maestro/Maestro.Base/UI/LabelLocalizationDialog.resx 2011-11-30 13:53:57 UTC (rev 6268)
@@ -0,0 +1,270 @@
+<?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=2.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>
+ </resheader>
+ <assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
+ <data name="grdStrings.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
+ <value>Top, Bottom, Left, Right</value>
+ </data>
+ <assembly alias="System.Drawing" name="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+ <data name="grdStrings.Location" type="System.Drawing.Point, System.Drawing">
+ <value>13, 51</value>
+ </data>
+ <data name="grdStrings.Size" type="System.Drawing.Size, System.Drawing">
+ <value>567, 336</value>
+ </data>
+ <assembly alias="mscorlib" name="mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
+ <data name="grdStrings.TabIndex" type="System.Int32, mscorlib">
+ <value>0</value>
+ </data>
+ <data name=">>grdStrings.Name" xml:space="preserve">
+ <value>grdStrings</value>
+ </data>
+ <data name=">>grdStrings.Type" xml:space="preserve">
+ <value>System.Windows.Forms.DataGridView, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </data>
+ <data name=">>grdStrings.Parent" xml:space="preserve">
+ <value>$this</value>
+ </data>
+ <data name=">>grdStrings.ZOrder" xml:space="preserve">
+ <value>4</value>
+ </data>
+ <data name="label1.Location" type="System.Drawing.Point, System.Drawing">
+ <value>13, 13</value>
+ </data>
+ <data name="label1.Size" type="System.Drawing.Size, System.Drawing">
+ <value>567, 35</value>
+ </data>
+ <data name="label1.TabIndex" type="System.Int32, mscorlib">
+ <value>1</value>
+ </data>
+ <data name="label1.Text" xml:space="preserve">
+ <value>The following localizable strings were found in your layout. Tick the labels which require translation and enter the translation in the given cell</value>
+ </data>
+ <data name=">>label1.Name" xml:space="preserve">
+ <value>label1</value>
+ </data>
+ <data name=">>label1.Type" xml:space="preserve">
+ <value>System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </data>
+ <data name=">>label1.Parent" xml:space="preserve">
+ <value>$this</value>
+ </data>
+ <data name=">>label1.ZOrder" xml:space="preserve">
+ <value>3</value>
+ </data>
+ <data name="btnApply.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
+ <value>Bottom, Right</value>
+ </data>
+ <data name="btnApply.Location" type="System.Drawing.Point, System.Drawing">
+ <value>424, 393</value>
+ </data>
+ <data name="btnApply.Size" type="System.Drawing.Size, System.Drawing">
+ <value>75, 23</value>
+ </data>
+ <data name="btnApply.TabIndex" type="System.Int32, mscorlib">
+ <value>2</value>
+ </data>
+ <data name="btnApply.Text" xml:space="preserve">
+ <value>Apply</value>
+ </data>
+ <data name=">>btnApply.Name" xml:space="preserve">
+ <value>btnApply</value>
+ </data>
+ <data name=">>btnApply.Type" xml:space="preserve">
+ <value>System.Windows.Forms.Button, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </data>
+ <data name=">>btnApply.Parent" xml:space="preserve">
+ <value>$this</value>
+ </data>
+ <data name=">>btnApply.ZOrder" xml:space="preserve">
+ <value>2</value>
+ </data>
+ <data name="btnCancel.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
+ <value>Bottom, Right</value>
+ </data>
+ <data name="btnCancel.Location" type="System.Drawing.Point, System.Drawing">
+ <value>505, 393</value>
+ </data>
+ <data name="btnCancel.Size" type="System.Drawing.Size, System.Drawing">
+ <value>75, 23</value>
+ </data>
+ <data name="btnCancel.TabIndex" type="System.Int32, mscorlib">
+ <value>3</value>
+ </data>
+ <data name="btnCancel.Text" xml:space="preserve">
+ <value>Cancel</value>
+ </data>
+ <data name=">>btnCancel.Name" xml:space="preserve">
+ <value>btnCancel</value>
+ </data>
+ <data name=">>btnCancel.Type" xml:space="preserve">
+ <value>System.Windows.Forms.Button, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </data>
+ <data name=">>btnCancel.Parent" xml:space="preserve">
+ <value>$this</value>
+ </data>
+ <data name=">>btnCancel.ZOrder" xml:space="preserve">
+ <value>1</value>
+ </data>
+ <data name="btnCheckAll.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
+ <value>Bottom, Left</value>
+ </data>
+ <data name="btnCheckAll.Location" type="System.Drawing.Point, System.Drawing">
+ <value>12, 393</value>
+ </data>
+ <data name="btnCheckAll.Size" type="System.Drawing.Size, System.Drawing">
+ <value>75, 23</value>
+ </data>
+ <data name="btnCheckAll.TabIndex" type="System.Int32, mscorlib">
+ <value>4</value>
+ </data>
+ <data name="btnCheckAll.Text" xml:space="preserve">
+ <value>Check All</value>
+ </data>
+ <data name=">>btnCheckAll.Name" xml:space="preserve">
+ <value>btnCheckAll</value>
+ </data>
+ <data name=">>btnCheckAll.Type" xml:space="preserve">
+ <value>System.Windows.Forms.Button, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </data>
+ <data name=">>btnCheckAll.Parent" xml:space="preserve">
+ <value>$this</value>
+ </data>
+ <data name=">>btnCheckAll.ZOrder" xml:space="preserve">
+ <value>0</value>
+ </data>
+ <metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <value>True</value>
+ </metadata>
+ <data name="$this.ClientSize" type="System.Drawing.Size, System.Drawing">
+ <value>592, 428</value>
+ </data>
+ <data name="$this.StartPosition" type="System.Windows.Forms.FormStartPosition, System.Windows.Forms">
+ <value>CenterParent</value>
+ </data>
+ <data name="$this.Text" xml:space="preserve">
+ <value>Localize Layout</value>
+ </data>
+ <data name=">>$this.Name" xml:space="preserve">
+ <value>LabelLocalizationDialog</value>
+ </data>
+ <data name=">>$this.Type" xml:space="preserve">
+ <value>System.Windows.Forms.Form, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </data>
+</root>
\ No newline at end of file
More information about the mapguide-commits
mailing list