org.tigris.scarab.util.build.l10nchecker
Class L10nInspector

java.lang.Object
  extended byorg.tigris.scarab.util.build.l10nchecker.L10nInspector

public class L10nInspector
extends java.lang.Object

Scarab language checker.

A L10nInspector represents a class that is reading a property file (see setReference(String)) containing l10n properties as a reference and then running through a given list of other property files to check if all localisations that are needed are given.

A property language files that need to be checked against can be passed the reference file can be set by checkFile(String).

The results can be retrieved by using the get* methods.

Author:
sreindl

Constructor Summary
L10nInspector()
          Create a standard instance
 
Method Summary
 int checkFile(java.lang.String filename)
          Check an language file.
 java.util.List getErrors()
          Function to return only the errors that occured during parsing
 java.util.List getInfos()
          Generate a list of information messages generated during processing.
 java.util.List getMessages()
          Return the messages collected.
 java.util.List getWarnings()
          Return a list of warnings generated during processing
 boolean hasErrors()
          Check if the parsing/checking resulted in errors.
static void main(java.lang.String[] args)
          Main line.
 int setReference(java.lang.String aRefFile)
          Set the reference file to be used.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

L10nInspector

public L10nInspector()
              throws org.apache.oro.text.regex.MalformedPatternException
Create a standard instance

Method Detail

setReference

public int setReference(java.lang.String aRefFile)
                 throws java.io.IOException
Set the reference file to be used. This call resets all internal variables and resets all counters

Parameters:
aRefFile - The file to be used as a reference
Throws:
java.io.IOException - In case the file cannot be read.

getErrors

public java.util.List getErrors()
Function to return only the errors that occured during parsing

Returns:
Returns the errors.

getWarnings

public java.util.List getWarnings()
Return a list of warnings generated during processing

Returns:
Returns the warnings.

getInfos

public java.util.List getInfos()
Generate a list of information messages generated during processing.

Returns:
Returns the information messages.

getMessages

public java.util.List getMessages()
Return the messages collected.

Returns:
messages

hasErrors

public boolean hasErrors()
Check if the parsing/checking resulted in errors.

Returns:
true if errors have been seen during loading/parsing

checkFile

public int checkFile(java.lang.String filename)
              throws java.io.IOException
Check an language file.

TODO: Sophisticated exception handling

Returns:
Number of (unique)translation entries
Throws:
java.io.IOException

main

public static void main(java.lang.String[] args)
Main line.

The pathes here are hardcoded, please change accordingly if you want to use the test main code



Copyright © 2000-2004 Tigris.org. All Rights Reserved.