de.olafpanz.translationtable
Class ODSLoader

java.lang.Object
  extended by de.olafpanz.translationtable.ODSLoader

final class ODSLoader
extends java.lang.Object

Create translation files from .odt table: - Interface that defines all translation keys. This ensures that keys are only used once - Translation table for all specified languages. - Error messages for wrong formats

Author:
Olaf Panz

Field Summary
private static java.lang.String CONTENT_NAME
          Name of the content file within the ods file.
private  org.w3c.dom.Document doc
          The document to process.
private  TranslationTableParameters param
          Parameters for creation.
 
Constructor Summary
ODSLoader(TranslationTableParameters param)
          Create new class to create the translation table.
 
Method Summary
 java.util.List<TranslationDocument> load()
          Create translations tables for one file
private  java.lang.String readCellValue(org.w3c.dom.NodeList rows, int row, int column)
          Read a column from a given row.
private  java.util.List<TranslationDocument> readSheet()
          Read the all pages from document.
private  TranslationDocument readTable(org.w3c.dom.Element table)
          Process one table
(package private) static java.util.Locale toLocale(java.lang.String locString)
          Create locale from string
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CONTENT_NAME

private static final java.lang.String CONTENT_NAME
Name of the content file within the ods file.

See Also:
Constant Field Values

doc

private org.w3c.dom.Document doc
The document to process.


param

private final TranslationTableParameters param
Parameters for creation.

Constructor Detail

ODSLoader

public ODSLoader(TranslationTableParameters param)
Create new class to create the translation table.

Parameters:
param - Parameters for code generation
Method Detail

load

public java.util.List<TranslationDocument> load()
                                         throws java.io.IOException,
                                                javax.xml.parsers.ParserConfigurationException,
                                                org.xml.sax.SAXException
Create translations tables for one file

Returns:
List of loaded translation tables.
Throws:
java.io.IOException - File loading might mail.
javax.xml.parsers.ParserConfigurationException - Parsing of document might fail
org.xml.sax.SAXException - Parsing of document might fail

toLocale

static final java.util.Locale toLocale(java.lang.String locString)
Create locale from string

Parameters:
locString - The locale string
Returns:
The created locale.

readCellValue

private final java.lang.String readCellValue(org.w3c.dom.NodeList rows,
                                             int row,
                                             int column)
Read a column from a given row.

Parameters:
rows - List of rows in xml
row - The row to use
column - The column index
Returns:
null, if value is not specified.

readSheet

private final java.util.List<TranslationDocument> readSheet()
Read the all pages from document.

Returns:
List of loaded documents.

readTable

private final TranslationDocument readTable(org.w3c.dom.Element table)
Process one table

Parameters:
table - The table to process.
Returns:
Table read from file.