Add translation trait.
1 unresolved thread
1 unresolved thread
Closes #3097313
Merge request reports
Activity
added 1 commit
- 61479198 - Using placeholder to pass the string in translation function.
170 173 $languages = $cloned_entity->getTranslationLanguages(); 171 174 foreach ($languages as $langcode => $language) { 172 175 $translation = $cloned_entity->getTranslation($langcode); 173 $translation->set($label_key, $translation->label() . ' - Cloned'); 176 $translation->set($label_key, $translation->label() . $this->t('%suffix', ['%suffix' => ' - Cloned'])); This is not correct, the problem is that 'label' is not part of the sentence. If your entity is named 'Fancy webpage' and you want to clone is, the result will be 'Fancy webpage - Cloned'. But in languages that are not LTR, but RTL the result would be (not a real case, but purely for example) 'Webpage fancy - Cloned' but the expected result should be 'Cloned - Webpage fancy'. Also as a translator you want to know the context of ' - Cloned', by creating a string like '@label - Cloned' you will know that 'Cloned' is a state of the '@label'.
changed this line in version 4 of the diff
@TessBakker - Updated prefix/suffix as per language direction, please review.
Edited by Pravin Gaikwad
added 1 commit
- d0f8ed47 - translate and add cloned prefix or suffix based on language direction.
Please register or sign in to reply