8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-11-24 20:33:11 +00:00

Merge branch 'translation' into 'master'

Set language button

See merge request federez/re2o!142
This commit is contained in:
klafyvel 2018-04-23 14:00:24 +02:00
commit 9c332890bc
7 changed files with 91 additions and 40 deletions

Binary file not shown.

View file

@ -30,6 +30,14 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: settings.py:140
msgid "English"
msgstr "Anglais"
#: settings.py:141
msgid "French"
msgstr "Français"
#: templates/re2o/about.html:29 templates/re2o/about.html:35
msgid "About Re2o"
msgstr "A propos de Re2o"
@ -147,6 +155,10 @@ msgstr ""
msgid "Dependencies"
msgstr "Dépendances"
#: templates/re2o/buttons/setlang.html:34
msgid "Translation in development"
msgstr "Traduction en développement"
#: views.py:172
msgid "No Git repository configured"
msgstr "Aucun repository git configuré"

View file

@ -37,6 +37,7 @@ from __future__ import unicode_literals
import os
from .settings_local import *
from django.utils.translation import ugettext_lazy as _
# The root directory for the project
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
@ -135,6 +136,10 @@ LOCALE_PATHS = [
# For translations outside of apps
os.path.join(BASE_DIR, 'templates', 'locale').replace('\\', '/')
]
LANGUAGES = [
('en', _('English')),
('fr', _('French'))
]
# Should use time zone ?
USE_TZ = True

View file

@ -55,6 +55,7 @@ urlpatterns = [
url(r'^about/$', about_page, name='about'),
url('^logout/', auth_views.logout, {'next_page': '/'}),
url('^', include('django.contrib.auth.urls')),
url(r'^i18n/', include('django.conf.urls.i18n')),
url(r'^admin/', include(admin.site.urls)),
url(r'^users/', include('users.urls', namespace='users')),
url(r'^search/', include('search.urls', namespace='search')),

View file

@ -35,6 +35,26 @@ footer a {
border-radius: 0;
}
/* Add right colors for buttons in dropdown in navbar-inverse (else it is light
* gray on white bg and white when hovered */
.navbar-inverse .dropdown-menu .btn-link {
text-decoration: none;
color: #262626;
padding: 0;
}
.navbar-inverse .dropdown-menu .btn-link:hover {
background-color: #f5f5f5;
}
@media screen and (max-width: 767px) {
.navbar-inverse .dropdown-menu .btn-link {
color: #9d9d9d;
}
.navbar-inverse .dropdown-menu .btn-link:hover {
color: #fff;
background-color: transparent;
}
}
/* Set height of the grid so .sidenav can be 100% (adjust as needed) */
.row.content {
height: 100%;

View file

@ -118,7 +118,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
</li>
{% acl_end %}
<li>
<a href="{% url 'about' %}"><i class="fa fa-info-circle"></i> {% trans "About" %}</a>
<a href="{% url 'about' %}"><i class="fa fa-info-circle"></i> {% trans "About" %}</a>
</li>
{% if not request.user.is_authenticated %}
{% if var_sa %}
@ -145,48 +145,11 @@ with this program; if not, write to the Free Software Foundation, Inc.,
</div>
</form>
</li>
{% endif %}
</ul>
</ul>
{% comment %}
<div class="navbar-right">
<form action="{% url "search:search"%}" class="navbar-form" role="search">
<div class="input-group">
<input type="text" class="form-control" placeholder="Search" name="q" id="search-term" {% if search_term %}value="{{ search_term }}"{% endif %}>
<div class="input-group-btn">
<button class="btn btn-default" type="submit"><i class="fa fa-search"></i></button>
<a href="{% url "search:searchp" %}" class="btn btn-default" role="button"><i class="fa fa-plus"></i></a>
</div>
</div>
</form>
</div>
<ul class="nav navbar-nav navbar-right">
{% if not request.user.is_authenticated %}
{% if var_sa %}
<li>
<a href="{% url 'users:new-user' %}">
<i class="fa fa-user-plus"></i> Créer un compte
</a>
</li>
{% endif %}
<li>
<a href="{% url 'login' %}">
<i class="fa fa-sign-in-alt"></i> Login
</a>
</li>
{% endif %}
{% can_view_app preferences %}
{% endif %}
<li>
<a href="{% url 'preferences:display-options' %}">
<i class="fa fa-cogs"></i> Preferences
</a>
</li>
{% acl_end %}
<li>
<a href="{% url 'about' %}"><i class="fa fa-info-circle"></i> A propos</a>
{% include 'buttons/setlang.html' %}
</li>
</ul>
{% endcomment %}
</div>
</div>
</nav>

View file

@ -0,0 +1,50 @@
{% comment %}
Re2o est un logiciel d'administration développé initiallement au rezometz. Il
se veut agnostique au réseau considéré, de manière à être installable en
quelques clics.
Copyright © 2018 Maël Kervella
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
{% endcomment %}
{% load i18n %}
{% get_current_language as LANGUAGE_CODE %}
{% get_available_languages as LANGUAGES %}
{% get_language_info_list for LANGUAGES as languages %}
<a class="dropdown" type="button" role="button" id="setlang"
data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
<i class="fa fa-globe"></i> <span class="caret"></span>
</a>
<div class="dropdown-menu" aria-labelledby="setlang">
<p style="text-align: center"><small><i class="fa fa-exclamation-triangle"></i> {% trans "Translation in development" %}</small></p>
<hr>
<form method="post" action="{% url 'set_language' %}">
{% csrf_token %}
<input type="hidden" name="next" value="{{ request.path }}">
{% for language in languages %}
<button type="submit" name="language" value="{{ language.code }}"
class="btn btn-link btn-block
{% if language.code == LANGUAGE_CODE %}disabled{% endif %}">
{% if language.code == LANGUAGE_CODE %}
<i class="fa fa-check"></i>
{% endif %}
{{ language.name_local | title }} ({{ language.code }})
</button>
{% endfor %}
</form>
</div>