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 Details

  • 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 be null.
      resourceLookup - the resource lookup service, cannot be null.
      translationFeatureKeyProvider - the translation feature key provider service, cannot be null.
      storageManager - the storage manager to get shared project reader, cannot be null.
  • Method Details

    • isComputedString

      public boolean isComputedString(org.eclipse.emf.ecore.EObject object, EFeatureSettings stringFeature)
      Description copied from interface: IComputedStringFeatureProvider
      Checks if the string in feature is computed string.
      Specified by:
      isComputedString in interface IComputedStringFeatureProvider
      Parameters:
      object - the object
      stringFeature - 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: IComputedStringFeatureTranslationProvider
      Compute translated string from translations of base objects.
      Specified by:
      computeTranslatedString in interface IComputedStringFeatureTranslationProvider
      Parameters:
      object - the object
      stringFeature - the string feature
      translationProvider - the translation provider
      language - 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 is NAMED_ELEMENT__NAME. Clients may override this settings according they split the string feature.
      Parameters:
      object - the object , cannot be null.
      stringFeature - the string feature, cannot be null.
      Returns:
      the part settings, cannot return null.
    • getSplitRegex

      protected abstract String getSplitRegex()
      Gets the regular expression which should split string into parts.
      Returns:
      the split regular expression, cannot return null.
    • getSupportedFeatures

      protected abstract Set<FeatureSettings> 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 part
      object - the object
      value - the value
      Returns:
      true, if is valid part