diff options
Diffstat (limited to 'l10ntools/java/l10nconv/java/com/sun/star/tooling/converter')
19 files changed, 421 insertions, 421 deletions
diff --git a/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/Convert.java b/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/Convert.java index d6fddfd049ae..0ec343b1f3a8 100755 --- a/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/Convert.java +++ b/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/Convert.java @@ -1,7 +1,7 @@ /************************************************************************* * * 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 @@ -26,7 +26,7 @@ ************************************************************************/ /* * the main Class - * + * * Command Line arguments are reviewed * and a Converter is constructed */ @@ -42,32 +42,32 @@ import com.sun.star.tooling.DirtyTags.DirtyTagWrapper; /** * The main class of the converter tool - * + * * The converter tool is command line based. * Its classes allow the converting between the * file formats sdf, gsi and <a href="http://www.oasis-open.org/committees/xliff/documents/cs-xliff-core-1.1-20031031.htm">xliff</a>. - * + * * Those file formats are used in localization * of Star-Office and Open-Office. - * - * Information about the whole localization process can be found in + * + * Information about the whole localization process can be found in * <a href="http://ded-1.germany.sun.com/webcontent/guidelines/pdf/L10NSO8.pdf">http://ded-1.germany.sun.com/webcontent/guidelines/pdf/L10NSO8.pdf</a> - * + * * @author Christian Schmidt 2005 - * + * */ public class Convert { private static Calendar cal; - + private static final String EMPTY = ""; - + /** * The name of the file containing the debug information * that where found while converting (every output goes here too) */ private static String dbgName = EMPTY; - + /** * the character that separates the extension from the file name */ @@ -95,7 +95,7 @@ public class Convert { private static File secondSource; //private static final char pathSeperator = '\\'; - + /** * The language that should be the source language * that means the language to translate from @@ -111,7 +111,7 @@ public class Convert { * the type of the source file (sdf,xliff,...) */ private static String sourceType = EMPTY; - + /** * The time when converting started */ @@ -133,7 +133,7 @@ public class Convert { private static String targetType = EMPTY; /** - * Store the current version ID and number of this tool + * Store the current version ID and number of this tool */ final static String version = " Prod.20050710:1255 "; @@ -143,19 +143,19 @@ public class Convert { private static String secondSourceName=EMPTY; /** * Indicate whether strings in xliff files should - * be wrapped with ept/bpt or sub tags to enable translation tools + * be wrapped with ept/bpt or sub tags to enable translation tools * to synchronize source language string with there translation - * + * * @see <a href="http://ded-1.germany.sun.com/webcontent/guidelines/pdf/L10NSO8.pdf">http://ded-1.germany.sun.com/webcontent/guidelines/pdf/L10NSO8.pdf</a> */ private static boolean doWrap=true; - + public static void main(String[] args) throws IOException, Exception { try{ - - //go, parse and check the command line parameters + + //go, parse and check the command line parameters ParameterChecker.checkClParameters(args); ParameterChecker.createContentOfClParameters(); //Initialize the tagWrapper @@ -170,12 +170,12 @@ public class Convert { printPreamble(); //do the job conv.convert(); - + showStatistic(); - + //close log, debug... OutputHandler.closeAll(); - + } catch(Exception e){ System.out.print("An EXCEPTION occured, please check your commad line settings \n"+e.getMessage()); System.exit(-1); @@ -194,7 +194,7 @@ public class Convert { final String ls = System.getProperty("line.separator"); System.out .println( - + "File Converting Tool 'converter' Version " + Convert.version + ls @@ -220,13 +220,13 @@ public class Convert { + "-nw disable the wrapping with ept/bpt tags." + ls + ls + "The created files were stored in the SourceFile Path if nothing else is given. " + ls - + "The extension is '.xliff','.sdf' depending on the source file and '.log' " + ls + + "The extension is '.xliff','.sdf' depending on the source file and '.log' " + ls + "for the logfile." + ls); } /** * show the parameters the converter starts with - * + * * @throws IOException */ final private static void printPreamble() throws IOException { @@ -245,7 +245,7 @@ public class Convert { /** * show some statistic data - * + * * @throws IOException */ final private static void showStatistic() throws IOException { @@ -265,9 +265,9 @@ public class Convert { /** * Get the extensiion of a file name * (sdf,xliff,gsi) - * + * * @param sourceString the file name - * @return the extension + * @return the extension */ static protected String extractExtension(String sourceString) { String ext = sourceString.substring(sourceString @@ -291,16 +291,16 @@ public class Convert { // } /** - * + * */ public Convert() { } /** - * - * Verify a parameter array and create content useable by the programm + * + * Verify a parameter array and create content useable by the programm * from the switches and attributes set at command line - * + * * @author Christian Schmidt 2005 */ private static class ParameterChecker { @@ -316,13 +316,13 @@ public class Convert { /** * Create a new Instance of ParameterChecker - * - * + * + * */ public ParameterChecker(){}; /** * Checks the command line parameters - * + * * @param args the parameters to check and to parse * @throws IOException */ @@ -350,54 +350,54 @@ public class Convert { if (!source.exists()) throw new IOException("ERROR:Can not find Source File '" + sourceName + "'. Aborting..."); - + // String name=source.getName(); // String parent=source.getParent(); // String path=source.getPath(); - + filePath = (source.getParent()==null)?"":source.getParent()+File.separator; //extractPath(sourceName); fileName = source.getName().substring(0,source.getName().lastIndexOf(extensionSeperator)); - + for (int i = 1; i < args.length; i++) { - - + + if ("-s".equals(args[i])) { if (args.length > i + 1) { sourceLanguage = args[++i]; - + } else { throw new ConverterException( "missing argument for -s source language"); } continue; } - + if ("-S".equals(args[i])) { if (args.length > i + 1) { sourceType = args[++i]; if (args.length > i +1 &&!args[i+1].startsWith("-")) { secondSourceName = args[++i]; } - + } else { throw new ConverterException( "missing argument for -S source type"); } continue; } - + if ("-T".equals(args[i])) { if (args.length > i + 1) { targetType = args[++i]; - - + + } else { throw new ConverterException( "missing argument for -T target type"); } continue; } - + if ("-l".equals(args[i])) { OutputHandler.doLog = true; if (args.length > i + 1 @@ -408,27 +408,27 @@ public class Convert { } continue; } - + if ("-o".equals(args[i])) { overwrite = true; continue; } - + if ("-nw".equals(args[i])) { doWrap = false; continue; } - + if ("-h".equals(args[i])) { printHelp(); System.exit(0); } - + if ("-dbg".equals(args[i])) { OutputHandler.doDebug = true; continue; } - + if ("-t".equals(args[i])) { if (args.length > i + 1) { TargetLanguage = args[++i]; @@ -438,7 +438,7 @@ public class Convert { } continue; } - + if (i == 1 && !args[i].startsWith("-")) { //target file // found targetName = args[i]; @@ -449,7 +449,7 @@ public class Convert { throw new ConverterException("unknown Attribute: " + args[i]); - + }//end for } catch (ConverterException e) { OutputHandler.out("ERROR: "+e.getMessage()); @@ -462,9 +462,9 @@ public class Convert { }//end checkClParameters /** - * Creates the appropriate content of what ever data + * Creates the appropriate content of what ever data * we found in the command line - * + * * @throws IOException */ private static void createContentOfClParameters() throws IOException { @@ -498,16 +498,16 @@ public class Convert { throw new ConverterException("Source type is missing"); } } - + if(sourceType.equalsIgnoreCase("gsi")){ - + if(EMPTY.equals(Convert.secondSourceName)){ Convert.secondSourceName=filePath+fileName+".sdf"; } //secondSource=new File(Convert.secondSourceName); - + } - + if (EMPTY.equals(sourceName)) { sourceName = filePath + fileName + "." + sourceType; } @@ -537,12 +537,12 @@ public class Convert { OutputHandler.out("ERROR: \nSource '"+Convert.sourceName+"' and \nTarget'"+targetName+"' are the same"); System.exit(0); } - - + + } catch (ConverterException e) { - OutputHandler.out(e.getMessage()); + OutputHandler.out(e.getMessage()); } - + } } diff --git a/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/Converter.java b/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/Converter.java index ad846ae88295..ff6c20dd99e3 100755 --- a/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/Converter.java +++ b/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/Converter.java @@ -1,7 +1,7 @@ /************************************************************************* * * 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 @@ -52,11 +52,11 @@ import org.xml.sax.XMLReader; import org.xml.sax.helpers.DefaultHandler; /** - * + * * This class handles the creating of the source to read from, * the target to write to and the appropriate DataHandler - * - * @author Christian Schmidt 2005 + * + * @author Christian Schmidt 2005 */ public final class Converter { @@ -66,7 +66,7 @@ public final class Converter { private final static String CHARSET = new String("UTF-8"); private static final String EMPTY = new String(""); - + /** * The DataHandler use to connect reader and writer */ @@ -76,13 +76,13 @@ public final class Converter { * Counting the lines written by a writer */ private static int lineCounter; - + /** * The target to write to */ private static DataWriter theTargetWriter; - - + + /** * Overwrite existing files */ @@ -106,7 +106,7 @@ public final class Converter { /** * the Type of the Target file(SDF,GSI,XLIFF) */ - private String targetType; + private String targetType; /** * The writer that handles the output */ @@ -116,7 +116,7 @@ public final class Converter { * The sourceLanguage */ String sourceLanguage = "en-US"; - + /** * The targetLanguage */ @@ -145,7 +145,7 @@ public final class Converter { /** * Creates a new instance of Converter - * + * * @param sourceType the type of the sourceFile * @param sourceString the name of the sourceFile * @param SourceLanguage the ISO Id of the sourceLanguage @@ -197,7 +197,7 @@ public final class Converter { /** * Do the converting from the source file format to the target file format - * + * * @throws IOException */ public final void convert() throws IOException { @@ -214,12 +214,12 @@ public final class Converter { } } - + /** - * + * * Encapsulate the reading from an GSI file - * + * * @author Christian Schmidt 2005 * */ @@ -227,7 +227,7 @@ public final class Converter { DataReader theSourceReader; /** * Create a new Instance of GSISource - * + * * @throws IOException * @throws Exception */ @@ -238,7 +238,7 @@ public final class Converter { } public void convertTo(Target t) { - + try { theTargetWriter = t.getWriter(); while (handler.fillDataFrom(theSourceReader)) { @@ -257,19 +257,19 @@ public final class Converter { } /** - * + * * Encapsulate to write to a GSI file - * + * * @author Christian Schmidt 2005 * */ private class GSITarget implements Target { File target; - + /** * Create a new Instance of GSITarget - * + * * @throws FileNotFoundException * @throws IOException */ @@ -281,17 +281,17 @@ public final class Converter { } public DataWriter getWriter() { - + return theTargetWriter; } } /** - * + * * Encapsulate the reading from an SDF file - * + * * @author Christian Schmidt 2005 - * + * */ private final class SDFSource implements Source { @@ -337,7 +337,7 @@ public final class Converter { /** * Create a new Instance of SDFTarget - * + * * @throws IOException */ public SDFTarget() throws IOException { @@ -358,16 +358,16 @@ public final class Converter { /** * The interface for all convertable sources - * + * * @author Christian Schmidt 2005 * */ private interface Source { - + DataReader Source=null; /** * Convert this. to the designated target - * @param target the target of the converting + * @param target the target of the converting * @throws IOException */ abstract void convertTo(Target target) throws IOException; @@ -375,7 +375,7 @@ public final class Converter { /** * The interface for all creatable targets - * + * * @author Christian Schmidt 2005 * */ @@ -388,8 +388,8 @@ public final class Converter { /** * Get the writer * this target uses to write the - * data in the correct format. - * + * data in the correct format. + * * @return the used DataWriter */ abstract DataWriter getWriter(); @@ -406,8 +406,8 @@ public final class Converter { /** * Create a new Instance of XLIFFSource - * - * + * + * */ public XLIFFSource() { @@ -434,8 +434,8 @@ public final class Converter { SAXParser parser=factory.newSAXParser(); XMLReader xliffreader=parser.getXMLReader(); - - + + // XMLReader xliffreader = XMLReaderFactory // .createXMLReader("org.apache.crimson.parser.XMLReaderImpl"); xliffreader.setErrorHandler(contentHandler); @@ -445,7 +445,7 @@ public final class Converter { xliffreader.setEntityResolver(res); /* * a second possibility to resolve an extern entity (DTD) - * + * * xliffreader.setFeature("xml.org/sax/features/validation",true); * xliffreader.setEntityResolver(new EntityResolver() { * public InputSource resolveEntity(java.lang.String @@ -455,7 +455,7 @@ public final class Converter { * return new InputSource(new ByteArrayInputStream( " <?xml * version='1.0' encoding='UTF-8'?>" .getBytes())); else * return null; } }); - * + * */ xliffreader.parse(sourceString); @@ -490,7 +490,7 @@ public final class Converter { } /** * Encapsulate writing to a XLIFF file - * + * * @author Christian Schmidt 2005 * */ @@ -499,7 +499,7 @@ public final class Converter { /** * Create a new Instance of XLIFFTarget - * + * * @throws FileNotFoundException * @throws IOException */ diff --git a/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/ConverterException.java b/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/ConverterException.java index 0b630978098d..cfa664dcaad8 100755 --- a/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/ConverterException.java +++ b/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/ConverterException.java @@ -1,7 +1,7 @@ /************************************************************************* * * 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 @@ -26,7 +26,7 @@ ************************************************************************/ /* * a simple exception - * just to seperate + * just to seperate * it from other * exceptions */ @@ -34,14 +34,14 @@ package com.sun.star.tooling.converter; /** * @author Christian Schmidt - * + * * Thrown if an error occurs during converting from one file format to another * that does not belong to an other exception */ public class ConverterException extends Exception { /** - * + * */ public ConverterException() { super(); diff --git a/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/DataHandler.java b/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/DataHandler.java index fcc95905d3be..308462c8440b 100755 --- a/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/DataHandler.java +++ b/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/DataHandler.java @@ -1,7 +1,7 @@ /************************************************************************* * * 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 @@ -28,8 +28,8 @@ * DataHandler.java * * take the data from the reader - * and put it to the Writer - * + * and put it to the Writer + * */ package com.sun.star.tooling.converter; @@ -37,17 +37,17 @@ package com.sun.star.tooling.converter; import java.util.*; /** - * Handle the Data to get it from the Source - * readable to the Target - * + * Handle the Data to get it from the Source + * readable to the Target + * * @author Christian Schmidt */ public class DataHandler { /** - * An arrays that holds the names that will be + * An arrays that holds the names that will be * keys for the HashMap containing the data - * + * */ private final String[] dataNames = { "BlockNr", "Project", "SourceFile", "Dummy", "ResType", "GID", "LID", "HID", "Platform", @@ -58,7 +58,7 @@ public class DataHandler { private static final String EMPTY = new String(""); /** - * The HashMap containing the data + * The HashMap containing the data */ private final Map data = new ExtMap(dataNames, null); @@ -68,7 +68,7 @@ public class DataHandler { /** * fill the data from the desired source - * + * * @param source where to get the data from * @return true if data is read and false if null is read * @throws IOException @@ -81,20 +81,20 @@ public class DataHandler { line = source.getData(); if (line == null){ - + return false; - }else{ - + }else{ + this.data.putAll(line); return true; } - + } /** * fill this data with the inData - * + * * @param inData the data to handle by this handler */ public void fillDataWith(Map inData) { @@ -109,7 +109,7 @@ public class DataHandler { /** * The designated output is filled with the content of this handler - * + * * @param output an array of Maps [0] should hold the source language data [1] the target language data * @throws java.io.IOException */ @@ -127,7 +127,7 @@ public class DataHandler { } /** * The designated output is filled with the content of this handler - * + * * @param output a Map that should hold the source language data and the target language data * @throws java.io.IOException */ diff --git a/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/DataReader.java b/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/DataReader.java index d6bb2ed85d73..de23f35a02d0 100755 --- a/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/DataReader.java +++ b/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/DataReader.java @@ -1,7 +1,7 @@ /************************************************************************* * * 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 @@ -33,14 +33,14 @@ import java.util.*; * Gets Line counting from LineNumberReader all Converter Reader classes inherit * from this. * The abstract parent class of all converter reader classes - * + * * @author Christian Schmidt */ abstract public class DataReader extends LineNumberReader { /** * Creates a new instance of DataReader - * + * * @param isr * InputStreamReader used as Source for this class */ @@ -49,22 +49,22 @@ abstract public class DataReader extends LineNumberReader { } /** - + * @throws java.io.IOException * @throws ConverterException - * + * * TODO this should no longer use an array as return type better a Map - * + * */ /** * The next block of the SDF file is reviewed and the Line including the * source language and the Line including the target Language are given back * in an array - * - * + * + * * @return A Map including the source language - * and the target Language content are given back - * + * and the target Language content are given back + * * @throws java.io.IOException * @throws ConverterException */ diff --git a/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/DataWriter.java b/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/DataWriter.java index 497bb54bbdb8..9263e1fbaa1e 100755 --- a/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/DataWriter.java +++ b/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/DataWriter.java @@ -1,7 +1,7 @@ /************************************************************************* * * 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 @@ -39,12 +39,12 @@ import java.io.OutputStreamWriter; /** * The abstract parent class of all converter writer classes - * + * * @author Christian Schmidt */ abstract public class DataWriter extends OutputStreamWriter { protected final String seperator = new String("|"); - + /** * the char sequence used as line seperator */ @@ -54,7 +54,7 @@ abstract public class DataWriter extends OutputStreamWriter { /** Creates a new instance of DataWriter */ /** * @param bos the buffered output stream holding the data - * @param encoding the encoding to use for read from bos + * @param encoding the encoding to use for read from bos * @throws java.io.UnsupportedEncodingException */ public DataWriter(BufferedOutputStream bos, String encoding) @@ -66,16 +66,16 @@ abstract public class DataWriter extends OutputStreamWriter { /** * get the data that should be written from the DataHandler - * + * * @param handler the DataHandler having the data * @throws java.io.IOException */ abstract protected void getDataFrom(DataHandler handler) throws java.io.IOException; - + /** * write the Data - * + * * @throws java.io.IOException */ abstract protected void writeData() throws java.io.IOException; diff --git a/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/ExtMap.java b/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/ExtMap.java index a26665e1629e..51bed4c08169 100755 --- a/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/ExtMap.java +++ b/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/ExtMap.java @@ -1,7 +1,7 @@ /************************************************************************* * * 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 @@ -36,14 +36,14 @@ import java.util.Map; /** * @author Christian Schmidt - * + * * Create a Hash Map from two Arrays - * + * */ public class ExtMap extends HashMap { /** - * + * */ public ExtMap() { super(); diff --git a/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/FileMaker.java b/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/FileMaker.java index 600687c41d29..131c10bd8c20 100755 --- a/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/FileMaker.java +++ b/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/FileMaker.java @@ -1,7 +1,7 @@ /************************************************************************* * * 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 @@ -25,10 +25,10 @@ * ************************************************************************/ /* - * creates new files + * creates new files * checks if they exist or * can be overwritten - * + * */ package com.sun.star.tooling.converter; @@ -37,17 +37,17 @@ import java.io.IOException; /** * Creates new files only if the file does not yet exist - * or overwriting is allowed - * + * or overwriting is allowed + * * @author Christian Schmidt 2005 - * + * */ public final class FileMaker { /** * Create a new file if overwriting is not alowed * ask if existing files should be overwritten - * + * * @param fileName the files name to overwrite * @param overwrite indicates wether the file can be overwritten * @return the File created from the fileName diff --git a/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/GSIReader.java b/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/GSIReader.java index 398fcc9b686b..638e61441f23 100755 --- a/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/GSIReader.java +++ b/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/GSIReader.java @@ -1,7 +1,7 @@ /************************************************************************* * * 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 @@ -26,7 +26,7 @@ ************************************************************************/ /* * Created on 2005 - * by Christian Schmidt + * by Christian Schmidt */ package com.sun.star.tooling.converter; @@ -42,7 +42,7 @@ import com.sun.star.tooling.languageResolver.LanguageResolver.LanguageResolvingE /** * @author Christian Schmidt 2005 - * + * */ public class GSIReader extends DataReader { /** @@ -102,7 +102,7 @@ public class GSIReader extends DataReader { /** * Create a new Instance of GSIReader - * + * * @param source * the file to read from * @param sourceLanguage @@ -127,10 +127,10 @@ public class GSIReader extends DataReader { /** * Read the next GSIBlock and return the data - * - * @return A Map containing the data of the read GSIBlock the keys for the language depending data are the language id (numeric) the + * + * @return A Map containing the data of the read GSIBlock the keys for the language depending data are the language id (numeric) the * single language are acessible with the keys "BlockNr", "resType", "languageNr", "status","content". - * + * * @throws IOException */ public Map getGSIData() throws IOException { @@ -147,7 +147,7 @@ public class GSIReader extends DataReader { while (useBuffer || (line = readLine()) != null) { - + if (useBuffer) { GSILine = GSILineBuffer; @@ -214,7 +214,7 @@ public class GSIReader extends DataReader { OutputHandler.out("\n\n"); OutputHandler.out("GSI Blocks : " + this.blockCounter); OutputHandler.out("GSI Lines : " + this.lineCounter); - + return null; }else{ lastLineFound = true; @@ -230,7 +230,7 @@ public class GSIReader extends DataReader { /** * Split a GSILine to single fields - * + * * @param line * The line to split * @return An array containing the contents of the columns in the given line diff --git a/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/GSIWriter.java b/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/GSIWriter.java index 0f7aee811569..b5819f783d1c 100755 --- a/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/GSIWriter.java +++ b/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/GSIWriter.java @@ -1,7 +1,7 @@ /************************************************************************* * * 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 @@ -37,7 +37,7 @@ import com.sun.star.tooling.languageResolver.LanguageResolver.LanguageResolvingE */ public class GSIWriter extends DataWriter { /** - * The seperator used to seperate GSI columns + * The seperator used to seperate GSI columns */ final String seperator=new String("($$)"); @@ -66,7 +66,7 @@ public class GSIWriter extends DataWriter { * A map holding the content of an GSI Line contianing the source and the target language */ private ExtMap outData=new ExtMap(outLineNames, null); - + private static final String EMPTY = new String(""); /** * The sourceLanguage to use @@ -76,7 +76,7 @@ public class GSIWriter extends DataWriter { * The sourceLanguage to use */ private String targetLanguage; - + /** * GSILines have a special Line End */ @@ -87,29 +87,29 @@ public class GSIWriter extends DataWriter { * The blockNr of the current line */ private String blockNr; - - - + + + /** * Create a new Instance of GSIWriter - * + * * @param bos the Buffered Output Stream to write to * @param charset the used charset * @throws java.io.UnsupportedEncodingException */ public GSIWriter(BufferedOutputStream bos,String charset) throws java.io.UnsupportedEncodingException { super(bos,charset); + - - + } - + /* (non-Javadoc) * @see com.sun.star.tooling.converter.DataWriter#writeData() */ public final void writeData() throws java.io.IOException { - + StringBuffer buffer=new StringBuffer(""); if(this.sourceLanguage==null&&this.targetLanguage==null){ LanguageResolver lang =new LanguageResolver(); @@ -117,13 +117,13 @@ public class GSIWriter extends DataWriter { this.sourceLanguage=lang.getNrFromISO((String)outData.get("SourceLanguageID")); this.targetLanguage=lang.getNrFromISO((String)outData.get("TargetLanguageID")); } catch (LanguageResolvingException e) { - + OutputHandler.out(e.getMessage()); System.exit(0); } } - - + + this.blockNr=(String)outData.get("BlockNr"); // get the values of the found fields //create the gsi lines @@ -133,7 +133,7 @@ public class GSIWriter extends DataWriter { buffer.append(getSourceLine("HText")); buffer.append(getSourceLine("QText")); buffer.append(getSourceLine("Title")); - + //now the target language line // put them together for output buffer.append(getTargetLine("Text")); @@ -142,9 +142,9 @@ public class GSIWriter extends DataWriter { buffer.append(getTargetLine("Title")); //ok...put all to disk; this.write(buffer.toString()); - + } - + /** * Create a line containing the source string from the data * @param resType @@ -171,14 +171,14 @@ public class GSIWriter extends DataWriter { // seperate the fields with ($$) buffer.append(this.seperator); buffer.append(outData.get(resString)); - + // this line is full // so close it with '! cr lf' buffer.append(GSIWriter.lineEnd); Converter.countLine(); return buffer; } - + } /** * Create a line containing the target string from the data @@ -205,30 +205,30 @@ public class GSIWriter extends DataWriter { // seperate the fields with ($$) buffer.append(this.seperator); buffer.append(outData.get(resString)); - + // this line is full // so close it with '! cr lf' buffer.append(GSIWriter.lineEnd); Converter.countLine(); return buffer; } - + } - + /* (non-Javadoc) * @see com.sun.star.tooling.converter.DataWriter#writeData(java.util.Map[]) */ protected void writeData(Map[] data) throws IOException { // TODO redesign DataHandler in the way that this is not nessesary any more - + } /* (non-Javadoc) * @see com.sun.star.tooling.converter.DataWriter#getDataFrom(com.sun.star.tooling.converter.DataHandler) */ protected void getDataFrom(DataHandler handler) throws IOException { - + handler.putDataTo(this.outData); } @@ -236,8 +236,8 @@ public class GSIWriter extends DataWriter { * @see com.sun.star.tooling.converter.DataWriter#getDatafrom(com.sun.star.tooling.converter.DataHandler) */ protected void getDatafrom(DataHandler handler) throws IOException { - + handler.putDataTo(this.outData); - + } } diff --git a/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/GSIandSDFMerger.java b/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/GSIandSDFMerger.java index 526f3ca75640..01133229210e 100755 --- a/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/GSIandSDFMerger.java +++ b/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/GSIandSDFMerger.java @@ -1,7 +1,7 @@ /************************************************************************* * * 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 @@ -26,7 +26,7 @@ ************************************************************************/ /* * Created on 2005 - * by Christian Schmidt + * by Christian Schmidt */ package com.sun.star.tooling.converter; @@ -37,15 +37,15 @@ import java.util.Map; /** * Merge GSIFiles back to to the original (!) SDFFile - * - * + * + * * @author Christian Schmidt 2005 * */ public class GSIandSDFMerger extends SDFReader { - + int lineCounter=0; - + GSIReader gsiReader; private Map temp=new HashMap(); @@ -59,11 +59,11 @@ public class GSIandSDFMerger extends SDFReader { private int count; /** * Merge the GSIFile back to the original(!) SDFFile - * + * * @param source the file to read from * @param sourceLanguage the source language in the source file * @param targetLanguage the target language in the source file - * @param charset the charset of the files + * @param charset the charset of the files * @throws java.io.IOException * @throws Exception */ @@ -77,7 +77,7 @@ public class GSIandSDFMerger extends SDFReader { gsiReader=new GSIReader(source,sourceLanguage,targetLanguage,charset); } - + /* (non-Javadoc) * @see com.sun.star.tooling.converter.DataReader#getData() */ @@ -90,15 +90,15 @@ public class GSIandSDFMerger extends SDFReader { OutputHandler.out("Blocks merged : "+this.lineCounter); } return temp; - + } - + /** * Read each block of the GSIFile and check whether there is a matching - * block in the SDFFile. Match depends on the BlockNr and BlockId. - * + * block in the SDFFile. Match depends on the BlockNr and BlockId. + * * @return A Map that contains the source language content - * and the target language content. + * and the target language content. * @throws IOException * @throws ConverterException */ @@ -107,7 +107,7 @@ public class GSIandSDFMerger extends SDFReader { try { //System.out.println("Start..."); - + if (dontLoadGSI||(gsiBlock=gsiReader.getGSIData())!=null){ dontLoadGSI=false; //check if we must update this block @@ -115,14 +115,14 @@ public class GSIandSDFMerger extends SDFReader { if((sdfBlock = super.getData())!=null){ if(((String)sdfBlock.get("BlockNr")).equals((String)gsiBlock.get("BlockNr"))){ - + gsiBlock.remove(EMPTY); //if the target language string is empty this may be caused by an error in the source sdf File //I don't want to overwrite a possibly correct translation with an empty string // so remove the target part from the gsiBlock Map mp=(Map)gsiBlock.get(gsiReader.targetLanguage); if (mp.size()!=0&&!((String)mp.get("TargetText")).equals("")){ - + // target language part in this gsiBlock // if(((String)mp.get("TargetText")).equals("")){ // gsiBlock.remove(targetLanguage); @@ -131,16 +131,16 @@ public class GSIandSDFMerger extends SDFReader { lineCounter++; Map helpMap = (Map)gsiBlock.get(super.targetLanguage);//"ja" sdfBlock.putAll(helpMap); - skip=false; + skip=false; }else{ //no target language part in this gsiBlock skip=true; // // return null; - } + } }else{ // skip=true; -// +// // // we cant match this gsi block to the current sdf block // try matching the next sdf block with this gsi line dontLoadGSI=true; @@ -148,17 +148,17 @@ public class GSIandSDFMerger extends SDFReader { } return sdfBlock; } - + } catch (IOException e) { - + e.printStackTrace(); } return null; } + - - - + + } diff --git a/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/LineErrorException.java b/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/LineErrorException.java index 26ce5a6518eb..7f87e99fee37 100755 --- a/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/LineErrorException.java +++ b/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/LineErrorException.java @@ -1,7 +1,7 @@ /************************************************************************* * * 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 @@ -26,7 +26,7 @@ ************************************************************************/ /* * Exception for errors in - * SDFLines + * SDFLines */ package com.sun.star.tooling.converter; @@ -34,7 +34,7 @@ package com.sun.star.tooling.converter; /** * This Exeption is thrown if a DataReader finds an error in a read Line * f. e. wrong column number - * + * * @author Christian Schmidt 2005 * */ @@ -42,11 +42,11 @@ public class LineErrorException extends Exception { public int tokenCount; /** - * + * */ public LineErrorException() { super(); - + } /** @@ -54,7 +54,7 @@ public class LineErrorException extends Exception { */ public LineErrorException(String arg0) { super(arg0); - + } /** @@ -62,7 +62,7 @@ public class LineErrorException extends Exception { */ public LineErrorException(Throwable arg0) { super(arg0); - + } /** @@ -71,8 +71,8 @@ public class LineErrorException extends Exception { */ public LineErrorException(String arg0, Throwable arg1) { super(arg0, arg1); - + } - + }
\ No newline at end of file diff --git a/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/OutputHandler.java b/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/OutputHandler.java index 997a522acedb..a874839a99a7 100755 --- a/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/OutputHandler.java +++ b/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/OutputHandler.java @@ -1,7 +1,7 @@ /************************************************************************* * * 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 @@ -26,7 +26,7 @@ ************************************************************************/ /* * Creates logfile and file for debug information - * + * */ package com.sun.star.tooling.converter; @@ -34,11 +34,11 @@ import java.io.BufferedWriter; import java.io.IOException; /** - * Handle the whole output during converting process except the converted files. - * Write output to logfiles and to screen depending on switches given + * Handle the whole output during converting process except the converted files. + * Write output to logfiles and to screen depending on switches given * at command line. * @author Christian Schmidt 2005 - * + * */ public class OutputHandler { @@ -67,7 +67,7 @@ public class OutputHandler { /** * Write the data to screen and if the switches were set to * logfile and debugfile - * + * * @param out the String to write */ final static void out(String out) { @@ -100,9 +100,9 @@ public class OutputHandler { } /** - * write the data to log file and if the switch is set + * write the data to log file and if the switch is set * to the debug file - * + * * @param out the String to write */ final static void log(String out) { @@ -127,7 +127,7 @@ public class OutputHandler { /** * write the string to the debug file - * + * * @param out the String to write * @throws IOException */ @@ -145,7 +145,7 @@ public class OutputHandler { /** * Set a new value to indicate whether a debug file should be written or not - * + * * @param doDebug * The debug value to set. */ @@ -153,16 +153,16 @@ public class OutputHandler { OutputHandler.doDebug = doDebug; } - // /** - // * @return Returns the doDebug. - // */ - // private static boolean isDebug() { - // return doDebug; - // } + // /** + // * @return Returns the doDebug. + // */ + // private static boolean isDebug() { + // return doDebug; + // } /** - * Set the debug file to write to. - * + * Set the debug file to write to. + * * @param dbgFile * The debug File to use. */ diff --git a/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/ResTypeResolver.java b/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/ResTypeResolver.java index 585f69fe2c88..7466660c1a9d 100755 --- a/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/ResTypeResolver.java +++ b/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/ResTypeResolver.java @@ -1,7 +1,7 @@ /************************************************************************* * * 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 @@ -26,7 +26,7 @@ ************************************************************************/ /* * Created on 2005 - * by Christian Schmidt + * by Christian Schmidt */ package com.sun.star.tooling.converter; @@ -35,7 +35,7 @@ import java.util.Map; /** * Helps resolving restype descriptors used outside the tool to * restype descriptors used by this tool - * + * * @author Christian Schmidt 2005 * */ @@ -44,20 +44,20 @@ public class ResTypeResolver { final static String[] outFields={"res","res-quickhelp","res-help","res-title"}; final static Map internKeys=new ExtMap(inFields,outFields); final static Map externKeys=new ExtMap(outFields,inFields); - + /** * Get the intern key depending to the given extern key - * + * * @param externKey the externKey {"res","res-quickhelp","res-help","title"} * @return the depending intern key */ public static String getInternKey(String externKey){ return (String)externKeys.get(externKey); } - + /** * Get the extern key to the given intern key - * + * * @param internKey the internal key * @return the external key */ diff --git a/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/Resolver.java b/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/Resolver.java index 557731fe88f1..88f2235e0995 100755 --- a/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/Resolver.java +++ b/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/Resolver.java @@ -1,7 +1,7 @@ /************************************************************************* * * 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 @@ -51,7 +51,7 @@ public class Resolver implements EntityResolver { /** * Allow the application to resolve external entities. - * + * * The Parser will call this method before opening any external entity * except the top-level document entity (including the external DTD subset, * external entities referenced within the DTD, and external entities @@ -59,11 +59,11 @@ public class Resolver implements EntityResolver { * the parser resolve the entity itself, that it use an alternative URI, or * that it use an entirely different input source. */ - + /* (non-Javadoc) * @see org.xml.sax.EntityResolver#resolveEntity(java.lang.String, java.lang.String) */ - + public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException { diff --git a/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/SDFReader.java b/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/SDFReader.java index 9e47ae73c719..9b5d0ac41c2a 100755 --- a/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/SDFReader.java +++ b/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/SDFReader.java @@ -1,7 +1,7 @@ /************************************************************************* * * 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 @@ -27,7 +27,7 @@ /* * SDFReader.java * - * + * */ package com.sun.star.tooling.converter; @@ -39,25 +39,25 @@ import java.io.InputStreamReader; import java.text.DecimalFormat; import java.util.*; -/** - * - * SDFReader is a FileReader that knows about +/** + * + * SDFReader is a FileReader that knows about * the content of SDFFiles - * - * A SDFBlock is read of the given file. A SDFBlock - * consists of all SDFLines that are traanslations of the + * + * A SDFBlock is read of the given file. A SDFBlock + * consists of all SDFLines that are traanslations of the * same String and the SDFLine containing the source string * itself. SDFFile lines are read and checked whether they - * have the allowed column count and don't contain illeagal + * have the allowed column count and don't contain illeagal * characters (like most unprintable characters below 0x00df). - * If the given source language is not found in the first - * block of SDFLines a ConverterException is thrown at runtime. + * If the given source language is not found in the first + * block of SDFLines a ConverterException is thrown at runtime. * If the given target language is "" (that means not given) - * the first language that is not the given source language + * the first language that is not the given source language * is taken for target language. The found values are returned in HashMaps that * use the following keys: * <br/> - * "BlockNr" originally coming from reading the sdf file, contains 'block nr in sdf file'+'-'+'hash value of the sdf id fields'.<br/> + * "BlockNr" originally coming from reading the sdf file, contains 'block nr in sdf file'+'-'+'hash value of the sdf id fields'.<br/> * "Project" first column in sdf file format.<br/> * "SourceFile" second column in sdf file format.<br/> * "Dummy" third column in sdf file format.<br/> @@ -67,20 +67,20 @@ import java.util.*; * "HID" 7. column in sdf file format.<br/> * "Platform" 8. column in sdf file format. <br/> * "Width", 9. column in sdf file format.<br/> - * "SourceLanguageID" 10. column in sdf file format(in the line with the source language).<br/> + * "SourceLanguageID" 10. column in sdf file format(in the line with the source language).<br/> * "SourceText" 11. column in sdf file format(in the line with the source language).<br/> * "SourceHText" 12. column in sdf file format(in the line with the source language).<br/> * "SourceQText" 13. column in sdf file format(in the line with the source language).<br/> - * "SourceTitle" 14. column in sdf file format(in the line with the source language).<br/> + * "SourceTitle" 14. column in sdf file format(in the line with the source language).<br/> * "TargetLanguageID" 10. column in sdf file format (in the line with the target language).<br/> * "TargetText" 11. column in sdf file format (in the line with the target language).<br/> * "TargetHText" 12. column in sdf file format (in the line with the target language).<br/> * "TargetQText" 13. column in sdf file format (in the line with the target language).<br/> * "TargetTitle", 14. column in sdf file format (in the line with the target language).<br/> * "TimeStamp" 15. column in sdf file format.<br/> - * + * * @author Christian Schmidt 2005 - * + * */ public class SDFReader extends DataReader { @@ -132,7 +132,7 @@ public class SDFReader extends DataReader { * language line */ private Map[] data = { sourceMap, targetMap }; - + /** * The Id of the current SDFBlock */ @@ -142,7 +142,7 @@ public class SDFReader extends DataReader { * The SDF file to read from */ private File sourceFile; - + /** * The language in the source file that should be handelt as source language */ @@ -152,12 +152,12 @@ public class SDFReader extends DataReader { * The language in the source file that should be handelt as target language */ protected String targetLanguage; - + /** * A counter holding the number of blocks just read * from this file */ - private long blockNr = 0;// If we use Integer, more then numbers greater than 128k would be signed + private long blockNr = 0;// If we use Integer, more then numbers greater than 128k would be signed /** * A counter holding the number of skipped lines that means @@ -166,18 +166,18 @@ public class SDFReader extends DataReader { private int skippedLines = 0; /** - * This switch is set for indicating that all source file lines + * This switch is set for indicating that all source file lines * are read and no lines remain buffered. Finding this like 'true' - * means the source file is finished + * means the source file is finished */ private boolean endIt = false; /** - * Indicates whether the targetLanguage is found in this source file so far + * Indicates whether the targetLanguage is found in this source file so far */ private boolean foundTarget = false; /** - * Indicates whether the sourceLanguage is found in this source file so far + * Indicates whether the sourceLanguage is found in this source file so far */ private boolean foundSource = false; @@ -213,7 +213,7 @@ public class SDFReader extends DataReader { * Counts the blocks without targetLanguage */ private int targetLangMiss; - + /** * Counts the blocks without sourceLanguage */ @@ -237,12 +237,12 @@ public class SDFReader extends DataReader { /** * Create a new Instance of SDFREader - * - * @param source the file to read from + * + * @param source the file to read from * @param sourceLanguage the sourceLanguage (must not be empty) * @param targetLanguage the targetLanguage * @param charset the charset used to read source - * @throws java.io.IOException + * @throws java.io.IOException * @throws Exception */ public SDFReader(File source, String sourceLanguage, String targetLanguage, @@ -260,7 +260,7 @@ public class SDFReader extends DataReader { if ((splitLine = split(line)) != null){ this.CurrentBlockId = getSDFBlockId(splitLine); this.CurrentBlockHash=this.CurrentBlockId.hashCode(); - //found the first + //found the first this.blockNr++; } this.splittedLineBuffer = splitLine; @@ -268,12 +268,12 @@ public class SDFReader extends DataReader { reset(); } - + /* (non-Javadoc) * @see com.sun.star.tooling.converter.DataReader#getData() */ public Map getData()throws IOException { - + Map map=new HashMap(); // do { this.skip=false; @@ -287,17 +287,17 @@ public class SDFReader extends DataReader { }else{ map.putAll(help[1]); map.putAll(help[0]); - + } -// }while(this.skip=true); +// }while(this.skip=true); return map; } /** - * Read a Block from the sdf file and return + * Read a Block from the sdf file and return * @return a Map[] where [0] holds the source and [1] the target language data. - * + * * @throws java.io.IOException */ public Map[] readBlock() throws java.io.IOException { @@ -317,13 +317,13 @@ public class SDFReader extends DataReader { line = this.lineBuffer; splittedLine = this.splittedLineBuffer; this.SDFMap = new ExtMap(SDFReader.fieldnames, splittedLine); - + try { checkLanguage(splittedLine); } catch (ConverterException e) { throw e; }finally{ - + useBuffer = false; } } else { @@ -358,7 +358,7 @@ public class SDFReader extends DataReader { * we found the next block , but do we have the * target text? */ - + if (!foundTarget) { createTargetLine(); } @@ -402,7 +402,7 @@ public class SDFReader extends DataReader { } } catch (LineErrorException e) { - + OutputHandler.log(e.getMessage()); this.skippedLines++; } catch (ConverterException e) { @@ -442,7 +442,7 @@ public class SDFReader extends DataReader { } /** - * + * */ private void createTargetLine() { targetLangMiss++; @@ -466,7 +466,7 @@ public class SDFReader extends DataReader { /** * Show the statistic information got while * reading the file - * + * * @throws IOException */ private void showStat() throws IOException { @@ -493,13 +493,13 @@ public class SDFReader extends DataReader { } /** - * Check the current line whether the source language + * Check the current line whether the source language * or target language is in it - * + * * @throws ConverterException if a not needed language or no target language is found - * in this block + * in this block * @throws IOException - * + * */ final private void checkLanguage(String[] splittedLine) throws ConverterException, IOException { @@ -509,7 +509,7 @@ public class SDFReader extends DataReader { if (!foundSource && this.sourceLanguage.equals(langID)) { // found the next source language line this.data[0] = new ExtMap(SDFReader.sourceLineNames, splittedLine); - + // this.data[0].put("BlockNr", Integer.toHexString(blockNr)); // this.data[0].put("BlockHash", Integer.toHexString(this.CurrentBlockHash)); this.data[0].put("BlockNr", blockNrFormatter.format(blockNr)+'-'+Integer.toHexString(this.CurrentBlockHash)); @@ -533,7 +533,7 @@ public class SDFReader extends DataReader { + this.sourceLanguage + " "); OutputHandler.out("Target Language is: " + this.targetLanguage + " "); - OutputHandler.out(EMPTY); + OutputHandler.out(EMPTY); System.out.println("Start"); } else { @@ -572,8 +572,8 @@ public class SDFReader extends DataReader { } /** - * split the SDFLine in its columns - * + * split the SDFLine in its columns + * * @param line the current SDFLine * @return the splitted SDFLine as array of String * or null if an error occours @@ -592,9 +592,9 @@ public class SDFReader extends DataReader { /** * create a block Id from a splitted SDFLine * the blockId consists of the column one to eight of an SDF File - * + * * @param splitLine the line to create a block id from - * @return the blockId as String + * @return the blockId as String */ private String getSDFBlockId(String[] splitLine) { StringBuffer BlockId = new StringBuffer(""); @@ -610,11 +610,11 @@ public class SDFReader extends DataReader { /** * Check if there are not allowed characters in this line - * + * * @param line the SDFLine to check * @return if everything, ok the original * else the wrong character as String - * + * * @throws java.io.IOException */ private String check(String line) throws java.io.IOException { diff --git a/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/SDFWriter.java b/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/SDFWriter.java index 4c79cd113f6f..d66b21ce90f3 100755 --- a/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/SDFWriter.java +++ b/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/SDFWriter.java @@ -1,7 +1,7 @@ /************************************************************************* * * 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 @@ -27,7 +27,7 @@ /* * SDFWriter.java * - * + * */ package com.sun.star.tooling.converter; @@ -35,8 +35,8 @@ import java.io.*; import java.util.Map; /** - * Write data to a SDFFile - * + * Write data to a SDFFile + * * @author Christian Schmidt 2005 * */ @@ -57,7 +57,7 @@ public class SDFWriter extends DataWriter { * an array of the SDF files column names if the source and the target language is in */ final static String[] outLineNames= {"BlockNr","Project","SourceFile","Dummy","ResType","GID","LID","HID","Platform","Width","SourceLanguageID","SourceText","SourceHText","SourceQText","SourceTitle","TargetLanguageID","TargetText","TargetHText","TargetQText","TargetTitle","TimeStamp"}; - + /** * A Map holding the source language line content */ @@ -80,31 +80,31 @@ public class SDFWriter extends DataWriter { * The language to translate to */ private String targetLanguage; - + // private boolean SourceIsFirst=false; - - - - + + + + /** * Create a new Instance of SDFWriter - * + * * @param bos BufferedWriter to write to * @param charset the charset to use to write * @throws java.io.UnsupportedEncodingException */ public SDFWriter(BufferedOutputStream bos,String charset) throws java.io.UnsupportedEncodingException { super(bos,charset); - + } - + /* (non-Javadoc) * @see com.sun.star.tooling.converter.DataWriter#writeData() */ public final void writeData() throws java.io.IOException { - + StringBuffer buffer=new StringBuffer(""); - + // get the values of the found fields //create the two sdf lines @@ -120,7 +120,7 @@ public class SDFWriter extends DataWriter { // so close it with lf buffer.append(lineEnd); Converter.countLine(); - } + } } // is there a target line with anything in the strings? if (!(outData.get("TargetLanguageID")==null||((outData.get("TargetTitle").equals("")&&outData.get("TargetText").equals("")&&outData.get("TargetHText").equals("")&&outData.get("TargetQText").equals(""))))){ @@ -136,13 +136,13 @@ public class SDFWriter extends DataWriter { //so close it with lf buffer.append(lineEnd); Converter.countLine(); - } + } } } this.write(buffer.toString()); - + } - + /* (non-Javadoc) @@ -150,14 +150,14 @@ public class SDFWriter extends DataWriter { */ protected void writeData(Map[] data) throws IOException { // TODO redesign DataHandler in the way that this is not nessesary any more - + } /* (non-Javadoc) * @see com.sun.star.tooling.converter.DataWriter#getDataFrom(com.sun.star.tooling.converter.DataHandler) */ protected void getDataFrom(DataHandler handler) throws IOException { - + handler.putDataTo(this.outData); } @@ -165,8 +165,8 @@ public class SDFWriter extends DataWriter { * @see com.sun.star.tooling.converter.DataWriter#getDatafrom(com.sun.star.tooling.converter.DataHandler) */ protected void getDatafrom(DataHandler handler) throws IOException { - + handler.putDataTo(this.outData); - + } } diff --git a/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/XLIFFReader.java b/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/XLIFFReader.java index 76d14bd98569..88242070a538 100755 --- a/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/XLIFFReader.java +++ b/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/XLIFFReader.java @@ -1,7 +1,7 @@ /************************************************************************* * * 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 @@ -27,7 +27,7 @@ /* * XLIFFReader.java * - * + * */ package com.sun.star.tooling.converter; @@ -47,13 +47,13 @@ import org.xml.sax.helpers.DefaultHandler; /** * Parse the given file and extract the content needed. * <br/> - * This Reader understands the parts of the + * This Reader understands the parts of the * <a href="http://www.oasis-open.org/committees/xliff/documents/cs-xliff-core-1.1-20031031.htm">xliff</a> spezification used to translate * the strings in Star-Office and Open-Office. * <br/> * The given file is parsed and the content is stored in a HashMap with those keys: * <br/> - * "BlockNr" originally coming from reading the sdf file, contains 'block nr in sdf file'+'-'+'hash value of the sdf id fields'.<br/> + * "BlockNr" originally coming from reading the sdf file, contains 'block nr in sdf file'+'-'+'hash value of the sdf id fields'.<br/> * "Project" first column in sdf file format.<br/> * "SourceFile" second column in sdf file format.<br/> * "Dummy" third column in sdf file format.<br/> @@ -63,11 +63,11 @@ import org.xml.sax.helpers.DefaultHandler; * "HID" 7. column in sdf file format.<br/> * "Platform" 8. column in sdf file format. <br/> * "Width", 9. column in sdf file format.<br/> - * "SourceLanguageID" 10. column in sdf file format(in the line with the source language).<br/> + * "SourceLanguageID" 10. column in sdf file format(in the line with the source language).<br/> * "SourceText" 11. column in sdf file format(in the line with the source language).<br/> * "SourceHText" 12. column in sdf file format(in the line with the source language).<br/> * "SourceQText" 13. column in sdf file format(in the line with the source language).<br/> - * "SourceTitle" 14. column in sdf file format(in the line with the source language).<br/> + * "SourceTitle" 14. column in sdf file format(in the line with the source language).<br/> * "TargetLanguageID" 10. column in sdf file format (in the line with the target language).<br/> * "TargetText" 11. column in sdf file format (in the line with the target language).<br/> * "TargetHText" 12. column in sdf file format (in the line with the target language).<br/> @@ -81,7 +81,7 @@ import org.xml.sax.helpers.DefaultHandler; public class XLIFFReader extends DefaultHandler { /** - * A String array holding the keys used by the HashMap holding the Data + * A String array holding the keys used by the HashMap holding the Data */ private final String[] dataNames = { "BlockNr", "Project", "SourceFile", "Dummy", "ResType", "GID", "LID", "HID", "Platform", @@ -90,7 +90,7 @@ public class XLIFFReader extends DefaultHandler { "TargetHText", "TargetQText", "TargetTitle", "TimeStamp" }; /** - * Used to index in the data array + * Used to index in the data array */ static int index = 0; @@ -100,7 +100,7 @@ public class XLIFFReader extends DefaultHandler { private Map moveData = new ExtMap(); /** - * A Map that holds yet incomplete data + * A Map that holds yet incomplete data * until all depending transunits are found */ private Hashtable DataStore = new Hashtable(); @@ -128,7 +128,7 @@ public class XLIFFReader extends DefaultHandler { /** * data holds the information created while parsing - * + * */ private String[] data = new String[26]; @@ -164,7 +164,7 @@ public class XLIFFReader extends DefaultHandler { private String targetLanguage; /** - * indicates whether this is the first Transunit + * indicates whether this is the first Transunit */ private boolean isFirst = true; @@ -269,7 +269,7 @@ public class XLIFFReader extends DefaultHandler { * Index for the Found Parts Counter in the data array */ private static final int FOUND_PARTS_COUNTER_IDX = 18; - + /** * used to find the matching ISO or RFC3066 language code */ @@ -281,8 +281,8 @@ public class XLIFFReader extends DefaultHandler { /** * Create a new Instance of XLIFFReader - * - * @param handler the DataHandler to use + * + * @param handler the DataHandler to use * @param target the target used * @throws IOException */ @@ -291,21 +291,21 @@ public class XLIFFReader extends DefaultHandler { this.handler = handler; this.target = target; } - + /** * Create a new Instance of XLIFFReader - * - * @param handler the DataHandler to use + * + * @param handler the DataHandler to use * @param target the target used * @param doBlockCompleteCheck indicates whether every single transunit should be returned or the whole block data is to be collected - * + * * @throws IOException */ public XLIFFReader(DataHandler handler, DataWriter target,boolean doBlockCompleteCheck) throws IOException { this(handler, target); this.languageResolver = new LanguageResolver(); this.doBlockCompleteCheck=doBlockCompleteCheck; - + } /** @@ -374,7 +374,7 @@ public class XLIFFReader extends DefaultHandler { storeIt=true; return; - + } if (qName.equals("target")) { if ((resType = data[RESTYPE_IDX]) == null) { @@ -382,7 +382,7 @@ public class XLIFFReader extends DefaultHandler { } else { if ("res".equals(resType)) { index = TARGET_TEXT_IDX; - + storeIt = true; return; } @@ -393,13 +393,13 @@ public class XLIFFReader extends DefaultHandler { // } if ("res-QuickHelp".equals(resType)) { index = TARGET_QUICKHELP_TEXT_IDX; - + storeIt = true; return; } if ("res-Title".equals(resType)) { index = TARGET_TITLE_TEXT_IDX; - + storeIt = true; return; } @@ -412,7 +412,7 @@ public class XLIFFReader extends DefaultHandler { } else { if ("res".equals(resType)) { index = SOURCE_TEXT_IDX; - + storeIt = true; return; } @@ -450,7 +450,7 @@ public class XLIFFReader extends DefaultHandler { if (qName.equals("trans-unit")) { String id = attrs.getValue("id"); if ((DataStore.get(id)) != null) { - //TODO arraycopy might not be nessessary + //TODO arraycopy might not be nessessary System.arraycopy((String[]) DataStore.get(id), 0, data, 0, data.length); int help = (new Integer(data[FOUND_PARTS_COUNTER_IDX])).intValue(); //found one more part @@ -468,7 +468,7 @@ public class XLIFFReader extends DefaultHandler { } if (qName.equals("context")) { - + String value = attrs.getValue("context-type"); if ("SourceHelpText".equals(value)) { @@ -570,7 +570,7 @@ public class XLIFFReader extends DefaultHandler { * @see org.xml.sax.ErrorHandler#fatalError(org.xml.sax.SAXParseException) */ public void fatalError(SAXParseException e) throws SAXParseException { - + OutputHandler.log("PARSE ERROR in line " + e.getLineNumber() + ", " + e.getMessage() ); @@ -585,9 +585,9 @@ public class XLIFFReader extends DefaultHandler { } /** - * Put the Data to the DataHandler + * Put the Data to the DataHandler * tell the Writer to write it - * + * * @throws SAXException */ public void showData() throws SAXException { @@ -627,10 +627,10 @@ public class XLIFFReader extends DefaultHandler { initData(); } - + /** * put the data in an Map in the format that - * DataHandler can handle it + * DataHandler can handle it */ final public void moveData() { @@ -685,16 +685,16 @@ public class XLIFFReader extends DefaultHandler { /** * complete means all depending parts have been found esp. all res types * that belong to the same SDF Line - * + * * @return true if the data is complete - * + * */ final public boolean isComplete() { - + if(!doBlockCompleteCheck){ return true; } - + String sParts; if (data[FOUND_PARTS_COUNTER_IDX] == EMPTY) data[FOUND_PARTS_COUNTER_IDX] = "1"; //this is the first part @@ -713,7 +713,7 @@ public class XLIFFReader extends DefaultHandler { /** * show the user that it is going * on by printing dots on the screen - * + * */ private void makeDot() { int count = 0; @@ -725,7 +725,7 @@ public class XLIFFReader extends DefaultHandler { /** * show the statistic data found while parse this file - * + * * @throws IOException */ final void showStatistic() throws IOException { diff --git a/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/XLIFFWriter.java b/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/XLIFFWriter.java index d7b6160dcc95..15a618b0d6d6 100755 --- a/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/XLIFFWriter.java +++ b/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/XLIFFWriter.java @@ -1,7 +1,7 @@ /************************************************************************* * * 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 @@ -25,11 +25,11 @@ * ************************************************************************/ /* - * + * /* * XLIFFWriter.java * - * + * */ package com.sun.star.tooling.converter; @@ -42,8 +42,8 @@ import com.sun.star.tooling.languageResolver.LanguageResolver; import com.sun.star.tooling.languageResolver.LanguageResolver.LanguageResolvingException; /** - * Write the Data to a wellformed XLIFF File - * + * Write the Data to a wellformed XLIFF File + * * @author Christian Schmidt */ public class XLIFFWriter extends DataWriter { @@ -71,32 +71,32 @@ public class XLIFFWriter extends DataWriter { "SourceQText", "SourceTitle", "TargetLanguageID", "TargetText", "TargetHText", "TargetQText", "TargetTitle", "TimeStamp" }; /** - * An Map holding the source and target content + * An Map holding the source and target content */ private final Map data = new ExtMap(outLineNames, null); /** - * Indicates if this is the first Transunit to write + * Indicates if this is the first Transunit to write */ boolean isFirst = true; - + LanguageResolver languageResolver; - + /** * Create a new Instance of XLIFFWriter - * + * * @param bos the Buffered Output Stream to write to * @param charset the charset to use - * @throws IOException + * @throws IOException */ public XLIFFWriter(BufferedOutputStream bos, String charset) throws IOException { super(bos, charset); this.languageResolver =new LanguageResolver(); - - + + } /* (non-Javadoc) @@ -107,8 +107,8 @@ public class XLIFFWriter extends DataWriter { } /** - * check if the item is an empty String - * + * check if the item is an empty String + * * @param item the string to check * @return true if it is not empty, false if it is empty */ @@ -120,7 +120,7 @@ public class XLIFFWriter extends DataWriter { /** * Replaces all characters that mustn't be in XLIFF PCdata - * + * * @param string the string to check * @return the checked string with all characters replaced * @throws java.io.IOException @@ -129,17 +129,17 @@ public class XLIFFWriter extends DataWriter { if (string == null) return string; // "" String str = string; -// str = str.replaceAll("&", "&"); -// str = str.replaceAll("<", "<"); -// str = str.replaceAll(">", ">"); -// str = str.replaceAll("\"", """); -// str = str.replaceAll("'", "'"); +// str = str.replaceAll("&", "&"); +// str = str.replaceAll("<", "<"); +// str = str.replaceAll(">", ">"); +// str = str.replaceAll("\"", """); +// str = str.replaceAll("'", "'"); for(int i=0;i<str.length();i++){ if(str.charAt(i)=='&'){ str=str.substring(0, i)+"&"+str.substring(i+1); continue; } - + if(str.charAt(i)=='<'){ str=str.substring(0, i)+"<"+str.substring(i+1); continue; @@ -178,30 +178,30 @@ public class XLIFFWriter extends DataWriter { */ public void writeData() throws IOException { if (isFirst) { - + writeHeader(); isFirst = false; } try{ writeTransUnit(); }catch(DirtyTagWrapper.TagWrapperException e){ - + } } /** * Write the XLIFFFiles header - * + * * @throws IOException */ - private void writeHeader() throws IOException { + private void writeHeader() throws IOException { this.write(getHeader()); } /** * Write the XLIFFFiles Trailer - * + * * @throws IOException */ private void writeTrailer() throws IOException { @@ -210,20 +210,20 @@ public class XLIFFWriter extends DataWriter { /** * Write the next TransUnit - * + * * @throws IOException */ private void writeTransUnit() throws IOException, DirtyTagWrapper.TagWrapperException { try{ StringBuffer writeBuffer = new StringBuffer(1000); - + StringBuffer allLinesEnd = new StringBuffer(200); String sRessource = ""; int parts = 0; if (data == null) { OutputHandler.out("error");// TBD Exception } - + if (!(this.data.get("SourceText").equals("") || this.data.get( "SourceText").equals(" "))) { parts++; @@ -243,10 +243,10 @@ public class XLIFFWriter extends DataWriter { if (!(this.data.get("SourceText").equals("") || this.data.get( "SourceText").equals(" "))) { sRessource = "res"; // normal TEXT source - + allLinesEnd .append("\t\t\t\t<context-group name=\"StarOffice Attributes\">\n"); - + if (isUsed((String) this.data.get("ResType"))) allLinesEnd .append("\t\t\t\t\t<context context-type=\"DBType\">" @@ -299,7 +299,7 @@ public class XLIFFWriter extends DataWriter { + "</context>\n"); allLinesEnd.append("\t\t\t\t</context-group>\n" + "\t\t\t</trans-unit>\n"); - + writeBuffer.append("\t\t\t<trans-unit id=\"" + this.data.get("BlockNr") + ":" + parts + "\" restype=\"" + sRessource + "\" translate=\"yes\">\n"); @@ -308,7 +308,7 @@ public class XLIFFWriter extends DataWriter { + languageResolver.getRFCFromISO((String)this.data.get("SourceLanguageID")) + "\">" + DirtyTagWrapper.wrapString((String) this.data.get("SourceText")) + "</source>\n"); - + if (isUsed((String) this.data.get("TargetText"))) writeBuffer .append("\t\t\t\t<target state=\"to_translate\" xml:lang=\"" @@ -318,7 +318,7 @@ public class XLIFFWriter extends DataWriter { .get("TargetText")) + "</target>\n"); writeBuffer.append(allLinesEnd); Converter.countLine(); - + } // if(!(this.data.get("SourceHText").equals("")||this.data.get("SourceHText").equals(" // "))){ @@ -336,7 +336,7 @@ public class XLIFFWriter extends DataWriter { // writeBuffer.append(allLinesEnd); // Converter.countLine(); // } - + if (!(this.data.get("SourceQText").equals("") || this.data.get( "SourceQText").equals(" "))) { sRessource = "res-QuickHelp"; // Source is OuickHelp @@ -359,11 +359,11 @@ public class XLIFFWriter extends DataWriter { writeBuffer.append(allLinesEnd); Converter.countLine(); } - + if (!(this.data.get("SourceTitle").equals("") || this.data.get( "SourceTitle").equals(" "))) { sRessource = "res-Title"; // Source is Title - + writeBuffer.append("\t\t\t<trans-unit id=\"" + this.data.get("BlockNr") + ":" + parts + "\" restype=\"" + sRessource + "\" translate=\"yes\">\n");// always translate @@ -389,8 +389,8 @@ public class XLIFFWriter extends DataWriter { } /** - * Create the XLIFFFiles Header - * + * Create the XLIFFFiles Header + * * @return the header as string * @throws java.io.UnsupportedEncodingException */ @@ -399,18 +399,18 @@ public class XLIFFWriter extends DataWriter { (getProcessingInstructionTag() + getDTDLine() + openVersionLine() + openFileLine() + getHeaderTag() + openBodyTag()) .getBytes(), "UTF8"); - + } /** * Create the XLIFFFiles Trailer - * + * * @return the trailer as string */ private String getTrailer() { return closeBodyTag() + closeFileLine() + closeVersionLine(); } - + /** * Create the Processing Instruction Tag used by this XLIFFFile * @return the Processing Instruction Tag used by this XLIFFFile @@ -439,7 +439,7 @@ public class XLIFFWriter extends DataWriter { /** * Create the beginning of the line holding the version of this XIFFFile - * + * * @return a string with the beginning of the line holding the version of this XIFFFile */ private String openVersionLine() { @@ -447,7 +447,7 @@ public class XLIFFWriter extends DataWriter { } /** * Create the ending of the line holding the version of this XIFFFile - * + * * @return a string with the ending of the line holding the version of this XIFFFile */ private String closeVersionLine() { @@ -455,11 +455,11 @@ public class XLIFFWriter extends DataWriter { } /** * Create the beginning of the line holding the file tag of this XIFFFile - * + * * @return a string with the beginning of the file tag of this XIFFFile */ private String openFileLine() { - + String FileTagStart = "\t<file"; String FileDataType = " datatype=\"STAROFFICE\""; String FileDate = " date=\"" + this.data.get("TimeStamp") + "\""; @@ -478,11 +478,11 @@ public class XLIFFWriter extends DataWriter { String FileTagEnd = ">"; return FileTagStart + FileDataType + FileDate + FileOriginal + FileSourceLanguage + FileTargetLanguage + FileTagEnd; - + } /** * Create the ending of the line holding the file tag of this XIFFFile - * + * * @return a string with the ending of the file tag of this XIFFFile */ private String closeFileLine() { @@ -497,7 +497,7 @@ public class XLIFFWriter extends DataWriter { } /** * Create the begining of the line holding the body tag of this XIFFFile - * + * * @return a string with the begining of the body tag of this XIFFFile */ private String openBodyTag() { @@ -505,7 +505,7 @@ public class XLIFFWriter extends DataWriter { } /** * Create the ending of the line holding the body tag of this XIFFFile - * + * * @return a string with the ending of the body tag of this XIFFFile */ private String closeBodyTag() { @@ -514,7 +514,7 @@ public class XLIFFWriter extends DataWriter { /* * (non-Javadoc) - * + * * @see com.sun.star.tooling.converter.DataWriter#writeData(java.util.Map[]) */ protected void writeData(Map[] data) throws IOException { @@ -524,9 +524,9 @@ public class XLIFFWriter extends DataWriter { /* * (non-Javadoc) - * + * * @see com.sun.star.tooling.converter.DataWriter#getDataFrom(com.sun.star.tooling.converter.DataHandler) */ - protected void getDataFrom(DataHandler handler) { } + protected void getDataFrom(DataHandler handler) { } } |