summaryrefslogtreecommitdiff
path: root/l10ntools
diff options
context:
space:
mode:
authorKurt Zenker <kz@openoffice.org>2010-08-18 16:59:10 +0200
committerKurt Zenker <kz@openoffice.org>2010-08-18 16:59:10 +0200
commit38bf7f931e181e3cd9b8a1785c517f3a1f8d3512 (patch)
tree455e0934fda2ee283863d7276d3a3ae841482fc3 /l10ntools
parent2440f8452e59a1b9a6d138c66e723c82a4176d43 (diff)
parent62a8f17d4862b90bbbccde3b86157dd9bc930712 (diff)
CWS-TOOLING: integrate CWS txtl10n
Notes
split repo tag: libs-gui_ooo/OOO330_m5
Diffstat (limited to 'l10ntools')
-rw-r--r--l10ntools/inc/lngmerge.hxx2
-rw-r--r--l10ntools/prj/d.lst8
-rw-r--r--l10ntools/scripts/tool/const.py39
-rw-r--r--l10ntools/scripts/tool/l10ntool.py211
-rw-r--r--l10ntools/scripts/tool/pseudo.py184
-rw-r--r--l10ntools/scripts/tool/sdf.py165
-rw-r--r--l10ntools/scripts/tool/xhtex.py135
-rw-r--r--l10ntools/scripts/tool/xtxex.py93
-rwxr-xr-xl10ntools/scripts/xhtex39
-rwxr-xr-xl10ntools/scripts/xtxex39
-rw-r--r--l10ntools/source/cfglex.l17
-rw-r--r--l10ntools/source/cfgmerge.cxx15
-rw-r--r--l10ntools/source/export.cxx12
-rw-r--r--l10ntools/source/helpex.cxx8
-rw-r--r--l10ntools/source/helpmerge.cxx11
-rw-r--r--l10ntools/source/lngex.cxx20
-rw-r--r--l10ntools/source/lngmerge.cxx5
-rw-r--r--l10ntools/source/localize.cxx44
-rw-r--r--l10ntools/source/srclex.l6
-rw-r--r--l10ntools/source/xrmlex.l5
-rw-r--r--l10ntools/source/xrmmerge.cxx11
21 files changed, 932 insertions, 137 deletions
diff --git a/l10ntools/inc/lngmerge.hxx b/l10ntools/inc/lngmerge.hxx
index 923da89988b6..843d1a6de3d2 100644
--- a/l10ntools/inc/lngmerge.hxx
+++ b/l10ntools/inc/lngmerge.hxx
@@ -58,7 +58,7 @@ private:
const ByteString &rPrj ,
const ByteString &rRoot , const ByteString &sActFileName , const ByteString &sID );
public:
- LngParser( const ByteString &rLngFile, BOOL bUTF8, BOOL bULFFormat, bool bQuiet_in );
+ LngParser( const ByteString &rLngFile, BOOL bUTF8, BOOL bULFFormat );
~LngParser();
BOOL CreateSDF( const ByteString &rSDFFile, const ByteString &rPrj, const ByteString &rRoot );
diff --git a/l10ntools/prj/d.lst b/l10ntools/prj/d.lst
index 0b6a43444613..53c846832fca 100644
--- a/l10ntools/prj/d.lst
+++ b/l10ntools/prj/d.lst
@@ -47,6 +47,14 @@ mkdir: %_DEST%\bin%_EXT%\help\com\sun\star\help
..\scripts\localize %_DEST%\bin%_EXT%\localize
..\scripts\fast_merge.pl %_DEST%\bin%_EXT%\fast_merge.pl
..\scripts\keyidGen.pl %_DEST%\bin%_EXT%\keyidGen.pl
+..\scripts\tool\const.py %_DEST%\bin%_EXT%\const.py
+..\scripts\tool\l10ntool.py %_DEST%\bin%_EXT%\l10ntool.py
+..\scripts\tool\xtxex.py %_DEST%\bin%_EXT%\xtxex.py
+..\scripts\tool\sdf.py %_DEST%\bin%_EXT%\sdf.py
+..\scripts\tool\xhtex.py %_DEST%\bin%_EXT%\xhtex.py
+..\scripts\tool\pseudo.py %_DEST%\bin%_EXT%\pseudo.py
+..\scripts\xtxex %_DEST%\bin%_EXT%\xtxex
+..\scripts\xhtex %_DEST%\bin%_EXT%\xhtex
..\inc\export.hxx %_DEST%\inc%_EXT%\l10ntools\export.hxx
..\inc\l10ntools\directory.hxx %_DEST%\inc%_EXT%\l10ntools\directory.hxx
diff --git a/l10ntools/scripts/tool/const.py b/l10ntools/scripts/tool/const.py
new file mode 100644
index 000000000000..2d514eabdab6
--- /dev/null
+++ b/l10ntools/scripts/tool/const.py
@@ -0,0 +1,39 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+# Pseudo const
+class _const:
+ class ConstError(TypeError): pass
+ def __setattr__(self, name, value):
+ if self.__dict__.has_key(name):
+ raise self.ConstError, "Can't rebind const(%s)"%name
+ self.__dict__[name] = value
+
+import sys
+sys.modules[__name__] = _const()
+
+
diff --git a/l10ntools/scripts/tool/l10ntool.py b/l10ntools/scripts/tool/l10ntool.py
new file mode 100644
index 000000000000..70d88674f07b
--- /dev/null
+++ b/l10ntools/scripts/tool/l10ntool.py
@@ -0,0 +1,211 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+from optparse import OptionParser
+from sdf import SdfData
+from pseudo import PseudoSet
+
+import sys
+import os
+import shutil
+
+class AbstractL10nTool:
+ _options = {}
+ _args = ""
+ _resource_type = ""
+ _source_language = "en-US"
+
+ ##### Implement these abstract methods
+
+ ##### Nameing scheme for the output files
+ def get_outputfile_format_str(self):
+ # filename,fileNoExt,language,extension,pathPrefix,pathPostFix,path
+ #return "{path}/{fileNoExt}_{language}.{extension}"
+ return self._options.pattern
+
+ ################################# Merge single files ###########################################
+
+ ##### Merge a single file
+ def merge_file(self, inputfilename, outputfilename, parsed_file_ref, lang, is_forced_lang, sdfdata):
+ pass
+
+ ##### Helper for parse-once-use-often like parsing a xml file is needed implement it here
+ def parse_file(self, filename):
+ return None
+
+ ################### Merge one big file containing all strings in all languages #################
+ def merge_one_big_file(self, inputfile, outputfilename, parsed_file_ref, lang, sdfdata):
+ pass
+
+ ################### Extract a single File ######################################################
+ def extract_file(self, inputfile):
+ pass
+
+ ################################################################################################
+
+ def format_outputfile(self, filename, language):
+ extension = filename[filename.rfind('.')+1:]
+ file = filename[:filename.rfind('.')]
+
+ # Python 2.3.x friendly
+ return self.get_outputfile_format_str().replace('[', '%(').replace(']',')s') % \
+ { 'filename': filename, 'fileNoExt': file, 'language': language, 'extension': extension, 'path_prefix': self._options.path_prefix,
+ 'path_postfix': self._options.path_postfix, 'path': self.get_path() }
+
+ #return self.get_outputfile_format_str().replace('[', '{').replace(']','}').format(
+ # filename=filename, fileNoExt=file, language=language, extension=extension, path_prefix=self._options.path_prefix,
+ # path_postfix=self._options.path_postfix, path=self.get_path())
+
+ def get_path(self):
+ if self._options.outputfile.find('/') == -1:
+ return ""
+ else:
+ return self._options.outputfile[:self._options.outputfile.rfind('/')]
+
+ def merge(self, sdfdata):
+ langset,forcedset, foundset = PseudoSet(), PseudoSet() , PseudoSet()
+
+ if self._options.languages:
+ langset = PseudoSet(self._options.languages)
+ if self._options.forcedlanguages:
+ forcedset = PseudoSet(self._options.forcedlanguages)
+ if sdfdata.get_languages_found_in_sdf():
+ foundset = sdfdata.get_languages_found_in_sdf()
+
+ if self.has_multi_inputfiles():
+ filelist = self.read_inputfile_list()
+ else:
+ filelist = self._options.inputfile
+
+ for inputfile in filelist:
+ ref = self.parse_file(inputfile)
+ # Don't write that files if there is no l10n present
+ if ((langset & foundset) - forcedset): # all langs given and found in sdf without enforced
+ [self.merge_file(inputfile,self.format_outputfile(inputfile, lang), ref, lang, False, sdfdata) for lang in ((langset & foundset) - forcedset)]
+ # Always write those files even if there is no l10n available
+ if forcedset: # all enforced langs
+ [self.merge_file(inputfile, self.format_outputfile(inputfile, lang), ref, lang, True, sdfdata) for lang in forcedset]
+ # In case a big file have to be written
+ if ((langset & foundset) | forcedset): # all langs given ,found in sdf and enforced ones
+ self.merge_one_big_file(inputfile, self.format_outputfile(inputfile, lang), ref, ((langset & foundset) | forcedset), sdfdata)
+
+ def has_multi_inputfiles(self):
+ return self._options.inputfile[0] == '@'
+
+ def copy_file(self, inputfilename, outputfilename):
+ try:
+ shutil.copy(inputfilename, outputfilename)
+ except IOError:
+ print "ERROR: Can not copy file '" + inputfilename + "' to " + "'" + outputfilename + "'"
+ sys.exit(-1)
+
+ def extract(self):
+ try:
+ f = open(self._options.outputfile, "w+")
+ f.write(self.extract_file(self._options.inputfile))
+ except IOError:
+ print "ERROR: Can not write file " + self._options.outputfile
+ else:
+ f.close()
+
+ # Parse the common options
+ def parse_options(self):
+ parser = OptionParser()
+ parser.add_option("-i", "--inputfile", dest="inputfile", metavar="FILE", help="resource file to read" )
+ parser.add_option("-o", "--outputfile", dest="outputfile", metavar="FILE", help="extracted sdf or merged file" )
+ parser.add_option("-m", "--inputsdffile", dest="input_sdf_file", metavar="FILE", help="merge this sdf file" )
+ parser.add_option("-x", "--pathprefix", dest="path_prefix", metavar="PATH", help="" )
+ parser.add_option("-y", "--pathpostfix", dest="path_postfix", metavar="PATH", help="" )
+ parser.add_option("-p", "--projectname", dest="project_name", metavar="NAME", help="" )
+ parser.add_option("-r", "--projectroot", dest="project_root", metavar="PATH", help="" )
+ parser.add_option("-f", "--forcedlanguages", dest="forcedlanguages", metavar="ISOCODE[,ISOCODE]", help="Always merge those langs even if no l10n is available for those langs" )
+ parser.add_option("-l", "--languages", dest="languages", metavar="ISOCODE[,ISOCODE]", help="Merge those langs if l10n is found for each")
+ parser.add_option("-s", "--pattern", dest="pattern", metavar="", help="" )
+ parser.add_option("-q", "--quiet", action="store_true", dest="quietmode", help="",default=False)
+ (self._options, self.args) = parser.parse_args()
+
+ # -l "de,pr,pt-BR" => [ "de" , "pt" , "pt-BR" ]
+ parse_complex_arg = lambda arg: arg.split(",")
+
+ if self._options.forcedlanguages:
+ self._options.forcedlanguages = parse_complex_arg(self._options.forcedlanguages)
+ if self._options.languages:
+ self._options.languages = parse_complex_arg(self._options.languages)
+ self.test_options()
+
+ def __init__(self):
+ self.parse_options()
+ if self._options.input_sdf_file != None and len(self._options.input_sdf_file):
+ sdfdata = SdfData(self._options.input_sdf_file)
+ sdfdata.read()
+ self.merge(sdfdata)
+ else:
+ self.extract()
+
+ def make_dirs(self, filename):
+ dir = filename[:filename.rfind('/')]
+ if os.path.exists(dir):
+ if os.path.isfile(dir):
+ print "ERROR: There is a file '"+dir+"' where I want create a directory"
+ sys.exit(-1)
+ else:
+ return
+ else:
+ try:
+ os.makedirs(dir)
+ except IOError:
+ print "Error: Can not create dir " + dir
+ sys.exit(-1)
+
+ def test_options(self):
+ opt = self._options
+ is_valid = lambda x: x != None and len(x) > 0
+ return is_valid(opt.project_root) and is_valid(opt.project_name) and is_valid(opt.languages) and \
+ ( is_valid(opt.inputfile) and (( is_valid(opt.path_prefix) and is_valid(opt.path_postfix) ) or is_valid(opt.outputfile)) and \
+ ( ( is_valid(opt.input_sdf_file) and ( is_valid(opt.outputfile) or ( is_valid(opt.path_prefix) and is_valid(opt.path_postfix) ) or \
+ ( is_valid(opt.inputfile) and is_valid(opt.outputFile)) ))))
+ print "Strange options ..."
+ sys.exit( -1 )
+
+ def read_inputfile_list(self):
+ if self.has_multi_inputfiles():
+ lines = []
+ try:
+ f = open(self._options.inputfile[1:], "r")
+ lines = [line.strip('\n') for line in f.readlines()]
+ except IOError:
+ print "ERROR: Can not read file list " + self._options.inputfile[2:]
+ sys.exit(-1)
+ else:
+ f.close()
+ return lines
+
+ def get_filename_string(self, inputfile):
+ absfile = os.path.realpath(os.path.abspath(inputfile))
+ absroot = os.path.realpath(os.path.abspath(self._options.project_root))
+ return absfile[len(absroot)+1:].replace('/','\\')
+
diff --git a/l10ntools/scripts/tool/pseudo.py b/l10ntools/scripts/tool/pseudo.py
new file mode 100644
index 000000000000..0956325e31db
--- /dev/null
+++ b/l10ntools/scripts/tool/pseudo.py
@@ -0,0 +1,184 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+# to support macosx baseline machines from Cretaceous period
+
+# incomplete set() class implementation of Python 2.4
+class PseudoSet:
+ _list = []
+
+ def __str__(self):
+ return str(self._list)
+
+ def __init__(self, newlist=[]):
+ self._list = self._remove_dupes(newlist)
+
+ def __or__(self, other):
+ tmplist = []
+ if self._list != None and other != None:
+ tmplist.extend(self._list)
+ tmplist.extend(other)
+ return PseudoSet(self._remove_dupes(tmplist))
+ else:
+ print "__or__(None)"
+
+ def __sub__(self,other):
+ tmplist = []
+ if self._list != None and other != None:
+ tmplist.extend(self._list)
+ [tmplist.remove(key) for key in other if key in tmplist]
+ else:
+ print "__sub__(none)"
+ return PseudoSet(tmplist)
+
+ def __and__(self, other):
+ tmplist = []
+ if other != None and self._list != None:
+ [tmplist.append(key) for key in self._list if key in other]
+ return PseudoSet(tmplist)
+ else:
+ print "__and__(None)"
+
+ def __iter__(self):
+ return self._list.__iter__()
+
+ def __items__(self):
+ return self._list.items()
+
+ def __keys__(self):
+ return keys(self._list)
+
+ def _remove_dupes(self, list):
+ tmpdict = {}
+ for key in list:
+ tmpdict[key] = 1
+ return tmpdict.keys()
+
+# incomplete OrderedDict() class implementation
+class PseudoOrderedDict(dict):
+ _keylist = []
+ _valuelist = []
+
+ def __init__(self, defaults={}):
+ dict.__init__(self)
+ for n,v in defaults.items():
+ self[n] = v
+
+ def __setitem__(self, key, value):
+ self._keylist.append(key)
+ self._valuelist.append(value)
+ return dict.__setitem__(self, key, value)
+
+ def __delattr__(self, key):
+ self._keylist.__delattr__(key)
+ self._valuelist.__delattr__(dict[key])
+ return dict.__delattr__(self, key)
+
+ def __delitem__(self, key):
+ self._keylist.__delitem__(key)
+ self._valuelist.__delitem__(dict[key])
+ return dict.__delitem__(self, key)
+
+ def __iter__(self):
+ raise NotImplementedError("__iter__")
+
+ def __iterkeys__(self):
+ return self._keylist
+
+ def iteritems(self):
+ #return self._valuelist
+ return zip(self._keylist, self._valuelist)
+
+ def items(self):
+ return zip(self._keylist,self._valuelist)
+
+ def __keys__(self):
+ return self._keylist
+
+ def keys(self):
+ return self._keylist
+
+ def __keysattr__(self):
+ return self._keylist
+
+ def pop(self, key):
+ self._keylist.pop(key)
+ self._valuelist.pop(key)
+ return dict.__pop__(self, key)
+
+ def popitem(self):
+ raise NotImplementedError("popitem")
+
+def _testdriver_set():
+ list, list1 = [] ,[]
+ list.append("a")
+ list.append("b")
+ list.append("c")
+
+ list1.append("a")
+ list1.append("b")
+ list1.append("d")
+ list1.append("e")
+ list1.append("e")
+
+ if "a" in list:
+ print "YEAH!"
+
+ a = PseudoSet(list)
+ b = PseudoSet(list1)
+
+ print "a="+str(a)
+ print "b="+str(b)
+ print "a|b=" + str(a|b)
+ print "a="+str(a)
+ print "b="+str(b)
+ print "a&b=" + str(a&b)
+ print "a="+str(a)
+ print "b="+str(b)
+ print "a-b" + str(a-b)
+
+ for key in a:
+ print key
+
+def _testdriver_dict():
+ d = PseudoOrderedDict()
+ d["a"] = 1
+ d["b"] = 2
+ d["c"] = 3
+ d["d"] = 4
+ d["e"] = 5
+ d["f"] = 6
+
+ print "a="+str(d["a"])
+ print "e="+str(d["e"])
+ for key,value in d.iteritems():
+ print "d["+key+"]="+str(d[key])
+ print "key="+str(key)+" value="+str(value)
+
+ print "keys="+str(d.keys())
+
+#_testdriver_dict()
diff --git a/l10ntools/scripts/tool/sdf.py b/l10ntools/scripts/tool/sdf.py
new file mode 100644
index 000000000000..2afcbaf4bb1f
--- /dev/null
+++ b/l10ntools/scripts/tool/sdf.py
@@ -0,0 +1,165 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+from pseudo import PseudoSet,PseudoOrderedDict
+
+class SdfData:
+ _filename = "";
+ _dict = PseudoOrderedDict()
+ _languages_found = [];
+
+ def __init__ (self, filename=""):
+ self._filename = filename
+
+ def __getitem__(self, key):
+ if self._dict.has_key(key):
+ return self._dict[key]
+ else:
+ return None
+
+ def has_key(self, key):
+ return self._dict.has_key(key)
+
+ def __setitem__(self, key, value):
+ self._dict[key] = value
+
+ def get_languages_found_in_sdf(self):
+ return PseudoSet(self._languages_found)
+
+ def read(self):
+ try:
+ f = open(self._filename, "r")
+ lines = [line.rstrip('\n') for line in f.readlines()]
+ except IOError:
+ print "ERROR: Trying to read "+ self._filename
+ raise
+ else:
+ f.close()
+ for line in lines:
+ entity = SdfEntity()
+ entity.set_properties(line)
+ self._dict[entity.get_id()] = entity
+ self._languages_found.append(entity.langid)
+
+ def write(self, filename):
+ try:
+ f = open(filename, "w+")
+ for value in self._dict.itervalues():
+ #f.write( repr(value)+"\n" )
+ f.write(value + "\n")
+ except IOError:
+ print "ERROR: Trying to write " + filename
+ raise
+ else:
+ f.close()
+
+import sys
+class SdfEntity:
+ # Sdf format columns
+ project = ""
+ source_file = ""
+ dummy1 = ""
+ resource_type = ""
+ gid = ""
+ lid = ""
+ helpid = ""
+ platform = ""
+ dummy2 = ""
+ langid = ""
+ text = ""
+ helptext = ""
+ quickhelptext = ""
+ title = ""
+ date = ""
+
+ import const
+ const._PROJECT_POS = 0
+ const._SOURCE_FILE_POS = 1
+ const._DUMMY1_POS = 2
+ const._RESOURCE_TYPE_POS = 3
+ const._GID_POS = 4
+ const._LID_POS = 5
+ const._HELPID_POS = 6
+ const._PLATFORM_POS = 7
+ const._DUMMY2_POS = 8
+ const._LANGID_POS = 9
+ const._TEXT_POS = 10
+ const._HELPTEXT_POS = 11
+ const._QUICKHELPTEXT_POS = 12
+ const._TITLE_POS = 13
+ const._DATE_POS = 14
+
+ def __init__(self, project="", source_file="", dummy1="", resource_type="", gid="", lid="", helpid="", platform="", dummy2="", langid="",
+ text="", helptext="", quickhelptext="", title="", date="2002-02-02 02:02:02"):
+ self.project = project;
+ self.source_file = source_file;
+ self.dummy1 = dummy1;
+ self.resource_type = resource_type;
+ self.gid = gid;
+ self.lid = lid;
+ self.helpid = helpid;
+ self.platform = platform;
+ self.dummy2 = dummy2;
+ self.langid = langid;
+ self.text = text;
+ self.helptext = helptext;
+ self.quickhelptext = quickhelptext;
+ self.title = title;
+ self.date = date;
+
+ def set_properties(self, line):
+ splitted = line.split("\t")
+ if len(splitted) == 15:
+ self.project = splitted[ self.const._PROJECT_POS ]
+ self.source_file = splitted[ self.const._SOURCE_FILE_POS ]
+ self.dummy1 = splitted[ self.const._DUMMY1_POS ]
+ self.resource_type = splitted[ self.const._RESOURCE_TYPE_POS ]
+ self.gid = splitted[ self.const._GID_POS ]
+ self.lid = splitted[ self.const._LID_POS ]
+ self.helpid = splitted[ self.const._HELPID_POS ]
+ self.platform = splitted[ self.const._PLATFORM_POS ]
+ self.dummy2 = splitted[ self.const._DUMMY2_POS ]
+ self.langid = splitted[ self.const._LANGID_POS ]
+ self.text = splitted[ self.const._TEXT_POS ]
+ self.helptext = splitted[ self.const._HELPTEXT_POS ]
+ self.quickhelptext = splitted[ self.const._QUICKHELPTEXT_POS ]
+ self.title = splitted[ self.const._TITLE_POS ]
+ self.date = splitted[ self.const._DATE_POS ]
+
+ def get_file_id(self):
+ return self.project + "\\" + self.source_file
+
+ def get_resource_path(self):
+ return self.source_file[0:self.source_file.rfind( "\\" )-1]
+
+ def __str__(self):
+ return ''.join([self.project, "\t", self.source_file, "\t", self.dummy1, "\t", self.resource_type, "\t" ,
+ self.gid, "\t", self.lid, "\t", self.helpid, "\t", self.platform, "\t", self.dummy2, "\t" , self.langid,
+ "\t", self.text, "\t", self.helptext, "\t", self.quickhelptext, "\t" , self.title, "\t", self.date ])
+
+ def get_id(self):
+ return ''.join([self.project, self.gid, self.lid, self.source_file, self.resource_type, self.platform, self.helpid, self.langid])
diff --git a/l10ntools/scripts/tool/xhtex.py b/l10ntools/scripts/tool/xhtex.py
new file mode 100644
index 000000000000..c427a7feccdd
--- /dev/null
+++ b/l10ntools/scripts/tool/xhtex.py
@@ -0,0 +1,135 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+from l10ntool import AbstractL10nTool
+from sdf import SdfEntity
+import sys
+import xml.dom.minidom
+
+class Xhtex(AbstractL10nTool):
+ _resource_type = "xht"
+ _sdfdata = ()
+ _lang = ""
+
+ # Extract methods
+ def extract_topic(self, list, inputfile):
+ topics = []
+ for elem in list:
+ if elem.childNodes[0].nodeType == elem.TEXT_NODE and len(elem.childNodes[0].data.strip()):
+ topics.append(self.prepare_sdf_line(id=elem.getAttribute("id").strip(), text=elem.childNodes[0].data, inputfile=inputfile))
+ return topics
+
+ def extract_title(self, list, inputfile):
+ titles = []
+ for elem in list:
+ if len(elem.getAttribute("title").strip()):
+ titles.append(self.prepare_sdf_line(id=elem.getAttribute("id").strip(), text=elem.getAttribute("title").strip(), inputfile=inputfile))
+ return titles
+
+ # Merge methods
+ def merge_topic(self, list, sdfdata, lang, inputfilename, dom):
+ for elem in list:
+ if elem.childNodes[0].nodeType == elem.TEXT_NODE and elem.getAttribute("id").strip():
+ obj = self.prepare_sdf_line(inputfile=inputfilename, lang=lang, id=elem.getAttribute("id").strip())
+ if sdfdata[obj.get_id()]:
+ elem.childNodes[0].data = str(sdfdata[obj.get_id()].text)
+
+ def merge_title(self, list, sdfdata, lang, inputfilename):
+ for elem in list:
+ obj = self.prepare_sdf_line(inputfile=inputfilename, lang=lang, id=elem.getAttribute("id").strip())
+ if elem.getAttribute("id").strip() and sdfdata[obj.get_id()]:
+ elem.setAttribute("title", str(sdfdata[obj.get_id()].text))
+
+ # L10N tool
+ def __init__(self):
+ AbstractL10nTool.__init__(self)
+
+ def parse_file(self, filename):
+ document = ""
+ try:
+ f = open(filename, "r+")
+ document = f.read()
+ except IOError:
+ print "ERROR: Can not read file " + filename
+ sys.exit(-1)
+ else:
+ f.close()
+ return xml.dom.minidom.parseString(document)
+
+
+ def merge_file(self, inputfilename, outputfilename, parsed_file_ref, lang,is_forced_lang, sdfdata):
+ if lang == "en-US":
+ mod_outputfilename = outputfilename.replace("_en-US",'')
+ self.make_dirs(mod_outputfilename)
+ self.copy_file(inputfilename, mod_outputfilename)
+ return
+ dom = parsed_file_ref.cloneNode(True)
+ #dom = self.parse_file(inputfilename) # in case cloneNode is buggy just parse it always
+
+ self.merge_topic(dom.getElementsByTagName("topic"), sdfdata, lang, inputfilename, dom)
+ self.merge_title(dom.getElementsByTagName("node"), sdfdata, lang, inputfilename)
+ self.merge_title(dom.getElementsByTagName("help_section"), sdfdata, lang, inputfilename)
+ self.make_dirs(outputfilename)
+ try:
+ f = open(outputfilename, "w+")
+ str = dom.toxml()
+ f.write(str)
+ except IOError:
+ print "ERROR: Can not write file " + outputfilename
+ sys.exit(-1)
+ else:
+ f.close()
+
+ ##### Helper for parse-once-use-often like parsing a xml file is needed implement it here
+ def parse_file(self, filename):
+ document = ""
+ try:
+ f = open(filename,"r+")
+ document = f.read()
+ except IOError:
+ print "ERROR: Can not read file " + filename
+ else:
+ f.close()
+ return xml.dom.minidom.parseString(document)
+
+ ##### Extract a single File
+ def extract_file(self, inputfile):
+ sdf_data = []
+ dom = self.parse_file(inputfile)
+ sdf_data.extend(self.extract_topic(dom.getElementsByTagName("topic"), inputfile))
+ sdf_data.extend(self.extract_title(dom.getElementsByTagName("help_section"), inputfile))
+ sdf_data.extend(self.extract_title(dom.getElementsByTagName("node"), inputfile))
+ return ''.join([str(line)+"\n" for line in sdf_data])
+
+ def prepare_sdf_line(self, inputfile="", lang="" , id="" , text=""):
+ if lang == "":
+ lang = self._source_language
+ return SdfEntity(project=self._options.project_name, source_file=self.get_filename_string(inputfile),
+ resource_type=self._resource_type, gid=id, lid="", langid=lang,text=text)
+
+run = Xhtex()
+
diff --git a/l10ntools/scripts/tool/xtxex.py b/l10ntools/scripts/tool/xtxex.py
new file mode 100644
index 000000000000..2c5f132530a6
--- /dev/null
+++ b/l10ntools/scripts/tool/xtxex.py
@@ -0,0 +1,93 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+from l10ntool import AbstractL10nTool
+from sdf import SdfEntity
+import sys
+import shutil
+
+class Xtxex(AbstractL10nTool):
+ _resource_type = "xtx"
+
+ def __init__(self):
+ AbstractL10nTool.__init__(self)
+
+ def merge_file(self, inputfilename, outputfilename, parsed_file_ref, lang, is_forced_lang, sdfdata):
+ # Special handling for en-US files
+ if lang == "en-US":
+ mod_outputfilename = outputfilename.replace("_en-US",'')
+ self.copy_file(inputfilename, mod_outputfilename)
+ return
+ # merge usual lang
+ sdfline = self.prepare_sdf_line(inputfilename,lang)
+ if sdfdata.has_key(sdfline.get_id()):
+ line = sdfdata[sdfline.get_id()].text.replace("\\n", '\n')
+ self.make_dirs(outputfilename)
+ try:
+ f = open(outputfilename, "w+")
+ f.write(line)
+ except IOError:
+ print "ERROR: Can not write file " + outputfilename
+ sys.exit(-1)
+ else:
+ f.close()
+ return
+ # no sdf data found then copy en-US source file
+ if is_forced_lang:
+ self.copy_file(inputfilename, outputfilename)
+
+ ##### Extract a single File
+ def extract_file(self, inputfile):
+ lines = []
+ try:
+ f = open(inputfile, "r")
+ lines = f.readlines()
+ except IOError:
+ print "ERROR: Can not open file " + inputfile
+ sys.exit(-1)
+ else:
+ f.close()
+ # remove legal header
+ lines = [line for line in lines if len(line) > 0 and not line[0] == '#']
+ # escape all returns
+ lines = [line.replace('\n', "\\n") for line in lines]
+ line = ''.join(lines)
+ test = str(line)
+ if len(test.strip()):
+ sdf_entity = self.prepare_sdf_line(inputfile);
+ sdf_entity.text = line
+ return str(sdf_entity)
+ else:
+ return ""
+
+ def prepare_sdf_line(self, inputfile="", lang=""):
+ if lang == "":
+ lang = self._source_language
+ return SdfEntity(project=self._options.project_name, source_file=self.get_filename_string(inputfile),
+ resource_type=self._resource_type, gid="none", lid="none", langid=lang,text="")
+
+run = Xtxex()
diff --git a/l10ntools/scripts/xhtex b/l10ntools/scripts/xhtex
new file mode 100755
index 000000000000..659cd06e16d4
--- /dev/null
+++ b/l10ntools/scripts/xhtex
@@ -0,0 +1,39 @@
+#!/bin/sh
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+if [ x${SOLARENV}x = xx ]; then
+ echo No environment found, please use 'setsolar'
+exit 1
+fi
+
+if [ x${SOLARVER}x = xx -o x${UPDMINOREXT}x = xx ]; then
+ exec python $SOLARVERSION/$INPATH/bin/xhtex.py "$@"
+else
+ exec python $SOLARVERSION/$INPATH/bin$UPDMINOREXT/xhtex.py "$@"
+fi
+
diff --git a/l10ntools/scripts/xtxex b/l10ntools/scripts/xtxex
new file mode 100755
index 000000000000..28529506e3a2
--- /dev/null
+++ b/l10ntools/scripts/xtxex
@@ -0,0 +1,39 @@
+#!/bin/sh
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+if [ x${SOLARENV}x = xx ]; then
+ echo No environment found, please use 'setsolar'
+exit 1
+fi
+
+if [ x${SOLARVER}x = xx -o x${UPDMINOREXT}x = xx ]; then
+ exec python $SOLARVERSION/$INPATH/bin/xtxex.py "$@"
+else
+ exec python $SOLARVERSION/$INPATH/bin$UPDMINOREXT/xtxex.py "$@"
+fi
+
diff --git a/l10ntools/source/cfglex.l b/l10ntools/source/cfglex.l
index cc92632620be..3fc3aa5b965c 100644
--- a/l10ntools/source/cfglex.l
+++ b/l10ntools/source/cfglex.l
@@ -169,10 +169,6 @@ main( int argc, char* argv[])
FILE *pFile;
pOutput = GetOutputFile( argc, argv );
- if( !isQuiet() ){
- fprintf( stdout, "\nCfgEx 0.9 Copyright 2000, 2010 Oracle and/or its affiliates. All Rights Reserved.\n" );
- fprintf( stdout, "===================================================================================\n" );
- }
if ( !pOutput ) {
fprintf( stdout, "Syntax: CFGEX[-p Prj][-r PrjRoot]-i FileIn [-o FileOut][-m DataBase][-e][-b][-u][-f][-d DoneFile][-g[:dtd] ][-L l1,l2,...]\n" );
@@ -181,7 +177,6 @@ main( int argc, char* argv[])
fprintf( stdout, " FileIn: Source files (*.src)\n" );
fprintf( stdout, " FileOut: Destination file (*.*)\n" );
fprintf( stdout, " DataBase: Mergedata (*.sdf)\n" );
- fprintf( stdout, " -QQ: quiet output\n" );
fprintf( stdout, " -e: Disable writing errorlog\n" );
fprintf( stdout, " -b: Break when Token \"HelpText\" found in source\n" );
fprintf( stdout, " -u: [english] and [german] are allowed, Id is Taken from DataBase \n" );
@@ -213,20 +208,10 @@ main( int argc, char* argv[])
nRetValue = GetError();
EndCfgExport();
- if( !isQuiet() ){
- fprintf( stdout, "\n===================================\n\n" );
- }
removeTempFile();
/* return error level */
return nRetValue;
}
-/*"<!--"[^"-->"]*"-->" {
- bText = 0;
- WorkOnTokenSet( COMMEND, yytext );
-}*/
-/*"<!"[^\-].*\> {
- bText = 0;
- WorkOnTokenSet( CFG_TAG, yytext );
-}*/
+
diff --git a/l10ntools/source/cfgmerge.cxx b/l10ntools/source/cfgmerge.cxx
index 170c2922d9ce..e8feee1fe3c8 100644
--- a/l10ntools/source/cfgmerge.cxx
+++ b/l10ntools/source/cfgmerge.cxx
@@ -59,7 +59,6 @@ BOOL bMergeMode;
BOOL bErrorLog;
BOOL bForce;
BOOL bUTF8;
-bool bQuiet;
ByteString sPrj;
ByteString sPrjRoot;
ByteString sInputFileName;
@@ -83,7 +82,6 @@ extern char *GetOutputFile( int argc, char* argv[])
bErrorLog = TRUE;
bForce = FALSE;
bUTF8 = TRUE;
- bQuiet = false;
sPrj = "";
sPrjRoot = "";
sInputFileName = "";
@@ -128,9 +126,6 @@ extern char *GetOutputFile( int argc, char* argv[])
nState = STATE_FORCE;
bForce = TRUE;
}
- else if ( sSwitch == "-QQ" ) {
- bQuiet = true;
- }
else if ( sSwitch == "-L" ) {
nState = STATE_LANGUAGES;
}
@@ -184,10 +179,6 @@ extern char *GetOutputFile( int argc, char* argv[])
// command line is not valid
return NULL;
}
-int isQuiet(){
- if( bQuiet ) return 1;
- else return 0;
-}
/*****************************************************************************/
int InitCfgExport( char *pOutput , char* pFilename )
/*****************************************************************************/
@@ -247,7 +238,7 @@ extern FILE *GetCfgFile()
if ( !pFile ){
fprintf( stderr, "Error: Could not open file %s\n",
sInputFileName.GetBuffer());
- exit( 13 );
+ exit( -13 );
}
else {
// this is a valid file which can be opened, so
@@ -264,8 +255,6 @@ extern FILE *GetCfgFile()
// printf("sFullEntry = %s\n",sFullEntry.GetBuffer());
sActFileName = sFullEntry.Copy( sPrjEntry.Len() + 1 );
// printf("sActFileName = %s\n",sActFileName.GetBuffer());
- if( !bQuiet )
- fprintf( stdout, "\nProcessing File %s ...\n", sInputFileName.GetBuffer());
sActFileName.SearchAndReplaceAll( "/", "\\" );
@@ -615,7 +604,7 @@ CfgOutputParser::CfgOutputParser( const ByteString &rOutputFile )
Error( sError );
delete pOutputStream;
pOutputStream = NULL;
- exit( 13 );
+ exit( -13 );
}
}
diff --git a/l10ntools/source/export.cxx b/l10ntools/source/export.cxx
index 59f29525eda4..d6c7a9533309 100644
--- a/l10ntools/source/export.cxx
+++ b/l10ntools/source/export.cxx
@@ -62,7 +62,6 @@ BOOL bErrorLog;
BOOL bBreakWhenHelpText;
BOOL bUnmerge;
BOOL bUTF8;
-bool bQuiet;
ByteString sPrj;
ByteString sPrjRoot;
ByteString sActFileName;
@@ -98,7 +97,6 @@ extern char *GetOutputFile( int argc, char* argv[])
Export::sForcedLanguages = "";
sTempFile = "";
pTempFile = NULL;
- bQuiet = false;
USHORT nState = STATE_NON;
BOOL bInput = FALSE;
@@ -115,9 +113,6 @@ extern char *GetOutputFile( int argc, char* argv[])
else if (sSwitch == "-p" || sSwitch == "-P" ) {
nState = STATE_PRJ; // next token specifies the cur. project
}
- else if (sSwitch == "-qq" || sSwitch == "-QQ" ) {
- bQuiet = true;
- }
else if (sSwitch == "-r" || sSwitch == "-R" ) {
nState = STATE_ROOT; // next token specifies path to project root
@@ -196,12 +191,6 @@ extern char *GetOutputFile( int argc, char* argv[])
return NULL;
}
/*****************************************************************************/
-int isQuiet(){
-/*****************************************************************************/
- if( bQuiet ) return 1;
- else return 0;
-}
-/*****************************************************************************/
int InitExport( char *pOutput , char* pFilename )
/*****************************************************************************/
{
@@ -282,7 +271,6 @@ extern FILE *GetNextFile()
// (e.g.: source\ui\src\menue.src)
sActFileName = sFullEntry.Copy( sPrjEntry.Len() + 1 );
- if( !bQuiet ) fprintf( stdout, "\nProcessing File %s ...\n", sOrigFile.GetBuffer());
sActFileName.SearchAndReplaceAll( "/", "\\" );
sFile = sActFileName;
diff --git a/l10ntools/source/helpex.cxx b/l10ntools/source/helpex.cxx
index 49a59266a85d..15239db5d9bd 100644
--- a/l10ntools/source/helpex.cxx
+++ b/l10ntools/source/helpex.cxx
@@ -61,7 +61,6 @@ ByteString sOutputFile;
ByteString sOutputFileX;
ByteString sOutputFileY;
ByteString sSDFFile;
-bool bQuiet;
/*****************************************************************************/
BOOL ParseCommandLine( int argc, char* argv[])
@@ -73,7 +72,6 @@ BOOL ParseCommandLine( int argc, char* argv[])
bUTF8 = TRUE;
sPrj = "";
sPrjRoot = "";
- bQuiet = false;
Export::sLanguages = "";
Export::sForcedLanguages = "";
@@ -111,9 +109,6 @@ BOOL ParseCommandLine( int argc, char* argv[])
nState = STATE_ERRORLOG;
bErrorLog = FALSE;
}
- else if ( ByteString( argv[ i ] ).ToUpperAscii() == "-QQ" ) {
- bQuiet = true;
- }
else if ( ByteString( argv[ i ]).ToUpperAscii() == "-UTF8" ) {
nState = STATE_UTF8;
bUTF8 = TRUE;
@@ -188,13 +183,12 @@ BOOL ParseCommandLine( int argc, char* argv[])
void Help()
/*****************************************************************************/
{
- fprintf( stdout, "Syntax: HELPEX[-p Prj][-r PrjRoot]-i FileIn ( -o FileOut | -x path -y relfile )[-m DataBase][-e][-b][-u][-L l1,l2,...][-QQ] -LF l1,l2 \n" );
+ fprintf( stdout, "Syntax: HELPEX[-p Prj][-r PrjRoot]-i FileIn ( -o FileOut | -x path -y relfile )[-m DataBase][-e][-b][-u][-L l1,l2,...] -LF l1,l2 \n" );
fprintf( stdout, " Prj: Project\n" );
fprintf( stdout, " PrjRoot: Path to project root (..\\.. etc.)\n" );
fprintf( stdout, " FileIn: Source file (*.lng)\n" );
fprintf( stdout, " FileOut: Destination file (*.*)\n" );
fprintf( stdout, " DataBase: Mergedata (*.sdf)\n" );
- fprintf( stdout, " -QQ: quiet output\n" );
fprintf( stdout, " -L: Restrict the handled languages. l1,l2,... are elements of (en-US,fr,de...)\n" );
fprintf( stdout, " A fallback language can be defined like this: l1=f1.\n" );
fprintf( stdout, " f1, f2,... are also elements of (en-US,fr,de...)\n" );
diff --git a/l10ntools/source/helpmerge.cxx b/l10ntools/source/helpmerge.cxx
index 0ab7e6eb5c2e..15cb1e311002 100644
--- a/l10ntools/source/helpmerge.cxx
+++ b/l10ntools/source/helpmerge.cxx
@@ -181,17 +181,6 @@ bool HelpParser::CreateSDF(
ByteString sActFileName = makeAbsolutePath( sHelpFile , rRoot_in );
-/* DirEntry aEntry( String( sHelpFile, RTL_TEXTENCODING_ASCII_US ));
- aEntry.ToAbs();
- String sFullEntry = aEntry.GetFull();
- aEntry += DirEntry( String( "..", RTL_TEXTENCODING_ASCII_US ));
- aEntry += DirEntry( rRoot_in );
- ByteString sPrjEntry( aEntry.GetFull(), gsl_getSystemTextEncoding());
- ByteString sActFileName(
- sFullEntry.Copy( sPrjEntry.Len() + 1 ), gsl_getSystemTextEncoding());
-
- sActFileName.SearchAndReplaceAll( "/", "\\" );
-*/
XMLHashMap* aXMLStrHM = file->GetStrings();
LangHashMap* pElem;
XMLElement* pXMLElement = NULL;
diff --git a/l10ntools/source/lngex.cxx b/l10ntools/source/lngex.cxx
index c593b85d4932..4ec069a810f5 100644
--- a/l10ntools/source/lngex.cxx
+++ b/l10ntools/source/lngex.cxx
@@ -53,7 +53,6 @@ BOOL bMergeMode;
BOOL bErrorLog;
BOOL bUTF8;
BOOL bULF; // ULF = Unicode Language File
-bool bQuiet;
ByteString sPrj;
ByteString sPrjRoot;
ByteString sOutputFile;
@@ -68,7 +67,6 @@ BOOL ParseCommandLine( int argc, char* argv[])
bErrorLog = TRUE;
bUTF8 = TRUE;
bULF = FALSE;
- bQuiet = false;
sPrj = "";
sPrjRoot = "";
Export::sLanguages = "";
@@ -92,9 +90,6 @@ BOOL ParseCommandLine( int argc, char* argv[])
else if ( sSwitch == "-R" ) {
nState = STATE_ROOT; // next token specifies path to project root
}
- else if ( sSwitch == "-QQ" ) {
- bQuiet = true;
- }
else if ( sSwitch == "-M" ) {
nState = STATE_MERGESRC; // next token specifies the merge database
}
@@ -170,16 +165,12 @@ BOOL ParseCommandLine( int argc, char* argv[])
void Help()
/*****************************************************************************/
{
- //fprintf( stdout, "Syntax:ULFEX[-p Prj][-r PrjRoot]-i FileIn -o FileOut[-m DataBase][-e][-b][-u][-NOUTF8][-ULF][-L l1,l2,...]\n" );
fprintf( stdout, "Syntax:ULFEX[-p Prj][-r PrjRoot]-i FileIn -o FileOut[-m DataBase][-L l1,l2,...]\n" );
fprintf( stdout, " Prj: Project\n" );
fprintf( stdout, " PrjRoot: Path to project root (..\\.. etc.)\n" );
fprintf( stdout, " FileIn: Source file (*.lng)\n" );
fprintf( stdout, " FileOut: Destination file (*.*)\n" );
fprintf( stdout, " DataBase: Mergedata (*.sdf)\n" );
- fprintf( stdout, " -QQ: quite output\n" );
- //fprintf( stdout, " -NOUTF8: disable UTF8 as language independent encoding\n" );
- //fprintf( stdout, " -ULF: enables Unicode Language File format, leads to UTF8 encoded version of lng files" );
fprintf( stdout, " -L: Restrict the handled languages. l1,l2,... are elements of (de,en-US...)\n" );
fprintf( stdout, " A fallback language can be defined like this: l1=f1.\n" );
fprintf( stdout, " f1, f2,... are also elements of (de,en-US...)\n" );
@@ -199,25 +190,16 @@ int _cdecl main( int argc, char *argv[] )
Help();
return 1;
}
- if( !bQuiet ){
- fprintf( stdout, "\nUlfEx 1 Copyright 2000, 2010 Oracle and/or its affiliates. All Rights Reserved.\n" );
- fprintf( stdout, "=================================================================================\n" );
- fprintf( stdout, "\nProcessing File %s ...\n", sInputFile.GetBuffer());
- }else
- {
fprintf(stdout, ".");
fflush( stdout );
- }
if ( sOutputFile.Len()) {
- LngParser aParser( sInputFile, bUTF8, bULF , bQuiet );
+ LngParser aParser( sInputFile, bUTF8, bULF );
if ( bMergeMode )
aParser.Merge( sMergeSrc, sOutputFile , sPrj );
else
aParser.CreateSDF( sOutputFile, sPrj, sPrjRoot );
}
- if( !bQuiet ) fprintf( stdout, "\n=================================================\n\n" );
-
return 0;
}
diff --git a/l10ntools/source/lngmerge.cxx b/l10ntools/source/lngmerge.cxx
index 5f40a4346f53..f0093bbccea7 100644
--- a/l10ntools/source/lngmerge.cxx
+++ b/l10ntools/source/lngmerge.cxx
@@ -38,15 +38,14 @@ using namespace std;
// class LngParser
//
/*****************************************************************************/
-LngParser::LngParser( const ByteString &rLngFile, BOOL bUTF8, BOOL bULFFormat , bool bQuiet_in )
+LngParser::LngParser( const ByteString &rLngFile, BOOL bUTF8, BOOL bULFFormat )
/*****************************************************************************/
:
nError( LNG_OK ),
pLines( NULL ),
sSource( rLngFile ),
bDBIsUTF8( bUTF8 ),
- bULF( bULFFormat ),
- bQuiet( bQuiet_in )
+ bULF( bULFFormat )
{
pLines = new LngLineList( 100, 100 );
DirEntry aEntry( String( sSource, RTL_TEXTENCODING_ASCII_US ));
diff --git a/l10ntools/source/localize.cxx b/l10ntools/source/localize.cxx
index 6cecb0972cb7..bbc27dc229e7 100644
--- a/l10ntools/source/localize.cxx
+++ b/l10ntools/source/localize.cxx
@@ -53,10 +53,8 @@ namespace transex3
const char *ExeTable[][5] = {
{ "src", "transex3", " -UTF8 -e", "negative", "noiso" },
{ "hrc", "transex3", " -UTF8 -e", "positive", "noiso" },
- //{ "src", "transex3", "-UTF8 -e", "negative", "noiso" },
- //{ "hrc", "transex3", "-UTF8 -e", "positive", "noiso" },
-
- //{ "lng", "lngex", "-UTF8 -e", "negative", "noiso" },
+ { "tree", "xhtex", "", "negative", "noiso" },
+ { "xtx", "xtxex", "", "negative", "noiso" },
{ "ulf", "ulfex", " -e", "negative", "noiso" },
{ "xrb", "xmlex", "-UTF8 -e", "negative", "iso" },
{ "xxl", "xmlex", "-UTF8 -e", "negative", "iso" },
@@ -136,7 +134,6 @@ private:
ByteString sLanguageRestriction;
ByteString sOutputFile;
- bool bQuiet2;
int nFileCnt;
@@ -169,7 +166,7 @@ private:
);
public:
- SourceTreeLocalizer( const ByteString &rRoot, const ByteString &rVersion , bool bLocal , bool bQuiet2_in , bool skip_links );
+ SourceTreeLocalizer( const ByteString &rRoot, const ByteString &rVersion , bool bLocal , bool skip_links );
~SourceTreeLocalizer();
ByteString getSourceLanguages( ByteString sLanguageRestriction , ByteString sCommand );
@@ -185,11 +182,10 @@ public:
/*****************************************************************************/
SourceTreeLocalizer::SourceTreeLocalizer(
- const ByteString &rRoot, const ByteString &rVersion, bool bLocal_in , bool bQuiet2_in , bool skip_links )
+ const ByteString &rRoot, const ByteString &rVersion, bool bLocal_in , bool skip_links )
/*****************************************************************************/
: SourceTreeIterator( rRoot, rVersion , bLocal_in ),
nMode( LOCALIZE_NONE ),
- bQuiet2( bQuiet2_in ),
nFileCnt( 0 )
{
bSkipLinks = skip_links ;
@@ -325,9 +321,6 @@ void SourceTreeLocalizer::WorkOnFile(
sCommand += getSourceLanguages( sLanguageRestriction , sCommand );
}
- if( bQuiet2 ){
- sCommand +=" -QQ ";
- }
//printf("DBG: %s\n",sCommand.GetBuffer());
if (system(sCommand.GetBuffer()) == -1)
fprintf(stderr, "%s failed\n", sCommand.GetBuffer());
@@ -487,7 +480,6 @@ void SourceTreeLocalizer::OnExecuteDirectory( const rtl::OUString &aDirectory )
{
ByteString rDirectory( rtl::OUStringToOString( aDirectory , RTL_TEXTENCODING_UTF8 , aDirectory.getLength() ) ) ;
if ( nMode == LOCALIZE_NONE ){
- if( !bQuiet2 ) fprintf( stdout, "%s\n", rDirectory.GetBuffer());
}
else
WorkOnDirectory( rDirectory );
@@ -543,7 +535,6 @@ BOOL SourceTreeLocalizer::MergeSingleFile(
ByteString sFile( aEntry.GetFull(), RTL_TEXTENCODING_ASCII_US );
ByteString sBCur( aEntry.GetFull(), RTL_TEXTENCODING_ASCII_US );
- if( !bQuiet2 ) fprintf( stdout, "##### %s #####\n", sBCur.GetBuffer());
ULONG nIndex = 0;
ByteString sExtension( aEntry.GetExtension(), RTL_TEXTENCODING_ASCII_US );
@@ -591,9 +582,6 @@ BOOL SourceTreeLocalizer::MergeSingleFile(
sCommand += " -l ";
sCommand += sLanguageRestriction;
}
- if( bQuiet2 ){
- sCommand +=" -QQ ";
- }
DirEntry aPath( aEntry.GetPath());
DirEntry aOldCWD;
@@ -603,7 +591,6 @@ BOOL SourceTreeLocalizer::MergeSingleFile(
fprintf(stderr, "%s failed\n", sCommand.GetBuffer());
nFileCnt++;
printf(".");
- //if( bQuiet2 ){ printf("."); }
SvFileStream aInStream( aOut.GetFull(), STREAM_READ );
if ( !aInStream.IsOpen()) {
fprintf( stderr,
@@ -794,12 +781,11 @@ void Help()
fprintf( stdout,
"As part of the L10N framework, localize extracts and merges translations\n"
"out of and into the whole source tree.\n\n"
- "Syntax: localize -e -l en-US -f FileName [-QQ]\n"
+ "Syntax: localize -e -l en-US -f FileName \n"
"Parameter:\n"
"\t-e: Extract mode\n"
"\tFileName: Output file when extract mode, input file when merge mode\n"
"\tl1...ln: supported languages (\"all\" for all languages).\n"
- "\tQQ: quiet output)"
);
fprintf( stdout,
@@ -842,15 +828,12 @@ int _cdecl main( int argc, char *argv[] )
BOOL bExport = FALSE;
BOOL bMerge = FALSE;
- bool bQuiet = false;
- bool bQuiet2 = false;
bool bSkipLinks = false;
ByteString sLanguages;
ByteString sFileName;
ByteString sOutput;
- bQuiet2 = true;
bExport = TRUE;
for( int i = 1; i < argc; i++ ) {
@@ -863,17 +846,12 @@ int _cdecl main( int argc, char *argv[] )
return Error();
bExport = TRUE;
}
- else if( sSwitch.Equals( "-Q" )) {
- bQuiet = true;
- }
else if ( sSwitch.Equals( "-I" ) )
nState = STATE_ISOCODE;
else if ( sSwitch.Equals( "-L" ) )
nState = STATE_LANGUAGES;
else if ( sSwitch.Equals( "-F" ) )
nState = STATE_FILENAME;
- else if ( sSwitch.Equals( "-QQ" ))
- bQuiet2 = true;
else if ( ByteString( argv[ i ]).ToUpperAscii().Equals( "-O" ) )
nState = STATE_OUTPUT;
else {
@@ -956,10 +934,10 @@ int _cdecl main( int argc, char *argv[] )
else
curRepository = string( Export::GetEnv("SOURCE_ROOT_DIR") ) + "/" + *iter;
cout << "Localizing repository " << curRepository << "\n";
- SourceTreeLocalizer aIter( ByteString( curRepository.c_str() ) , sVersion , (sOutput.Len() > 0) , bQuiet2 , bSkipLinks );
+ SourceTreeLocalizer aIter( ByteString( curRepository.c_str() ) , sVersion , (sOutput.Len() > 0) , bSkipLinks );
aIter.SetLanguageRestriction( sLanguages );
if ( bExport ){
- if( bQuiet2 ){ /*printf("");*/fflush( stdout );}
+ fflush( stdout );
if( *iter == "ooo" )
aIter.Extract( sFileName );
else
@@ -969,7 +947,7 @@ int _cdecl main( int argc, char *argv[] )
sFileNameWithExt += ByteString( (*iter).c_str() );
aIter.Extract( sFileNameWithExt );
}
- if( bQuiet2 ){ printf("\n%d files found!\n",aIter.GetFileCnt());}
+ printf("\n%d files found!\n",aIter.GetFileCnt());
}
}
if( hasPwd )
@@ -977,12 +955,12 @@ int _cdecl main( int argc, char *argv[] )
string pwd;
Export::getCurrentDir( pwd );
cout << "Localizing repository " << pwd << "\n";
- SourceTreeLocalizer aIter( ByteString( pwd.c_str() ) , sVersion , (sOutput.Len() > 0) , bQuiet2 , bSkipLinks );
+ SourceTreeLocalizer aIter( ByteString( pwd.c_str() ) , sVersion , (sOutput.Len() > 0) , bSkipLinks );
aIter.SetLanguageRestriction( sLanguages );
if ( bExport ){
- if( bQuiet2 ){ /*printf("");*/fflush( stdout );}
+ fflush( stdout );
aIter.Extract( sFileName );
- if( bQuiet2 ){ printf("\n%d files found!\n",aIter.GetFileCnt());}
+ printf("\n%d files found!\n",aIter.GetFileCnt());
}
}
diff --git a/l10ntools/source/srclex.l b/l10ntools/source/srclex.l
index 473da8b5d511..eb2b6af78b34 100644
--- a/l10ntools/source/srclex.l
+++ b/l10ntools/source/srclex.l
@@ -259,10 +259,6 @@ main( int argc, char* argv[])
FILE *pFile;
pOutput = GetOutputFile( argc, argv );
- if( !isQuiet() ){
- fprintf( stdout, "\nTransEx 3.1 Copyright 2000, 2010 Oracle and/or its affiliates. All Rights Reserved.\n" );
- fprintf( stdout, "=====================================================================================\n" );
- }
if ( !pOutput ) {
fprintf( stdout, "Syntax:TRANSEX[-p Prj][-r PrjRoot]-i FileIn...[-o FileOut][-m DataBase][-e][-b][-u][-L l1,l2,...]\n" );
@@ -301,8 +297,6 @@ main( int argc, char* argv[])
nRetValue = GetError();
EndExport();
- if( !isQuiet() ) fprintf( stdout, "\n===================================\n\n" );
-
/* return error level */
return nRetValue;
}
diff --git a/l10ntools/source/xrmlex.l b/l10ntools/source/xrmlex.l
index 4770a851c741..6229525d7e84 100644
--- a/l10ntools/source/xrmlex.l
+++ b/l10ntools/source/xrmlex.l
@@ -180,10 +180,6 @@ main( int argc, char* argv[])
FILE *pFile;
pOutput = GetOutputFile( argc, argv );
- if( !isQuiet() ){
- fprintf( stdout, "\nXrmEx 0.9 Copyright 2000, 2010 Oracle and/or its affiliates. All Rights Reserved.\n" );
- fprintf( stdout, "===================================================================================\n" );
- }
if ( !pOutput ) {
fprintf( stdout, "Syntax: XRMEX[-p Prj][-r PrjRoot]-i FileIn [-o FileOut][-m DataBase][-e][-b][-u][-NOUTF8][-L l1,l2,...]\n" );
@@ -222,7 +218,6 @@ main( int argc, char* argv[])
nRetValue = GetError();
EndXrmExport();
- if( !isQuiet() ) fprintf( stdout, "\n===================================\n\n" );
removeTempFile();
/* return error level */
return nRetValue;
diff --git a/l10ntools/source/xrmmerge.cxx b/l10ntools/source/xrmmerge.cxx
index b77f75ea04e5..fa7fdb4b4376 100644
--- a/l10ntools/source/xrmmerge.cxx
+++ b/l10ntools/source/xrmmerge.cxx
@@ -61,7 +61,6 @@ BOOL bEnableExport;
BOOL bMergeMode;
BOOL bErrorLog;
BOOL bUTF8;
-bool bQuiet;
ByteString sPrj;
ByteString sPrjRoot;
ByteString sInputFileName;
@@ -87,7 +86,6 @@ extern char *GetOutputFile( int argc, char* argv[])
sInputFileName = "";
sActFileName = "";
Export::sLanguages = "";
- bQuiet = false;
USHORT nState = STATE_NON;
BOOL bInput = FALSE;
@@ -108,9 +106,6 @@ extern char *GetOutputFile( int argc, char* argv[])
else if ( ByteString( argv[ i ] ).ToUpperAscii() == "-M" ) {
nState = STATE_MERGESRC; // next token specifies the merge database
}
- else if ( ByteString( argv[ i ] ).ToUpperAscii() == "-QQ" ) {
- bQuiet = true;
- }
else if ( ByteString( argv[ i ] ).ToUpperAscii() == "-E" ) {
nState = STATE_ERRORLOG;
bErrorLog = FALSE;
@@ -199,10 +194,6 @@ int InitXrmExport( char *pOutput , char* pFilename)
return 1;
}
-int isQuiet(){
- if( bQuiet ) return 1;
- else return 0;
-}
/*****************************************************************************/
int EndXrmExport()
/*****************************************************************************/
@@ -252,8 +243,6 @@ extern FILE *GetXrmFile()
// (e.g.: source\ui\src\menue.src)
sActFileName = sFullEntry.Copy( sPrjEntry.Len() + 1 );
- if( !bQuiet )
- fprintf( stdout, "\nProcessing File %s ...\n", sInputFileName.GetBuffer());
sActFileName.SearchAndReplaceAll( "/", "\\" );