[chronojump] All the jumps cairo graphs translatable



commit 05b275158e63b515834c67e075124029a4ce9672
Author: Xavier de Blas <xaviblas gmail com>
Date:   Mon Aug 10 12:40:47 2020 +0200

    All the jumps cairo graphs translatable

 glade/app1.glade                      | 42 +++++++++++++++++++++--------------
 po/POTFILES.in                        |  2 ++
 src/gui/cairo/jumpsDjOptimalFall.cs   | 10 ++++-----
 src/gui/cairo/jumpsEvolution.cs       |  8 +++----
 src/gui/cairo/jumpsRjFatigue.cs       |  8 +++----
 src/gui/cairo/jumpsWeightFVProfile.cs | 27 +++++++++++-----------
 src/gui/cairo/xy.cs                   | 33 ++++++++++++++++++++-------
 7 files changed, 79 insertions(+), 51 deletions(-)
---
diff --git a/glade/app1.glade b/glade/app1.glade
index 929b8989..c18e5dbf 100644
--- a/glade/app1.glade
+++ b/glade/app1.glade
@@ -20322,7 +20322,7 @@ Concentric</property>
                                                             <widget class="GtkHBox" id="hbox330">
                                                             <property name="visible">True</property>
                                                             <property name="can_focus">False</property>
-                                                            <property name="spacing">12</property>
+                                                            <property name="spacing">6</property>
                                                             <child>
                                                             <widget class="GtkLabel" id="label563">
                                                             <property name="visible">True</property>
@@ -20360,7 +20360,7 @@ Concentric</property>
                                                             <widget class="GtkHBox" id="hbox437">
                                                             <property name="visible">True</property>
                                                             <property name="can_focus">False</property>
-                                                            <property name="spacing">12</property>
+                                                            <property name="spacing">6</property>
                                                             <child>
                                                             <widget class="GtkLabel" id="label567">
                                                             <property name="visible">True</property>
@@ -20398,7 +20398,7 @@ Concentric</property>
                                                             <widget class="GtkHBox" id="hbox198">
                                                             <property name="visible">True</property>
                                                             <property name="can_focus">False</property>
-                                                            <property name="spacing">12</property>
+                                                            <property name="spacing">6</property>
                                                             <child>
                                                             <widget class="GtkLabel" id="label560">
                                                             <property name="visible">True</property>
@@ -20445,7 +20445,8 @@ Concentric</property>
                                                             <widget class="GtkLabel" id="label564">
                                                             <property name="visible">True</property>
                                                             <property name="can_focus">False</property>
-                                                            <property name="label" translatable="yes">Flight 
time</property>
+                                                            <property name="tooltip" 
translatable="yes">Flight time</property>
+                                                            <property name="label" 
translatable="yes">TF</property>
                                                             </widget>
                                                             <packing>
                                                             <property name="expand">False</property>
@@ -20469,7 +20470,8 @@ Concentric</property>
                                                             <widget class="GtkLabel" id="label565">
                                                             <property name="visible">True</property>
                                                             <property name="can_focus">False</property>
-                                                            <property name="label" 
translatable="yes">Contact time</property>
+                                                            <property name="tooltip" 
translatable="yes">Contact time</property>
+                                                            <property name="label" 
translatable="yes">TC</property>
                                                             </widget>
                                                             <packing>
                                                             <property name="expand">False</property>
@@ -24846,6 +24848,9 @@ Concentric</property>
                                                             <child>
                                                             <placeholder/>
                                                             </child>
+                                                            <child>
+                                                            <placeholder/>
+                                                            </child>
                                                             </widget>
                                                             <packing>
                                                             <property name="expand">False</property>
@@ -27711,18 +27716,6 @@ Concentric</property>
                                                             <property name="can_focus">False</property>
                                                             <property name="spacing">6</property>
                                                             <child>
-                                                            <widget class="GtkLabel" 
id="label_video_encoder_tests_will_be_filmed">
-                                                            <property name="can_focus">False</property>
-                                                            <property name="label" translatable="yes">Tests 
will be filmed</property>
-                                                            </widget>
-                                                            <packing>
-                                                            <property name="expand">False</property>
-                                                            <property name="fill">False</property>
-                                                            <property name="pack_type">end</property>
-                                                            <property name="position">0</property>
-                                                            </packing>
-                                                            </child>
-                                                            <child>
                                                             <widget class="GtkHBox" 
id="hbox_video_encoder_capturing">
                                                             <property name="can_focus">False</property>
                                                             <property name="spacing">4</property>
@@ -27759,6 +27752,18 @@ Concentric</property>
                                                             </packing>
                                                             </child>
                                                             <child>
+                                                            <widget class="GtkLabel" 
id="label_video_encoder_tests_will_be_filmed">
+                                                            <property name="can_focus">False</property>
+                                                            <property name="label" translatable="yes">Tests 
will be filmed</property>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="pack_type">end</property>
+                                                            <property name="position">0</property>
+                                                            </packing>
+                                                            </child>
+                                                            <child>
                                                             <widget class="GtkHBox" 
id="hbox_video_encoder_no_capturing">
                                                             <property name="visible">True</property>
                                                             <property name="can_focus">False</property>
@@ -35766,6 +35771,9 @@ then click this button.</property>
                                                             <child>
                                                             <placeholder/>
                                                             </child>
+                                                            <child>
+                                                            <placeholder/>
+                                                            </child>
                                                             </widget>
                                                             <packing>
                                                             <property name="expand">False</property>
diff --git a/po/POTFILES.in b/po/POTFILES.in
index ab2421a0..2b5d30a4 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -78,6 +78,8 @@ src/gui/app1/session/export.cs
 src/gui/app1/session/loadAndImport.cs
 src/gui/app1/session/main.cs
 src/gui/app1/shortcuts.cs
+src/gui/cairo/jumpsWeightFVProfile.cs
+src/gui/cairo/xy.cs
 src/gui/chronopic.cs
 src/gui/chronopicRegister.cs
 src/gui/confirm.cs
diff --git a/src/gui/cairo/jumpsDjOptimalFall.cs b/src/gui/cairo/jumpsDjOptimalFall.cs
index c02f1d7c..5055bcc7 100644
--- a/src/gui/cairo/jumpsDjOptimalFall.cs
+++ b/src/gui/cairo/jumpsDjOptimalFall.cs
@@ -37,7 +37,7 @@ public class JumpsDjOptimalFallGraph : CairoXY
 
                g.SetFontSize(16);
                printText(area.Allocation.Width /2, area.Allocation.Height /2, 24, textHeight,
-                               string.Format("Need to execute jumps: {0}.", jumpType), g, true);
+                               needToExecuteJumpsStr + " " + jumpType + ".", g, true);
 
                endGraph();
        }
@@ -61,8 +61,8 @@ public class JumpsDjOptimalFallGraph : CairoXY
                this.jumpType = jumpType;
                this.date = date;
 
-               xVariable = "Fall";
-               yVariable = "Height";
+               xVariable = fallStr;
+               yVariable = heightStr;
                xUnits = "cm";
                yUnits = "cm";
        }
@@ -106,8 +106,8 @@ public class JumpsDjOptimalFallGraph : CairoXY
                int ypos = -6;
 
                writeTextAtRight(ypos++, title, true);
-               writeTextAtRight(ypos++, "Optimal fall height", false);
-               writeTextAtRight(ypos++, "Jumptype: " + jumpType, false);
+               writeTextAtRight(ypos++, optimalFallHeightStr, false);
+               writeTextAtRight(ypos++, jumpTypeStr + " " + jumpType, false);
                writeTextAtRight(ypos++, date, false);
        }
 
diff --git a/src/gui/cairo/jumpsEvolution.cs b/src/gui/cairo/jumpsEvolution.cs
index b94f88a2..74b2fa7a 100644
--- a/src/gui/cairo/jumpsEvolution.cs
+++ b/src/gui/cairo/jumpsEvolution.cs
@@ -36,7 +36,7 @@ public class JumpsEvolutionGraph : CairoXY
 
                g.SetFontSize(16);
                printText(area.Allocation.Width /2, area.Allocation.Height /2, 24, textHeight,
-                               string.Format("Need to execute jumps: {0}.", jumpType), g, true);
+                               needToExecuteJumpsStr + " " + jumpType + ".", g, true);
 
                endGraph();
        }
@@ -54,8 +54,8 @@ public class JumpsEvolutionGraph : CairoXY
                this.jumpType = jumpType;
                this.date = date;
 
-               xVariable = "Date";
-               yVariable = "Height";
+               xVariable = dateStr;
+               yVariable = heightStr;
                xUnits = "";
                yUnits = "cm";
        }
@@ -149,7 +149,7 @@ public class JumpsEvolutionGraph : CairoXY
                int ypos = -6;
 
                writeTextAtRight(ypos++, title, true);
-               writeTextAtRight(ypos++, "Jumptype: " + jumpType, false);
+               writeTextAtRight(ypos++, jumpTypeStr + " " + jumpType, false);
                writeTextAtRight(ypos++, date, false);
        }
 
diff --git a/src/gui/cairo/jumpsRjFatigue.cs b/src/gui/cairo/jumpsRjFatigue.cs
index 2e896557..f3034814 100644
--- a/src/gui/cairo/jumpsRjFatigue.cs
+++ b/src/gui/cairo/jumpsRjFatigue.cs
@@ -52,14 +52,14 @@ public class JumpsRjFatigueGraph : CairoXY
                this.jumpType = jumpType;
                this.date = date;
 
-               xVariable = "Count";
+               xVariable = countStr;
                xUnits = "";
 
                if(heights) {
-                       yVariable = "Height";
+                       yVariable = heightStr;
                        yUnits = "cm";
                } else {
-                       yVariable = "TF/TC";
+                       yVariable = tfStr + "/" + tcStr;
                        yUnits = "";
                }
        }
@@ -98,7 +98,7 @@ public class JumpsRjFatigueGraph : CairoXY
                int ypos = -6;
 
                writeTextAtRight(ypos++, title, true);
-               writeTextAtRight(ypos++, "Jumptype: " + jumpType, false);
+               writeTextAtRight(ypos++, jumpTypeStr + " " + jumpType, false);
                writeTextAtRight(ypos++, date, false);
        }
 
diff --git a/src/gui/cairo/jumpsWeightFVProfile.cs b/src/gui/cairo/jumpsWeightFVProfile.cs
index cfe203eb..c3dc40dc 100644
--- a/src/gui/cairo/jumpsWeightFVProfile.cs
+++ b/src/gui/cairo/jumpsWeightFVProfile.cs
@@ -23,6 +23,7 @@ using System;
 using System.Collections.Generic; //List
 using Gtk;
 using Cairo;
+using Mono.Unix;
 
 
 public class JumpsWeightFVProfileGraph : CairoXY
@@ -77,8 +78,8 @@ public class JumpsWeightFVProfileGraph : CairoXY
                if(showFullGraph)
                        innerMargins = 0;
 
-               xVariable = "Speed";
-               yVariable = "Force";
+               xVariable = speedStr;
+               yVariable = forceStr;
                xUnits = "m/s";
                yUnits = "N/Kg";
 
@@ -103,19 +104,19 @@ public class JumpsWeightFVProfileGraph : CairoXY
        {
                string message = "";
                if(errorMessage == ErrorAtStart.NEEDLEGPARAMS)
-                       message = "Need to fill person's leg parameters.";
+                       message = Catalog.GetString("Need to fill person's leg parameters.");
                else if(errorMessage == ErrorAtStart.BADLEGPARAMS)
-                       message = "Person's leg parameters are incorrect.";
+                       message = Catalog.GetString("Person's leg parameters are incorrect.");
                else if(errorMessage == ErrorAtStart.NEEDJUMPS)
-                       message = "Need to execute jumps SJl and/or SJ.";
+                       message = Catalog.GetString("Need to execute jumps SJl and/or SJ.");
                else if(errorMessage == ErrorAtStart.NEEDJUMPSX)
-                       message = "Need to execute jumps with different weights.";
+                       message = Catalog.GetString("Need to execute jumps with different weights.");
                else if(errorMessage == ErrorAtStart.F0ANDV0NOTPOSITIVE)
-                       message = "F0 and V0 are not > 0.";
+                       message = Catalog.GetString("F0 and V0 are not > 0.");
                else if(errorMessage == ErrorAtStart.F0NOTPOSITIVE)
-                       message = "F0 is not > 0.";
+                       message = Catalog.GetString("F0 is not > 0.");
                else if(errorMessage == ErrorAtStart.V0NOTPOSITIVE)
-                       message = "V0 is not > 0.";
+                       message = Catalog.GetString("V0 is not > 0.");
 
                g.SetFontSize(16);
                printText(area.Allocation.Width /2, area.Allocation.Height /2, 24, textHeight, message, g, 
true);
@@ -182,9 +183,9 @@ public class JumpsWeightFVProfileGraph : CairoXY
 
                g.Color = red;
                if(needDevelopForce)
-                       writeTextAtRight(ypos++, "- Need to develop force", false);
+                       writeTextAtRight(ypos++, "- " + Catalog.GetString("Need to develop force"), false);
                else
-                       writeTextAtRight(ypos++, "- Need to develop speed", false);
+                       writeTextAtRight(ypos++, "- " + Catalog.GetString("Need to develop speed"), false);
                g.SetSourceRGB(0, 0, 0);
        }
 
@@ -211,8 +212,8 @@ public class JumpsWeightFVProfileGraph : CairoXY
                double heightCm = (double) l_keydouble[0].D;
                double extraWeight = (double) l_keydouble[1].D;
 
-               writeTextAtRight(line + lineVertSpacing, string.Format("- Height: {0} cm", 
Util.TrimDecimals(heightCm, 2)), false);
-               writeTextAtRight(line + 2*lineVertSpacing, string.Format("- Extra weight: {0} Kg", 
Util.TrimDecimals(extraWeight, 2)), false);
+               writeTextAtRight(line + lineVertSpacing, "- " + heightStr + string.Format(" : {0} cm", 
Util.TrimDecimals(heightCm, 2)), false);
+               writeTextAtRight(line + 2*lineVertSpacing, "- " + extraWeightStr + string.Format(" : {0} Kg", 
Util.TrimDecimals(extraWeight, 2)), false);
                writeTextAtRight(line + 3*lineVertSpacing, string.Format("- {0}: {1} {2}", xVariable, 
Util.TrimDecimals(pClosest.X, 2), xUnits), false);
                writeTextAtRight(line + 4*lineVertSpacing, string.Format("- {0}: {1} {2}", yVariable, 
Util.TrimDecimals(pClosest.Y, 2), yUnits), false);
        }
diff --git a/src/gui/cairo/xy.cs b/src/gui/cairo/xy.cs
index 32fd3979..49230831 100644
--- a/src/gui/cairo/xy.cs
+++ b/src/gui/cairo/xy.cs
@@ -23,6 +23,7 @@ using System;
 using System.Collections.Generic; //List
 using Gtk;
 using Cairo;
+using Mono.Unix;
 
 public abstract class CairoXY
 {
@@ -80,6 +81,22 @@ public abstract class CairoXY
        private int crossMargins = 10; //cross slope line with margins will have this length
        int totalMargins;
 
+       //translated strings
+       //done to use Catalog just only on gui/cairo/xy.cs
+       //but jumpsWeightFVProfile has many messages, so done also there
+       protected string needToExecuteJumpsStr = Catalog.GetString("Need to execute jumps:");
+       protected string optimalFallHeightStr = Catalog.GetString("Optimal fall height");
+       protected string heightStr = Catalog.GetString("Height");
+       protected string extraWeightStr = Catalog.GetString("Extra weight");
+       protected string fallStr = Catalog.GetString("Fall");
+       protected string speedStr = Catalog.GetString("Speed");
+       protected string forceStr = Catalog.GetString("Force");
+       protected string dateStr = Catalog.GetString("Date");
+       protected string tfStr = Catalog.GetString("TF");
+       protected string tcStr = Catalog.GetString("TC");
+       protected string countStr = Catalog.GetString("Count");
+       protected string jumpTypeStr = Catalog.GetString("Jump type:");
+
        public abstract void Do();
 
        protected void initGraph()
@@ -432,21 +449,21 @@ public abstract class CairoXY
 
        protected void writeTextPredictedPoint()
        {
-               writeTextAtRight(0, "Fall: " + Util.TrimDecimals(xAtMMaxY, 2) + " cm", false);
-               writeTextAtRight(1, "Jump height: " + Util.TrimDecimals(yAtMMaxY, 2) + " cm", false);
+               writeTextAtRight(0, fallStr + ": " + Util.TrimDecimals(xAtMMaxY, 2) + " cm", false);
+               writeTextAtRight(1, heightStr + ": " + Util.TrimDecimals(yAtMMaxY, 2) + " cm", false);
        }
 
        protected void writeTextConcaveParabole()
        {
-               writeTextAtRight(0, "Error:", false);
-               writeTextAtRight(1, "Parabole is concave", false);
+               writeTextAtRight(0, Catalog.GetString("Error") + ":", false);
+               writeTextAtRight(1, Catalog.GetString("Parabole is concave"), false);
        }
 
        protected void writeTextNeed3PointsWithDifferentFall()
        {
-               writeTextAtRight(0, "Error:", false);
-               writeTextAtRight(1, "Need at least 3 points", false);
-               writeTextAtRight(2, "with different falling heights", false);
+               writeTextAtRight(0, Catalog.GetString("Error") + ":", false);
+               writeTextAtRight(1, Catalog.GetString("Need at least 3 points"), false);
+               writeTextAtRight(2, Catalog.GetString("with different falling heights"), false);
        }
 
        protected void writeTextAtRight(double line, string text, bool bold)
@@ -534,7 +551,7 @@ public abstract class CairoXY
        protected virtual void writeSelectedValues(int line, PointF pClosest)
        {
                g.Color = bluePlots;
-               writeTextAtRight(line, "Selected:", false);
+               writeTextAtRight(line, Catalog.GetString("Selected") + ":", false);
                g.SetSourceRGB(0, 0, 0);
 
                writeTextAtRight(line +1, string.Format("- {0}: {1} {2}", xVariable, 
Util.TrimDecimals(pClosest.X, 2), xUnits), false);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]