Author: mkrueger
Date: 2007-08-01 04:46:47 -0400 (Wed, 01 Aug 2007)
New Revision: 83153
Modified:
trunk/monodevelop/Extras/MonoDevelop.Gettext/ChangeLog
trunk/monodevelop/Extras/MonoDevelop.Gettext/MonoDevelop.Gettext.Editor/POEditorWidget.cs
trunk/monodevelop/Extras/MonoDevelop.Gettext/gtk-gui/MonoDevelop.Gettext.POEditorWidget.cs
trunk/monodevelop/Extras/MonoDevelop.Gettext/gtk-gui/gui.stetic
Log:
* MonoDevelop.Gettext.Editor/POEditorWidget.cs,
gtk-gui/MonoDevelop.Gettext.POEditorWidget.cs: Editor now supports
n plural forms instead of 2.
Modified: trunk/monodevelop/Extras/MonoDevelop.Gettext/ChangeLog
===================================================================
--- trunk/monodevelop/Extras/MonoDevelop.Gettext/ChangeLog 2007-08-01
07:43:28 UTC (rev 83152)
+++ trunk/monodevelop/Extras/MonoDevelop.Gettext/ChangeLog 2007-08-01
08:46:47 UTC (rev 83153)
@@ -1,5 +1,11 @@
2007-08-01 Mike Krüger <[EMAIL PROTECTED]>
+ * MonoDevelop.Gettext.Editor/POEditorWidget.cs,
+ gtk-gui/MonoDevelop.Gettext.POEditorWidget.cs: Editor now supports
+ n plural forms instead of 2.
+
+2007-08-01 Mike Krüger <[EMAIL PROTECTED]>
+
* MonoDevelop.Gettext.Editor/GtkSpell.cs,
MonoDevelop.Gettext.Editor/POEditorWidget.cs: Added spellchecking
to original string (hardcoded currently to "en" - maybe shoul add
Modified:
trunk/monodevelop/Extras/MonoDevelop.Gettext/MonoDevelop.Gettext.Editor/POEditorWidget.cs
===================================================================
---
trunk/monodevelop/Extras/MonoDevelop.Gettext/MonoDevelop.Gettext.Editor/POEditorWidget.cs
2007-08-01 07:43:28 UTC (rev 83152)
+++
trunk/monodevelop/Extras/MonoDevelop.Gettext/MonoDevelop.Gettext.Editor/POEditorWidget.cs
2007-08-01 08:46:47 UTC (rev 83153)
@@ -119,22 +119,17 @@
} catch {}
MonoDevelop.Ide.Gui.IdeApp.Workbench.OpenDocument (file, lineNr, 1, true);
};
+ this.notebookTranslated.RemovePage (0);
+ AddTextview (GettextCatalog.GetString ("Singular"), 0);
- this.textviewTranslated.Buffer.Changed += delegate {
- if (this.isUpdating)
- return;
- if (this.currentEntry != null)
- this.currentEntry.SetTranslation
(textviewTranslated.Buffer.Text, 0);
- UpdateProgressBar ();
- };
-
- this.textviewTranslatedPlural.Buffer.Changed +=
delegate {
- if (this.isUpdating)
- return;
- if (this.currentEntry != null)
- this.currentEntry.SetTranslation
(textviewTranslatedPlural.Buffer.Text, 1);
- UpdateProgressBar ();
- };
+// this.textviewTranslatedPlural.Buffer.Changed +=
delegate {
+// if (this.isUpdating)
+// return;
+// if (this.currentEntry != null)
+// this.currentEntry.SetTranslation
(textviewTranslatedPlural.Buffer.Text, 1);
+// UpdateProgressBar ();
+// };
+//
this.textviewComments.Buffer.Changed += delegate {
if (this.isUpdating)
return;
@@ -158,6 +153,34 @@
widgets.Add (this);
}
+ TextView GetTextView (int index)
+ {
+ ScrolledWindow window =
this.notebookTranslated.GetNthPage (index) as ScrolledWindow;
+ if (window != null)
+ return window.Child as TextView;
+ return null;
+ }
+
+ void AddTextview (string text, int index)
+ {
+ ScrolledWindow window = new ScrolledWindow ();
+ TextView textView = new TextView ();
+ window.Child = textView;
+
+ textView.Buffer.Changed += delegate {
+ if (this.isUpdating)
+ return;
+ if (this.currentEntry != null)
+ this.currentEntry.SetTranslation
(textView.Buffer.Text, index);
+ UpdateProgressBar ();
+ };
+
+ Label label = new Label ();
+ label.Text = text;
+ window.ShowAll ();
+ this.notebookTranslated.AppendPage (window, label);
+ }
+
void ShowPopup ()
{
Gtk.Menu contextMenu = CreateContextMenu ();
@@ -241,33 +264,59 @@
#region EntryEditor handling
CatalogEntry currentEntry;
Dictionary<TextView, bool> gtkSpellSet = new
Dictionary<TextView, bool> ();
-
+ void RemoveTextViewsFrom (int index)
+ {
+ for (int i = this.notebookTranslated.NPages - 1; i >=
index ; i--) {
+ TextView view = GetTextView (i);
+ if (view == null)
+ continue;
+ if (gtkSpellSet.ContainsKey (view)) {
+// GtkSpell.Detach (view);
+ gtkSpellSet.Remove (view);
+ }
+ this.notebookTranslated.RemovePage (i);
+ }
+ }
void EditEntry (CatalogEntry entry)
{
this.isUpdating = true;
try {
currentEntry = entry;
+
this.textviewOriginal.Buffer.Text = entry !=
null ? entry.String : "";
- this.textviewTranslated.Buffer.Text = entry !=
null ? entry.GetTranslation (0) : "";
-
-
+
if (GtkSpell.IsSupported &&
!gtkSpellSet.ContainsKey (this.textviewOriginal)) {
GtkSpell.Attach (this.textviewOriginal,
"en");
this.gtkSpellSet[this.textviewOriginal] = true;
- }
+ }
- frameOriginalPlural.Visible =
frameTranslatedPlural.Visible = entry != null ? entry.HasPlural : false;
+ this.frameOriginalPlural.Visible = entry !=
null && entry.HasPlural;
+ this.notebookTranslated.ShowTabs = entry !=
null && entry.HasPlural;
if (entry != null && entry.HasPlural) {
this.textviewOriginalPlural.Buffer.Text
= entry.PluralString;
-
this.textviewTranslatedPlural.Buffer.Text = entry.GetTranslation (1);
-
if (GtkSpell.IsSupported &&
!gtkSpellSet.ContainsKey (this.textviewOriginalPlural)) {
GtkSpell.Attach
(this.textviewOriginalPlural, "en");
this.gtkSpellSet[this.textviewOriginalPlural] = true;
}
}
+ RemoveTextViewsFrom
(entry.NumberOfTranslations);
+ for (int i = this.notebookTranslated.NPages; i
< entry.NumberOfTranslations; i++) {
+ AddTextview (String.Format
(GettextCatalog.GetString ("Plural {0}"), i), i);
+ }
+
+ for (int i = 0; i < entry.NumberOfTranslations;
i++) {
+ TextView textView = GetTextView (i);
+ if (textView == null)
+ continue;
+ textView.Buffer.Text = entry != null ?
entry.GetTranslation (i) : "";
+ if (GtkSpell.IsSupported &&
!gtkSpellSet.ContainsKey (textView)) {
+ GtkSpell.Attach (textView,
"en");
+ this.gtkSpellSet[textView] =
true;
+ }
+ }
+
this.foundInStore.Clear ();
if (entry != null) {
foreach (string reference in
entry.References) {
@@ -289,14 +338,6 @@
this.textviewComments.Buffer.Text = entry !=
null ? entry.Comment : null;
if (GtkSpell.IsSupported) {
- if (!gtkSpellSet.ContainsKey
(this.textviewTranslated)) {
- GtkSpell.Attach
(this.textviewTranslated, catalog.LocaleCode);
-
this.gtkSpellSet[this.textviewTranslated] = true;
- }
- if (frameOriginalPlural.Visible &&
!gtkSpellSet.ContainsKey (this.textviewTranslatedPlural)) {
- GtkSpell.Attach
(this.textviewTranslatedPlural, catalog.LocaleCode);
-
this.gtkSpellSet[this.textviewTranslatedPlural] = true;
- }
foreach (TextView view in
this.gtkSpellSet.Keys)
GtkSpell.Recheck (view);
}
Modified:
trunk/monodevelop/Extras/MonoDevelop.Gettext/gtk-gui/MonoDevelop.Gettext.POEditorWidget.cs
===================================================================
---
trunk/monodevelop/Extras/MonoDevelop.Gettext/gtk-gui/MonoDevelop.Gettext.POEditorWidget.cs
2007-08-01 07:43:28 UTC (rev 83152)
+++
trunk/monodevelop/Extras/MonoDevelop.Gettext/gtk-gui/MonoDevelop.Gettext.POEditorWidget.cs
2007-08-01 08:46:47 UTC (rev 83153)
@@ -77,22 +77,10 @@
private Gtk.Alignment GtkAlignment1;
- private Gtk.VBox vbox6;
+ private Gtk.Notebook notebookTranslated;
- private Gtk.ScrolledWindow scrolledwindow4;
+ private Gtk.Label label1;
- private Gtk.TextView textviewTranslated;
-
- private Gtk.Frame frameTranslatedPlural;
-
- private Gtk.Alignment GtkAlignment6;
-
- private Gtk.ScrolledWindow scrolledwindow5;
-
- private Gtk.TextView textviewTranslatedPlural;
-
- private Gtk.Label GtkLabel6;
-
private Gtk.Label GtkLabel3;
private Gtk.Label label5;
@@ -301,55 +289,19 @@
this.GtkAlignment1.Name = "GtkAlignment1";
this.GtkAlignment1.LeftPadding = ((uint)(12));
// Container child GtkAlignment1.Gtk.Container+ContainerChild
- this.vbox6 = new Gtk.VBox();
- this.vbox6.Name = "vbox6";
- this.vbox6.Spacing = 6;
- // Container child vbox6.Gtk.Box+BoxChild
- this.scrolledwindow4 = new Gtk.ScrolledWindow();
- this.scrolledwindow4.CanFocus = true;
- this.scrolledwindow4.Name = "scrolledwindow4";
- this.scrolledwindow4.VscrollbarPolicy = ((Gtk.PolicyType)(1));
- this.scrolledwindow4.HscrollbarPolicy = ((Gtk.PolicyType)(1));
- this.scrolledwindow4.ShadowType = ((Gtk.ShadowType)(1));
- // Container child scrolledwindow4.Gtk.Container+ContainerChild
- this.textviewTranslated = new Gtk.TextView();
- this.textviewTranslated.CanFocus = true;
- this.textviewTranslated.Name = "textviewTranslated";
- this.scrolledwindow4.Add(this.textviewTranslated);
- this.vbox6.Add(this.scrolledwindow4);
- Gtk.Box.BoxChild w24 =
((Gtk.Box.BoxChild)(this.vbox6[this.scrolledwindow4]));
- w24.Position = 0;
- // Container child vbox6.Gtk.Box+BoxChild
- this.frameTranslatedPlural = new Gtk.Frame();
- this.frameTranslatedPlural.Name = "frameTranslatedPlural";
- this.frameTranslatedPlural.LabelXalign = 0F;
- // Container child
frameTranslatedPlural.Gtk.Container+ContainerChild
- this.GtkAlignment6 = new Gtk.Alignment(0F, 0F, 1F, 1F);
- this.GtkAlignment6.Name = "GtkAlignment6";
- this.GtkAlignment6.LeftPadding = ((uint)(12));
- // Container child GtkAlignment6.Gtk.Container+ContainerChild
- this.scrolledwindow5 = new Gtk.ScrolledWindow();
- this.scrolledwindow5.CanFocus = true;
- this.scrolledwindow5.Name = "scrolledwindow5";
- this.scrolledwindow5.VscrollbarPolicy = ((Gtk.PolicyType)(1));
- this.scrolledwindow5.HscrollbarPolicy = ((Gtk.PolicyType)(1));
- this.scrolledwindow5.ShadowType = ((Gtk.ShadowType)(1));
- // Container child scrolledwindow5.Gtk.Container+ContainerChild
- this.textviewTranslatedPlural = new Gtk.TextView();
- this.textviewTranslatedPlural.CanFocus = true;
- this.textviewTranslatedPlural.Name = "textviewTranslatedPlural";
- this.scrolledwindow5.Add(this.textviewTranslatedPlural);
- this.GtkAlignment6.Add(this.scrolledwindow5);
- this.frameTranslatedPlural.Add(this.GtkAlignment6);
- this.GtkLabel6 = new Gtk.Label();
- this.GtkLabel6.Name = "GtkLabel6";
- this.GtkLabel6.LabelProp = Mono.Unix.Catalog.GetString("plural:");
- this.GtkLabel6.UseMarkup = true;
- this.frameTranslatedPlural.LabelWidget = this.GtkLabel6;
- this.vbox6.Add(this.frameTranslatedPlural);
- Gtk.Box.BoxChild w28 =
((Gtk.Box.BoxChild)(this.vbox6[this.frameTranslatedPlural]));
- w28.Position = 1;
- this.GtkAlignment1.Add(this.vbox6);
+ this.notebookTranslated = new Gtk.Notebook();
+ this.notebookTranslated.CanFocus = true;
+ this.notebookTranslated.Name = "notebookTranslated";
+ this.notebookTranslated.CurrentPage = 0;
+ // Notebook tab
+ Gtk.Label w23 = new Gtk.Label();
+ w23.Visible = true;
+ this.notebookTranslated.Add(w23);
+ this.label1 = new Gtk.Label();
+ this.label1.Name = "label1";
+ this.label1.LabelProp = Mono.Unix.Catalog.GetString("page1");
+ this.notebookTranslated.SetTabLabel(w23, this.label1);
+ this.GtkAlignment1.Add(this.notebookTranslated);
this.frame4.Add(this.GtkAlignment1);
this.GtkLabel3 = new Gtk.Label();
this.GtkLabel3.Name = "GtkLabel3";
@@ -357,25 +309,25 @@
this.GtkLabel3.UseMarkup = true;
this.frame4.LabelWidget = this.GtkLabel3;
this.table1.Add(this.frame4);
- Gtk.Table.TableChild w31 =
((Gtk.Table.TableChild)(this.table1[this.frame4]));
- w31.TopAttach = ((uint)(1));
- w31.BottomAttach = ((uint)(2));
- w31.XOptions = ((Gtk.AttachOptions)(4));
+ Gtk.Table.TableChild w26 =
((Gtk.Table.TableChild)(this.table1[this.frame4]));
+ w26.TopAttach = ((uint)(1));
+ w26.BottomAttach = ((uint)(2));
+ w26.XOptions = ((Gtk.AttachOptions)(4));
this.vpaned2.Add(this.table1);
this.vbox7.Add(this.vpaned2);
- Gtk.Box.BoxChild w33 =
((Gtk.Box.BoxChild)(this.vbox7[this.vpaned2]));
- w33.Position = 0;
+ Gtk.Box.BoxChild w28 =
((Gtk.Box.BoxChild)(this.vbox7[this.vpaned2]));
+ w28.Position = 0;
this.notebookPages.Add(this.vbox7);
- Gtk.Notebook.NotebookChild w34 =
((Gtk.Notebook.NotebookChild)(this.notebookPages[this.vbox7]));
- w34.TabExpand = false;
+ Gtk.Notebook.NotebookChild w29 =
((Gtk.Notebook.NotebookChild)(this.notebookPages[this.vbox7]));
+ w29.TabExpand = false;
// Notebook tab
this.label5 = new Gtk.Label();
this.label5.Name = "label5";
this.label5.LabelProp = Mono.Unix.Catalog.GetString("page1");
this.notebookPages.SetTabLabel(this.vbox7, this.label5);
this.vbox2.Add(this.notebookPages);
- Gtk.Box.BoxChild w35 =
((Gtk.Box.BoxChild)(this.vbox2[this.notebookPages]));
- w35.Position = 0;
+ Gtk.Box.BoxChild w30 =
((Gtk.Box.BoxChild)(this.vbox2[this.notebookPages]));
+ w30.Position = 0;
// Container child vbox2.Gtk.Box+BoxChild
this.hbox1 = new Gtk.HBox();
this.hbox1.Name = "hbox1";
@@ -387,19 +339,19 @@
this.toolbarPages.ShowArrow = false;
this.toolbarPages.ToolbarStyle = ((Gtk.ToolbarStyle)(0));
this.hbox1.Add(this.toolbarPages);
- Gtk.Box.BoxChild w36 =
((Gtk.Box.BoxChild)(this.hbox1[this.toolbarPages]));
- w36.Position = 0;
+ Gtk.Box.BoxChild w31 =
((Gtk.Box.BoxChild)(this.hbox1[this.toolbarPages]));
+ w31.Position = 0;
// Container child hbox1.Gtk.Box+BoxChild
this.progressbar1 = new Gtk.ProgressBar();
this.progressbar1.Name = "progressbar1";
this.hbox1.Add(this.progressbar1);
- Gtk.Box.BoxChild w37 =
((Gtk.Box.BoxChild)(this.hbox1[this.progressbar1]));
- w37.Position = 1;
+ Gtk.Box.BoxChild w32 =
((Gtk.Box.BoxChild)(this.hbox1[this.progressbar1]));
+ w32.Position = 1;
this.vbox2.Add(this.hbox1);
- Gtk.Box.BoxChild w38 =
((Gtk.Box.BoxChild)(this.vbox2[this.hbox1]));
- w38.Position = 1;
- w38.Expand = false;
- w38.Fill = false;
+ Gtk.Box.BoxChild w33 =
((Gtk.Box.BoxChild)(this.vbox2[this.hbox1]));
+ w33.Position = 1;
+ w33.Expand = false;
+ w33.Fill = false;
this.Add(this.vbox2);
if ((this.Child != null)) {
this.Child.ShowAll();
Modified: trunk/monodevelop/Extras/MonoDevelop.Gettext/gtk-gui/gui.stetic
===================================================================
--- trunk/monodevelop/Extras/MonoDevelop.Gettext/gtk-gui/gui.stetic
2007-08-01 07:43:28 UTC (rev 83152)
+++ trunk/monodevelop/Extras/MonoDevelop.Gettext/gtk-gui/gui.stetic
2007-08-01 08:46:47 UTC (rev 83153)
@@ -1665,71 +1665,20 @@
<property name="Yalign">0</property>
<property name="LeftPadding">12</property>
<child>
- <widget class="Gtk.VBox" id="vbox6">
+ <widget class="Gtk.Notebook"
id="notebookTranslated">
<property name="MemberName" />
- <property name="Spacing">6</property>
+ <property name="CanFocus">True</property>
+ <property name="CurrentPage">0</property>
<child>
- <widget class="Gtk.ScrolledWindow"
id="scrolledwindow4">
- <property name="MemberName" />
- <property
name="CanFocus">True</property>
- <property
name="VscrollbarPolicy">Automatic</property>
- <property
name="HscrollbarPolicy">Automatic</property>
- <property
name="ShadowType">In</property>
- <child>
- <widget class="Gtk.TextView"
id="textviewTranslated">
- <property name="MemberName" />
- <property
name="CanFocus">True</property>
- <property name="Text"
translatable="yes" />
- </widget>
- </child>
- </widget>
- <packing>
- <property name="Position">0</property>
- <property
name="AutoSize">True</property>
- </packing>
+ <placeholder />
</child>
<child>
- <widget class="Gtk.Frame"
id="frameTranslatedPlural">
+ <widget class="Gtk.Label" id="label1">
<property name="MemberName" />
- <property
name="LabelXalign">0</property>
- <child>
- <widget class="Gtk.Alignment"
id="GtkAlignment6">
- <property name="MemberName" />
- <property
name="Xalign">0</property>
- <property
name="Yalign">0</property>
- <property
name="LeftPadding">12</property>
- <child>
- <widget
class="Gtk.ScrolledWindow" id="scrolledwindow5">
- <property name="MemberName" />
- <property
name="CanFocus">True</property>
- <property
name="VscrollbarPolicy">Automatic</property>
- <property
name="HscrollbarPolicy">Automatic</property>
- <property
name="ShadowType">In</property>
- <child>
- <widget class="Gtk.TextView"
id="textviewTranslatedPlural">
- <property
name="MemberName" />
- <property
name="CanFocus">True</property>
- <property name="Text"
translatable="yes" />
- </widget>
- </child>
- </widget>
- </child>
- </widget>
- </child>
- <child>
- <widget class="Gtk.Label"
id="GtkLabel6">
- <property name="MemberName" />
- <property name="LabelProp"
translatable="yes">plural:</property>
- <property
name="UseMarkup">True</property>
- </widget>
- <packing>
- <property
name="type">label_item</property>
- </packing>
- </child>
+ <property name="LabelProp"
translatable="yes">page1</property>
</widget>
<packing>
- <property name="Position">1</property>
- <property
name="AutoSize">True</property>
+ <property name="type">tab</property>
</packing>
</child>
</widget>
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches