add template for translations used in angular. add sparql request for themes
Binary file src/p4l/locale/en/LC_MESSAGES/django.mo has changed
--- 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 <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\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."
Binary file src/p4l/locale/es/LC_MESSAGES/django.mo has changed
--- 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 <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\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"
Binary file src/p4l/locale/fr/LC_MESSAGES/django.mo has changed
--- 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 <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\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
--- 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:<http://www.w3.org/2004/02/skos/core#>
+PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
+PREFIX owl:<http://www.w3.org/2002/07/owl#>
+PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>
+SELECT DISTINCT ?uri ?label
+WHERE {
+ ?uri a skos:Concept.
+ ?uri skos:inScheme <http://www.iiep.unesco.org/plan4learning/scheme/Themes> .
+ ?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:<http://www.w3.org/2004/02/skos/core#>
+PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
+PREFIX owl:<http://www.w3.org/2002/07/owl#>
+PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>
+SELECT DISTINCT ?uri ?label
+WHERE {
+ ?uri a skos:Concept ;
+ skos:inScheme <http://www.iiep.unesco.org/plan4learning/scheme/Themes> ;
+ skos:prefLabel ?label .
+ FILTER (lang(?label) = ?language).
+ FILTER NOT EXISTS { [skos:narrower ?uri] }
+}
+""",
+'childs' : """
+PREFIX skos:<http://www.w3.org/2004/02/skos/core#>
+PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
+PREFIX owl:<http://www.w3.org/2002/07/owl#>
+PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>
+SELECT DISTINCT ?uri ?label
+WHERE {
+ ?uri skos:inScheme <http://www.iiep.unesco.org/plan4learning/scheme/Themes> .
+ { ?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:<http://www.w3.org/2004/02/skos/core#>
+PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
+PREFIX owl:<http://www.w3.org/2002/07/owl#>
+PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>
+SELECT (COUNT(?uri) as ?nb)
+WHERE {
+ ?uri skos:inScheme <http://www.iiep.unesco.org/plan4learning/scheme/Themes> .
+ ?root skos:narrower|skos:member ?uri.
+}
+"""
+ }
+
REST_FRAMEWORK = {
# Use hyperlinked styles by default.
--- 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