summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2019-08-01 18:47:59 +0200
committerÉtienne Loks <etienne@peacefrogs.net>2019-08-01 18:47:59 +0200
commit98a3f7225b8b1265b3255a7e104545ea94e05ab4 (patch)
tree2b989210904c577ea4c241c1f850674adea1f8d7
parent108b5514fe795e3bbf4c76245047f5ea054c3d20 (diff)
downloadComm-on-net-98a3f7225b8b1265b3255a7e104545ea94e05ab4.tar.bz2
Comm-on-net-98a3f7225b8b1265b3255a7e104545ea94e05ab4.zip
Translations - basic makefile
-rw-r--r--Makefile26
-rw-r--r--commcrawler/locale/fr/LC_MESSAGES/django.po170
-rw-r--r--commcrawler/scrapy.py5
-rw-r--r--commonnet/local_settings.py.sample2
-rw-r--r--commonnet/settings.py9
-rw-r--r--commorganization/locale/fr/LC_MESSAGES/django.po97
6 files changed, 302 insertions, 7 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..0b7601a
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,26 @@
+PROJECT=commonnet
+APPS="commorganization" "commcrawler"
+PYTHON=python3
+
+help: ## display this help
+ @awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n\nTargets:\n"} /^[a-zA-Z_-]+:.*?##/ { printf " \033[36m%-10s\033[0m %s\n", $$1, $$2 }' $(MAKEFILE_LIST)
+
+makemessages: ## make messages for translation
+ for DIR in $(APPS); do \
+ cd $(CURDIR)/$$DIR; \
+ $(PYTHON) ../manage.py makemessages --all; \
+ done
+
+compilemessages: ## compile messages for translation
+ for DIR in $(APPS); do \
+ cd $(CURDIR)/$$DIR; \
+ $(PYTHON) ../manage.py compilemessages ; \
+ done
+
+run: ## run test server
+ $(PYTHON) manage.py runserver 0.0.0.0:8000
+
+generate_graphs: ## generate graph model for documentation
+ $(PYTHON) manage.py graph_models -g -n -L fr-fr $(APPS) > /tmp/$(PROJECT).dot
+ dot -Tpng /tmp/$(PROJECT).dot > docs/images/models.png
+ rm /tmp/$(PROJECT).dot \ No newline at end of file
diff --git a/commcrawler/locale/fr/LC_MESSAGES/django.po b/commcrawler/locale/fr/LC_MESSAGES/django.po
new file mode 100644
index 0000000..a839672
--- /dev/null
+++ b/commcrawler/locale/fr/LC_MESSAGES/django.po
@@ -0,0 +1,170 @@
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2019-08-01 18:26+0200\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE <LL@li.org>\n"
+"Language: \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"
+
+#: apps.py:7
+msgid "Crawler"
+msgstr "Robot d'indexation"
+
+#: models.py:11
+msgid "Created"
+msgstr "Créé"
+
+#: models.py:11
+msgid "In progress"
+msgstr "En cours"
+
+#: models.py:12
+msgid "Finished"
+msgstr "Fini"
+
+#: models.py:14
+msgid "Name"
+msgstr "Nom"
+
+#: models.py:16
+msgid "Creation date"
+msgstr "Date de création"
+
+#: models.py:18
+msgid "Start date"
+msgstr "Date de création"
+
+#: models.py:20
+msgid "End date"
+msgstr "Date de fin"
+
+#: models.py:25 models.py:38 models.py:96
+msgid "Crawl"
+msgstr "Session d'indexation"
+
+#: models.py:26
+msgid "Crawls"
+msgstr "Session d'indexation"
+
+#: models.py:39
+msgid "Target"
+msgstr "Cible"
+
+#: models.py:41
+msgid "Number of external links"
+msgstr "Nombre de liens externes"
+
+#: models.py:43
+msgid "Number of internal links"
+msgstr "Nombre de liens internes"
+
+#: models.py:45
+msgid "Number of images"
+msgstr "Nombre d'images"
+
+#: models.py:47
+msgid "Number of Facebook links"
+msgstr "Nombre de liens Facebook"
+
+#: models.py:49
+msgid "Number of Twitter links"
+msgstr "Nombre de liens Twitter"
+
+#: models.py:51
+msgid "Number of Instagram links"
+msgstr "Nombre de liens Instagram"
+
+#: models.py:53
+msgid "Number of Youtube links"
+msgstr "Nombre de liens Youtube"
+
+#: models.py:55
+msgid "Number of Dailymotion links"
+msgstr "Nombre de liens Dailymotion"
+
+#: models.py:57
+msgid "Number of Vimeo links"
+msgstr "Nombre de liens Vimeo"
+
+#: models.py:59
+msgid "Number of videos"
+msgstr "Nombre de vidéos"
+
+#: models.py:61
+msgid "Number of audios"
+msgstr "Nombre de fichiers audio"
+
+#: models.py:63 models.py:67
+msgid "Number of internal PDF"
+msgstr "Nombre de PDF internes"
+
+#: models.py:65 models.py:69
+msgid "Number of external PDF"
+msgstr "Nombre de PDF externes"
+
+#: models.py:71
+msgid "Website is online"
+msgstr "Site en ligne"
+
+#: models.py:73
+msgid "Redirection"
+msgstr "Redirection"
+
+#: models.py:76
+msgid "Crawl result"
+msgstr "Résultat d'indexation"
+
+#: models.py:77
+msgid "Crawl results"
+msgstr "Résultats d'indexation"
+
+#: models.py:84
+msgid "Result"
+msgstr "Résultat"
+
+#: models.py:85
+msgid "Link"
+msgstr "Lien"
+
+#: models.py:88
+msgid "Crawl link"
+msgstr "Indexation - lien"
+
+#: models.py:89
+msgid "Crawl links"
+msgstr "Indexations - liens"
+
+#: models.py:97
+msgid "Source"
+msgstr "Source"
+
+#: models.py:99
+msgid "Destination"
+msgstr "Destination"
+
+#: models.py:101
+msgid "Number"
+msgstr "Nombre"
+
+#: models.py:104
+msgid "Crawl relation"
+msgstr "Indexation - Relation"
+
+#: models.py:105
+msgid "Crawl relations"
+msgstr "Indexations - Relations"
+
+#: templates/admin/add_to_crawl.html:4
+#, python-format
+msgid "Add %(query_nb)s selected items to a crawl"
+msgstr "Ajout de %(query_nb)s éléments sélectionnés à une indexation"
+
+#: templates/admin/add_to_crawl.html:11
+msgid "Add"
+msgstr "Ajouter"
diff --git a/commcrawler/scrapy.py b/commcrawler/scrapy.py
index ea58164..e821a31 100644
--- a/commcrawler/scrapy.py
+++ b/commcrawler/scrapy.py
@@ -7,6 +7,8 @@ from django.conf import settings
class DefaultSpider:
+ target_id = None
+
def _parse_image(self, response, result):
for __ in response.css('img'):
if 'nb_images' not in result:
@@ -19,9 +21,6 @@ class DefaultSpider:
"target_id": self.target_id
}
self._parse_image(response, result)
-
- yield result
-
for link in LinkExtractor().extract_links(response):
if link.url is not None:
yield response.follow(link.url, self.parse)
diff --git a/commonnet/local_settings.py.sample b/commonnet/local_settings.py.sample
index c280f86..0cba3f5 100644
--- a/commonnet/local_settings.py.sample
+++ b/commonnet/local_settings.py.sample
@@ -2,3 +2,5 @@ RESPONSIBLE_EMAIL = None
# Cache for http request - set to false in production
DEV = True
+
+EXTRA_APPS = []
diff --git a/commonnet/settings.py b/commonnet/settings.py
index b51b83e..c72756c 100644
--- a/commonnet/settings.py
+++ b/commonnet/settings.py
@@ -112,13 +112,12 @@ DATA_UPLOAD_MAX_NUMBER_FIELDS = 5000
STATIC_URL = '/static/'
-RESPONSIBLE_EMAIL = None
-
try:
from .local_settings import *
except ImportError:
- print("ERROR: a local_settings.py must be defined")
- exit(1)
+ print("WARNING: a local_settings.py must be defined")
+ RESPONSIBLE_EMAIL = None
+ EXTRA_APPS = []
if not RESPONSIBLE_EMAIL:
print("ERROR: a RESPONSIBLE_EMAIL must be defined in your "
@@ -131,3 +130,5 @@ SCRAPPY_SETTINGS["USER_AGENT"] = "commonnet-scraper v{} ({})".format(
if DEV:
SCRAPPY_SETTINGS["HTTPCACHE_ENABLED"] = True
+
+INSTALLED_APPS += EXTRA_APPS
diff --git a/commorganization/locale/fr/LC_MESSAGES/django.po b/commorganization/locale/fr/LC_MESSAGES/django.po
new file mode 100644
index 0000000..8ed6282
--- /dev/null
+++ b/commorganization/locale/fr/LC_MESSAGES/django.po
@@ -0,0 +1,97 @@
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2019-08-01 18:26+0200\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE <LL@li.org>\n"
+"Language: \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"
+
+#: admin.py:58
+msgid "Crawl"
+msgstr "Session d'indexation"
+
+#: admin.py:98
+msgid "{} new targets added to {}"
+msgstr "{} nouvelles cibles ajoutées à {}"
+
+#: admin.py:110
+msgid "Add to crawl"
+msgstr "Ajouter à la session d'indexation"
+
+#: apps.py:7 models.py:68 models.py:84
+msgid "Organization"
+msgstr "Organisation"
+
+#: models.py:6 models.py:18 models.py:42 models.py:58 models.py:81
+msgid "Name"
+msgstr "Nom"
+
+#: models.py:9
+msgid "Area type"
+msgstr "Type de zone"
+
+#: models.py:10
+msgid "Area types"
+msgstr "Type de zones"
+
+#: models.py:20 models.py:64
+msgid "Type"
+msgstr "Type"
+
+#: models.py:21
+msgid "Population"
+msgstr "Population"
+
+#: models.py:24
+msgid "Reference"
+msgstr "Référence"
+
+#: models.py:25
+msgid "For instance, INSEE code for towns"
+msgstr "Par exemple, code INSEE pour les communes"
+
+#: models.py:27 models.py:43
+msgid "Parent"
+msgstr "Parent"
+
+#: models.py:31 models.py:60
+msgid "Area"
+msgstr "Zone"
+
+#: models.py:32
+msgid "Areas"
+msgstr "Zones"
+
+#: models.py:47
+msgid "Organization type"
+msgstr "Type d'organisation"
+
+#: models.py:48
+msgid "Organization types"
+msgstr "Types d'organisation"
+
+#: models.py:65
+msgid "Address"
+msgstr "Adresse"
+
+#: models.py:69
+msgid "Organizations"
+msgstr "Organisations"
+
+#: models.py:82
+msgid "URL"
+msgstr "URL"
+
+#: models.py:88
+msgid "Target"
+msgstr "Cible"
+
+#: models.py:89
+msgid "Targets"
+msgstr "Cibles"