From d41da0baeff50d55c71b0ec92d8b1532daa89836 Mon Sep 17 00:00:00 2001 From: vsr Date: Tue, 25 Oct 2016 15:02:36 +0300 Subject: [PATCH] 0023375: [CEA] Add command line option to force application's language --- bin/launchConfigureParser.py | 19 ++++++++++++++++++- bin/runSalome.py | 2 ++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/bin/launchConfigureParser.py b/bin/launchConfigureParser.py index cd81d3cb4..57c492797 100755 --- a/bin/launchConfigureParser.py +++ b/bin/launchConfigureParser.py @@ -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 diff --git a/bin/runSalome.py b/bin/runSalome.py index c8a092a3a..29ea4e3d1 100755 --- a/bin/runSalome.py +++ b/bin/runSalome.py @@ -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): -- 2.39.2