Class AbstractSplittedStringTranslationExistTranslationProvider
java.lang.Object
com.e1c.langtool.v8.dt.translator.AbstractSplittedStringTranslationExistTranslationProvider
- All Implemented Interfaces:
IComputedNameProvider,IComputedStringFeatureProvider,IComputedStringFeatureTranslationProvider
- Direct Known Subclasses:
FolderDataPathPartTranslationProvider,StringLiteralPartTranslationProvider,StringLiteralPartTranslationProvider,StringValuePartTranslationProvider,TextStatementTranslationProvider
public abstract class AbstractSplittedStringTranslationExistTranslationProvider
extends Object
implements IComputedStringFeatureTranslationProvider
The abstract implementation of computed string translation provider that can split string feature value into parts
and translate all parts as separate words and join them together.
Clients may override
getPartSettings(EObject, EFeatureSettings) to provide their own feature.-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final IResourceLookupprotected static final StringThe reg-exp to split by special symbols: [\. ,\(\)]+protected static final StringThe reg-exp to split by dotprotected final ITranslationStorageManagerprotected final ITranslatingProjectManagerprotected final ITranslationFeatureKeyProvider -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractSplittedStringTranslationExistTranslationProvider(ITranslatingProjectManager translatingProjectManager, IResourceLookup resourceLookup, ITranslationFeatureKeyProvider translationFeatureKeyProvider, ITranslationStorageManager storageManager) Instantiates a new abstract splitted string translation exist translation provider. -
Method Summary
Modifier and TypeMethodDescriptioncomputeTranslatedString(org.eclipse.emf.ecore.EObject object, EFeatureSettings stringFeature, IProjectTranslationProvider translationProvider, TranslateLanguage language) Compute translated string from translations of base objects.protected FeatureSettingsgetPartSettings(org.eclipse.emf.ecore.EObject object, EFeatureSettings stringFeature) Gets the part settings.protected abstract StringGets the regular expression which should split string into parts.protected abstract Set<FeatureSettings>Gets the supported features of the object that can be splited into parts.booleanisComputedString(org.eclipse.emf.ecore.EObject object, EFeatureSettings stringFeature) Checks if the string in feature is computed string.protected abstract booleanisValidPart(String part, org.eclipse.emf.ecore.EObject object, String value) Checks if the part is valid for the feature.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.e1c.langtool.emf.collector.IComputedNameProvider
isSupported
-
Field Details
-
SPLIT_REGEX_DOT
The reg-exp to split by dot- See Also:
-
SPLIT_REGEX_ALL
The reg-exp to split by special symbols: [\. ,\(\)]+- See Also:
-
translatingProjectManager
-
resourceLookup
-
translationFeatureKeyProvider
-
storageManager
-
-
Constructor Details
-
AbstractSplittedStringTranslationExistTranslationProvider
protected AbstractSplittedStringTranslationExistTranslationProvider(ITranslatingProjectManager translatingProjectManager, IResourceLookup resourceLookup, ITranslationFeatureKeyProvider translationFeatureKeyProvider, ITranslationStorageManager storageManager) Instantiates a new abstract splitted string translation exist translation provider.- Parameters:
translatingProjectManager- the translating project manager service, cannot benull.resourceLookup- the resource lookup service, cannot benull.translationFeatureKeyProvider- the translation feature key provider service, cannot benull.storageManager- the storage manager to get shared project reader, cannot benull.
-
-
Method Details
-
isComputedString
public boolean isComputedString(org.eclipse.emf.ecore.EObject object, EFeatureSettings stringFeature) Description copied from interface:IComputedStringFeatureProviderChecks if the string in feature is computed string.- Specified by:
isComputedStringin interfaceIComputedStringFeatureProvider- Parameters:
object- the objectstringFeature- the string feature- Returns:
- true, if the string is computed
-
computeTranslatedString
public String computeTranslatedString(org.eclipse.emf.ecore.EObject object, EFeatureSettings stringFeature, IProjectTranslationProvider translationProvider, TranslateLanguage language) Description copied from interface:IComputedStringFeatureTranslationProviderCompute translated string from translations of base objects.- Specified by:
computeTranslatedStringin interfaceIComputedStringFeatureTranslationProvider- Parameters:
object- the objectstringFeature- the string featuretranslationProvider- the translation providerlanguage- the language- Returns:
- the computed string translated into given language
-
getPartSettings
protected FeatureSettings getPartSettings(org.eclipse.emf.ecore.EObject object, EFeatureSettings stringFeature) Gets the part settings. Default isNAMED_ELEMENT__NAME. Clients may override this settings according they split the string feature.- Parameters:
object- the object , cannot benull.stringFeature- the string feature, cannot benull.- Returns:
- the part settings, cannot return
null.
-
getSplitRegex
Gets the regular expression which should split string into parts.- Returns:
- the split regular expression, cannot return
null.
-
getSupportedFeatures
Gets the supported features of the object that can be splited into parts.- Returns:
- the supported features, cannot return
null.
-
isValidPart
protected abstract boolean isValidPart(String part, org.eclipse.emf.ecore.EObject object, String value) Checks if the part is valid for the feature.- Parameters:
part- the partobject- the objectvalue- the value- Returns:
- true, if is valid part
-