app django pour porter les traductions (#71292) #528

Merged
fpeters merged 9 commits from wip/71292-translations into main 2024-03-15 07:29:47 +01:00
23 changed files with 765 additions and 151 deletions

2
Jenkinsfile vendored
View File

@ -9,7 +9,7 @@ pipeline {
script {
sh 'tox -rv' // makes pre-commit check style
if (env.GIT_BRANCH.startsWith('wip/')) {
sh 'make css'
sh 'python3 setup.py compile_scss'
}
sh '(cd help/fr/ && if [ $(yelp-build html *.page 2>&1 | wc -c) -ne 0 ]; then exit 1; fi)'
sh 'git clean -xdf'

22
MANIFEST.in Normal file
View File

@ -0,0 +1,22 @@
# static
recursive-include static *.scss *.css *.js *.ico *.gif *.svg *.png *.jpg *.jpeg *.woff *.woff2 *.ttf *.map *.json *.eot *.otf
# templates
recursive-include templates *.html *.txt
# documentation
recursive-include help *.page *.png
# scripts & pictos
recursive-include src *.py *.svg
# locales
recursive-include publik_base_theme/locale *.po *.mo
include MANIFEST.in
include COPYING
include VERSION
include inkscape_wrapper.py
include themes.json
include create_themes_json.py
include make_data_uris.py

View File

@ -1,96 +0,0 @@
VERSION=`git describe | sed 's/^v//; s/-/./g' `
NAME="publik-base-theme"
INKSCAPE=$(shell pwd)/src/inkscape_wrapper.py
prefix = /usr
all: themes.json icons css
static/includes/_data_uris.scss: $(wildcard static/includes/img/*)
python3 make_data_uris.py static/includes/
static/toodego/_data_uris.scss: $(wildcard static/toodego/img/*)
python3 make_data_uris.py static/toodego/
static/lille/_data_uris.scss: $(wildcard static/lille/img/*)
python3 make_data_uris.py static/lille/
static/lomme/_data_uris.scss: $(wildcard static/lomme/img/*)
python3 make_data_uris.py static/lomme/
static/hellemmes/_data_uris.scss: $(wildcard static/hellemmes/img/*)
python3 make_data_uris.py static/hellemmes/
static/toulouse-2022/_data_uris.scss: $(wildcard static/toulouse-2022/img/*)
python3 make_data_uris.py static/toulouse-2022/
themes.json: $(wildcard static/*/config.json) help/fr/misc-scss.page
python3 create_themes_json.py
%.css: export LC_ALL=C.UTF-8
.SECONDEXPANSION:
%.css: %.scss $(wildcard static/includes/*.scss static/includes/*/*.scss) static/includes/_data_uris.scss static/lille/_data_uris.scss static/lomme/_data_uris.scss static/hellemmes/_data_uris.scss static/toodego/_data_uris.scss static/toulouse-2022/_data_uris.scss $$(wildcard $$(@D)/*.scss)
sassc --sourcemap $< $@
css: $(shell python3 get_themes.py) static/portal-agent/css/agent-portal.css static/includes/gadjo-extra.css
rm -rf static/*/.sass-cache/
icons:
# chateauroux
cd src/ && python3 render-imgs-dashboard.py ../static/chateauroux/img/ --normal 333333 --selected 0779B7 --title FFFFFF --title-width 80
# orleans
cd src/ && python3 render-imgs-categories.py ../static/orleans/img/ --primary f05923 --secondary 34697D
cd src/ && python3 render-imgs-dashboard.py ../static/orleans/img/ --normal FFFFFF --normal-width 30 --selected f05923 --selected-width 30 --title FFFFFF --title-width 80
# publik
cd src/ && python3 render-imgs-categories.py ../static/publik/img/
cd src/ && python3 render-imgs-dashboard.py ../static/publik/img/ --normal 4D4D4D --selected DF017A --title FFFFFF --title-width 80
# somme
cd src/ && python3 render-imgs-categories.py ../static/somme-cd80/img/ --primary A8002B --secondary A8002B
cd src/ && python3 render-imgs-dashboard.py ../static/somme-cd80/img/ --normal 4D4D4D --selected 87A738 --title FFFFFF --title-width 80
# tournai
cd static/tournai/ && for F in assets/*.svg; do $(INKSCAPE) --without-gui --file $$F --export-area-drawing --export-area-snap --export-png img/$$(basename $$F .svg).png --export-width 40; done
clean:
rm -rf sdist
rm -f src/tmp-*.svg
rm -f static/*/_data_uris.scss
-rm $$(python3 get_themes.py --include-map-files)
-rm static/portal-agent/css/agent-portal.css static/portal-agent/css/agent-portal.css.map static/includes/gadjo-extra.css static/includes/gadjo-extra.css.map
DIST_FILES = \
Makefile \
desc.xml \
create_themes_json.py \
get_themes.py \
make_data_uris.py \
static templates \
src \
help
dist: clean
-mkdir sdist
rm -rf sdist/$(NAME)-$(VERSION)
mkdir -p sdist/$(NAME)-$(VERSION)
for i in $(DIST_FILES); do \
cp -R "$$i" sdist/$(NAME)-$(VERSION); \
done
install:
mkdir -p $(DESTDIR)$(prefix)/share/publik/themes/publik-base
cp -r static templates themes.json desc.xml $(DESTDIR)$(prefix)/share/publik/themes/publik-base
rm $(DESTDIR)$(prefix)/share/publik/themes/publik-base/static/*/config.json
mkdir -p $(DESTDIR)$(prefix)/share/wcs/themes/
ln -s $(prefix)/share/publik/themes/publik-base $(DESTDIR)$(prefix)/share/wcs/themes/publik-base
dist-bzip2: dist
-mkdir sdist
cd sdist && tar cfj ../sdist/$(NAME)-$(VERSION).tar.bz2 $(NAME)-$(VERSION)
version:
@(echo $(VERSION))
name:
@(echo $(NAME))
fullname:
@(echo $(NAME)-$(VERSION))

5
debian/control vendored
View File

@ -3,8 +3,12 @@ Section: web
Priority: optional
Maintainer: Frédéric Péters <fpeters@entrouvert.com>
Build-Depends: debhelper-compat (= 12),
dh-python,
inkscape,
python3,
python3-all,
python3-django,
python3-setuptools,
sassc (>= 3.4.2),
Standards-Version: 3.9.4
Homepage: http://git.entrouvert.org/publik-base-theme.git
@ -13,6 +17,7 @@ Package: publik-base-theme
Architecture: all
Depends: python3-gadjo,
${misc:Depends},
${python3:Depends},
${shlibs:Depends},
Conflicts: python-authentic2 (<< 2.1.20.742.gb6ee096-0),
python-django (<= 1:1.11),

9
debian/rules vendored
View File

@ -9,8 +9,9 @@
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
%:
dh $@
export PYBUILD_NAME=publik-django-templatetags
export PYBUILD_DISABLE=test
override_dh_auto_build:
dh_auto_build --no-parallel
%:
dh $@ --with python3 --buildsystem=pybuild

22
manage.py Executable file
View File

@ -0,0 +1,22 @@
#!/usr/bin/env python
"""Django's command-line utility for administrative tasks."""
import os
import sys
def main():
"""Run administrative tasks."""
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'publik_base_theme.settings')
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
raise ImportError(
"Couldn't import Django. Are you sure it's installed and "
'available on your PYTHONPATH environment variable? Did you '
'forget to activate a virtual environment?'
) from exc
execute_from_command_line(sys.argv)
if __name__ == '__main__':
main()

View File

View File

@ -0,0 +1,348 @@
# publik-base-theme French translation
# Copyright (C) Entrouvert
# This file is distributed under the same license as the publik-base-theme package.
#
msgid ""
msgstr ""
"Project-Id-Version: publik-base-theme 0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-03-07 08:01+0100\n"
"PO-Revision-Date: 2024-03-07 08:14+0100\n"
"Language: French\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
#: templates/authentic2/base.html
msgid "there are errors in the form"
msgstr "le formulaire présente des erreurs"
#: templates/authentic2/login.html
#: templates/variants/alpes-maritimes-2018/authentic2_auth_saml/login_cd06-adfs.html
#: templates/variants/alpes-maritimes-2022/authentic2_auth_saml/login_cd06-adfs.html
#: templates/variants/marseille/authentic2_auth_saml/login_marseille-adfs.html
#: templates/variants/tournai/authentic2_auth_fedict/login.html
msgid "Login"
msgstr "Connexion"
#: templates/beid/login_form.html
#: templates/variants/grandlyon-glc/authentic2/login_password_form.html
#: templates/variants/quimper/authentic2/login_password_form.html
#: templates/variants/strasbourg-2018/authentic2/login_password_form.html
#: templates/variants/tournai/authentic2/login_password_form.html
msgid "Log in"
msgstr "Connexion"
#: templates/beid/profile.html
msgid "Belgian eID card"
msgstr "Carte eID"
#: templates/beid/profile.html
#: templates/variants/strasbourg-2018/authentic2/accounts_edit_photo.html
msgid "Delete"
msgstr "Supprimer"
#: templates/combo/json/arpege_demands.html
#: templates/variants/toulouse-2022/combo/wcs/user_all_forms.html
msgid "There are no forms."
msgstr "Il ny a aucune demande."
#: templates/combo/page_template.html
#: templates/variants/nimes/combo/page_template_2sidebars.html
msgid "Top of content"
msgstr "Haut du contenu"
#: templates/combo/page_template.html
#: templates/portal-agent/combo/page_template.html
#: templates/portal-agent/combo/page_template_sidebar.html
#: templates/variants/nimes/combo/page_template_2sidebars.html
#: templates/variants/strasbourg-2018/combo/page_template.html
msgid "Content"
msgstr "Contenu"
#: templates/combo/page_template.html
#: templates/variants/nimes/combo/page_template_2sidebars.html
msgid "Bottom of content"
msgstr "Bas du contenu"
#: templates/combo/page_template.html
#: templates/variants/avray/combo/page_template.html
#: templates/variants/coprec/combo/page_template.html
#: templates/variants/montlouis-sur-loire/combo/page_template.html
#: templates/variants/strasbourg-2018/combo/page_template.html
msgid "Footer"
msgstr "Pied de page"
#: templates/combo/page_template_2cols.html
#: templates/combo/page_template_2cols_sidebar.html
#: templates/portal-agent/combo/page_template_2cols.html
#: templates/portal-agent/combo/page_template_2cols_sidebar.html
#: templates/variants/amiens-metropole/combo/page_template_homepage.html
#: templates/variants/lille/combo/page_template_homepage.html
#: templates/variants/meudon-2021/combo/page_template_homepage.html
msgid "Left column"
msgstr "Colonne de gauche"
#: templates/combo/page_template_2cols.html
#: templates/combo/page_template_2cols_sidebar.html
#: templates/portal-agent/combo/page_template_2cols.html
#: templates/portal-agent/combo/page_template_2cols_sidebar.html
#: templates/variants/amiens-metropole/combo/page_template_homepage.html
#: templates/variants/lille/combo/page_template_homepage.html
#: templates/variants/meudon-2021/combo/page_template_homepage.html
msgid "Right column"
msgstr "Colonne de droite"
#: templates/combo/page_template_sidebar.html
#: templates/portal-agent/combo/page_template_2cols_sidebar.html
#: templates/portal-agent/combo/page_template_sidebar.html
#: templates/variants/thonon-agglomeration-2021/combo/page_template_sidebar.html
msgid "Sidebar"
msgstr "Barre latérale"
#: templates/hobo/maintenance/maintenance_page.html
msgid "This site is currently unavailable."
msgstr "Ce site est actuellement indisponible."
#: templates/qommon/forms/widgets/includes/cartads-piece.html
msgid "Drop a file or click to select one"
msgstr "Déposez un fichier ou cliquez pour en sélectionner un."
#: templates/qommon/forms/widgets/includes/cartads-piece.html
msgid "Upload done"
msgstr "Téléchargement terminé."
#: templates/qommon/forms/widgets/includes/cartads-piece.html
#: templates/variants/toodego/qommon/forms/widgets/photo-x.html
msgid "Upload in progress..."
msgstr "Téléchargement en cours…"
#: templates/qommon/forms/widgets/includes/cartads-piece.html
msgid "Error during upload."
msgstr "Erreur lors du transfert."
#: templates/qommon/forms/widgets/includes/cartads-piece.html
#: templates/variants/toodego/qommon/forms/widgets/photo-x.html
msgid "Remove this file"
msgstr "Retirer ce fichier"
#: templates/qommon/forms/widgets/includes/cartads-piece.html
#: templates/variants/toodego/qommon/forms/widgets/photo-x.html
msgid "remove"
msgstr "retirer"
#: templates/registration/password_reset_form.html
msgid "Resetting password"
msgstr "Mot de passe oublié"
#: templates/registration/password_reset_form.html
#: templates/variants/montpellier/registration/registration_form.html
#: templates/variants/pre-saint-gervais/registration/registration_completion_form.html
#: templates/variants/pre-saint-gervais/registration/registration_form.html
#: templates/variants/strasbourg-2018/registration/registration_completion_form.html
#: templates/variants/toulouse-metropole/registration/registration_form.html
msgid "Submit"
msgstr "Valider"
#: templates/registration/registration_form.html
#: templates/variants/strasbourg-2018/registration/registration_completion_form.html
#: templates/variants/tournai/registration/registration_form.html
msgid "Registration"
msgstr "Création dun compte"
#: templates/variants/alpes-maritimes-2018/authentic2_auth_fc/login.html
#: templates/variants/toulouse-metropole/authentic2_auth_fc/login.html
msgid "Log in with FranceConnect"
msgstr "Sidentifier avec FranceConnect"
#: templates/variants/alpes-maritimes-2018/authentic2_auth_saml/login_cd06-adfs.html
#: templates/variants/alpes-maritimes-2022/authentic2_auth_saml/login_cd06-adfs.html
#: templates/variants/bouches-du-rhone/authentic2_auth_saml/login_cd13-adfs.html
#: templates/variants/grandlyon-glc/authentic2/login_password_form.html
#: templates/variants/marseille/authentic2_auth_saml/login_marseille-adfs.html
#: templates/variants/strasbourg-2018/authentic2/accounts_edit_photo.html
msgid "Cancel"
msgstr "Annuler"
#: templates/variants/amiens-metropole/combo/page_template_homepage.html
msgid "Top Banner"
msgstr "Bandeau du haut"
#: templates/variants/amiens-metropole/combo/page_template_homepage.html
#: templates/variants/lille/combo/page_template_homepage.html
msgid "Middle column"
msgstr "Colonne du milieu"
#: templates/variants/blois/wcs/front/formdata_history.html
msgid "Log"
msgstr "Historique"
#: templates/variants/grandlyon-glc/authentic2_auth_fc/linking.html
msgid "Link with a FranceConnect account"
msgstr "Liaison avec un compte FranceConnect"
#: templates/variants/grandlyon-glc/authentic2_auth_fc/linking.html
msgid "opens in new window"
msgstr "(souvre dans une nouvelle fenêtre)"
#: templates/variants/grandlyon-glc/authentic2_auth_fc/linking.html
msgid "What is FranceConnect?"
msgstr "Quest-ce que FranceConnect ?"
#: templates/variants/isere-cd38/qommon/forms/widgets/select--ens-calendar.html
msgid "Monday"
msgstr "Lundi"
#: templates/variants/isere-cd38/qommon/forms/widgets/select--ens-calendar.html
msgid "Tuesday"
msgstr "Mardi"
#: templates/variants/isere-cd38/qommon/forms/widgets/select--ens-calendar.html
msgid "Wednesday"
msgstr "Mercredi"
#: templates/variants/isere-cd38/qommon/forms/widgets/select--ens-calendar.html
msgid "Thursday"
msgstr "Jeudi"
#: templates/variants/isere-cd38/qommon/forms/widgets/select--ens-calendar.html
msgid "Friday"
msgstr "Vendredi"
#: templates/variants/isere-cd38/qommon/forms/widgets/select--ens-calendar.html
msgid "Saturday"
msgstr "Samedi"
#: templates/variants/isere-cd38/qommon/forms/widgets/select--ens-calendar.html
msgid "Sunday"
msgstr "Dimanche"
#: templates/variants/izi-ici/authentic2_idp_oidc/authorization.html
msgid "Your email:"
msgstr "Votre adresse de courriel :"
#: templates/variants/izi-ici/authentic2_idp_oidc/authorization.html
msgid "Do not ask again"
msgstr "Ne plus redemander"
#: templates/variants/izi-ici/authentic2_idp_oidc/authorization.html
msgid "Accept"
msgstr "Accepter"
#: templates/variants/izi-ici/authentic2_idp_oidc/authorization.html
msgid "Refuse"
msgstr "Refuser"
#: templates/variants/lille/combo/wcs/tracking_code_input.html
#: templates/variants/metz-metropole-2019/combo/wcs/tracking_code_input.html
#: templates/variants/strasbourg-2018/combo/wcs/tracking_code_input.html
#: templates/variants/toodego/portal-user/combo/wcs/tracking_code_input.html
msgid "The tracking code could not been found."
msgstr "Le code de suivi na pas pu être trouvé."
#: templates/variants/lille/combo/wcs/tracking_code_input.html
#: templates/variants/metz-metropole-2019/combo/wcs/tracking_code_input.html
#: templates/variants/strasbourg-2018/combo/wcs/tracking_code_input.html
#: templates/variants/toodego/portal-user/combo/wcs/tracking_code_input.html
msgid "Tracking Code"
msgstr "Code de suivi"
#: templates/variants/lille/combo/wcs/tracking_code_input.html
#: templates/variants/metz-metropole-2019/combo/wcs/tracking_code_input.html
#: templates/variants/strasbourg-2018/combo/wcs/tracking_code_input.html
#: templates/variants/toodego/portal-user/combo/wcs/tracking_code_input.html
msgid "ex: CNPHNTFB"
msgstr "ex. : CNPHNTFB"
#: templates/variants/montlouis-sur-loire/combo/page_template.html
msgid "Services"
msgstr "Services"
#: templates/variants/montpellier/authentic2/logout.html
msgid "Continue logout"
msgstr "Continuer la déconnexion"
#: templates/variants/montpellier/subscriptions/subscriptions.html
msgid "Modify"
msgstr "Modifier"
#: templates/variants/orleans/calendar/booking_calendar_content.html
msgid "previous"
msgstr "précédent"
#: templates/variants/orleans/calendar/booking_calendar_content.html
msgid "next"
msgstr "suivant"
#: templates/variants/roannais-icitoyen/combo/search-cell.html
msgid "Search"
msgstr "Recherche"
#: templates/variants/rouen/combo/wcs/current_drafts.html
msgid "draft"
msgstr "brouillon"
#: templates/variants/sables-d-olonne-2022/combo/menu.html
msgid "active page"
msgstr "page active"
#: templates/variants/strasbourg-2018/qommon/forms/widgets/select_jsonp--address.html
msgid "Manually enter the address"
msgstr "Entrer ladresse manuellement"
#: templates/variants/strasbourg-2018/registration/registration_completion_form.html
msgid "Please fill the form to complete your registration"
msgstr "Veuillez remplir le formulaire afin de finir la création de votre compte."
#: templates/variants/toodego/combo/dashboardcell.html
msgid "Loading..."
msgstr "Chargement…"
#: templates/variants/toodego/combo/json/rsj-a-traiter.html
msgid "Created"
msgstr "Date de création"
#: templates/variants/toodego/combo/json/rsj-a-traiter.html
msgid "Last Modified"
msgstr "Dernière modification"
#: templates/variants/toodego/combo/json/rsj-a-traiter.html
msgid "Status"
msgstr "Statut"
#: templates/variants/toulouse-2022/authentic2/login_password_form.html
msgid "Forgot password?"
msgstr "Mot de passe perdu ?"
#: templates/variants/toulouse-2022/authentic2/login_password_form.html
msgid "Reset it!"
msgstr "Récupérez votre accès !"
#: templates/variants/toulouse-2022/authentic2/login_password_form.html
msgid "Not a member?"
msgstr "Pas de compte ?"
#: templates/variants/toulouse-2022/authentic2/login_password_form.html
msgid "Register!"
msgstr "Enregistrez-vous !"
#: templates/variants/toulouse-2022/combo/wcs/current_forms.html
msgid "Current Forms"
msgstr "Demandes en cours"
#: templates/variants/toulouse-2022/combo/wcs/current_forms.html
msgid "There are no current forms."
msgstr "Il ny a aucune demande en cours de traitement."
#: templates/variants/toulouse-2022/combo/wcs/user_all_forms.html
msgid "All Forms"
msgstr "Toutes les demandes"
#: templates/variants/toulouse-2022/combo/wcs/user_done_forms.html
msgid "Done Forms"
msgstr "Demandes terminées"
#: templates/variants/toulouse-2022/combo/wcs/user_done_forms.html
msgid "There are no done forms or they have been removed."
msgstr "Il ny a aucune demande traitée ou celles-ci ont été supprimées."

View File

View File

@ -0,0 +1,29 @@
# publik-base-theme
# Copyright (C) 2014-2024 Entr'ouvert
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from django.core.management.commands import makemessages
class Command(makemessages.Command):
def handle(self, *args, **options):
if not options.get('add_location') and self.gettext_version >= (0, 19):
options['add_location'] = 'file'
return super().handle(*args, **options)
def find_files(self, root):
for file in super().find_files('templates'):
file.locale_dir = 'publik_base_theme/locale'
yield file

View File

@ -0,0 +1,23 @@
from pathlib import Path
# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent
# Application definition
INSTALLED_APPS = ['publik_base_theme']
# Internationalization
# https://docs.djangoproject.com/en/3.2/topics/i18n/
LANGUAGE_CODE = 'fr-fr'
TIME_ZONE = 'Europe/Paris'
USE_I18N = True
USE_L10N = True
USE_TZ = True
LOCALE_PATHS = (BASE_DIR / 'publik_base_theme' / 'locale',)

274
setup.py Normal file
View File

@ -0,0 +1,274 @@
#! /usr/bin/env python
import glob
import os
import subprocess
import sys
from distutils.cmd import Command as BaseCommand
from distutils.command.build import build as _build
from distutils.command.sdist import sdist
from distutils.errors import CompileError
from distutils.spawn import find_executable
from multiprocessing import Pool
from setuptools import find_packages, setup
from setuptools.command.install_lib import install_lib as _install_lib
inkscape = os.path.abspath(os.path.join(os.path.dirname(__file__), 'src', 'inkscape_wrapper.py'))
class Command(BaseCommand):
user_options = []
def initialize_options(self):
pass
def finalize_options(self):
pass
class eo_sdist(sdist):
def run(self):
print('creating VERSION file')
if os.path.exists('VERSION'):
os.remove('VERSION')
version = get_version()
version_file = open('VERSION', 'w')
version_file.write(version)
version_file.close()
sdist.run(self)
print('removing VERSION file')
if os.path.exists('VERSION'):
os.remove('VERSION')
def get_version():
'''Use the VERSION, if absent generates a version with git describe, if not
tag exists, take 0.0- and add the length of the commit log.
'''
if os.path.exists('VERSION'):
with open('VERSION') as v:
return v.read()
if os.path.exists('.git'):
p = subprocess.Popen(
['git', 'describe', '--dirty=.dirty', '--match=v*'],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
)
result = p.communicate()[0]
if p.returncode == 0:
result = result.decode('ascii').strip()[1:] # strip spaces/newlines and initial v
if '-' in result: # not a tagged version
real_number, commit_count, commit_hash = result.split('-', 2)
version = '%s.post%s+%s' % (real_number, commit_count, commit_hash)
else:
version = result.replace('.dirty', '+dirty')
return version
else:
return '0.0.post%s' % len(subprocess.check_output(['git', 'rev-list', 'HEAD']).splitlines())
return '0.0'
class compile_translations(Command):
description = 'compile message catalogs to MO files via django compilemessages'
user_options = []
def run(self):
curdir = os.getcwd()
try:
from django.core.management import call_command
for path, dirs, files in os.walk('publik_base_theme'):
if 'locale' not in dirs:
continue
os.chdir(os.path.realpath(path))
call_command('compilemessages')
os.chdir(curdir)
except ImportError:
sys.stderr.write('!!! Please install Django >= 1.4 to build translations\n')
finally:
os.chdir(curdir)
class build_themes_json(Command):
def run(self):
subprocess.run(['python3', 'create_themes_json.py'])
def get_css_files(include_map_files=False):
for dirname in sorted(os.listdir('static')):
config = os.path.join('static', dirname, 'config.json')
if not os.path.exists(config):
continue
yield 'static/%s/style.css' % dirname
if include_map_files:
yield 'static/%s/style.css.map' % dirname
if os.path.exists(os.path.join('static', dirname, 'backoffice.scss')):
yield 'static/%s/backoffice.css' % dirname
if include_map_files:
yield 'static/%s/backoffice.css.map' % dirname
yield 'static/portal-agent/css/agent-portal.css'
yield 'static/includes/gadjo-extra.css'
def subprocess_run(command):
kwargs = {
'env': {'LC_ALL': 'C.UTF-8'},
}
if isinstance(command, list):
print(' '.join(command))
else:
print(command)
kwargs['shell'] = True
return bool(subprocess.run(command, **kwargs).returncode == 0)
class compile_scss(Command):
description = 'compile scss files into css files'
def run(self):
sass_bin = find_executable('sassc')
if not sass_bin:
raise CompileError(
'A sass compiler is required but none was found. See sass-lang.com for choices.'
)
for dirname in ('includes', 'toodego', 'lille', 'lomme', 'hellemmes', 'toulouse-2022'):
subprocess.run(['python3', 'make_data_uris.py', os.path.join('static', dirname)], check=True)
def get_build_commands():
for css_filename in get_css_files():
yield ['sassc', '--sourcemap', css_filename.replace('.css', '.scss'), css_filename]
with Pool() as pool:
for result in pool.imap_unordered(subprocess_run, get_build_commands()):
if not result:
raise CompileError('error compiling css')
class build_icons(Command):
def run(self):
cmds = [
'python3 src/render-imgs-dashboard.py static/chateauroux/img/ --normal 333333 '
'--selected 0779B7 --title FFFFFF --title-width 80',
'python3 src/render-imgs-categories.py static/orleans/img/ --primary f05923 --secondary 34697D',
'python3 src/render-imgs-dashboard.py static/orleans/img/ --normal FFFFFF '
'--normal-width 30 --selected f05923 --selected-width 30 --title FFFFFF --title-width 80',
'python3 src/render-imgs-categories.py static/publik/img/',
'python3 src/render-imgs-dashboard.py static/publik/img/ --normal 4D4D4D '
'--selected DF017A --title FFFFFF --title-width 80',
'python3 src/render-imgs-categories.py static/somme-cd80/img/ --primary A8002B '
'--secondary A8002B',
'python3 src/render-imgs-dashboard.py static/somme-cd80/img/ --normal 4D4D4D '
'--selected 87A738 --title FFFFFF --title-width 80',
]
if not os.path.exists('static/tournai/img'):
os.mkdir('static/tournai/img')
for image in glob.glob('static/tournai/assets/*.svg'):
target_filename = 'static/tournai/img/' + os.path.basename(image).replace('.svg', '.png')
if (
os.path.exists(target_filename)
and os.stat(image).st_mtime < os.stat(target_filename).st_mtime
):
continue
cmds.append(
[
inkscape,
'--without-gui',
'--file',
image,
'--export-area-drawing',
'--export-area-snap',
'--export-png',
target_filename,
'--export-width',
'40',
]
)
with Pool() as pool:
for result in pool.imap_unordered(subprocess_run, cmds):
if not result:
raise CompileError('error building icons')
class build(_build):
sub_commands = [
('build_themes_json', None),
('build_icons', None),
('compile_scss', None),
('compile_translations', None),
] + _build.sub_commands
class install_lib(_install_lib):
def run(self):
self.run_command('compile_translations')
super().run()
def data_tree(destdir, sourcedir):
extensions = [
'.html',
'.txt',
'.scss',
'.css',
'.js',
'.ico',
'.gif',
'.png',
'.jpg',
'.jpeg',
'.woff',
'.woff2',
'.ttf',
'.css',
'.map',
'.svg',
'.eot',
'.otf',
]
r = []
for root, dirs, files in os.walk(sourcedir):
l = [os.path.join(root, x) for x in files if os.path.splitext(x)[1] in extensions]
r.append((root.replace(sourcedir, destdir, 1), l))
return r
setup(
name='publik_base_theme',
version=get_version(),
license='AGPLv3 or later',
description='Themes for Publik',
url='https://dev.entrouvert.org/projects/publik-base-theme/',
author='Entrouvert',
author_email='info@entrouvert.com',
packages=find_packages(),
include_package_data=True,
data_files=data_tree('share/publik/themes/publik-base/static', 'static')
+ data_tree('share/publik/themes/publik-base/templates', 'templates')
+ [('share/publik/themes/publik-base', ['themes.json'])],
setup_requires=[
'django>=2.2',
],
classifiers=[
'Development Status :: 5 - Stable',
'Environment :: Web Environment',
'Framework :: Django',
'Intended Audience :: Developers',
'License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Programming Language :: Python :: 3',
],
zip_safe=False,
cmdclass={
'build': build,
'build_icons': build_icons,
'build_themes_json': build_themes_json,
'compile_scss': compile_scss,
'compile_translations': compile_translations,
'install_lib': install_lib,
'sdist': eo_sdist,
},
)

View File

@ -23,7 +23,8 @@ import subprocess
import sys
import xml.etree.ElementTree as ET
inkscape = os.path.abspath(os.path.join(os.path.dirname(__file__), 'inkscape_wrapper.py'))
base_dir = os.path.dirname(__file__)
inkscape = os.path.abspath(os.path.join(base_dir, 'inkscape_wrapper.py'))
names = {
'02': 'famille',
@ -95,15 +96,14 @@ parser.add_argument('--secondary', default='6D1F80')
args = parser.parse_args()
path_out = args.path
if not os.path.exists(path_out):
os.makedirs(path_out)
os.makedirs(path_out, exist_ok=True)
for filename in filenames:
outname = names.get(re.search(r'\d+', filename).group())
fd = open('tmp-%s.svg' % outname, 'w')
fd.write(
open(os.path.join('pictos', filename))
open(os.path.join(base_dir, 'pictos', filename))
.read()
.replace('E0037A', args.primary)
.replace('6D1F80', args.secondary)
@ -123,7 +123,7 @@ for filename in filenames:
]
)
tree = ET.parse(open(os.path.join('pictos', filename)))
tree = ET.parse(open(os.path.join(base_dir, 'pictos', filename)))
parent_map = {c: p for p in tree.iter() for c in p}
for i in range(10):
for node in tree.iter():

View File

@ -24,6 +24,7 @@ import sys
import tempfile
import xml.etree.ElementTree as ET
base_dir = os.path.dirname(__file__)
inkscape = os.path.abspath(os.path.join(os.path.dirname(__file__), 'inkscape_wrapper.py'))
names = {
@ -72,8 +73,7 @@ for variant in ('normal', 'selected', 'title'):
'width': getattr(args, variant + '_width'),
}
if not os.path.exists(path_out):
os.makedirs(path_out)
os.makedirs(path_out, exist_ok=True)
for filename in filenames:
icon_name = names.get(re.search(r'\d+', filename).group())
@ -82,7 +82,7 @@ for filename in filenames:
variant_colour = variant_data.get('colour')
variant_height = variant_data.get('height')
variant_width = variant_data.get('width')
tree = ET.parse(open(os.path.join('pictos', filename)))
tree = ET.parse(open(os.path.join(base_dir, 'pictos', filename)))
if variant_name:
out_filepath = os.path.join(path_out, '%s-%s.png' % (icon_name, variant_name))
else:

View File

@ -13,8 +13,7 @@
{% block footer-top %}
<div id="footer-top-wrapper">
<div id="footer-top">
{% trans "Pied de page - haut" as name %}
{% placeholder "footer-top" acquired=True name=name optional=True %}
{% placeholder "footer-top" acquired=True name="Pied de page - haut" optional=True %}
</div>
</div>
{% endblock %}
@ -22,8 +21,7 @@
{% block footer %}
{% block footer-logo-text %}
<div id="footer-logo-text">
{% trans "Pied de page - logo et texte" as name %}
{% placeholder "footer-logo-text" acquired=True name=name optional=True %}
{% placeholder "footer-logo-text" acquired=True name="Pied de page - logo et texte" optional=True %}
</div>
{% endblock %}
{% trans "Footer" as name %}

View File

@ -1,5 +1,5 @@
{% extends "combo/page_template.html" %}
{% load static i18n combo gadjo pwa %}
{% load static combo gadjo pwa %}
{% block header-title %}
<div class="col left">
@ -22,16 +22,13 @@
{% block footer %}
<div class="columns">
<div class="col col-1">
{% trans "Pied de page - colonne 1" as name %}
{% placeholder "footer-col1" acquired=True name=name optional=True %}
{% placeholder "footer-col1" acquired=True name="Pied de page - colonne 1" optional=True %}
</div>
<div class="col col-2">
{% trans "Pied de page - colonne 2" as name %}
{% placeholder "footer-col2" acquired=True name=name optional=True %}
{% placeholder "footer-col2" acquired=True name="Pied de page - colonne 2" optional=True %}
</div>
<div class="col col-3">
{% trans "Pied de page - colonne 3" as name %}
{% placeholder "footer-col3" acquired=True name=name optional=True %}
{% placeholder "footer-col3" acquired=True name="Pied de page - colonne 3" optional=True %}
</div>
<div class="col col-4">
<div class="cca-logo"></div>

View File

@ -1,11 +1,10 @@
{% extends "combo/page_template.html" %}
{% load static i18n combo gadjo %}
{% load static combo gadjo %}
{% block before-main-content %}
<div id="bandeau">
<div id="bandeau-wrapper">
{% trans "Bandeau" as name %}
{% placeholder "bandeau" acquired=True name=name %}
{% placeholder "bandeau" acquired=True name="Bandeau" %}
</div>
</div>
{% endblock %}
@ -13,8 +12,7 @@
{% block content-post %}
<div id="partners-text">
{% trans "Partenaires texte" as name %}
{% placeholder "partners-text" acquired=True name=name %}
{% placeholder "partners-text" acquired=True name="Partenaires texte" %}
</div>
<div class="partners">
<div class="partner apave"></div>
@ -25,8 +23,7 @@
<div class="partner socotec"></div>
</div>
<div id="call-to-action">
{% trans "Lien d'action" as name %}
{% placeholder "call-to-action" acquired=True name=name %}
{% placeholder "call-to-action" acquired=True name="Lien daction" %}
</div>
{% endblock %}

View File

@ -4,8 +4,7 @@
{% block before-main-content %}
<div id="bandeau">
<div id="bandeau-wrapper">
{% trans "Bandeau" as name %}
{% placeholder "bandeau" acquired=True name=name %}
{% placeholder "bandeau" acquired=True name="Bandeau" %}
</div>
</div>
{% endblock %}

View File

@ -1,5 +1,5 @@
{% extends "combo/page_template.html" %}
{% load static i18n combo gadjo pwa %}
{% load static combo gadjo pwa %}
{% block header-bottom %}
@ -15,18 +15,15 @@
{% block footer %}
<div class="col-container">
<div class="col left">
{% trans "Pied de page - colonne gauche" as name %}
{% placeholder "footer-left" acquired=True name=name optional=True %}
{% placeholder "footer-left" acquired=True name="Pied de page - colonne gauche" optional=True %}
</div>
<div class="col middle">
{% trans "Pied de page" as name %}
{% placeholder "footer" acquired=True name=name optional=True %}
{% placeholder "footer" acquired=True name="Pied de page" optional=True %}
</div>
<div class="col right"><a href="https://www.malakoff.fr/" class="logo">_</a></div>
</div>
<div class="bottom">
{% trans "Pied de page - bas - liens" as name %}
{% placeholder "footer-bottom" acquired=True name=name optional=True %}
{% placeholder "footer-bottom" acquired=True name="Pied de page - bas - liens" optional=True %}
</div>
{% endblock %}

View File

@ -172,12 +172,12 @@
<p style="">Apr&egrave;s avoir rempli les champs du formulaire ci-dessous et cliqu&eacute; sur le bouton &quot;Payer&quot;, vous serez redirig&eacute; vers le serveur de paiement s&eacute;curis&eacute; de la direction g&eacute;n&eacute;rale des finances publiques sur lequel vous pourrez finaliser votre paiement gr&acirc;ce &agrave; votre carte bancaire. Vous recevrez ensuite un courriel de confirmation de la transaction.</p>
<div id="tipi_block">
<div id="wip">
<h3>{% trans "Paiement en cours..." %}</h3>
<h3>Paiement en cours...</h3>
</div>
<form name='tipi'>
<ul>
<li>
<label>{% trans "Identifiant collectivité" %}</label>
<label>Identifiant collectivité</label>
<select id="numcli">
<option value="005955">005955</option>
<option value="005956">005956</option>
@ -188,24 +188,24 @@
</select>
</li>
<li>
<label>{% trans "Réference titre" %}</label>
<label>Réference titre</label>
<input type='text' id='exer' maxlength=4 size=4 tabindex="2" onkeyup="checkLen(this, this.value)" /> -
<input type='text' id='idpiece' maxlength=8 size=7 tabindex="3" onkeyup="checkLen(this, this.value)" /> -
<input type='text' id='idligne' maxlength=5 size=4 tabindex="4" onkeyup="checkLen(this, this.value)" />
<span class="error" id="refdet_error">{% trans "numéro invalide" %}</span>
<span class="error" id="refdet_error">numéro invalide</span>
</li>
<li>
<label>{% trans "Montant" %}</label>
<label>Montant</label>
<input type='text' id='montant_euros' size="4" maxlength="4" placeholder="0000" tabindex="5" onkeyup="checkLen(this, this.value)" /> ,
<input type='text' id='montant_cents' size="2" maxlength="2" placeholder="00" tabindex="6" onkeyup="checkLen(this, this.value)" value="00" />
<span class="error" id="montant_error">{% trans "montant invalide" %}</span>
<span class="error" id="montant_error">montant invalide</span>
</li>
<li>
<label>{% trans "Votre courriel" %}</label>
<input type='email' id='mel' {% if request.user.email %}value="{{ request.user.email }}" {% else %}placeholder="{% trans "nom@domaine.com" %}"{% endif %} />
<span class="error" id="mel_error">{% trans "courriel invalide" %}</span></li>
<label>Votre courriel</label>
<input type='email' id='mel' {% if request.user.email %}value="{{ request.user.email }}" {% else %}placeholder="nom@domaine.com"{% endif %} />
<span class="error" id="mel_error">courriel invalide</span></li>
<li>
<input type='button' value='{% trans "Payer" %}' onclick='call_tipi()'/>
<input type='button' value='Payer' onclick='call_tipi()'/>
</li>
</ul>
</form>

View File

@ -1,5 +1,5 @@
{% load i18n %}
<h2>{% trans "Mes abonnements" %}</h2>
<h2>Mes abonnements</h2>
<div id="passerelle-register-plugin-{{ instance.id }}" class="passerelle-register-plugin">
{{ form.non_field_errors }}
{% for field in form %}

View File

@ -3,8 +3,7 @@
{% block page-content %}
<div id="sidebar">
{% trans "Barre Latérale Gauche" as name %}
{% placeholder "left-sidebar" name=name %}
{% placeholder "left-sidebar" name="Barre Latérale Gauche" %}
</div>
<div id="columns-wrapper">
{% block columns-top %}
@ -21,8 +20,7 @@
{% endblock %}
</div>
<div id="right-sidebar">
{% trans "Barre Latérale Droite" as name %}
{% placeholder "right-sidebar" name=name %}
{% placeholder "right-sidebar" name="Barre Latérale Droite" %}
</div>
{% endblock %}