puput
puput copied to clipboard
i18n support
Hi, how i18n is handled in pupput?
My blog has to be both in english and french. Is there a way to add a blog entry in 2 languages?
Thanks.
Hi @nux17, We are writing a documentation with the approach that we developed for our customers. The main idea is that you have to duplicate your content for each language. Since Wagtail doesn't have a proper i18n support we need to do tweaks like this in order figure out this problem.
Sure, so are the translation features available right now?
As I said, you have to duplicate your content. So you need to create a structure like /en/blog/ and /fr/blog and create the same entries for each blog.
Got it. So no i18n support on url patterns for the blog. That's weird Wagtail doesn't support localization OOB.
Could I have some support doing this?
I need it translated in French and English, do I have to insert puppet urls
inside i18n patterns and then build 2 sites on Wagtail admin? Just need some advices doing it the proper way.
Is that what is reffering this Wagtail doc page to?
@marctc Thanks for helping.
Hi @nux17 ! Yes, we are talking about the refered Wagtail doc page. You don't have to insert puput urls inside i18n because the language code in the url will be the title/slug of your "home pages" at the Wagtaild admin. You just need to follow the puput's documentation.
Puput's now ready to suport this, @marctc and I work on it in this commit and this other one. The idea of this issue can be find at the first commit, at the second there are some fixes.
That's what I've done and, if you link your pages, it works properly.
I'll add a section to the Puput's documentation explaining this issue. I'll try to do it in short time. Meanwhile, I hope that this short comment will be useful.
Thanks for helping @csalom!
Almost got this to work. Here are my urls: `urlpatterns = i18n_patterns( url(r'^$', index), )
urlpatterns += [ url(r'^admin/', admin.site.urls), url(r'^newsletter', newsletter_handler), url(r'^robots.txt$', lambda r: HttpResponse("User-agent: *\nDisallow:")),]
urlpatterns += url(r'^language/', include('django.conf.urls.i18n')),
urlpatterns += url(r'', include('puput.urls')), `
Going to /blog
works and redirects me on the right Blog depending on language.
Since my root page isn't a Wagtail one but a static view with i18n patterns, going to /
should redirect me to /fr
or /en
, but puput_initial_data
links this to a root page and just shows me a blank page with Root written on.
Without that page, i18n patterns add an /en
before /blog
and thus the route isn't done the good way and my blog is not reachable.
How to merge those routes and to work?
I guess there's an issue about using a static page at r''
and puput routes...
Hi @nux17, As you said, that solution is not good enough. It's not completed. As I tried to explain at my other comment, you have to include a new page above the blog's page. When you look at your wagtail tree (at the admin) instead of /blog/ at your root level you should see: /fr/blog and /en/blog.
You have to follow wagtail's documentation at this link. Try to understand the first example. It's very similar to the wagtail tree that you must have to be able to run what you want correctly. You should place your blogs at the same level of the contact pages.
See you, Carlos.
Hello all, Is there an easy way to integrate wagtailtrans with puput? Many thanks.
Tried the following and it seems working fine:
- Created an abstract class from "TranslatablePage":
from wagtailtrans.models import TranslatablePage
class TranslatablePageAbstract(TranslatablePage):
class Meta:
abstract = True
- Subclassed from the previous class and puput pages.
from puput.models import BlogPage, EntryPage
from wagtailtrans.models import TranslatablePage
class TranslatablePageAbstract(TranslatablePage):
class Meta:
abstract = True
class TranslatableBlogPage(TranslatablePageAbstract, BlogPage):
subpage_types = ['blog.TranslatableEntryPage']
class TranslatableEntryPage(TranslatablePageAbstract, EntryPage):
parent_page_types = ['blog.TranslatableBlogPage']
Any thoughts about this implementation? Any issues that might arise?
If all is fine with this method I suggest adding it to the docs.
I'll close this issue because Internationalisation is included on the wagtail versions supported by Puput.