public interface TranslationService
Modifier and Type | Method and Description |
---|---|
void |
deleteTranslationById(Long translationId)
Deletes the given translations
|
List<Translation> |
findAllTranslationEntries(TranslatedEntity translatedEntity,
ResultType standard,
List<String> entityIds)
Find all the available translations for the given params.
|
Translation |
findTranslationById(Long id)
Find a translation instance by its primary key value.
|
TranslatedEntity |
getAssignableEntityType(String className)
Gets the TranslatedEntity based on the passed className.
|
javax.cache.Cache<String,Object> |
getCache()
Get the translation specific cache (different than the level-2 hibernate cache)
|
String |
getDefaultTranslationValue(Object entity,
String property,
Locale locale,
String requestedDefaultValue)
Intended for use with the
DynamicTranslationProvider to determine the default value when a
translation was not provided. |
String |
getTranslatedValue(Object entity,
String property,
Locale locale)
Returns the translated value of the property for the given entity.
|
Translation |
getTranslation(TranslatedEntity entity,
String entityId,
String fieldName,
String localeCode)
Attempts to find the translation object for the given parameters
|
List<Translation> |
getTranslations(String ceilingEntityClassname,
String entityId,
String property)
Finds all current translations for the specified field
|
void |
removeTranslationFromCache(Translation translation)
Remove a translation instance from the translation specific cache (different than level-2 hibernate cache)
|
Translation |
save(String entityType,
String entityId,
String fieldName,
String localeCode,
String translatedValue)
Creates a new translation object for the requested parameters, saves it, and returns the saved instance.
|
Translation |
save(Translation translation)
Persists the given translation
|
Translation |
update(Long translationId,
String localeCode,
String translatedValue)
Updates the given translation id with the new locale code and translated value
|
Translation save(Translation translation)
translation
- Translation save(String entityType, String entityId, String fieldName, String localeCode, String translatedValue)
entityType
- entityId
- fieldName
- localeCode
- translatedValue
- Translation update(Long translationId, String localeCode, String translatedValue)
translationId
- localeCode
- translatedValue
- void deleteTranslationById(Long translationId)
translationId
- List<Translation> getTranslations(String ceilingEntityClassname, String entityId, String property)
ceilingEntityClassname
- entityId
- property
- Translation getTranslation(TranslatedEntity entity, String entityId, String fieldName, String localeCode)
entity
- entityId
- fieldName
- localeCode
- String getTranslatedValue(Object entity, String property, Locale locale)
entity
- property
- locale
- TranslatedEntity getAssignableEntityType(String className)
className
- void removeTranslationFromCache(Translation translation)
translation
- The translation instance to removeTranslation findTranslationById(Long id)
id
- the primary key valuejavax.cache.Cache<String,Object> getCache()
String getDefaultTranslationValue(Object entity, String property, Locale locale, String requestedDefaultValue)
DynamicTranslationProvider
to determine the default value when a
translation was not provided.
The default implementation of this method relies on a system property "returnBlankTranslationForNotDefaultLocale".
If this is true, the system will return blank if the language of the defaultLocale does not match the language
of the passed in locale.
For example, consider the "longDescription" property and the system default locale is "en". If this method is
called for a locale of "en_CA", the requestedDefaultValue will be returned. If the method is called with a value
of "fr_CA", blank will be returned.entity
- property
- locale
- requestedDefaultValue
- List<Translation> findAllTranslationEntries(TranslatedEntity translatedEntity, ResultType standard, List<String> entityIds)
entityType
- stage
- param drives whether to look for entries at a template level or standard site level (multitenant concepts). Can be IGNORE. Any multitenant behavior is ignored in the absence of the multitenant module.entityIds
- the Translation.getEntityId()
to restrict the results byCopyright © 2022. All rights reserved.