* Bug #14929 fixed - setlanguage failed on main demos labels 16/19216/3
Samuel GOUGEON [Sat, 31 Dec 2016 13:06:51 +0000 (14:06 +0100)]
Change-Id: I9f0ade57889d7484c9b7bc20159a5000ad5ead9a

20 files changed:
scilab/modules/cacsd/demos/cacsd.dem.gateway.sce
scilab/modules/core/demos/core.dem.gateway.sce
scilab/modules/demo_tools/macros/demo_gui.sci
scilab/modules/demo_tools/tests/nonreg_tests/bug_14929.tst [new file with mode: 0644]
scilab/modules/differential_equations/demos/differential_equations.dem.gateway.sce
scilab/modules/dynamic_link/demos/dynamic_link.dem.gateway.sce
scilab/modules/graphics/demos/graphics.dem.gateway.sce
scilab/modules/gui/demos/gui.dem.gateway.sce
scilab/modules/hdf5/demos/hdf5.dem.gateway.sce
scilab/modules/optimization/demos/optimization.dem.gateway.sce
scilab/modules/parameters/demos/parameters.dem.gateway.sce
scilab/modules/polynomials/demos/polynomials.dem.gateway.sce
scilab/modules/randlib/demos/randlib.dem.gateway.sce
scilab/modules/signal_processing/demos/signal_processing.dem.gateway.sce
scilab/modules/sound/demos/sound.dem.gateway.sce
scilab/modules/spreadsheet/demos/spreadsheet.dem.gateway.sce
scilab/modules/tclsci/demos/tclsci.dem.gateway.sce
scilab/modules/umfpack/demos/umfpack.dem.gateway.sce
scilab/modules/xcos/demos/xcos.dem.gateway.sce
scilab/modules/xml/demos/xml.dem.gateway.sce

index e43acb6..e358960 100644 (file)
@@ -6,7 +6,8 @@
 
 function subdemolist = demo_gateway()
     demopath = get_absolute_file_path("cacsd.dem.gateway.sce");
-    add_demo(gettext("Control Systems - CACSD"), demopath + "cacsd.dem.gateway.sce");
+    _("Control Systems - CACSD");  // lets gettext() harvesting it
+    add_demo("Control Systems - CACSD", demopath + "cacsd.dem.gateway.sce");
 
     subdemolist = [_("LQG")                , "lqg/lqg.dem"
     _("Mixed-sensitivity")  , "mixed.dem"
index 823e846..b5c50fc 100644 (file)
@@ -6,7 +6,8 @@
 function subdemolist = demo_gateway()
 
     demopath = get_absolute_file_path("core.dem.gateway.sce");
-    add_demo(_("Introduction: Getting started with Scilab"), demopath + "core.dem.gateway.sce");
+    _("Introduction: Getting started with Scilab");  // lets gettext() harvesting it
+    add_demo("Introduction: Getting started with Scilab", demopath + "core.dem.gateway.sce");
 
     //subdemolist = [_("Getting started with Scilab")  ,"intro/intro.dem.sce"]
     subdemolist = [_("Scilab objects")                      ,"intro/scilab_objects.dem.sce"
index 701ba73..ac6e4f4 100644 (file)
@@ -33,6 +33,11 @@ function demo_gui()
         end
     end
 
+    // define a local demolist variable
+    tmp = demolist;
+    clear demolist   // The global one must stay in en_US
+    demolist = gettext(tmp);
+
     if get("scilab_demo_fig") <> [] then
         set("scilab_demo_fig", "visible", "on");
         return;
diff --git a/scilab/modules/demo_tools/tests/nonreg_tests/bug_14929.tst b/scilab/modules/demo_tools/tests/nonreg_tests/bug_14929.tst
new file mode 100644 (file)
index 0000000..b87a0f9
--- /dev/null
@@ -0,0 +1,51 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2017 - Samuel GOUGEON
+//
+//  This file is distributed under the same license as the Scilab package.
+// =============================================================================
+
+// <-- TEST WITH GRAPHIC -->
+// <-- INTERACTIVE TEST -->
+
+// <-- Non-regression test for bug 14929 -->
+//
+// <-- Bugzilla URL -->
+// http://bugzilla.scilab.org/14929
+//
+// <-- Short Description -->
+// When the default language is not en_US, setlanguage failed updating the main
+// demos labels in the demo GUI.
+
+
+// 1) launch scilab in normal mode but -- say -- in Russian (all supported
+//    languages except english):
+//    # scilab -l ru_RU
+//    or
+//    # wscilex -l ru_RU
+//    or in Scilab on MS Windows:
+setdefaultlanguage ru_RU
+exit
+      // restart Scilab
+// 2) Run the demo GUI:
+demo_gui
+// 3) Check that most of the MAIN labels (in the left column) are in Russian
+//   For instance, the "Signal processing"  entry should be labelled
+//   "Обработка сигналов" (7th row)
+// 4) Close the demo GUI
+// 5) Change the current language, for instance to french, of the current session
+setlanguage fr_FR
+// 6) Reopen the demo GUI:
+demo_gui
+// 7) The "Signal Processing" item must now be translated into
+//    "Traitement du signal" as the translation also exists:
+//--> gettext("Signal Processing")
+// ans  =
+// Traitement du signal
+//    Check it visually.
+//  Whether it is the case, the bug is FIXED. Otherwise it is still unfixed.
+// 8) Finally check that even going to english with setlanguage() is possible:
+//    * Close the demo GUI
+      setlanguage en_US
+      demo_gui
+//    If the bug is unfixed, even this will let items in the default Russian
index 9ac6b1b..64e6edd 100644 (file)
@@ -7,7 +7,8 @@
 function subdemolist = demo_gateway()
 
     demopath = get_absolute_file_path("differential_equations.dem.gateway.sce");
-    add_demo(gettext("Simulation"), demopath + "differential_equations.dem.gateway.sce");
+    _("Simulation");  // lets gettext() harvesting it
+    add_demo("Simulation", demopath + "differential_equations.dem.gateway.sce");
 
     subdemolist = [_("n-pendulum")         ,"n_pendulum/n_pendulum.dem.sce" ;
     _("Wheel simulation")   ,"wheel/wheel.dem.gateway.sce"   ;
index edd17c1..924b362 100644 (file)
@@ -7,7 +7,8 @@
 function subdemolist = demo_gateway()
 
     demopath = get_absolute_file_path("dynamic_link.dem.gateway.sce");
-    add_demo(_("Dynamic link"), demopath+"dynamic_link.dem.gateway.sce");
+    _("Dynamic link");  // lets gettext() harvesting it
+    add_demo("Dynamic link", demopath+"dynamic_link.dem.gateway.sce");
 
     subdemolist = [_("Call a C function")                   , "call_c.sce" ;
     _("Call a C function (using C standard library)")       , "call_c_stdlib.sce" ;
index 348b60d..c7cbc9f 100644 (file)
@@ -9,7 +9,8 @@
 function subdemolist = demo_gateway()
 
     demopath = get_absolute_file_path("graphics.dem.gateway.sce");
-    add_demo(gettext("Graphics"), demopath+"graphics.dem.gateway.sce");
+    _("Graphics");  // lets gettext() harvesting it
+    add_demo("Graphics", demopath+"graphics.dem.gateway.sce");
 
     subdemolist = [_("2D and 3D plots")             ,"2d_3d_plots/2d_3d_plots.dem.gateway.sce"             ; ..
     _("Basic functions")             ,"basic_functions/basic_functions.dem.gateway.sce"     ; ..
index 2f68c11..7224842 100644 (file)
@@ -9,7 +9,8 @@
 function subdemolist = demo_gateway()
 
     demopath = get_absolute_file_path("gui.dem.gateway.sce");
-    add_demo(gettext("GUI"), demopath + "gui.dem.gateway.sce");
+    _("GUI");  // lets gettext() harvesting it
+    add_demo("GUI", demopath + "gui.dem.gateway.sce");
 
     subdemolist = [_("Dialogs")   ,"dialogs/dialogs.dem.gateway.sce" ; ..
     _("Uicontrols 1") ,"uicontrol.dem.sce" ];
index 5e56d62..f1a2bf9 100644 (file)
@@ -7,7 +7,8 @@
 function subdemolist = demo_gateway()
 
     demopath = get_absolute_file_path("hdf5.dem.gateway.sce");
-    add_demo(gettext("HDF5"), demopath + "hdf5.dem.gateway.sce");
+    _("HDF5");  // lets gettext() harvesting it
+    add_demo("HDF5", demopath + "hdf5.dem.gateway.sce");
 
     subdemolist = [_("Ring resonator (HDF5 data source)")   ,"resonator.dem.sce" ]
 
index a9da31f..63067e7 100644 (file)
@@ -7,7 +7,8 @@
 function subdemolist = demo_gateway()
 
     demopath = get_absolute_file_path("optimization.dem.gateway.sce");
-    add_demo(gettext("Optimization and Simulation"), demopath+"optimization.dem.gateway.sce");
+    _("Optimization and Simulation");  // lets gettext() harvesting it
+    add_demo("Optimization and Simulation", demopath+"optimization.dem.gateway.sce");
 
     subdemolist = [_("Non linear data fitting"), "datafit/datafit.dem.gateway.sce"; ..
     _("Optimisation"),            "optim/optim.dem.gateway.sce"; ..
index 525c007..376ef3c 100644 (file)
@@ -6,7 +6,8 @@
 function subdemolist = demo_gateway()
 
     demopath = get_absolute_file_path("parameters.dem.gateway.sce");
-    add_demo(_("Parameters"), demopath + "parameters.dem.gateway.sce");
+    _("Parameters");  // lets gettext() harvesting it
+    add_demo("Parameters", demopath + "parameters.dem.gateway.sce");
 
     subdemolist = [_("plist handling")  ,"params_demo.sce"]
 
index a1a3fda..9fdd346 100644 (file)
@@ -7,7 +7,8 @@
 function subdemolist = demo_gateway()
 
     demopath = get_absolute_file_path("polynomials.dem.gateway.sce");
-    add_demo(gettext("Polynomials"),demopath+"polynomials.dem.gateway.sce");
+    gettext("Polynomials");   // Lets gettext() harvesting it
+    add_demo("Polynomials",demopath+"polynomials.dem.gateway.sce");
 
     subdemolist = [_("Introduction")             , "intro/poly.intro.dem.sce" ];
 
index d4c5305..c4e0f1f 100644 (file)
@@ -7,7 +7,8 @@
 function subdemolist = demo_gateway()
 
     demopath = get_absolute_file_path("randlib.dem.gateway.sce");
-    add_demo(_("Random"), demopath + "randlib.dem.gateway.sce");
+    gettext("Random");   // Lets gettext() harvesting it
+    add_demo("Random", demopath + "randlib.dem.gateway.sce");
 
     subdemolist = [_("binomial random variable")        ,"binomial.dem.sce"      ; ..
     _("discrete random variable")        ,"discrete.dem.sce"      ; ..
index 99c7cd1..d24a119 100644 (file)
@@ -7,7 +7,8 @@
 function subdemolist = demo_gateway()
 
     demopath = get_absolute_file_path("signal_processing.dem.gateway.sce");
-    add_demo(gettext("Signal Processing"), demopath + "signal_processing.dem.gateway.sce");
+    gettext("Signal Processing");   // Lets gettext() harvesting it
+    add_demo("Signal Processing", demopath + "signal_processing.dem.gateway.sce");
 
     subdemolist = [_("Spectral Estimation")               , "spect.dem.sce"
     _("IIR filter design")                 , "iir.dem.sce"
index 83185be..6b57ac1 100644 (file)
@@ -6,7 +6,8 @@
 function subdemolist = demo_gateway()
 
     demopath = get_absolute_file_path("sound.dem.gateway.sce");
-    add_demo(_("Sound file handling"), demopath + "sound.dem.gateway.sce");
+    gettext("Sound file handling");   // Lets gettext() harvesting it
+    add_demo("Sound file handling", demopath + "sound.dem.gateway.sce");
 
     subdemolist = [_("FFT on a wav file")  ,"sound.dem.sce"]
 
index 2d727fc..8098344 100644 (file)
@@ -6,7 +6,8 @@
 function subdemolist = demo_gateway()
 
     demopath = get_absolute_file_path("spreadsheet.dem.gateway.sce");
-    add_demo(_("Spreadsheet"), demopath + "spreadsheet.dem.gateway.sce");
+    gettext("Spreadsheet");   // Lets gettext() harvesting it
+    add_demo("Spreadsheet", demopath + "spreadsheet.dem.gateway.sce");
 
     subdemolist = [_("Read a xls file")  ,"spreadsheet.dem.sce"];
 
index 49f168c..c341d45 100644 (file)
@@ -7,7 +7,7 @@
 function subdemolist = demo_gateway()
 
     demopath = get_absolute_file_path("tclsci.dem.gateway.sce");
-    add_demo(gettext("Tcl/Tk"), demopath + "tclsci.dem.gateway.sce");
+    add_demo("Tcl/Tk", demopath + "tclsci.dem.gateway.sce");
 
     subdemolist = [_("Color")  ,"color.dem.sce"      ; ..
     _("Puzzle") ,"puzzle.dem.sce"     ; ..
index 58d5432..a839bbb 100644 (file)
@@ -9,7 +9,8 @@
 function subdemolist = demo_gateway()
 
     demopath = get_absolute_file_path("umfpack.dem.gateway.sce");
-    add_demo(gettext("UMFPACK"), demopath+"umfpack.dem.gateway.sce");
+    gettext("UMFPACK");   // Lets gettext() harvesting it
+    add_demo("UMFPACK", demopath+"umfpack.dem.gateway.sce");
 
     subdemolist = [_("Sparse Matrices"), "sparse_matrices.sce"
     _("Harwell-Boeing"), "harwell-boeing.sce"
index 7b05225..03dbb6b 100644 (file)
@@ -9,7 +9,7 @@
 function subdemolist = demo_gateway()
 
     demopath = get_absolute_file_path("xcos.dem.gateway.sce");
-    add_demo(gettext("Xcos"), demopath + "xcos.dem.gateway.sce");
+    add_demo("Xcos", demopath + "xcos.dem.gateway.sce");
 
     subdemolist = [
     _("Standard demos")      , "standard.dem.gateway.sce"           ; ..
index aeb12cd..e924188 100644 (file)
@@ -7,7 +7,7 @@
 function subdemolist = demo_gateway()
 
     demopath = get_absolute_file_path("xml.dem.gateway.sce");
-    add_demo(gettext("XML"), demopath + "xml.dem.gateway.sce");
+    add_demo("XML", demopath + "xml.dem.gateway.sce");
 
     subdemolist = [_("CML read")   ,"diazepam.dem.sce" ]