|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object file2xliff4j.TuStrings
public class TuStrings
This class encapsulates the target strings that an XLIFF file contains for a specified language. (Note: It might be later enhanced to be able to hold the source strings rather than a target string.)
Constructor Summary | |
---|---|
TuStrings()
Creates a new instance of TuStrings |
Method Summary | |
---|---|
static java.lang.String |
escapeTuString(java.lang.String in)
Escape string to store safely as valid XML |
java.lang.String |
getTu(java.lang.String id)
Passed a trans-unit identifier, return the target string associated with it. |
java.lang.String |
getTu(java.lang.String id,
java.lang.String datatype)
Passed a trans-unit identifier, return the target string associated with it. |
java.lang.String |
getTu(java.lang.String id,
java.lang.String datatype,
boolean followNextAttr)
Passed a trans-unit identifier, return the target string associated with it. |
java.lang.String |
getTu(java.lang.String id,
java.lang.String datatype,
boolean followNextAttr,
boolean validate)
Passed a trans-unit identifier, return the target string associated with it. |
void |
loadStrings(java.lang.String xliffFile,
java.util.Locale lang,
java.lang.String phaseName,
int maxPhase,
boolean ampEntities)
Passed the name of an XLIFF file and a target Locale, read the strings for the specified locale from the file and place them in a HashMap for later access. |
static java.lang.String |
unEscapeTuString(java.lang.String in)
Un-do the escaping performed by escapeTuString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public TuStrings()
Method Detail |
---|
public java.lang.String getTu(java.lang.String id)
id
- The trans-unit identifier
public java.lang.String getTu(java.lang.String id, java.lang.String datatype)
id
- The trans-unit identifierdatatype
- The datatype of the native file from which the XLIFF was
created
public java.lang.String getTu(java.lang.String id, java.lang.String datatype, boolean followNextAttr)
id
- The trans-unit identifierdatatype
- The datatype of the native file from which the XLIFF was
createdfollowNextAttr
- Boolean value indicating whether to follow the
lt:next-tu-id attribute (referring to a "chain" of adjacent
sentence segments). If set to true, the return string will
include multiple TUs concatenated together.
public java.lang.String getTu(java.lang.String id, java.lang.String datatype, boolean followNextAttr, boolean validate)
id
- The trans-unit identifierdatatype
- The datatype of the native file from which the XLIFF was
createdfollowNextAttr
- Boolean value indicating whether to follow the
lt:next-tu-id attribute (referring to a "chain" of adjacent
sentence segments). If set to true, the return string will
include multiple TUs concatenated together.validate
- If true: in the process of retrieving the target, validate
(and repair if appropriate) the core text of the target. If false:
don't validate (and repair).
public void loadStrings(java.lang.String xliffFile, java.util.Locale lang, java.lang.String phaseName, int maxPhase, boolean ampEntities) throws ConversionException
xliffFile
- Fully-qualified name of the xliff filelang
- The language whose strings we're interested in.phaseName
- The phase-name of the targets we are requesting. If your
XLIFF doesn't use targets, specify null, and loadStrings will
use the first target it finds for each target language.
If phaseName if formatted like an integer greater than 1 and a matching phase is not found, loadStrings will search recursively for a matching target, decrementing the phase "number" until phase "1" has been reached.
maxPhase
- If phaseName is specified as "0" and maxPhase is
a non-negative integer, search for the highest "numbered" phase,
starting at maxPhase, and searching down to phase "1".ampEntities
- If true, convert all bare ampersands (in error messages
for "not yet translated" segments) to the amp entity.
ConversionException
- If unable to load the XLIFF filepublic static java.lang.String escapeTuString(java.lang.String in)
in
- String to be escaped.
public static java.lang.String unEscapeTuString(java.lang.String in)
in
- String to be unescaped.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |