Class AITranslatePropertyWrapper
- java.lang.Object
-
- com.composum.ai.aem.core.impl.autotranslate.AITranslatePropertyWrapper
-
public class AITranslatePropertyWrapper extends Object
-
-
Field Summary
Fields Modifier and Type Field Description static String
AI_MANUAL_CHANGE_SUFFIX
Suffix for a property name where a manual change is saved when a retranslation is done despite a manual modification.static String
AI_ORIGINAL_SUFFIX
Suffix for the property name of a property that saves the original value of the property, to track when it has to be re-translated.static String
AI_PREFIX
Prefix for property names of saved values.static String
AI_TRANSLATED_SUFFIX
Suffix for the property name of a property that saves the translated value of the property, to track whether it has been manually changed after automatic translation.static String
AI_TRANSLATION_ERRORMARKER
Attribute that is set on jcr:content of a page when the translation of a page failed, to make it easy to find such pages.static String
LC_PREFIX
Prefix for property names changed to language copiesstatic String
PROPERTY_AI_ADDINSTRUCTIONS
PageContent only property: saves the additional instructions the page was translated with.static String
PROPERTY_AI_TRANSLATED_BY
Saves user who triggered the automatic translation of the resource.static String
PROPERTY_AI_TRANSLATED_DATE
Saves the date when a resource was automatically translated.static String
PROPERTY_AI_TRANSLATED_MODEL
Informationally, saves the model that was used.
-
Constructor Summary
Constructors Constructor Description AITranslatePropertyWrapper(org.apache.sling.api.resource.ValueMap sourceValueMap, org.apache.sling.api.resource.ModifiableValueMap targetValueMap, String propertyName)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description String[]
allAiKeys()
String[]
allGeneralKeys()
String[]
allKeys()
String[]
allLcKeys()
String
getCurrentValue()
String
getLcOriginal()
String
getLcTranslated()
String
getOriginal()
String
getOriginalCopy()
String
getTranslatedCopy()
boolean
hasSavedTranslation()
protected static boolean
isAiTranslateProperty(String name)
Checks whether a property was created by us and must not be translated etc.boolean
isOriginalAsWhenLastTranslating()
void
saveManualChange()
Currently not actually used, but save for differential retranslation.void
setAiTranslatedBy(String value)
void
setAiTranslatedDate(Calendar value)
void
setAiTranslatedModel(String value)
void
setCurrentValue(String value)
void
setLcOriginal(String value)
void
setLcTranslated(String value)
void
setOriginalCopy(String value)
void
setTranslatedCopy(String value)
-
-
-
Field Detail
-
PROPERTY_AI_ADDINSTRUCTIONS
public static final String PROPERTY_AI_ADDINSTRUCTIONS
PageContent only property: saves the additional instructions the page was translated with.- See Also:
- Constant Field Values
-
PROPERTY_AI_TRANSLATED_DATE
public static final String PROPERTY_AI_TRANSLATED_DATE
Saves the date when a resource was automatically translated. Find translated resources with /content//*[@ai_translated] .- See Also:
- Constant Field Values
-
PROPERTY_AI_TRANSLATED_BY
public static final String PROPERTY_AI_TRANSLATED_BY
Saves user who triggered the automatic translation of the resource.- See Also:
- Constant Field Values
-
PROPERTY_AI_TRANSLATED_MODEL
public static final String PROPERTY_AI_TRANSLATED_MODEL
Informationally, saves the model that was used.- See Also:
- Constant Field Values
-
AI_PREFIX
public static final String AI_PREFIX
Prefix for property names of saved values.- See Also:
- Constant Field Values
-
LC_PREFIX
public static final String LC_PREFIX
Prefix for property names changed to language copies- See Also:
- Constant Field Values
-
AI_ORIGINAL_SUFFIX
public static final String AI_ORIGINAL_SUFFIX
Suffix for the property name of a property that saves the original value of the property, to track when it has to be re-translated.- See Also:
- Constant Field Values
-
AI_TRANSLATED_SUFFIX
public static final String AI_TRANSLATED_SUFFIX
Suffix for the property name of a property that saves the translated value of the property, to track whether it has been manually changed after automatic translation.- See Also:
- Constant Field Values
-
AI_MANUAL_CHANGE_SUFFIX
public static final String AI_MANUAL_CHANGE_SUFFIX
Suffix for a property name where a manual change is saved when a retranslation is done despite a manual modification. Will be overwritten if another retranslation is done. Also keep original and translated values - as additional suffix.- See Also:
- Constant Field Values
-
AI_TRANSLATION_ERRORMARKER
public static final String AI_TRANSLATION_ERRORMARKER
Attribute that is set on jcr:content of a page when the translation of a page failed, to make it easy to find such pages. Not set byAITranslatePropertyWrapper
, but since all property names are defined here... Is set to the time at which the error occurred, to make it easy to find in the logs.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
AITranslatePropertyWrapper
public AITranslatePropertyWrapper(org.apache.sling.api.resource.ValueMap sourceValueMap, org.apache.sling.api.resource.ModifiableValueMap targetValueMap, String propertyName)
-
-
Method Detail
-
getOriginal
public String getOriginal()
-
getCurrentValue
public String getCurrentValue()
-
setCurrentValue
public void setCurrentValue(String value)
-
getOriginalCopy
public String getOriginalCopy()
-
setOriginalCopy
public void setOriginalCopy(String value)
-
getTranslatedCopy
public String getTranslatedCopy()
-
setTranslatedCopy
public void setTranslatedCopy(String value)
-
getLcOriginal
public String getLcOriginal()
-
setLcOriginal
public void setLcOriginal(String value)
-
getLcTranslated
public String getLcTranslated()
-
setLcTranslated
public void setLcTranslated(String value)
-
setAiTranslatedBy
public void setAiTranslatedBy(String value)
-
setAiTranslatedDate
public void setAiTranslatedDate(Calendar value)
-
setAiTranslatedModel
public void setAiTranslatedModel(String value)
-
saveManualChange
public void saveManualChange()
Currently not actually used, but save for differential retranslation.
-
hasSavedTranslation
public boolean hasSavedTranslation()
-
isOriginalAsWhenLastTranslating
public boolean isOriginalAsWhenLastTranslating()
-
allLcKeys
public String[] allLcKeys()
-
allAiKeys
public String[] allAiKeys()
-
allGeneralKeys
public String[] allGeneralKeys()
-
allKeys
public String[] allKeys()
-
isAiTranslateProperty
protected static boolean isAiTranslateProperty(String name)
Checks whether a property was created by us and must not be translated etc.
-
-