From 9569e22df9d44239b0eca0a5f5d9247f54d1a879 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ma=C3=ABl=20Kervella?= Date: Mon, 16 Apr 2018 18:07:54 +0000 Subject: [PATCH] Set language button --- re2o/locale/fr/LC_MESSAGES/django.mo | Bin 3605 -> 3694 bytes re2o/locale/fr/LC_MESSAGES/django.po | 8 +++++ re2o/settings.py | 5 +++ re2o/urls.py | 1 + static/css/base.css | 20 +++++++++++ templates/base.html | 43 ++---------------------- templates/buttons/setlang.html | 48 +++++++++++++++++++++++++++ 7 files changed, 85 insertions(+), 40 deletions(-) create mode 100644 templates/buttons/setlang.html diff --git a/re2o/locale/fr/LC_MESSAGES/django.mo b/re2o/locale/fr/LC_MESSAGES/django.mo index eb533f3e22010443cc48455dd1c5342fd6f88cd5..f5ba827358e0722273624a066f190f9160ccc7aa 100644 GIT binary patch delta 409 zcmXxgy-EW?6o%n1KbypuKbL?OD*<~!v=>rDq68BJErmriyCN%?%EmO_fhJ8#ixjC$ z3NOGeO)4wFJJ7}(@I8w;?94M~n4L2-1MkP{f4S*_h%(KiJ=4}{g#;ZDU=u?;!RdeQ zB&8PlG0s!c2wn24jFiWFT*F5!;1IL;f_$3LQLnElgH0wDSjBJLp-7U|N921s=?ow6 z5I?YuwH2wJmTqx_{Iw`maE^9?Pqf0nXoXdhSgIV>(8VovrCkQL!6{NVKAkOG2LEey znV@ZIVYjs4;&E6Jdqo~24z?3#6=#$)+fM8|rAE}f344JK?k=N?V0NA9WXnwXVUH<4 MdLR4Y(_8WU4-D)n&Hw-a delta 329 zcmXZXy=uZ>6vpuRV(5uBW)x^#B4B_MQg5xThP9k_&2hfZD8TX1q|ouqdl zbhnFF5PAg;{!j40!!L)tdC$qezxKnEmt2d=6Q3+dkwnDm!I1{o#TT4k`(F&`D+%dv zBTdkw@1&(H_R;PMFo&;b_s_6_A6S+`ZFsODKlsdx$dyL;n310F6Nh-jeo|`RN;Uc^ z8yD~$tGGfNw8bXwv4wwV=g-I(v1?qmq|}qRGyc$8&WIloGn68Cgnh(raj}DzUrv4Z P=Co3~@AS}JmhQ(FvLhah diff --git a/re2o/locale/fr/LC_MESSAGES/django.po b/re2o/locale/fr/LC_MESSAGES/django.po index 2cabc6ec..cb06fb57 100644 --- a/re2o/locale/fr/LC_MESSAGES/django.po +++ b/re2o/locale/fr/LC_MESSAGES/django.po @@ -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" diff --git a/re2o/settings.py b/re2o/settings.py index bac8982b..52606b6d 100644 --- a/re2o/settings.py +++ b/re2o/settings.py @@ -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 diff --git a/re2o/urls.py b/re2o/urls.py index b1cccfd9..47172521 100644 --- a/re2o/urls.py +++ b/re2o/urls.py @@ -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')), diff --git a/static/css/base.css b/static/css/base.css index 7338fab6..b6a7ae26 100644 --- a/static/css/base.css +++ b/static/css/base.css @@ -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%; diff --git a/templates/base.html b/templates/base.html index 297cac89..f198feec 100644 --- a/templates/base.html +++ b/templates/base.html @@ -118,7 +118,7 @@ with this program; if not, write to the Free Software Foundation, Inc., {% acl_end %}
  • - {% trans "About" %} + {% trans "About" %}
  • {% 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., - {% endif %} - - - {% comment %} - - - {% endcomment %} diff --git a/templates/buttons/setlang.html b/templates/buttons/setlang.html new file mode 100644 index 00000000..0789685a --- /dev/null +++ b/templates/buttons/setlang.html @@ -0,0 +1,48 @@ +{% 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 %} + + + + +