org.objectweb.cjdbc.scenario.tools.util
Class TranslationCheck

java.lang.Object
  extended byorg.objectweb.cjdbc.scenario.tools.util.TranslationCheck

public class TranslationCheck
extends java.lang.Object

This looks at the language file and the java code to gather information on what translation tags are correct, missing ...

Author:
Nicolas Modrzyk

Nested Class Summary
(package private)  class TranslationCheck.InvalidTag
          This is a small class for storing invalid tag found in java files
 
Field Summary
(package private)  int analysedXslFile
           
(package private)  int analyseJavaFile
           
private  java.util.ArrayList configurationKeys
           
(package private) static java.lang.String EXCEPTION_TAG
           
private  java.util.ArrayList ignore
           
private  java.util.ArrayList invalidKeys
           
private  java.util.ArrayList javaFiles
           
private  java.util.ArrayList javaKeys
           
(package private) static java.lang.String LOGGER_TAG
           
(package private) static java.lang.String LOGGER_TEST
           
private  java.util.ArrayList missingLogger
           
private  java.util.ArrayList missingTranslations
           
private  java.util.ArrayList missingXslKeys
           
(package private) static java.lang.String TRANSLATE_TAG
           
(package private) static int TRANSLATE_TAG_LENGTH
           
private  java.lang.String translationFile
           
private  java.util.ArrayList usedXslKeys
           
private  java.lang.String userDir
           
private  java.util.ArrayList xslKeys
           
 
Constructor Summary
TranslationCheck()
          Creates a new translation checker object.
 
Method Summary
private  void analyseJava()
          Starts analysing the java code
private  void analyseXsl()
           
private  void analyseXslFile(java.io.File f)
           
 void displayTranslationState()
          Display the state of translation work
 java.util.ArrayList getConfigurationKeys()
           
 java.util.ArrayList getinvalidKeys()
           
 java.util.ArrayList getJavaKeys()
           
private  void getMissingTranslations()
          Computes the missing translations in the configuration file
 boolean isTranslationUpToDate()
          We need to know if all the valid keys in the java code are in the configuration file
private  boolean isValidTranslateTag(java.lang.String tmp)
          Should indicate whether the tag is valid or not
private  void processUnValidTag(java.lang.String description, java.io.File target, java.lang.String tmp, int line)
          We found an invalid tag, so let's store it.
private  boolean processValidTag(java.lang.String tmp)
          We found a valid tag so let's take the key from it
private  void searchForKeys(java.io.File target)
          Recursivly searches the file target for java files
private  void searchJavaFile(java.io.File target)
          We have found a java file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TRANSLATE_TAG

static final java.lang.String TRANSLATE_TAG
See Also:
Constant Field Values

LOGGER_TAG

static final java.lang.String LOGGER_TAG
See Also:
Constant Field Values

LOGGER_TEST

static final java.lang.String LOGGER_TEST
See Also:
Constant Field Values

EXCEPTION_TAG

static final java.lang.String EXCEPTION_TAG
See Also:
Constant Field Values

TRANSLATE_TAG_LENGTH

static final int TRANSLATE_TAG_LENGTH

translationFile

private java.lang.String translationFile

ignore

private java.util.ArrayList ignore

userDir

private final java.lang.String userDir

analysedXslFile

int analysedXslFile

analyseJavaFile

int analyseJavaFile

xslKeys

private java.util.ArrayList xslKeys

missingXslKeys

private java.util.ArrayList missingXslKeys

usedXslKeys

private java.util.ArrayList usedXslKeys

configurationKeys

private java.util.ArrayList configurationKeys

javaKeys

private java.util.ArrayList javaKeys

invalidKeys

private java.util.ArrayList invalidKeys

missingTranslations

private java.util.ArrayList missingTranslations

missingLogger

private java.util.ArrayList missingLogger

javaFiles

private java.util.ArrayList javaFiles
Constructor Detail

TranslationCheck

public TranslationCheck()
Creates a new translation checker object. This starts analysing the java code when instanciated

Method Detail

getMissingTranslations

private void getMissingTranslations()
Computes the missing translations in the configuration file

Returns:
an ArrayList of tags where the associated translation is an empty string

analyseXsl

private void analyseXsl()

analyseXslFile

private void analyseXslFile(java.io.File f)

analyseJava

private void analyseJava()
Starts analysing the java code


searchForKeys

private void searchForKeys(java.io.File target)
Recursivly searches the file target for java files

Parameters:
target - file to search into

isValidTranslateTag

private boolean isValidTranslateTag(java.lang.String tmp)
Should indicate whether the tag is valid or not

Parameters:
tmp - taken from java file after translate tag has been found
Returns:
true if tmp contains no '+' sign, false otherwise We could use regexp in the near future for better guessing

processValidTag

private boolean processValidTag(java.lang.String tmp)
We found a valid tag so let's take the key from it

Parameters:
tmp - string that could be a key
Returns:
true if tmp was a key and was added to the javaKeys list, false if we should further process it.

processUnValidTag

private void processUnValidTag(java.lang.String description,
                               java.io.File target,
                               java.lang.String tmp,
                               int line)
We found an invalid tag, so let's store it.

Parameters:
target - file where it was found
tmp - the tag content
line - where the invalid tag was found

searchJavaFile

private void searchJavaFile(java.io.File target)
We have found a java file. We first check it is not in the ignore list and then we look for the Translate.get string

Parameters:
target - file to process

getConfigurationKeys

public java.util.ArrayList getConfigurationKeys()
Returns:
Returns the configurationKeys.

getJavaKeys

public java.util.ArrayList getJavaKeys()
Returns:
Returns the javaKeys.

getinvalidKeys

public java.util.ArrayList getinvalidKeys()
Returns:
Returns the invalidKeys.

isTranslationUpToDate

public boolean isTranslationUpToDate()
We need to know if all the valid keys in the java code are in the configuration file

Returns:
true if all are there... will probably be false at this stage though !

displayTranslationState

public void displayTranslationState()
Display the state of translation work



Copyright © 2002, 2005 - ObjectWeb Consortium - All Rights Reserved.