|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object | +--com.g11ntoolkit.levblock.XLEntry
The set of information that makes up one translation entry for a particular leverage entry block.
Each entry is made up of the locale, the string, the context, and optional comments. An XLEntry can be either a source entry or a target entry.
The locales are made up of a code for the language and a code for the country. Refer to the Locale Guide in the G11NToolKit documentation for more information on locales.
The context for the string is a TokContext object.
This program 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 General Public License for more details.
See License Agreement.
TokContext| Field Summary | |
protected java.lang.String |
datatype
The datatype for this entry block. |
private static java.util.logging.Logger |
log
The log used for all messages from this class. |
protected static java.util.ResourceBundle |
mrb
Message Resource Bundle. |
protected java.lang.String |
theComments
The comments for this entry block. |
protected TokContext |
theContext
The context for this entry block. |
protected java.util.Locale |
theLocale
The locale for this entry block. |
protected java.lang.String |
theString
The string for this entry block. |
protected static java.util.ResourceBundle |
vrb
Variables Resource Bundle. |
protected static java.util.ResourceBundle |
xliffrb
Resource Bundle for XLIFF File information. |
protected static java.util.ResourceBundle |
xrb
Constants, messages, and variables used by the tools and classes for XML processing. |
| Constructor Summary | |
XLEntry()
Constructs an empty instance so it is ready to receive data via the set methods. |
|
XLEntry(java.util.Locale aLocale,
java.lang.String aString)
Constructs an instance for the specified locale and string. |
|
XLEntry(java.util.Locale aLocale,
java.lang.String aString,
java.lang.String aComment)
Constructs an instance for the specified locale, string, and comments. |
|
| Method Summary | |
void |
addComment(java.lang.String aComment)
Adds the specified comment to the current comments. |
void |
addString(java.lang.String aString)
Adds the specified string to the current string. |
void |
clean()
Cleans the string for this entry. |
void |
debugDump()
Dumps the contents of the object to StdOut. |
boolean |
equals(java.lang.Object anotherEntry)
Returns true if this entry is equal to the specified object. |
boolean |
equals(XLEntry anotherEntry)
Returns true if this entry is equal to the specified entry. |
java.lang.String |
getComments()
Returns the comments for this entry. |
TokContext |
getContext()
Returns the context for this entry. |
java.lang.String |
getContextDisplay()
Returns the context for this entry in a displayable comment form. |
java.lang.String |
getDatatype()
Returns the data type of the source file. |
java.util.Locale |
getLocale()
Returns the locale for this entry. |
java.lang.String |
getString()
Returns the string for this entry. |
boolean |
hasComments()
Returns true if there are comments for this entry. |
boolean |
hasContext()
Returns true if there is a context set for this entry. |
int |
hashCode()
Returns a hash code for this entry. |
void |
setComments(java.lang.String aComment)
Sets the comments for this entry. |
void |
setContext(TokContext aContext)
Sets the context for this entry. |
void |
setDatatype(java.lang.String dt)
Sets the data type of the source file. |
void |
setString(java.util.Locale aLocale,
java.lang.String aString)
Sets the locale and string for this entry. |
java.lang.String |
toString()
Returns a displayable string of the contents of this entry. |
boolean |
validate()
Returns true if this entry has a locale and a string. |
void |
writeFlatXML(java.io.Writer out)
Writes the string to the specified output writer in a flat XML form. |
void |
writeXML(java.io.Writer out)
Writes the string out to the specified output writer in its XML form. |
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
private static java.util.logging.Logger log
protected static java.util.ResourceBundle mrb
protected static java.util.ResourceBundle xliffrb
protected static java.util.ResourceBundle vrb
protected static java.util.ResourceBundle xrb
protected java.util.Locale theLocale
protected java.lang.String theString
protected java.lang.String theComments
protected TokContext theContext
protected java.lang.String datatype
This is needed for the XLIFF file format. The value must be one of the values specified in the xliff.datatype section of the xliffres.java file.
xliffres| Constructor Detail |
public XLEntry()
public XLEntry(java.util.Locale aLocale,
java.lang.String aString)
aLocale - a Locale objectaString - a String specifying the string for this entry
public XLEntry(java.util.Locale aLocale,
java.lang.String aString,
java.lang.String aComment)
aLocale - a Locale objectaString - a String specifying the string for this entryaComment - a String specifying a comment for this entry| Method Detail |
public void setString(java.util.Locale aLocale,
java.lang.String aString)
If the locale or string are already specified they will be replaced.
aLocale - a Locale objectaString - a String specifying the string for this entrygetString()public void addString(java.lang.String aString)
The specified string is added to the end of the current string. No extra blank or new line characters are added to the string.
aString - a String specifying an additional string for this entrypublic void setComments(java.lang.String aComment)
Tries to make the comment a context. If it is an invalid context string then the string is treated as a comment.
If the comments are already specified they will be replaced.
If the string begins with the comment delimiter, the delimiter is removed before making the string the comment.
aComment - a String specifying the comments valuegetComments()public void addComment(java.lang.String aComment)
Tries to make the comment a context. If it is an invalid context string then the string is treated as a comment.
A single blank will be added to the comments before the specified comment is added.
If the string begins with the comment delimiter, the delimiter is removed before adding the string to the comments.
aComment - a String specifying the comments valuepublic void setContext(TokContext aContext)
aContext - a TokContext object specifying the context valuegetContext()public TokContext getContext()
setContext(com.g11ntoolkit.levblock.TokContext)public java.lang.String getContextDisplay()
public java.util.Locale getLocale()
public java.lang.String getString()
setString(java.util.Locale, java.lang.String)public java.lang.String getComments()
setComments(java.lang.String)public boolean hasContext()
public boolean hasComments()
public void setDatatype(java.lang.String dt)
dt - a String specifying the data type of the source filegetDatatype(),
datatypepublic java.lang.String getDatatype()
setDatatype(java.lang.String),
datatypepublic void clean()
Cleaning the string entails the reduction of all whitespace, which is outside any quoted string, to a single blank.
public java.lang.String toString()
toString in class java.lang.Object
public void writeXML(java.io.Writer out)
throws java.io.IOException
out - a Writer for the output
java.io.IOException - when any errors are detected in writing to the output file
public void writeFlatXML(java.io.Writer out)
throws java.io.IOException
The flat XML form just makes the Context element attributes of the String element.
This is done to accomodate the use of the StrFile in SDLX.
out - a Writer for the output
java.io.IOException - when any errors are detected in writing to the output filepublic boolean equals(XLEntry anotherEntry)
All parts of the entry except the comments must be equal to qualify for equality.
anotherEntry - a XLEntry object
XLEntry is equal to anotherEntrypublic boolean equals(java.lang.Object anotherEntry)
All parts of the entry except the comments must be equal to qualify for equality.
equals in class java.lang.ObjectanotherEntry - an Object purporting to be an XLEntry
Object is an XLEntry and is equal to this objectpublic int hashCode()
The hash code for an XL entry is defined as the sum of the hash code for the locale and the hash code for the string.
hashCode in class java.lang.Objectpublic boolean validate()
Since the entry can be built up a piece at a time there needs to be some way to say that the entry is well formed at any point. Well formed means that the entry has a locale and a string. It is not required to have any comments.
XLEntry is validpublic void debugDump()
StdOut.
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||