]> SALOME platform Git repositories - modules/kernel.git/commitdiff
Salome HOME
0023375: [CEA] Add command line option to force application's language
authorvsr <vsr@opencascade.com>
Tue, 25 Oct 2016 12:02:36 +0000 (15:02 +0300)
committervsr <vsr@opencascade.com>
Tue, 25 Oct 2016 12:03:52 +0000 (15:03 +0300)
bin/launchConfigureParser.py
bin/runSalome.py

index cd81d3cb47079813fb82e81c710825a54a1958e1..57c492797c978a1bb50f293b790b5fdb32688f70 100755 (executable)
@@ -60,6 +60,7 @@ pinter_nam     = "pinter"
 batch_nam      = "batch"
 test_nam       = "test"
 play_nam       = "play"
+lang_nam       = "language"
 gdb_session_nam = "gdb_session"
 ddd_session_nam = "ddd_session"
 valgrind_session_nam = "valgrind_session"
@@ -330,7 +331,7 @@ class xml_parser:
         # either "launch" or module name -- set section_name
         if self.space == [doc_tag, sec_tag] and nam_att in attrs.getNames():
             section_name = attrs.getValue( nam_att )
-            if section_name == lanch_nam:
+            if section_name in [lanch_nam, lang_nam]:
                 self.section = section_name # launch section
             elif self.opts.has_key( modules_nam ) and \
                  section_name in self.opts[ modules_nam ]:
@@ -793,6 +794,14 @@ def CreateOptionParser (theAdditionalOptions=None, exeName=None):
                              dest="use_port",
                                    help=help_str)
 
+    help_str  = "Force application language. By default, a language specified in "
+    help_str += "the user's preferences is used."
+    o_lang = optparse.Option("-a",
+                             "--language",
+                             action="store",
+                             dest="language",
+                             help=help_str)
+
     # All options
     opt_list = [o_t,o_g, # GUI/Terminal
                 o_d,o_o, # Desktop
@@ -822,6 +831,7 @@ def CreateOptionParser (theAdditionalOptions=None, exeName=None):
                 o_wake_up,
                 o_slm,   # Server launch mode
                 o_port,  # Use port
+                o_lang,  # Language
                 ]
 
     #std_options = ["gui", "desktop", "log_file", "resources",
@@ -1197,6 +1207,13 @@ def get_env(theAdditionalOptions=None, appname=salomeappname, cfgname=salomecfgn
             sys.exit(1)
         args[useport_nam] = cmd_opts.use_port
 
+    if cmd_opts.language is not None:
+        langs = args["language_languages"] if "language_languages" in args else []
+        if cmd_opts.language not in langs:
+            print "Error: unsupported language: %s" % cmd_opts.language
+            sys.exit(1)
+        args[lang_nam] = cmd_opts.language
+
     # return arguments
     os.environ[config_var] = os.pathsep.join(dirs)
     #print "Args: ", args
index c8a092a3ab399416deb99d137b14ea0d5be0200c..29ea4e3d1ea1ca5d49aedd6e488396a5f8907621 100755 (executable)
@@ -280,6 +280,8 @@ class SessionServer(Server):
             list_modules.reverse()
             self.SCMD2+=['--modules (%s)' % ":".join(list_modules)]
             pass
+        if self.args.has_key('language'):
+            self.SCMD2+=['--language=%s' % self.args['language']]
         pass
 
     def setpath(self,modules_list,modules_root_dir):