jazzband / django-recurrence

Utility for working with recurring dates in Django.
https://django-recurrence.readthedocs.org/
BSD 3-Clause "New" or "Revised" License
490 stars 190 forks source link

translation of rules buggy? #180

Open nerdoc opened 3 years ago

nerdoc commented 3 years ago

I have a simple object:

class RecurringTask(CreatedUpdatedMixin):
    title = models.CharField(max_length=255)
    recurrence = RecurrenceField()

    def __str__(self):
        return (
            f"{self.title} ({', '.join([r.to_text() for r in self.recurrence.rrules])})"
        )

When I see it in the Django admin, it translates the rule correctly into German (alle 3 Monate): image

But when I click on the item, the field is untranslated ("every 3 months"): image

Could it be that the RecurrenceField uses an untranslated string output when creating the edit widget? Or are these strings translated separatedly, and one is just not translated?

lino commented 2 years ago

Did you follow the instructions how to set up i18n?

https://django-recurrence.readthedocs.io/en/latest/installation.html#set-up-internationalization

nerdoc commented 2 years ago

Yes, this is my main urls.py:

import django
from django.urls import path
from main.views import MainView
from django.views.i18n import JavaScriptCatalog

urlpatterns = [...]

js_info_dict = {
    'packages': ('recurrence', ),
}

urlpatterns += [
    path('jsi18n', JavaScriptCatalog.as_view(), js_info_dict),
]