Package com.e1c.langtool.storage
Interface ITranslationStorageProvider.DictionaryStorage
- All Superinterfaces:
ITranslationStorageProvider.Storage
- All Known Implementing Classes:
ContextDefStorage,DbViewTermsStorage,DictionaryFileStorage
- Enclosing interface:
- ITranslationStorageProvider
public static interface ITranslationStorageProvider.DictionaryStorage
extends ITranslationStorageProvider.Storage
The Interface for dictionary storage of translation strings. Storage should have type
common
this means storage provides translation common for every resource in the project.-
Nested Class Summary
Nested classes/interfaces inherited from interface com.e1c.langtool.storage.ITranslationStorageProvider.Storage
ITranslationStorageProvider.Storage.Type -
Method Summary
Modifier and TypeMethodDescriptiondefault StringgetComment(TranslationKey key, TranslateLanguage language) Gets the comment by the translation key.default StringgetTranslation(FeatureValue source, TranslateLanguage language) Gets the translation from storage.getTranslation(TranslationKey key, TranslateLanguage language) Gets the translation from the dictionary storage.getType()Returns the type of translation storage.booleanhasKeyForValue(String value, TranslateLanguage language, TranslationKey skipKey) Checks that dictionary has key for the value except the given skip key.default voidmoveComment(TranslationKey fromKey, TranslationKey toKey, TranslateLanguage language, boolean autoSave) Move only comment from one translation key to another.default voidmoveTranslation(FeatureValue fromSource, FeatureValue toSource, TranslateLanguage language, boolean autoSave) Move translation inside the storage from one key to enother.voidmoveTranslation(TranslationKey fromKey, TranslationKey toKey, TranslateLanguage language, boolean autoSave) Move translation from one key to another inside this single storage.default voidremoveComment(TranslationKey key, TranslateLanguage language, boolean autoSave) Removes the comment of the translation key.default voidremoveTranslation(FeatureValue source, TranslateLanguage language, boolean autoSave) Removes the translation from storage.voidremoveTranslation(TranslationKey key, TranslateLanguage language, boolean autoSave) Removes the translation.Map<org.eclipse.core.resources.IFile,byte[]> saveFiles(TranslateLanguage language, com.google.common.hash.HashFunction hashFunction) TODO JavaDocdefault voidsetComment(TranslationKey key, TranslateLanguage language, String comment, boolean autoSave) Sets the comment for some translation key.default voidsetTranslation(FeatureValue source, TranslateLanguage language, String translation, boolean autoSave) Sets the translation.voidsetTranslation(TranslationKey key, TranslateLanguage language, String translation, boolean autoSave) Sets the translation of dictionary storage.Methods inherited from interface com.e1c.langtool.storage.ITranslationStorageProvider.Storage
addBatchUpdateNotification, addValueChangedListener, beginBatchUpdate, endBatchUpdate, getId, getSegment, isReadOnly, removeValueChangedListener
-
Method Details
-
getType
Description copied from interface:ITranslationStorageProvider.StorageReturns the type of translation storage.- Specified by:
getTypein interfaceITranslationStorageProvider.Storage- Returns:
- the type of storage
- See Also:
-
getTranslation
Description copied from interface:ITranslationStorageProvider.StorageGets the translation from storage.- Specified by:
getTranslationin interfaceITranslationStorageProvider.Storage- Parameters:
source- the source feature valuelanguage- the language- Returns:
- the translation
-
setTranslation
default void setTranslation(FeatureValue source, TranslateLanguage language, String translation, boolean autoSave) Description copied from interface:ITranslationStorageProvider.StorageSets the translation.- Specified by:
setTranslationin interfaceITranslationStorageProvider.Storage- Parameters:
source- the source feature valuelanguage- the languagetranslation- the translation
-
removeTranslation
Description copied from interface:ITranslationStorageProvider.StorageRemoves the translation from storage.- Specified by:
removeTranslationin interfaceITranslationStorageProvider.Storage- Parameters:
source- the source feature valuelanguage- the language
-
moveTranslation
default void moveTranslation(FeatureValue fromSource, FeatureValue toSource, TranslateLanguage language, boolean autoSave) Description copied from interface:ITranslationStorageProvider.StorageMove translation inside the storage from one key to enother.- Specified by:
moveTranslationin interfaceITranslationStorageProvider.Storage- Parameters:
fromSource- the source feature value to move fromtoSource- the source feature value to move tolanguage- the language
-
getTranslation
Gets the translation from the dictionary storage.- Parameters:
key- the translation key, cannot benull.language- the language, cannot benull.- Returns:
- the translation, can return
null.
-
setTranslation
void setTranslation(TranslationKey key, TranslateLanguage language, String translation, boolean autoSave) Sets the translation of dictionary storage.- Parameters:
key- the translation key, cannot benull.language- the language, cannot benull.translation- the translation, can benull.- Throws:
ModelValueAlreadyInUseException- if translation for model feature is already set for another key
-
saveFiles
Map<org.eclipse.core.resources.IFile,byte[]> saveFiles(TranslateLanguage language, com.google.common.hash.HashFunction hashFunction) TODO JavaDoc- Parameters:
language-hashFunction-- Returns:
-
removeTranslation
Removes the translation.- Parameters:
key- the translation key, cannot benull.language- the language, cannot benull.
-
moveTranslation
void moveTranslation(TranslationKey fromKey, TranslationKey toKey, TranslateLanguage language, boolean autoSave) Move translation from one key to another inside this single storage. Attantion! Implementation should move the comment of source translation key to new one.- Parameters:
fromKey- the from translation key, cannot benull.toKey- the to translation key, cannot benull.language- the language, cannot benull.
-
getComment
Gets the comment by the translation key.- Parameters:
key- the key, cannot benull.language- the language, cannot benull.- Returns:
- the comment, can return
null.
-
setComment
default void setComment(TranslationKey key, TranslateLanguage language, String comment, boolean autoSave) Sets the comment for some translation key.- Parameters:
key- the translation key, cannot benull.language- the language, cannot benull.comment- the comment, can benull.
-
removeComment
Removes the comment of the translation key.- Parameters:
key- the translation key, cannot benull.language- the language, cannot benull.
-
moveComment
default void moveComment(TranslationKey fromKey, TranslationKey toKey, TranslateLanguage language, boolean autoSave) Move only comment from one translation key to another. Note! The translation value of the source key will not move with it's comment.- Parameters:
fromKey- the from translation key, cannot benull.toKey- the to translation key, cannot benull.language- the language, cannot benull.
-
hasKeyForValue
Checks that dictionary has key for the value except the given skip key.- Parameters:
value- the value, cannot benull.language- the translate language, cannot benull.skipKey- the key which need to skip in the check, can benull.- Returns:
- true, if storage has key for the value
-