Problem/Motivation

Make Pet entity translatable.

Proposed resolution

Add translatable TRUE in the entity definition.
Add langcode as entity key.
Set translatable to TRUE for the fields that should be translatable.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

rbmboogie created an issue. See original summary.

bogdan.racz’s picture

Assigned: bogdan.racz » Unassigned
Status: Active » Needs review
FileSize
2.95 KB

Attached a patch.
Please review.

bogdan.racz’s picture

FileSize
2.94 KB

Forgot to leave the add form in the annotation.
Attached a complete patch.

ayalon’s picture

Here is my own attempt to make PETs translatable.

After applying the patch you need to run "drush entup". Then you can go to "/admin/config/regional/content-language" and enable "Translation" for the Pet Entity.

andreasderijcke’s picture

Tried both patches, both work, 0001-Translatable-PETs.patch seems a bit more concise although patch file itself needs a clean.

However, "drush entup" won't run if pet entities are already present. Update hook needs to added.

andreasderijcke’s picture

0001-Translatable-PETs.patch throws errors on uninstall of the module, while make_pet_translatable-2747525-3.patch does not.

andreasderijcke’s picture

Status: Needs review » Needs work

  • Sharique committed 262be4b on 8.x-1.x authored by rbmboogie
    Issue #2747525 by rbmboogie, ayalon: Make Pet translatable
    
Sharique’s picture

Status: Needs work » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

adinac’s picture

Although the entity type is translated, the translation is not used in pet_send_mail(). I also added the possibility to pass the language to pet_send_mail().

adinac’s picture

Other improvements, like sending the language as option to the token replacement callback.

Sharique’s picture

Please create a new ticket as this closed long back.

camilo.escobar’s picture

The point that @adinac made is important: it is not enough to make the PET entity translatable. All the code involved in sending the emails must be adapted to be able to receive a language parameter, otherwise, just making the entity translatable is useless.
A new issue was created: https://www.drupal.org/project/pet/issues/3366542