summaryrefslogtreecommitdiff
path: root/l10ntools
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@suse.cz>2010-10-06 14:25:47 +0200
committerLuboš Luňák <l.lunak@suse.cz>2010-10-06 14:25:47 +0200
commit6b97edf95f413113fda9d388c68faea3920e1fec (patch)
treebcb0d078ddb8c7959353388c2d179cce44e19d8c /l10ntools
parent07aaf4d327731ab858bdf84100960752cfe637a9 (diff)
parent36524b9df562caa67e885575a25acc3bcf19e081 (diff)
Merge commit 'ooo/OOO330_m9'
Conflicts: toolkit/source/awt/vclxwindow.cxx
Diffstat (limited to 'l10ntools')
-rw-r--r--l10ntools/java/jpropex/java/JPropEx.java10
-rw-r--r--l10ntools/prj/build.lst3
-rw-r--r--l10ntools/prj/d.lst16
-rw-r--r--l10ntools/scripts/makefile.mk57
-rw-r--r--l10ntools/scripts/tool/xhtex.py2
-rwxr-xr-xl10ntools/scripts/xhtex8
-rwxr-xr-xl10ntools/scripts/xtxex8
-rw-r--r--l10ntools/source/help/HelpIndexerTool.java24
-rw-r--r--l10ntools/source/help/HelpLinker.cxx117
9 files changed, 186 insertions, 59 deletions
diff --git a/l10ntools/java/jpropex/java/JPropEx.java b/l10ntools/java/jpropex/java/JPropEx.java
index ceeeb5083982..f068f93ad18b 100644
--- a/l10ntools/java/jpropex/java/JPropEx.java
+++ b/l10ntools/java/jpropex/java/JPropEx.java
@@ -126,8 +126,8 @@ public class JPropEx
{
key = (String) e.nextElement();
currentStr = (SdfEntity) dolly.clone();
- // Set the new LID and the string text
- currentStr.setLid( key );
+ // Set the new GID and the string text
+ currentStr.setGid( key );
value = prop.getProperty( key , "" );
//if( value.equals("") ) System.err.println("Warning: in file "+inputFileArg+" the string with the key "+key+" has a empty string!");
str = (prop.getProperty( key )).replaceAll("\t" , " " ); // remove tab
@@ -211,7 +211,7 @@ public class JPropEx
key = (String) e.nextElement();
sourceString = sourceProp.getProperty( key );
curStr = (SdfEntity) dolly.clone();
- curStr.setLid( key );
+ curStr.setGid( key );
for( Enumeration lang = langs.elements(); lang.hasMoreElements(); ) // merge in every language
{
curEntity = (SdfEntity) curStr.clone();
@@ -221,12 +221,12 @@ public class JPropEx
if( mergedEntity == null )
{
// in case there is no translation then fallback to the en-US source string
- ( (java.util.Properties) props.get( curLang )).setProperty( curEntity.getLid() , sourceString );
+ ( (java.util.Properties) props.get( curLang )).setProperty( curEntity.getGid() , sourceString );
}
else
{
// Set the merged text from the sdf file
- ( (java.util.Properties) props.get( curLang )).setProperty( mergedEntity.getLid() , mergedEntity.getText() ); // TODO: Quoting ???
+ ( (java.util.Properties) props.get( curLang )).setProperty( mergedEntity.getGid() , mergedEntity.getText() ); // TODO: Quoting ???
}
}
diff --git a/l10ntools/prj/build.lst b/l10ntools/prj/build.lst
index 8387154897b3..d8a2e8c00649 100644
--- a/l10ntools/prj/build.lst
+++ b/l10ntools/prj/build.lst
@@ -1,6 +1,7 @@
-tr l10ntools : tools LIBXSLT:libxslt BERKELEYDB:berkeleydb LUCENE:lucene NULL
+tr l10ntools : tools LIBXSLT:libxslt BERKELEYDB:berkeleydb LUCENE:lucene PYTHON:python NULL
tr l10ntools usr1 - all tr_mkout NULL
tr l10ntools\inc nmake - all tr_inc NULL
+tr l10ntools\scripts nmake - all tr_scripts NULL
tr l10ntools\source nmake - all tr_src tr_inc NULL
tr l10ntools\layout nmake - all rt_layout tr_src tr_inc NULL
tr l10ntools\java\jpropex nmake - all tr_blah NULL
diff --git a/l10ntools/prj/d.lst b/l10ntools/prj/d.lst
index 53c846832fca..9d493e1e9673 100644
--- a/l10ntools/prj/d.lst
+++ b/l10ntools/prj/d.lst
@@ -47,14 +47,18 @@ 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
+..\%__SRC%\bin\const.py %_DEST%\bin%_EXT%\const.py
+..\%__SRC%\bin\l10ntool.py %_DEST%\bin%_EXT%\l10ntool.py
+..\%__SRC%\bin\pseudo.py %_DEST%\bin%_EXT%\pseudo.py
+..\%__SRC%\bin\sdf.py %_DEST%\bin%_EXT%\sdf.py
+..\%__SRC%\bin\const.pyc %_DEST%\bin%_EXT%\const.pyc
+..\%__SRC%\bin\l10ntool.pyc %_DEST%\bin%_EXT%\l10ntool.pyc
+..\%__SRC%\bin\pseudo.pyc %_DEST%\bin%_EXT%\pseudo.pyc
+..\%__SRC%\bin\sdf.pyc %_DEST%\bin%_EXT%\sdf.pyc
+..\%__SRC%\bin\xhtex.py %_DEST%\bin%_EXT%\xhtex.py
+..\%__SRC%\bin\xtxex.py %_DEST%\bin%_EXT%\xtxex.py
..\inc\export.hxx %_DEST%\inc%_EXT%\l10ntools\export.hxx
..\inc\l10ntools\directory.hxx %_DEST%\inc%_EXT%\l10ntools\directory.hxx
diff --git a/l10ntools/scripts/makefile.mk b/l10ntools/scripts/makefile.mk
new file mode 100644
index 000000000000..af1f66bea32a
--- /dev/null
+++ b/l10ntools/scripts/makefile.mk
@@ -0,0 +1,57 @@
+#*************************************************************************
+#
+# 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.
+#
+#*************************************************************************
+
+# Copy *.py files into output tree and call a script once to
+# force python to create the *.pyc files.
+
+PRJ=..
+TARGET = l10ntools_dummy_pyc
+
+.INCLUDE: settings.mk
+
+.IF "$(SYSTEM_PYTHON)"!="YES"
+PYTHON=$(AUGMENT_LIBRARY_PATH) $(WRAPCMD) $(SOLARBINDIR)/python
+.ELSE # "$(SYSTEM_PYTHON)"!="YES"
+PYTHON=$(AUGMENT_LIBRARY_PATH) $(WRAPCMD) python
+.ENDIF # "$(SYSTEM_PYTHON)"!="YES"
+
+PYFILES = $(BIN)$/const.py \
+ $(BIN)$/l10ntool.py \
+ $(BIN)$/pseudo.py \
+ $(BIN)$/sdf.py \
+ $(BIN)$/xhtex.py \
+ $(BIN)$/xtxex.py
+
+.INCLUDE: target.mk
+
+.IGNORE : create_pyc
+ALLTAR : create_pyc
+create_pyc : $(PYFILES)
+ @$(PYTHON) $(BIN)/xtxex.py >& /dev/null
+
+$(BIN)$/%.py : tool/%.py
+ @$(COPY) $< $@
diff --git a/l10ntools/scripts/tool/xhtex.py b/l10ntools/scripts/tool/xhtex.py
index c427a7feccdd..ae973aacc555 100644
--- a/l10ntools/scripts/tool/xhtex.py
+++ b/l10ntools/scripts/tool/xhtex.py
@@ -108,7 +108,7 @@ class Xhtex(AbstractL10nTool):
def parse_file(self, filename):
document = ""
try:
- f = open(filename,"r+")
+ f = open(filename,"r")
document = f.read()
except IOError:
print "ERROR: Can not read file " + filename
diff --git a/l10ntools/scripts/xhtex b/l10ntools/scripts/xhtex
index ca307cf2d4a4..d337694c589b 100755
--- a/l10ntools/scripts/xhtex
+++ b/l10ntools/scripts/xhtex
@@ -31,16 +31,8 @@ if [ x${SOLARENV}x = xx ]; then
exit 1
fi
-if [ ${GUI} = "WNT" ]; then
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
-else
-if [ x${SOLARVER}x = xx -o x${UPDMINOREXT}x = xx ]; then
- exec python -B $SOLARVERSION/$INPATH/bin/xhtex.py "$@"
-else
- exec python -B $SOLARVERSION/$INPATH/bin$UPDMINOREXT/xhtex.py "$@"
-fi
-fi
diff --git a/l10ntools/scripts/xtxex b/l10ntools/scripts/xtxex
index fb54c1aee36c..01a70ae57d80 100755
--- a/l10ntools/scripts/xtxex
+++ b/l10ntools/scripts/xtxex
@@ -31,17 +31,9 @@ if [ x${SOLARENV}x = xx ]; then
exit 1
fi
-if [ ${GUI} = "WNT" ]; then
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
-else
-if [ x${SOLARVER}x = xx -o x${UPDMINOREXT}x = xx ]; then
- exec python -B $SOLARVERSION/$INPATH/bin/xtxex.py "$@"
-else
- exec python -B $SOLARVERSION/$INPATH/bin$UPDMINOREXT/xtxex.py "$@"
-fi
-fi
diff --git a/l10ntools/source/help/HelpIndexerTool.java b/l10ntools/source/help/HelpIndexerTool.java
index 2a49f964d48f..a39b5399e38d 100644
--- a/l10ntools/source/help/HelpIndexerTool.java
+++ b/l10ntools/source/help/HelpIndexerTool.java
@@ -72,6 +72,9 @@ public class HelpIndexerTool
String aSegmentName = "";
// Scan arguments
+ //If this tool is invoked in the build process for extensions help,
+ //then -extension must be set.
+ boolean bExtension = false;
boolean bLang = false;
boolean bMod = false;
boolean bZipDir = false;
@@ -83,7 +86,11 @@ public class HelpIndexerTool
int nArgCount = args.length;
for( int i = 0 ; i < nArgCount ; i++ )
{
- if( "-lang".equals(args[i]) )
+ if( "-extension".equals(args[i]) )
+ {
+ bExtension = true;
+ }
+ else if( "-lang".equals(args[i]) )
{
if( i + 1 < nArgCount )
{
@@ -142,20 +149,21 @@ public class HelpIndexerTool
bSegmentName = true;
}
i++;
- if (!(bCfsName && bSegmentName))
- {
- System.out.println("Usage: HelpIndexer -checkcfsandsegname _0 _3 (2 arguments needed)");
- System.exit( -1 );
- }
+ if (!(bCfsName && bSegmentName))
+ {
+ System.out.println("Usage: HelpIndexer -checkcfsandsegname _0 _3 (2 arguments needed)");
+ System.exit( -1 );
+ }
}
}
- if( !bLang || !bMod || !bZipDir || (!bOutput && !bExtensionMode) )
+ if( !bLang || !bMod || !bZipDir || (!bOutput && !bExtensionMode && !bExtension) )
{
if( bExtensionMode )
return;
System.out.println("Usage: HelpIndexer -lang ISOLangCode -mod HelpModule -zipdir TempZipDir -o OutputZipFile");
+ System.out.println("Usage: HelpIndexer -extension -lang ISOLangCode -mod HelpModule -zipdir PathToLangDir");
System.exit( -1 );
}
@@ -199,7 +207,7 @@ public class HelpIndexerTool
System.out.println( "Checking segment file " + aSegmentName+ ": " + (bSegmentFileOk ? "Found" : "Not found") );
}
- if( bExtensionMode )
+ if( bExtensionMode || bExtension)
{
if( !bSrcDir )
{
diff --git a/l10ntools/source/help/HelpLinker.cxx b/l10ntools/source/help/HelpLinker.cxx
index 94139f89de1e..411859bfe994 100644
--- a/l10ntools/source/help/HelpLinker.cxx
+++ b/l10ntools/source/help/HelpLinker.cxx
@@ -269,6 +269,8 @@ private:
fs::path idxContentStylesheet;
fs::path zipdir;
fs::path outputFile;
+ std::string extsource;
+ std::string extdestination;
std::string module;
std::string lang;
std::string hid;
@@ -762,18 +764,9 @@ void HelpLinker::main( std::vector<std::string> &args,
const rtl::OUString* pOfficeHelpPath )
throw( HelpProcessingException )
{
- rtl::OUString aOfficeHelpPath;
-
bExtensionMode = false;
- if( pExtensionPath && pExtensionPath->length() > 0 && pOfficeHelpPath )
- {
- helpFiles.clear();
- bExtensionMode = true;
- extensionPath = *pExtensionPath;
- sourceRoot = fs::path(extensionPath);
- extensionDestination = *pDestination;
- aOfficeHelpPath = *pOfficeHelpPath;
- }
+ helpFiles.clear();
+
if (args.size() > 0 && args[0][0] == '@')
{
std::vector<std::string> stringList;
@@ -793,10 +786,34 @@ void HelpLinker::main( std::vector<std::string> &args,
}
size_t i = 0;
-
+ bool bSrcOption = false;
while (i < args.size())
{
- if (args[i].compare("-src") == 0)
+ if (args[i].compare("-extlangsrc") == 0)
+ {
+ ++i;
+ if (i >= args.size())
+ {
+ std::stringstream aStrStream;
+ aStrStream << "extension source missing" << std::endl;
+ throw HelpProcessingException( HELPPROCESSING_GENERAL_ERROR, aStrStream.str() );
+ }
+ extsource = args[i];
+ }
+ else if (args[i].compare("-extlangdest") == 0)
+ {
+ //If this argument is not provided then the location provided in -extsource will
+ //also be the destination
+ ++i;
+ if (i >= args.size())
+ {
+ std::stringstream aStrStream;
+ aStrStream << "extension destination missing" << std::endl;
+ throw HelpProcessingException( HELPPROCESSING_GENERAL_ERROR, aStrStream.str() );
+ }
+ extdestination = args[i];
+ }
+ else if (args[i].compare("-src") == 0)
{
++i;
if (i >= args.size())
@@ -805,9 +822,8 @@ void HelpLinker::main( std::vector<std::string> &args,
aStrStream << "sourceroot missing" << std::endl;
throw HelpProcessingException( HELPPROCESSING_GENERAL_ERROR, aStrStream.str() );
}
-
- if( !bExtensionMode )
- sourceRoot = fs::path(args[i], fs::native);
+ bSrcOption = true;
+ sourceRoot = fs::path(args[i], fs::native);
}
else if (args[i].compare("-sty") == 0)
{
@@ -933,21 +949,70 @@ void HelpLinker::main( std::vector<std::string> &args,
++i;
}
+ //We can be called from the helplinker executable or the extension manager
+ //In the latter case extsource is not used.
+ if( (pExtensionPath && pExtensionPath->length() > 0 && pOfficeHelpPath)
+ || !extsource.empty())
+ {
+ bExtensionMode = true;
+ if (!extsource.empty())
+ {
+ //called from helplinker.exe, pExtensionPath and pOfficeHelpPath
+ //should be NULL
+ sourceRoot = fs::path(extsource, fs::native);
+ extensionPath = sourceRoot.toUTF8();
+
+ if (extdestination.empty())
+ {
+ std::stringstream aStrStream;
+ aStrStream << "-extlangdest is missing" << std::endl;
+ throw HelpProcessingException( HELPPROCESSING_GENERAL_ERROR, aStrStream.str() );
+ }
+ else
+ {
+ //Convert from system path to file URL!!!
+ fs::path p(extdestination, fs::native);
+ extensionDestination = p.toUTF8();
+ }
+ }
+ else
+ { //called from extension manager
+ extensionPath = *pExtensionPath;
+ sourceRoot = fs::path(extensionPath);
+ extensionDestination = *pDestination;
+ }
+ //check if -src option was used. This option must not be used
+ //when extension help is compiled.
+ if (bSrcOption)
+ {
+ std::stringstream aStrStream;
+ aStrStream << "-src must not be used together with -extsource missing" << std::endl;
+ throw HelpProcessingException( HELPPROCESSING_GENERAL_ERROR, aStrStream.str() );
+ }
+ }
+
if (!bExtensionMode && zipdir.empty())
{
std::stringstream aStrStream;
aStrStream << "no index dir given" << std::endl;
throw HelpProcessingException( HELPPROCESSING_GENERAL_ERROR, aStrStream.str() );
}
- if (!bExtensionMode && idxCaptionStylesheet.empty())
+
+ if (!bExtensionMode && idxCaptionStylesheet.empty()
+ || !extsource.empty() && idxCaptionStylesheet.empty())
{
+ //No extension mode and extension mode using commandline
+ //!extsource.empty indicates extension mode using commandline
+ // -idxcaption paramter is required
std::stringstream aStrStream;
aStrStream << "no index caption stylesheet given" << std::endl;
throw HelpProcessingException( HELPPROCESSING_GENERAL_ERROR, aStrStream.str() );
}
- else if ( bExtensionMode )
+ else if ( bExtensionMode && extsource.empty())
{
- rtl::OUString aIdxCaptionPathFileURL( aOfficeHelpPath );
+ //This part is used when compileExtensionHelp is called from the extensions manager.
+ //If extension help is compiled using helplinker in the build process
+ rtl::OUString aIdxCaptionPathFileURL( *pOfficeHelpPath );
aIdxCaptionPathFileURL += rtl::OUString::createFromAscii( "/idxcaption.xsl" );
rtl::OString aOStr_IdxCaptionPathFileURL( rtl::OUStringToOString
@@ -956,15 +1021,23 @@ void HelpLinker::main( std::vector<std::string> &args,
idxCaptionStylesheet = fs::path( aStdStr_IdxCaptionPathFileURL );
}
- if (!bExtensionMode && idxContentStylesheet.empty())
+
+ if (!bExtensionMode && idxContentStylesheet.empty()
+ || !extsource.empty() && idxContentStylesheet.empty())
{
+ //No extension mode and extension mode using commandline
+ //!extsource.empty indicates extension mode using commandline
+ // -idxcontent paramter is required
std::stringstream aStrStream;
aStrStream << "no index content stylesheet given" << std::endl;
throw HelpProcessingException( HELPPROCESSING_GENERAL_ERROR, aStrStream.str() );
}
- else if ( bExtensionMode )
+ else if ( bExtensionMode && extsource.empty())
{
- rtl::OUString aIdxContentPathFileURL( aOfficeHelpPath );
+ //If extension help is compiled using helplinker in the build process
+ //then -idxcontent must be supplied
+ //This part is used when compileExtensionHelp is called from the extensions manager.
+ rtl::OUString aIdxContentPathFileURL( *pOfficeHelpPath );
aIdxContentPathFileURL += rtl::OUString::createFromAscii( "/idxcontent.xsl" );
rtl::OString aOStr_IdxContentPathFileURL( rtl::OUStringToOString