# HG changeset patch # User cavaliet # Date 1378470236 -7200 # Node ID 9dd14a51a2bbeac9cc16b1228a3545ff5e47c59c # Parent 65912194e0474e2280516e21ccb89a142b10b54e add template for translations used in angular. add sparql request for themes diff -r 65912194e047 -r 9dd14a51a2bb src/p4l/locale/en/LC_MESSAGES/django.mo Binary file src/p4l/locale/en/LC_MESSAGES/django.mo has changed diff -r 65912194e047 -r 9dd14a51a2bb src/p4l/locale/en/LC_MESSAGES/django.po --- a/src/p4l/locale/en/LC_MESSAGES/django.po Thu Sep 05 16:28:59 2013 +0200 +++ b/src/p4l/locale/en/LC_MESSAGES/django.po Fri Sep 06 14:23:56 2013 +0200 @@ -7,7 +7,7 @@ msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2013-09-04 11:36-0500\n" +"POT-Creation-Date: 2013-09-06 07:20-0500\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -20,18 +20,36 @@ msgid "language" msgstr "language" -#: settings.py:41 +#: settings.py:42 msgid "French" msgstr "French" -#: settings.py:42 +#: settings.py:43 msgid "English" msgstr "English" -#: settings.py:43 +#: settings.py:44 msgid "Spanish" msgstr "Spanish" +#: semantictree/forms/widgets.py:39 +msgid "Search" +msgstr "" + +#: semantictree/forms/widgets.py:43 semantictree/forms/widgets.py:80 +msgid "" +"\"data-url\", \"data-query\", \"data-root-query\", \"data-childs-query\" and " +"\"data-child-count-query\" must be set in CharField configuration" +msgstr "" + +#: semantictree/forms/widgets.py:44 semantictree/forms/widgets.py:81 +msgid "Browse" +msgstr "" + +#: semantictree/forms/widgets.py:49 semantictree/forms/widgets.py:86 +msgid "or" +msgstr "" + #: templates/p4l/p4l_base.html:35 msgid "logout" msgstr "logout" @@ -264,6 +282,15 @@ msgid "is multilingual" msgstr "is multilingual" +#: templates/p4l/translations.html:3 +#, fuzzy +msgid "Add" +msgstr "Address" + +#: templates/p4l/translations.html:4 +msgid "Add a new subject" +msgstr "" + #: templates/registration/login.html:8 msgid "Sorry, that's not a valid username or password." msgstr "Sorry, that's not a valid username or password." diff -r 65912194e047 -r 9dd14a51a2bb src/p4l/locale/es/LC_MESSAGES/django.mo Binary file src/p4l/locale/es/LC_MESSAGES/django.mo has changed diff -r 65912194e047 -r 9dd14a51a2bb src/p4l/locale/es/LC_MESSAGES/django.po --- a/src/p4l/locale/es/LC_MESSAGES/django.po Thu Sep 05 16:28:59 2013 +0200 +++ b/src/p4l/locale/es/LC_MESSAGES/django.po Fri Sep 06 14:23:56 2013 +0200 @@ -7,7 +7,7 @@ msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2013-09-04 11:36-0500\n" +"POT-Creation-Date: 2013-09-06 07:20-0500\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -21,18 +21,36 @@ msgid "language" msgstr "language" -#: settings.py:41 +#: settings.py:42 msgid "French" msgstr "French" -#: settings.py:42 +#: settings.py:43 msgid "English" msgstr "English" -#: settings.py:43 +#: settings.py:44 msgid "Spanish" msgstr "Spanish" +#: semantictree/forms/widgets.py:39 +msgid "Search" +msgstr "" + +#: semantictree/forms/widgets.py:43 semantictree/forms/widgets.py:80 +msgid "" +"\"data-url\", \"data-query\", \"data-root-query\", \"data-childs-query\" and " +"\"data-child-count-query\" must be set in CharField configuration" +msgstr "" + +#: semantictree/forms/widgets.py:44 semantictree/forms/widgets.py:81 +msgid "Browse" +msgstr "" + +#: semantictree/forms/widgets.py:49 semantictree/forms/widgets.py:86 +msgid "or" +msgstr "" + #: templates/p4l/p4l_base.html:35 msgid "logout" msgstr "logout" @@ -265,6 +283,15 @@ msgid "is multilingual" msgstr "is multilingual" +#: templates/p4l/translations.html:3 +#, fuzzy +msgid "Add" +msgstr "Address" + +#: templates/p4l/translations.html:4 +msgid "Add a new subject" +msgstr "" + #: templates/registration/login.html:8 msgid "Sorry, that's not a valid username or password." msgstr "Sorry, that's not a valid username or password." @@ -275,4 +302,4 @@ #: templates/registration/login.html:20 templates/registration/login.html:22 msgid "Password" -msgstr "Password" \ No newline at end of file +msgstr "Password" diff -r 65912194e047 -r 9dd14a51a2bb src/p4l/locale/fr/LC_MESSAGES/django.mo Binary file src/p4l/locale/fr/LC_MESSAGES/django.mo has changed diff -r 65912194e047 -r 9dd14a51a2bb src/p4l/locale/fr/LC_MESSAGES/django.po --- a/src/p4l/locale/fr/LC_MESSAGES/django.po Thu Sep 05 16:28:59 2013 +0200 +++ b/src/p4l/locale/fr/LC_MESSAGES/django.po Fri Sep 06 14:23:56 2013 +0200 @@ -7,7 +7,7 @@ msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2013-09-04 11:36-0500\n" +"POT-Creation-Date: 2013-09-06 07:20-0500\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -17,36 +17,62 @@ "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" -#: admin.py:10 forms.py:36 templates/p4l/p4l_record_view.html:51 +#: admin.py:10 +#: forms.py:36 +#: templates/p4l/p4l_record_view.html:51 msgid "language" msgstr "langue" -#: settings.py:41 +#: settings.py:42 msgid "French" msgstr "Français" -#: settings.py:42 +#: settings.py:43 msgid "English" msgstr "Anglais" -#: settings.py:43 +#: settings.py:44 msgid "Spanish" msgstr "Espagnol" +#: semantictree/forms/widgets.py:39 +msgid "Search" +msgstr "Chercher" + +#: semantictree/forms/widgets.py:43 +#: semantictree/forms/widgets.py:80 +msgid "" +"\"data-url\", \"data-query\", \"data-root-query\", \"data-childs-query\" and " +"\"data-child-count-query\" must be set in CharField configuration" +msgstr "" + +#: semantictree/forms/widgets.py:44 +#: semantictree/forms/widgets.py:81 +msgid "Browse" +msgstr "Parcourir" + +#: semantictree/forms/widgets.py:49 +#: semantictree/forms/widgets.py:86 +msgid "or" +msgstr "ou" + #: templates/p4l/p4l_base.html:35 msgid "logout" msgstr "deconnection" -#: templates/p4l/p4l_base.html:37 templates/registration/login.html:4 +#: templates/p4l/p4l_base.html:37 +#: templates/registration/login.html:4 #: templates/registration/login.html:27 msgid "login" msgstr "connection" -#: templates/p4l/p4l_home.html:6 templates/p4l/p4l_home.html.py:10 +#: templates/p4l/p4l_home.html:6 +#: templates/p4l/p4l_home.html.py:10 msgid "Record List" msgstr "Liste notice" -#: templates/p4l/p4l_home.html:6 templates/p4l/p4l_home.html.py:29 +#: templates/p4l/p4l_home.html:6 +#: templates/p4l/p4l_home.html.py:29 #: templates/p4l/p4l_home.html:66 msgid "Page" msgstr "Page" @@ -55,19 +81,23 @@ msgid "Title" msgstr "Titre" -#: templates/p4l/p4l_home.html:26 templates/p4l/p4l_home.html.py:63 +#: templates/p4l/p4l_home.html:26 +#: templates/p4l/p4l_home.html.py:63 msgid "Previous" msgstr "Préc." -#: templates/p4l/p4l_home.html:29 templates/p4l/p4l_home.html.py:66 +#: templates/p4l/p4l_home.html:29 +#: templates/p4l/p4l_home.html.py:66 msgid "on" msgstr "sur" -#: templates/p4l/p4l_home.html:32 templates/p4l/p4l_home.html.py:69 +#: templates/p4l/p4l_home.html:32 +#: templates/p4l/p4l_home.html.py:69 msgid "Next" msgstr "Suiv." -#: templates/p4l/p4l_home.html:39 templates/p4l/p4l_record_view.html:59 +#: templates/p4l/p4l_home.html:39 +#: templates/p4l/p4l_record_view.html:59 msgid "titles" msgstr "titres" @@ -265,30 +295,25 @@ msgid "is multilingual" msgstr "multilingue" +#: templates/p4l/translations.html:3 +msgid "Add" +msgstr "Ajouter" + +#: templates/p4l/translations.html:4 +msgid "Add a new subject" +msgstr "Ajouter un nouveau sujet" + #: templates/registration/login.html:8 msgid "Sorry, that's not a valid username or password." msgstr "Désolé, utilisateur ou mot de passe invalide" -#: templates/registration/login.html:14 templates/registration/login.html:16 +#: templates/registration/login.html:14 +#: templates/registration/login.html:16 msgid "Username" msgstr "Utilisateur" -#: templates/registration/login.html:20 templates/registration/login.html:22 +#: templates/registration/login.html:20 +#: templates/registration/login.html:22 msgid "Password" msgstr "Mot de passe" -#: templates/p4l/record_update_form.html:0 -msgid "Add" -msgstr "Ajouter" - -#: templates/p4l/record_update_form.html:0 -msgid "or" -msgstr "ou" - -#: templates/p4l/record_update_form.html:0 -msgid "Browse" -msgstr "Parcourir" - -#: templates/p4l/record_update_form.html:0 -msgid "Add a new subject" -msgstr "Ajouter un nouveau sujet" \ No newline at end of file diff -r 65912194e047 -r 9dd14a51a2bb src/p4l/settings.py --- a/src/p4l/settings.py Thu Sep 05 16:28:59 2013 +0200 +++ b/src/p4l/settings.py Fri Sep 06 14:23:56 2013 +0200 @@ -234,6 +234,68 @@ } """ } +SPARQL_THEME_QUERIES = { +'filter' : """ +PREFIX skos: +PREFIX rdf: +PREFIX owl: +PREFIX rdfs: +SELECT DISTINCT ?uri ?label +WHERE { + ?uri a skos:Concept. + ?uri skos:inScheme . + ?uri skos:prefLabel ?label. + FILTER (lang(?label) = ?language). + ?uri skos:prefLabel ?lab. + FILTER regex (str(?lab), ?reg, 'i'). + FILTER (lang (?lab) = ?language). + BIND (STRLEN(STRBEFORE (str(?lab), ?reg)) AS ?place). + BIND (STRLEN(STR(?lab)) AS ?len) +} +ORDER BY ?place ?len ?lab +""", +'root' : """ +PREFIX skos: +PREFIX rdf: +PREFIX owl: +PREFIX rdfs: +SELECT DISTINCT ?uri ?label +WHERE { + ?uri a skos:Concept ; + skos:inScheme ; + skos:prefLabel ?label . + FILTER (lang(?label) = ?language). + FILTER NOT EXISTS { [skos:narrower ?uri] } +} +""", +'childs' : """ +PREFIX skos: +PREFIX rdf: +PREFIX owl: +PREFIX rdfs: +SELECT DISTINCT ?uri ?label +WHERE { + ?uri skos:inScheme . + { ?uri a ?type + FILTER (?type = skos:Collection || ?type = skos:Concept) }. + ?root skos:narrower|skos:member ?uri. + ?uri skos:prefLabel|rdfs:label ?label. + FILTER (lang(?label) = ?language). +} +""", +'child-count' : """ +PREFIX skos: +PREFIX rdf: +PREFIX owl: +PREFIX rdfs: +SELECT (COUNT(?uri) as ?nb) +WHERE { + ?uri skos:inScheme . + ?root skos:narrower|skos:member ?uri. +} +""" + } + REST_FRAMEWORK = { # Use hyperlinked styles by default. diff -r 65912194e047 -r 9dd14a51a2bb src/p4l/views.py --- a/src/p4l/views.py Thu Sep 05 16:28:59 2013 +0200 +++ b/src/p4l/views.py Fri Sep 06 14:23:56 2013 +0200 @@ -132,6 +132,13 @@ 'data-childs-query': settings.SPARQL_SUBJECT_QUERIES["childs"], 'data-child-count-query': settings.SPARQL_SUBJECT_QUERIES["child-count"] }) + context['themes_query_dict'] = json.dumps({ + 'data-url': settings.SPARQL_QUERY_ENDPOINT, + 'data-query': settings.SPARQL_THEME_QUERIES["filter"], + 'data-root-query': settings.SPARQL_THEME_QUERIES["root"], + 'data-childs-query': settings.SPARQL_THEME_QUERIES["childs"], + 'data-child-count-query': settings.SPARQL_THEME_QUERIES["child-count"] + }) return context