Comments (12)
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.
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.
Yes, the dates show up in the correct language but most text is hardcoded, for example:
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.
Thanks! A PR when you are ready would be most welcome.
from ls.joyous.
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.
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.
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.
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.
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.
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.
@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.
Thanks for the report of this problem. I have created a new Issue #33 for this.
from ls.joyous.
Related Issues (20)
- Suggestion: Sync with google HOT 2
- Make the Export functionality optional HOT 1
- FIRST_DAY_OF_WEEK doesn't work for monthly views HOT 3
- Ongoing events HOT 3
- Docs on updating joyous HOT 3
- Upgrade - no calendar HOT 6
- Japanese translation HOT 3
- Issues trying to use Modeltranslation HOT 14
- Joyous EventBase.status field clashes with Django-Model-Utils StatusModel.status field HOT 5
- 'WSGIRequest' object has no attribute 'site' HOT 2
- Feature for setting multi time-ranges in same day HOT 4
- Not working properly with codredcms? HOT 2
- New Day view
- Merging events from two calendars... HOT 4
- Release 1.5.0 with default_auto_field set in JoyousAppConfig HOT 2
- Version 1.4.0 incompatible with holidays v0.13 HOT 7
- Saving events with same title fails
- Incompatible with Wagtail 3
- Joyous raises error with Django 3.2.17 Wagtail 2.16.3 and Python 3.9 HOT 1
- Wagtail 4.0 compatibility
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ls.joyous.