Giter Club home page Giter Club logo

Comments (12)

acerix avatar acerix commented on May 28, 2024

Thanks for this app :)

I was able to easily translate the content using https://github.com/infoportugal/wagtail-modeltranslation by adding this to my app's translation.py:

from ls.joyous.models import GroupPage, EventBase, EventCategory, SimpleEventPage, MultidayEventPage, RecurringEventPage, ExtraInfoPage, CalendarPage

@register(GroupPage)
class GroupPageTR(TranslationOptions):
    fields = (
        'content',
    )

@register(EventBase)
class EventBaseTR(TranslationOptions):
    fields = (
        'details',
        'location',
        'website',
    )

@register(EventCategory)
class EventCategoryTR(TranslationOptions):
    fields = (
        'name',
    )

@register(SimpleEventPage)
class SimpleEventPageTR(TranslationOptions):
    fields = (
    )

@register(MultidayEventPage)
class SimpleEventPageTR(TranslationOptions):
    fields = (
    )

@register(RecurringEventPage)
class RecurringEventPageTR(TranslationOptions):
    fields = (
    )

@register(CalendarPage)
class CalendarPageTR(TranslationOptions):
    fields = (
        'intro',
    )

@register(ExtraInfoPage)
class ExtraInfoPageTR(TranslationOptions):
    fields = (
        'extra_title',
        'extra_information',
    )

I think you can add something like that to the repo to add support for wagtail-modeltranslation, let me know if you'd like a PR.

from ls.joyous.

linuxsoftware avatar linuxsoftware commented on May 28, 2024

Thanks! I will give that a go. I think there will still be some unlocalized strings, (e.g. the when property), but every improvement is very welcome.

from ls.joyous.

acerix avatar acerix commented on May 28, 2024

Yes, the dates show up in the correct language but most text is hardcoded, for example:

https://github.com/linuxsoftware/ls.joyous/blob/master/ls/joyous/templates/joyous/calendar_list_upcoming.html#L17

I plan to make a branch soon that makes the text translatable by django like this:

https://docs.djangoproject.com/en/dev/topics/i18n/translation/#std:templatetag-trans

from ls.joyous.

linuxsoftware avatar linuxsoftware commented on May 28, 2024

Thanks! A PR when you are ready would be most welcome.

from ls.joyous.

acerix avatar acerix commented on May 28, 2024

My fork now has support for wagtail-modeltranslation and has most basic text translated to French. I didn't translate anything JavaScript yet.

Would you consider a library like FullCalendar for the month and week views? It handles all the translations which would take long to implement otherwise.

https://fullcalendar.io/releases/fullcalendar/3.9.0/demos/locales.html

from ls.joyous.

linuxsoftware avatar linuxsoftware commented on May 28, 2024

Great.

Yes, using FullCalendar seems a good idea. Ideally I'd like to continue to support the plain HTML calendars too. Maybe using template overloading to switch between the two.

from ls.joyous.

acerix avatar acerix commented on May 28, 2024

That makes sense, although I wasn't able to find any obvious way to overload templates within an app.

Is there a way to add a new setting (eg. JOYOUS_USE_FULLCALENDAR) that when enabled would look for templates in another directory first (eg. templates/joyous-fullcalendar/), then fall back to the main template dir for any templates not copied there?

If not, I figure that could be done with a new template back-end, or maybe by making a new app that extends Joyous, but would rather a simpler solution.

from ls.joyous.

linuxsoftware avatar linuxsoftware commented on May 28, 2024

Hi @acerix I'm back to looking at Joyous again. I've merged your i18n changes into a branch https://github.com/linuxsoftware/ls.joyous/tree/i18n on my repository, and am working at completing it there. My French translation is from Google so will be awful. Corrections would be very welcome. Did you get any further on implementing a FullCalendar front end? If you do I would be happy to consider a PR for it. Thanks, David.

from ls.joyous.

acerix avatar acerix commented on May 28, 2024

Thanks, looks good. My French isn't the best but I looked through the translations you have and they seem fine. I didn't get any further with FullCalendar, I couldn't figure out an elegant way to add it as an option and it wasn't really needed for my project but would be nice to have since it covers most of the missing i18n.

from ls.joyous.

linuxsoftware avatar linuxsoftware commented on May 28, 2024

I am calling this issue done. Thanks for your help acerix. Hopefully this will let people use Joyous in their own languages.

from ls.joyous.

vbroskas avatar vbroskas commented on May 28, 2024

@acerix I'm running into some issues trying to use Modeltranslation with the joyous calendar. When I add the translation options as you have above I get this error:

Exception in thread django-main-thread:
Traceback (most recent call last):
  File "/usr/lib/python3.6/threading.py", line 916, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.6/threading.py", line 864, in run
    self._target(*self._args, **self._kwargs)
  File "/home/lo/Code/clients/nmafc/venv/lib/python3.6/site-packages/django/utils/autoreload.py", line 54, in wrapper
    fn(*args, **kwargs)
  File "/home/lo/Code/clients/nmafc/venv/lib/python3.6/site-packages/django/core/management/commands/runserver.py", line 117, in inner_run
    self.check(display_num_errors=True)
  File "/home/lo/Code/clients/nmafc/venv/lib/python3.6/site-packages/django/core/management/base.py", line 390, in check
    include_deployment_checks=include_deployment_checks,
  File "/home/lo/Code/clients/nmafc/venv/lib/python3.6/site-packages/django/core/management/base.py", line 377, in _run_checks
    return checks.run_checks(**kwargs)
  File "/home/lo/Code/clients/nmafc/venv/lib/python3.6/site-packages/django/core/checks/registry.py", line 72, in run_checks
    new_errors = check(app_configs=app_configs)
  File "/home/lo/Code/clients/nmafc/venv/lib/python3.6/site-packages/wagtail/admin/checks.py", line 63, in get_form_class_check
    if not issubclass(edit_handler.get_form_class(), WagtailAdminPageForm):
  File "/home/lo/Code/clients/nmafc/venv/lib/python3.6/site-packages/wagtail/admin/edit_handlers.py", line 369, in get_form_class
    widgets=self.widget_overrides())
  File "/home/lo/Code/clients/nmafc/venv/lib/python3.6/site-packages/wagtail/admin/edit_handlers.py", line 64, in get_form_for_model
    return metaclass(class_name, (form_class,), form_class_attrs)
  File "/home/lo/Code/clients/nmafc/venv/lib/python3.6/site-packages/wagtail/admin/forms/models.py", line 66, in __new__
    new_class = super(WagtailAdminModelFormMetaclass, cls).__new__(cls, name, bases, attrs)
  File "/home/lo/Code/clients/nmafc/venv/lib/python3.6/site-packages/modelcluster/forms.py", line 245, in __new__
    new_class = super(ClusterFormMetaclass, cls).__new__(cls, name, bases, attrs)
  File "/home/lo/Code/clients/nmafc/venv/lib/python3.6/site-packages/django/forms/models.py", line 266, in __new__
    raise FieldError(message)
django.core.exceptions.FieldError: Unknown field(s) (utc2local, upload) specified for CalendarPage

If I take the calendar page out of my translation.py file, i then run into an error where I can't publish a calendar page. I get a validation error saying that the title field can't be empty, even though I have it filled in.

Any ideas? Thanks for any help you can provide!

from ls.joyous.

linuxsoftware avatar linuxsoftware commented on May 28, 2024

Thanks for the report of this problem. I have created a new Issue #33 for this.

from ls.joyous.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.