MozillaFoundation / foundation.mozilla.org

Mozilla Foundation website
https://foundation.mozilla.org
Mozilla Public License 2.0
389 stars 153 forks source link

`CTA` model is not translatable but it is being used as such #11815

Open jhonatan-lopes opened 9 months ago

jhonatan-lopes commented 9 months ago

The CTA model does not inherit from TranslatableMixin and, thus, is not translatable and should not allow for localisation/translation:

class CTABase(models.Model):
    name = models.CharField(
        default="",
        max_length=100,
        help_text="Identify this component for other editors",
    )

    header = models.CharField(
        max_length=500,
        help_text="Heading that will display on page for this component",
        blank=True,
    )

    description = RichTextField(help_text="Body (richtext) of component", blank=True)

    newsletter = models.CharField(
        max_length=100,
        help_text="The (pre-existing) newsletter to sign up for",
        default="mozilla-foundation",
    )

    translatable_fields = [
        TranslatableField("name"),
        TranslatableField("header"),
        TranslatableField("description"),
        SynchronizedField("newsletter"),
    ]

    def __str__(self):
        return self.name

    class Meta:
        abstract = True

class CTA(CTABase):
    class Meta:
        ordering = ["-id"]
        verbose_name_plural = "CTA"

However, manual translations seem to have been introduced in production. There are several copies of CTA instances in multiple languages:

image

It is necessary to determine whether the CTA model is still relevant for this task, as there are several other CTA models.

Tasks:

┆Issue is synchronized with this Jira Task

data-sync-user commented 4 months ago

➤ Simon Acosta Torres commented:

Daniel Miranda You currently have https://mozilla-hub.atlassian.net/browse/TP1-357 ( https://mozilla-hub.atlassian.net/browse/TP1-357|smart-link ) assigned. Per the link, it seems this ticket should fulfill that other work. Do you think that is still valid in a way that this should be the priority over the other ticket or is it separate work that needs to be evaluated differently?

data-sync-user commented 4 months ago

➤ Daniel Miranda commented:

Hi Simon Acosta Torres ! After giving both tickets a look, I believe that we should finish this one first and then work on 357.