{% block nav_account_languages %} {% if LANGUAGES|length > 1 %} <form id="language_selector" class="navbar-left navbar-form" action="{% url 'set_language' %}" method="post"> {% csrf_token %} <input name="next" type="hidden" value="{{ language_neutral_url_path }}" /> <div class="form-group"> <select name="language" class="form-control"> {% get_language_info_list for LANGUAGES as languages %} {% for language in languages %} <option value="{{ language.code }}"{% if language.code == LANGUAGE_CODE%} selected="selected"{% endif %}> {{ language.name_local }} </option> {% endfor %} </select> </div> <button class="btn btn-default" type="submit" data-loading-text="{% trans 'Submitting...' %}">{% trans "Go" %}</button> </form> {% endif %} {% endblock %}
language_neutral_url_path }}` should be doing this. If that hidden input is empty, it probably means that you're missing `oscar.core.context_processors.metadata` from your template context processors setting.
TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': [TEMPLATE_DIR,], 'OPTIONS': { 'loaders': [ 'django.template.loaders.filesystem.Loader', 'django.template.loaders.app_directories.Loader', ], 'context_processors': [ 'django.contrib.auth.context_processors.auth', 'django.template.context_processors.request', 'django.template.context_processors.debug', 'django.template.context_processors.i18n',
'django.template.context_processors.media', 'django.template.context_processors.static', 'django.contrib.messages.context_processors.messages',
# Oscar specific 'oscar.apps.search.context_processors.search_form', 'oscar.apps.customer.notifications.context_processors.notifications', 'oscar.apps.checkout.context_processors.checkout', 'oscar.core.context_processors.metadata', ], 'debug': DEBUG, } }]
USE_I18N = True
USE_L10N = True
USE_TZ = True
--
https://github.com/django-oscar/django-oscar
http://django-oscar.readthedocs.org/en/latest/
https://twitter.com/django_oscar
---
You received this message because you are subscribed to a topic in the Google Groups "django-oscar" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/django-oscar/QPsfCnbbuzU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to django-oscar...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/django-oscar/27a96c67-3ba5-4764-bc31-9e5b8330f2b6%40googlegroups.com.
from Store import viewsurlpatterns = [ url(r'^$', views.home, name ='home'), url(r'^sobre-nos/$', views.about, name ='about'), url(r'^dashboard/translation$',views.dashboard_translation, name="dashboard_translation"), url(r'^dashboard/sobre-nos/$', views.sobre_nos, name='dashboard-sobre-nos'), url(r'^dashboard/bem-estar/$', views.bem_estar, name='dashboard-bem-estar'), url(r'^dashboard/home-page/$', views.home_page, name='dashboard-home-page'),
]
from django.contrib.sitemaps import views
urlpatterns += [
path('store/', include('Store.urls')),
path('bem-estar/', include('myblog.urls')), path('ckeditor/', include('ckeditor_uploader.urls')), path('i18n/', include('django.conf.urls.i18n')), # > Django-2.0 path('admin/', admin.site.urls), # > Django-2.0
path('', include(apps.get_app_config('oscar').urls[0])), # > Django-2.0
url(r'^sitemap\.xml$', views.index, {'sitemaps': base_sitemaps}), url(r'^sitemap-(?P<section>.+)\.xml$', views.sitemap, {'sitemaps': base_sitemaps}, name='django.contrib.sitemaps.views.sitemap'),
]+static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
That seems to be what you would want? So the next URL is set to be the same as the current URL without the language code. You should then get redirected to the new language code with this URL path appended.
On Wed, 22 Jan 2020, 15:36 Yahiba, <yahi...@gmail.com> wrote:
--Hello again Samir,I now noticed the the {{ language_neutral_url_path }} will be equal to the directory I am on, so previously it was just a slash ( / ) because I was in the root directory, so if I switch to the catalogue it will be ( /catalogue/ )I have the following configurations:
USE_I18N = TrueUSE_L10N = TrueUSE_TZ = True
I tried turnig False USE_I18N but then the language switching does not work.
quarta-feira, 22 de Janeiro de 2020 às 11:53:04 UTC, Samir Shah escreveu:I'm not too sure what the issue is then. Do you have `USE_I18N` set to True in your settings? That is the only other thing that would short-circuit the context variable.
https://github.com/django-oscar/django-oscar
http://django-oscar.readthedocs.org/en/latest/
https://twitter.com/django_oscar
---
You received this message because you are subscribed to a topic in the Google Groups "django-oscar" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/django-oscar/QPsfCnbbuzU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to django...@googlegroups.com.
[22/Jan/2020 14:59:07] "POST /i18n/setlang/ HTTP/1.1" 302 0[22/Jan/2020 14:59:07] "GET /es/ HTTP/1.1" 302 0[22/Jan/2020 14:59:07] "GET /catalogue/ HTTP/1.1" 200 70334
urlpatterns = [ url(r'^$', views.home, name ='home'),
]
urlpatterns = i18n_patterns(
url(r'^$', views.home, name ='home'),
)
from Store import views
urlpatterns = i18n_patterns( url(r'^$', views.home, name ='home'),)
urlpatterns += [
# url(r'/es/^$', views.home, name ='home'),
url(r'^sobre-nos/$', views.about, name ='about'), url(r'^dashboard/translation$',views.dashboard_translation, name="dashboard_translation"), url(r'^dashboard/sobre-nos/$', views.sobre_nos, name='dashboard-sobre-nos'), url(r'^dashboard/bem-estar/$', views.bem_estar, name='dashboard-bem-estar'), url(r'^dashboard/home-page/$', views.home_page, name='dashboard-home-page'),
]
from django.contrib.sitemaps import views
urlpatterns += [
path('store/', include('Store.urls')),
path('bem-estar/', include('myblog.urls')), path('ckeditor/', include('ckeditor_uploader.urls')), path('i18n/', include('django.conf.urls.i18n')), # > Django-2.0 path('admin/', admin.site.urls), # > Django-2.0
path('', include(apps.get_app_config('oscar').urls[0])), # > Django-2.0
url(r'^sitemap\.xml$', views.index, {'sitemaps': base_sitemaps}), url(r'^sitemap-(?P<section>.+)\.xml$', views.sitemap, {'sitemaps': base_sitemaps}, name='django.contrib.sitemaps.views.sitemap'),
]+static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)