class LingotekManagementRelatedEntitiesForm in Lingotek Translation 3.2.x
Same name and namespace in other branches
- 8.2 src/Form/LingotekManagementRelatedEntitiesForm.php \Drupal\lingotek\Form\LingotekManagementRelatedEntitiesForm
- 4.0.x src/Form/LingotekManagementRelatedEntitiesForm.php \Drupal\lingotek\Form\LingotekManagementRelatedEntitiesForm
- 3.0.x src/Form/LingotekManagementRelatedEntitiesForm.php \Drupal\lingotek\Form\LingotekManagementRelatedEntitiesForm
- 3.1.x src/Form/LingotekManagementRelatedEntitiesForm.php \Drupal\lingotek\Form\LingotekManagementRelatedEntitiesForm
- 3.3.x src/Form/LingotekManagementRelatedEntitiesForm.php \Drupal\lingotek\Form\LingotekManagementRelatedEntitiesForm
- 3.4.x src/Form/LingotekManagementRelatedEntitiesForm.php \Drupal\lingotek\Form\LingotekManagementRelatedEntitiesForm
- 3.5.x src/Form/LingotekManagementRelatedEntitiesForm.php \Drupal\lingotek\Form\LingotekManagementRelatedEntitiesForm
- 3.6.x src/Form/LingotekManagementRelatedEntitiesForm.php \Drupal\lingotek\Form\LingotekManagementRelatedEntitiesForm
- 3.7.x src/Form/LingotekManagementRelatedEntitiesForm.php \Drupal\lingotek\Form\LingotekManagementRelatedEntitiesForm
- 3.8.x src/Form/LingotekManagementRelatedEntitiesForm.php \Drupal\lingotek\Form\LingotekManagementRelatedEntitiesForm
Form for bulk management of related content.
Hierarchy
- class \Drupal\Core\Form\FormBase implements ContainerInjectionInterface, FormInterface uses DependencySerializationTrait, LoggerChannelTrait, MessengerTrait, RedirectDestinationTrait, StringTranslationTrait
- class \Drupal\lingotek\Form\LingotekManagementFormBase uses LingotekManagementFormHelperTrait, LingotekSetupTrait
- class \Drupal\lingotek\Form\LingotekManagementRelatedEntitiesForm
- class \Drupal\lingotek\Form\LingotekManagementFormBase uses LingotekManagementFormHelperTrait, LingotekSetupTrait
Expanded class hierarchy of LingotekManagementRelatedEntitiesForm
1 string reference to 'LingotekManagementRelatedEntitiesForm'
File
- src/
Form/ LingotekManagementRelatedEntitiesForm.php, line 27
Namespace
Drupal\lingotek\FormView source
class LingotekManagementRelatedEntitiesForm extends LingotekManagementFormBase {
/**
* @var \Drupal\node\NodeInterface
*/
protected $node;
/**
* Constructs a new LingotekManagementRelatedEntitiesForm object.
*
* @param \Drupal\Core\Database\Connection $connection
* The current database connection.
* @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
* The entity manager.
* @param \Drupal\Core\Language\LanguageManagerInterface $language_manager
* The language manager.
* @param \Drupal\lingotek\LingotekInterface $lingotek
* The lingotek service.
* @param \Drupal\lingotek\LingotekConfigurationServiceInterface $lingotek_configuration
* The Lingotek configuration service.
* @param \Drupal\lingotek\LanguageLocaleMapperInterface $language_locale_mapper
* The language-locale mapper.
* @param \Drupal\content_translation\ContentTranslationManagerInterface $content_translation_manager
* The content translation manager.
* @param \Drupal\lingotek\LingotekContentTranslationServiceInterface $translation_service
* The Lingotek content translation service.
* @param \Drupal\Core\TempStore\PrivateTempStoreFactory $temp_store_factory
* The factory for the temp store object.
* @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
* The module handler.
* @param \Drupal\Core\Entity\EntityFieldManagerInterface $entity_field_manager
* The entity field manager.
* @param \Drupal\Core\Entity\EntityTypeBundleInfoInterface $entity_type_bundle_info
* The entity type bundle info.
* @param \Drupal\Core\Utility\LinkGeneratorInterface $link_generator
* The link generator.
*/
public function __construct(Connection $connection, EntityTypeManagerInterface $entity_type_manager, LanguageManagerInterface $language_manager, LingotekInterface $lingotek, LingotekConfigurationServiceInterface $lingotek_configuration, LanguageLocaleMapperInterface $language_locale_mapper, ContentTranslationManagerInterface $content_translation_manager, LingotekContentTranslationServiceInterface $translation_service, PrivateTempStoreFactory $temp_store_factory, StateInterface $state, ModuleHandlerInterface $module_handler, EntityFieldManagerInterface $entity_field_manager = NULL, EntityTypeBundleInfoInterface $entity_type_bundle_info = NULL, LinkGeneratorInterface $link_generator = NULL) {
parent::__construct($connection, $entity_type_manager, $language_manager, $lingotek, $lingotek_configuration, $language_locale_mapper, $content_translation_manager, $translation_service, $temp_store_factory, $state, $module_handler, NULL, $entity_field_manager, $entity_type_bundle_info, $link_generator);
}
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container) {
return new static($container
->get('database'), $container
->get('entity_type.manager'), $container
->get('language_manager'), $container
->get('lingotek'), $container
->get('lingotek.configuration'), $container
->get('lingotek.language_locale_mapper'), $container
->get('content_translation.manager'), $container
->get('lingotek.content_translation'), $container
->get('tempstore.private'), $container
->get('state'), $container
->get('module_handler'), $container
->get('entity_field.manager'), $container
->get('entity_type.bundle.info'), $container
->get('link_generator'));
}
public function buildForm(array $form, FormStateInterface $form_state, ContentEntityInterface $node = NULL) {
$this->node = $node;
$form = parent::buildForm($form, $form_state);
$related = $this->related;
$depth = $this
->getRecursionDepth();
$form['depth_selection'] = [
'#type' => 'container',
'#attributes' => [
'class' => 'form-item-depth-selection',
],
'#weight' => 60,
];
$form['depth_selection']['depth'] = [
'#type' => 'select',
'#title' => $this
->t('Recursion depth:'),
'#options' => [
1 => 1,
2 => 2,
3 => 3,
4 => 4,
5 => 5,
],
'#default_value' => $depth,
];
$form['depth_selection']['submit'] = [
'#type' => 'submit',
'#value' => $this
->t('Apply'),
'#submit' => [
[
$this,
'recursionDepthCallback',
],
],
];
$relatedRows = [];
if (!empty($related)) {
// Generate the rows based on those entities.
$relatedRows = $this
->getRows($related);
}
$form['related'] = [
'#type' => 'details',
'#title' => $this
->t('Embedded content references'),
'#description' => $this
->t('These entities are included in the parent document, but listed here for reference. It is not recommended to operate on this data, as its contents will be already translated with the embedding document.'),
'#weight' => 100,
];
$form['related']['table'] = [
'#header' => $this
->getHeaders(),
'#rows' => $relatedRows,
'#empty' => $this
->t('No embedded content available'),
'#type' => 'table',
'#weight' => 100,
];
return $form;
}
protected function getSelectedEntities($values) {
$entityTypes = [];
$entities = [];
foreach ($values as $type_entity_id) {
list($type, $entity_id) = explode(":", $type_entity_id);
$entityTypes[$type][] = $entity_id;
}
foreach ($entityTypes as $type => $values) {
$entities = array_merge($entities, $this->entityTypeManager
->getStorage($type)
->loadMultiple($values));
}
return $entities;
}
/**
* {@inheritdoc}
*/
public function getFormId() {
return 'lingotek_entity_management';
}
/**
* {@inheritdoc}
*/
protected function getHeaders() {
$headers = [
'title' => $this
->t('Label'),
'entity_type_id' => $this
->t('Content Type'),
'bundle' => $this
->t('Bundle'),
'source' => $this
->t('Source'),
'translations' => $this
->t('Translations'),
'profile' => $this
->t('Profile'),
'job_id' => $this
->t('Job ID'),
];
return $headers;
}
/**
* @deprecated in lingotek:3.1.0 and is removed from lingotek:4.0.0.
* @see ::getNestedEntities
*/
public function calculateNestedEntities(ContentEntityInterface &$entity, &$visited = [], &$entities = []) {
$visited[$entity
->bundle()][] = $entity
->id();
$entities[$entity
->getEntityTypeId()][] = $entity;
$field_definitions = $this->entityFieldManager
->getFieldDefinitions($entity
->getEntityTypeId(), $entity
->bundle());
foreach ($field_definitions as $k => $definition) {
$field_type = $field_definitions[$k]
->getType();
if ($field_type === 'entity_reference' || $field_type === 'er_viewmode' || $field_type === 'entity_reference_revisions') {
$target_entity_type_id = $field_definitions[$k]
->getFieldStorageDefinition()
->getSetting('target_type');
$target_entity_type = $this->entityTypeManager
->getDefinition($target_entity_type_id);
if ($target_entity_type instanceof ContentEntityType) {
foreach ($entity->{$k} as $field_item) {
if (!isset($entities[$target_entity_type_id])) {
$entities[$target_entity_type_id] = [];
}
$entities[$target_entity_type_id][] = $field_item->target_id;
}
}
}
}
return $entities;
}
protected function getNestedEntities(ContentEntityInterface &$entity, &$visited = [], &$entities = [], $depth = 1, &$related = []) {
$visited[$entity
->bundle()][] = $entity
->id();
$entities[$entity
->getEntityTypeId()][$entity
->id()] = $entity
->getUntranslated();
if ($depth > 0) {
--$depth;
$field_definitions = $this->entityFieldManager
->getFieldDefinitions($entity
->getEntityTypeId(), $entity
->bundle());
foreach ($field_definitions as $k => $definition) {
$field_type = $field_definitions[$k]
->getType();
if (in_array($field_type, [
'entity_reference',
'entity_reference_revisions',
'er_viewmode',
])) {
$target_entity_type_id = $field_definitions[$k]
->getFieldStorageDefinition()
->getSetting('target_type');
$target_entity_type = $this->entityTypeManager
->getDefinition($target_entity_type_id);
if ($target_entity_type instanceof ContentEntityType) {
$child_entities = $entity->{$k}
->referencedEntities();
foreach ($child_entities as $embedded_entity) {
if ($embedded_entity !== NULL) {
// We need to avoid cycles if we have several entity references
// referencing each other.
if (!isset($visited[$embedded_entity
->bundle()]) || !in_array($embedded_entity
->id(), $visited[$embedded_entity
->bundle()])) {
if ($embedded_entity instanceof ContentEntityInterface && $embedded_entity
->isTranslatable() && $this->lingotekConfiguration
->isEnabled($embedded_entity
->getEntityTypeId(), $embedded_entity
->bundle())) {
if (!$this->lingotekConfiguration
->isFieldLingotekEnabled($entity
->getEntityTypeId(), $entity
->bundle(), $k)) {
$entities = $this
->getNestedEntities($embedded_entity, $visited, $entities, $depth, $related);
}
else {
$related[$embedded_entity
->getEntityTypeId()][$embedded_entity
->id()] = $embedded_entity
->getUntranslated();
}
}
}
}
}
}
}
}
}
$this->related = $related;
return $entities;
}
protected function getFilteredEntities() {
// This implies recursion through all the related content.
$visited = [];
$entities = [];
$related = [];
$recursion_depth = $this
->getRecursionDepth();
$entities = $this
->getNestedEntities($this->node, $visited, $entities, $recursion_depth, $related);
return $entities;
}
protected function getRows($entity_list) {
$counter = 1;
$rows = [];
foreach ($entity_list as $entity_type_id => $entities) {
foreach ($entities as $entity_id => $entity) {
$rowId = (string) $entity
->getEntityTypeId() . ':' . (string) $entity
->id();
$rows[$rowId] = $this
->getRow($entity);
$counter += 1;
}
}
return $rows;
}
protected function getRow($entity) {
// For this method to be able to be reused for the table component, order
// matters, so we rebuild the order of the row. For tableselect the headers
// defines the order, for the table, the order we add to the array matters.
$parentRow = parent::getRow($entity);
$bundleInfo = $this->entityTypeBundleInfo
->getBundleInfo($entity
->getEntityTypeId());
$row['title'] = $parentRow['title'];
$row['entity_type_id'] = $entity
->getEntityType()
->getLabel();
$row['bundle'] = $bundleInfo[$entity
->bundle()]['label'];
$row['title'] = $parentRow['title'];
$row['source'] = $parentRow['source'];
$row['translations'] = $parentRow['translations'];
$row['profile'] = $parentRow['profile'];
$row['job_id'] = $parentRow['job_id'];
return $row;
}
/**
* Gets the key used for persisting filtering options in the temp storage.
*
* @return string
* Temp storage identifier where filters are persisted.
*/
protected function getTempStorageFilterKey() {
return NULL;
}
/**
* Gets the filter keys so we can persist or clear filtering options.
*
* @return string[]
* Array of filter identifiers.
*/
protected function getFilterKeys() {
return NULL;
}
/**
* Gets the filters for rendering.
*
* @return array
* A form array.
*/
protected function getFilters() {
return NULL;
}
/**
* {@inheritdoc}
*/
protected function getPager() {
return NULL;
}
/**
* Gets the recursion depth saved in temp storage.
*
* @return int
* The recursion depth.
*/
protected function getRecursionDepth() {
$temp_store = $this->tempStoreFactory
->get('lingotek.management.recursion_depth');
$depth = $temp_store
->get('depth');
if ($depth === NULL) {
$depth = 1;
}
return $depth;
}
/**
* Saves the recursion depth in temp storage.
*
* @param int $depth
* The recursion depth.
*
* @throws \Drupal\Core\TempStore\TempStoreException
*/
protected function setRecursionDepth($depth) {
$temp_store = $this->tempStoreFactory
->get('lingotek.management.recursion_depth');
$temp_store
->set('depth', $depth);
}
/**
* {@inheritdoc}
*/
public function recursionDepthCallback(array &$form, FormStateInterface $form_state) {
$value = $form_state
->getValue('depth');
$this
->setRecursionDepth($value);
}
/**
* {@inheritdoc}
*/
protected function canHaveDeleteTranslationBulkOptions() {
return FALSE;
}
/**
* {@inheritdoc}
*/
protected function canHaveDeleteBulkOptions() {
return FALSE;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
DependencySerializationTrait:: |
protected | property | ||
DependencySerializationTrait:: |
protected | property | ||
DependencySerializationTrait:: |
public | function | 2 | |
DependencySerializationTrait:: |
public | function | 2 | |
FormBase:: |
protected | property | The config factory. | 3 |
FormBase:: |
protected | property | The request stack. | 1 |
FormBase:: |
protected | property | The route match. | |
FormBase:: |
protected | function | Retrieves a configuration object. | |
FormBase:: |
protected | function | Gets the config factory for this form. | 3 |
FormBase:: |
private | function | Returns the service container. | |
FormBase:: |
protected | function | Gets the current user. | |
FormBase:: |
protected | function | Gets the request object. | |
FormBase:: |
protected | function | Gets the route match. | |
FormBase:: |
protected | function | Gets the logger for a specific channel. | |
FormBase:: |
protected | function | Returns a redirect response object for the specified route. | |
FormBase:: |
public | function | Resets the configuration factory. | |
FormBase:: |
public | function | Sets the config factory for this form. | |
FormBase:: |
public | function | Sets the request stack object to use. | |
FormBase:: |
public | function |
Form validation handler. Overrides FormInterface:: |
72 |
LingotekManagementFormBase:: |
protected | property | The connection object on which to run queries. | |
LingotekManagementFormBase:: |
protected | property | The content translation manager. | |
LingotekManagementFormBase:: |
protected | property | The entity field manager. | |
LingotekManagementFormBase:: |
protected | property | The entity type bundle info. | |
LingotekManagementFormBase:: |
protected | property | The entity type id. | |
LingotekManagementFormBase:: |
protected | property | The entity manager. | |
LingotekManagementFormBase:: |
protected | property | The language-locale mapper. | |
LingotekManagementFormBase:: |
protected | property | The language manager. | |
LingotekManagementFormBase:: |
protected | property | The Lingotek configuration service. | |
LingotekManagementFormBase:: |
protected | property | The module handler. | |
LingotekManagementFormBase:: |
protected | property | The state key value store. | |
LingotekManagementFormBase:: |
protected | property | The Lingotek content translation service. | |
LingotekManagementFormBase:: |
public | function | Batch callback called when the batch finishes. | |
LingotekManagementFormBase:: |
public | function | Cancel the content from Lingotek. | |
LingotekManagementFormBase:: |
public | function | Cancel the content from Lingotek. | |
LingotekManagementFormBase:: |
public | function | Change Translation Profile. | |
LingotekManagementFormBase:: |
public | function | Check document upload status for a given content. | |
LingotekManagementFormBase:: |
public | function | Checks translation status for a given content in a given language. | |
LingotekManagementFormBase:: |
public | function | Checks all translations statuses for a given content. | |
LingotekManagementFormBase:: |
protected | function | Performs an operation to several values in a batch. | |
LingotekManagementFormBase:: |
protected | function | Create and set a cancellation batch. | |
LingotekManagementFormBase:: |
protected | function | Create and set a profile change batch. | |
LingotekManagementFormBase:: |
protected | function | Create and set an export batch. | |
LingotekManagementFormBase:: |
protected | function | Create and set a request target and download batch for all languages. | |
LingotekManagementFormBase:: |
protected | function | Create and set a request target and download batch for a given language. | |
LingotekManagementFormBase:: |
protected | function | Create and set a request translations batch for all languages. | |
LingotekManagementFormBase:: |
protected | function | Create and set a check translation status batch for a given language. | |
LingotekManagementFormBase:: |
protected | function | Create and set a request translations batch for all languages. | |
LingotekManagementFormBase:: |
protected | function | Create and set a target cancellation batch. | |
LingotekManagementFormBase:: |
protected | function | Create and set a check translation status batch for all languages. | |
LingotekManagementFormBase:: |
protected | function | Create and set an upload batch. | |
LingotekManagementFormBase:: |
protected | function | Create and set a check upload status batch. | |
LingotekManagementFormBase:: |
public | function | Export source for debugging purposes. | |
LingotekManagementFormBase:: |
public | function | Batch callback called when the debug export batch finishes. | |
LingotekManagementFormBase:: |
public | function | Download translation for a given content in a given language. | |
LingotekManagementFormBase:: |
public | function | Download translations for a given content in all enabled languages. | |
LingotekManagementFormBase:: |
public | function | Form submission handler for filtering. | |
LingotekManagementFormBase:: |
public | function | Get the bulk operations for the management form. | |
LingotekManagementFormBase:: |
protected | function | Gets all the bundles as options. | |
LingotekManagementFormBase:: |
protected | function | Gets all the groups as options. | |
LingotekManagementFormBase:: |
protected | function | Gets all the languages as options. | |
LingotekManagementFormBase:: |
protected | function | Gets the bulk options form array structure. | 1 |
LingotekManagementFormBase:: |
protected | function | ||
LingotekManagementFormBase:: |
protected | function | Gets the source status of an entity in a format ready to display. | |
LingotekManagementFormBase:: |
protected | function | Gets the translation status of an entity in a format ready to display. | |
LingotekManagementFormBase:: |
protected | function | Redirect to assign Job ID form. | |
LingotekManagementFormBase:: |
protected | function | Redirect to clear Job ID form. | |
LingotekManagementFormBase:: |
protected | function | Redirect to delete content form. | |
LingotekManagementFormBase:: |
protected | function | Redirect to delete translations form. | |
LingotekManagementFormBase:: |
protected | function | Redirect to delete specific translation form. | |
LingotekManagementFormBase:: |
public | function | Request translations for a given content in a given language. | |
LingotekManagementFormBase:: |
public | function | Request all translations for a given content. | |
LingotekManagementFormBase:: |
public | function | Form submission handler for resetting the filters. | |
LingotekManagementFormBase:: |
public | function |
Form submission handler. Overrides FormInterface:: |
|
LingotekManagementFormBase:: |
public | function | Upload source for translation. | |
LingotekManagementFormHelperTrait:: |
protected | property | The tempstore factory. | |
LingotekManagementFormHelperTrait:: |
protected | function | ||
LingotekManagementFormHelperTrait:: |
protected | function | ||
LingotekManagementRelatedEntitiesForm:: |
protected | property | ||
LingotekManagementRelatedEntitiesForm:: |
public | function |
Form constructor. Overrides LingotekManagementFormBase:: |
|
LingotekManagementRelatedEntitiesForm:: |
public | function | ||
LingotekManagementRelatedEntitiesForm:: |
protected | function |
Check if we can delete content in bulk based on the entity definition. Overrides LingotekManagementFormBase:: |
|
LingotekManagementRelatedEntitiesForm:: |
protected | function |
Check if we can delete translation in bulk based on the entity definition. Overrides LingotekManagementFormBase:: |
|
LingotekManagementRelatedEntitiesForm:: |
public static | function |
Instantiates a new instance of this class. Overrides LingotekManagementFormBase:: |
|
LingotekManagementRelatedEntitiesForm:: |
protected | function |
Gets the entities that needs to be displayed based on the current filters. Overrides LingotekManagementFormBase:: |
|
LingotekManagementRelatedEntitiesForm:: |
protected | function |
Gets the filter keys so we can persist or clear filtering options. Overrides LingotekManagementFormBase:: |
|
LingotekManagementRelatedEntitiesForm:: |
protected | function |
Gets the filters for rendering. Overrides LingotekManagementFormBase:: |
|
LingotekManagementRelatedEntitiesForm:: |
public | function |
Returns a unique string identifying the form. Overrides FormInterface:: |
|
LingotekManagementRelatedEntitiesForm:: |
protected | function |
Overrides LingotekManagementFormBase:: |
|
LingotekManagementRelatedEntitiesForm:: |
protected | function | ||
LingotekManagementRelatedEntitiesForm:: |
protected | function |
Gets the pager. Overrides LingotekManagementFormBase:: |
|
LingotekManagementRelatedEntitiesForm:: |
protected | function | Gets the recursion depth saved in temp storage. | |
LingotekManagementRelatedEntitiesForm:: |
protected | function |
Gets a rows fo rendering based on the passed entity. Overrides LingotekManagementFormBase:: |
|
LingotekManagementRelatedEntitiesForm:: |
protected | function |
Gets the rows for rendering based on the passed entity list. Overrides LingotekManagementFormBase:: |
|
LingotekManagementRelatedEntitiesForm:: |
protected | function |
Load the entities corresponding with the given identifiers. Overrides LingotekManagementFormBase:: |
|
LingotekManagementRelatedEntitiesForm:: |
protected | function |
Gets the key used for persisting filtering options in the temp storage. Overrides LingotekManagementFormBase:: |
|
LingotekManagementRelatedEntitiesForm:: |
public | function | ||
LingotekManagementRelatedEntitiesForm:: |
protected | function | Saves the recursion depth in temp storage. | |
LingotekManagementRelatedEntitiesForm:: |
public | function |
Constructs a new LingotekManagementRelatedEntitiesForm object. Overrides LingotekManagementFormBase:: |
|
LingotekSetupTrait:: |
protected | property | A lingotek connector object | |
LingotekSetupTrait:: |
protected | function | Verify the Lingotek Translation module has been properly initialized. | |
LingotekSetupTrait:: |
public | function | Checks if Lingotek module is completely set up. | |
LoggerChannelTrait:: |
protected | property | The logger channel factory service. | |
LoggerChannelTrait:: |
protected | function | Gets the logger for a specific channel. | |
LoggerChannelTrait:: |
public | function | Injects the logger channel factory. | |
MessengerTrait:: |
protected | property | The messenger. | 27 |
MessengerTrait:: |
public | function | Gets the messenger. | 27 |
MessengerTrait:: |
public | function | Sets the messenger. | |
RedirectDestinationTrait:: |
protected | property | The redirect destination service. | 1 |
RedirectDestinationTrait:: |
protected | function | Prepares a 'destination' URL query parameter for use with \Drupal\Core\Url. | |
RedirectDestinationTrait:: |
protected | function | Returns the redirect destination service. | |
RedirectDestinationTrait:: |
public | function | Sets the redirect destination service. | |
StringTranslationTrait:: |
protected | property | The string translation service. | 4 |
StringTranslationTrait:: |
protected | function | Formats a string containing a count of items. | |
StringTranslationTrait:: |
protected | function | Returns the number of plurals supported by a given language. | |
StringTranslationTrait:: |
protected | function | Gets the string translation service. | |
StringTranslationTrait:: |
public | function | Sets the string translation service to use. | 2 |
StringTranslationTrait:: |
protected | function | Translates a string to the current language or to a given language. |