Skip to content

Commit

Permalink
Merge pull request #3104 from centerofci/i18n-select-lang-anon-user
Browse files Browse the repository at this point in the history
[i18n] Language switcher for anon users
  • Loading branch information
seancolsen authored Oct 25, 2023
2 parents c2059cc + de03c76 commit adf1290
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
23 changes: 23 additions & 0 deletions mathesar/templates/mathesar/login_base.html
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,13 @@
font-size: var(--size-xx-large);
text-align: center;
}
.login-card .language-selector {
display: block;
background-color: transparent;
border: 1px solid var(--slate-200);
border-radius: 0.285rem;
cursor: pointer;
}
@media (max-width: 50rem) {
.unsupported-device {
display: block;
Expand Down Expand Up @@ -143,5 +150,21 @@
<div class="login-card align-center">
<h1>{% block h1 %} {% endblock %}</h1>
{% block box_content %} {% endblock %}
<!-- Commenting it out to avoid releasing any half baked changes
{% comment %} set_language https://docs.djangoproject.com/en/4.2/topics/i18n/translation/#the-set-language-redirect-view {% endcomment %}
<form action="{% url 'set_language' %}" method="post">{% csrf_token %}
<input name="next" type="hidden" value="{{ redirect_to }}">
<select name="language" onchange="form.submit()" class="language-selector align-center" aria-label="Display Language">
{% get_current_language as LANGUAGE_CODE %}
{% get_available_languages as LANGUAGES %}
{% get_language_info_list for LANGUAGES as languages %}
{% for language in languages %}
<option value="{{ language.code }}"{% if language.code == LANGUAGE_CODE %} selected{% endif %}>
{{ language.name_local }} ({{ language.code }})
</option>
{% endfor %}
</select>
</form>
-->
</div>
{% endblock %}
1 change: 1 addition & 0 deletions mathesar/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
path('shares/explorations/<slug>/', views.shared_query, name='shared_query'),
path('db/', views.home, name='db_home'),
path('db/<db_name>/', views.schemas, name='schemas'),
path('i18n/', include('django.conf.urls.i18n')),
re_path(
r'^db/(?P<db_name>\w+)/(?P<schema_id>\w+)/',
views.schema_home,
Expand Down

0 comments on commit adf1290

Please sign in to comment.