Open kaphadley opened 4 years ago
Did you run python manage.py migrate
after installing wagtail-localize
? Also, have you added at least one variant of de
into WAGTAIL_CONTENT_LANGUAGES
?
Thank you for your answer, I did not run any migration. I am new to wagtail and I simply followed the wagtail's instruction then the readme of wagtail-localize. The only reference to a migration that I saw was related to snippets.
I would suggest:
python manage.py migrate
instruction to the readme.urls.py
contain aurl()
function that is not available without import of django.conf.urls
.Now the dashboard and the homepage work! I translated the homepage, in the dashboard and it also works. But I am still unable to access the translated page.
The link to the translation points to /None
:
{% for language_code, language_name in LANGUAGES %}
{% get_language_info for language_code as lang %}
{% language language_code %}
<a href="{% pageurl page.localized %}" rel="alternate" hreflang="{{ language_code }}">
{{ lang.name_local }}
</a>
{% endlanguage %}
{% endfor %}
I neither can access the page by /translated-slug
nor /de/tranlated-slug
nor any other combination that I tried (404).
Another question: wagtail-localize philosophy is to write in the default language and to translate right? There is no way to create the initial content in another language and then translate to the site's default (or to never translate it)?
I followed the Wagtail's documentation to enable multi-language support:
https://docs.wagtail.io/en/stable/advanced_topics/i18n.html#multi-language-content
Then I installed wagtail-localize by following the readme instructions.
When I open a page in the admin, I get an error:
no such table: wagtail_localize_translatableobject
Traceback
``` Environment: Request Method: GET Request URL: http://localhost:8000/admin/pages/3/ Django Version: 3.1.3 Python Version: 3.8.6 Installed Applications: ['home', 'search', 'wagtail.contrib.forms', 'wagtail.contrib.redirects', 'wagtail.embeds', 'wagtail.sites', 'wagtail.users', 'wagtail.snippets', 'wagtail.documents', 'wagtail.images', 'wagtail.search', 'wagtail.admin', 'wagtail.core', 'wagtail_localize', 'wagtail_localize.locales', 'modelcluster', 'taggit', 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles'] Installed Middleware: ['django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', 'django.middleware.security.SecurityMiddleware', 'django.middleware.locale.LocaleMiddleware', 'wagtail.contrib.redirects.middleware.RedirectMiddleware'] Template error: In template /usr/local/lib/python3.8/site-packages/wagtail/admin/templates/wagtailadmin/pages/listing/_buttons.html, error at line 2 no such table: wagtail_localize_translatableobject 1 : {% for button in buttons %} 2 : {% if button.show %} 3 :HaL
34 : 35 : {% for language_code, language_name in LANGUAGES %} 36 : {% get_language_info for language_code as lang %} 37 : 38 : {% language language_code %} 39 : 40 : {{ lang.name_local }} 41 : 42 : {% endlanguage %} 43 : {% endfor %} 44 :Any idea on what is wrong?