# HG changeset patch # User ymh # Date 1424310226 -3600 # Node ID a74ec9e0204242c71036a3c49565c31f057a3285 # Parent ca7df977504fff053b29593cd79b6604c0f49f14 correct #35 + add tag abstract + improve translations diff -r ca7df977504f -r a74ec9e02042 src/hdalab/locale/de/LC_MESSAGES/django.mo Binary file src/hdalab/locale/de/LC_MESSAGES/django.mo has changed diff -r ca7df977504f -r a74ec9e02042 src/hdalab/locale/de/LC_MESSAGES/django.po --- a/src/hdalab/locale/de/LC_MESSAGES/django.po Wed Feb 18 16:22:38 2015 +0100 +++ b/src/hdalab/locale/de/LC_MESSAGES/django.po Thu Feb 19 02:43:46 2015 +0100 @@ -7,7 +7,7 @@ msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2015-02-18 04:16-0600\n" +"POT-Creation-Date: 2015-02-18 19:35-0600\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -146,7 +146,6 @@ msgstr "Suche nach Facetten" #: templates/categories.html:35 -#, fuzzy msgid "Explorer les domaines artistiques" msgstr "Künstlerische Disziplinen" @@ -437,6 +436,10 @@ msgid "Are you sure you want to unpublish this renkan ?" msgstr "" +#: templates/renkan_edit.html:67 +msgid "Ressources" +msgstr "" + #: templates/renkan_edit.html:184 msgid "Change organisation" msgstr "" @@ -676,7 +679,11 @@ msgid "Mot de passe (Verification)" msgstr "" -#: views/profile.py:421 views/profile.py:487 +#: views/profile.py:423 +msgid "Plus de Ressources" +msgstr "" + +#: views/profile.py:432 views/profile.py:511 msgid "Period" msgstr "" diff -r ca7df977504f -r a74ec9e02042 src/hdalab/locale/en/LC_MESSAGES/django.mo Binary file src/hdalab/locale/en/LC_MESSAGES/django.mo has changed diff -r ca7df977504f -r a74ec9e02042 src/hdalab/locale/en/LC_MESSAGES/django.po --- a/src/hdalab/locale/en/LC_MESSAGES/django.po Wed Feb 18 16:22:38 2015 +0100 +++ b/src/hdalab/locale/en/LC_MESSAGES/django.po Thu Feb 19 02:43:46 2015 +0100 @@ -6,7 +6,7 @@ msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2015-02-18 04:16-0600\n" +"POT-Creation-Date: 2015-02-18 19:35-0600\n" "PO-Revision-Date: 2012-03-09 02:10+0200\n" "Last-Translator: Yves-Marie Haussonne \n" "Language-Team: IRI\n" @@ -448,6 +448,10 @@ msgid "Are you sure you want to unpublish this renkan ?" msgstr "Are you sure you want to ask to publish this renkan ?" +#: templates/renkan_edit.html:67 +msgid "Ressources" +msgstr "Resources" + #: templates/renkan_edit.html:184 msgid "Change organisation" msgstr "Change organisation" @@ -687,7 +691,11 @@ msgid "Mot de passe (Verification)" msgstr "Password (verification)" -#: views/profile.py:421 views/profile.py:487 +#: views/profile.py:423 +msgid "Plus de Ressources" +msgstr "More Resources" + +#: views/profile.py:432 views/profile.py:511 msgid "Period" msgstr "Period" diff -r ca7df977504f -r a74ec9e02042 src/hdalab/locale/es/LC_MESSAGES/django.mo Binary file src/hdalab/locale/es/LC_MESSAGES/django.mo has changed diff -r ca7df977504f -r a74ec9e02042 src/hdalab/locale/es/LC_MESSAGES/django.po --- a/src/hdalab/locale/es/LC_MESSAGES/django.po Wed Feb 18 16:22:38 2015 +0100 +++ b/src/hdalab/locale/es/LC_MESSAGES/django.po Thu Feb 19 02:43:46 2015 +0100 @@ -7,7 +7,7 @@ msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2015-02-18 04:16-0600\n" +"POT-Creation-Date: 2015-02-18 19:35-0600\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -450,6 +450,11 @@ msgid "Are you sure you want to unpublish this renkan ?" msgstr "" +#: templates/renkan_edit.html:67 +#, fuzzy +msgid "Ressources" +msgstr "Recurso" + #: templates/renkan_edit.html:184 msgid "Change organisation" msgstr "" @@ -689,7 +694,12 @@ msgid "Mot de passe (Verification)" msgstr "" -#: views/profile.py:421 views/profile.py:487 +#: views/profile.py:423 +#, fuzzy +msgid "Plus de Ressources" +msgstr "Recurso" + +#: views/profile.py:432 views/profile.py:511 msgid "Period" msgstr "" diff -r ca7df977504f -r a74ec9e02042 src/hdalab/locale/fr/LC_MESSAGES/django.mo Binary file src/hdalab/locale/fr/LC_MESSAGES/django.mo has changed diff -r ca7df977504f -r a74ec9e02042 src/hdalab/locale/fr/LC_MESSAGES/django.po --- a/src/hdalab/locale/fr/LC_MESSAGES/django.po Wed Feb 18 16:22:38 2015 +0100 +++ b/src/hdalab/locale/fr/LC_MESSAGES/django.po Thu Feb 19 02:43:46 2015 +0100 @@ -7,7 +7,7 @@ msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2015-02-18 04:16-0600\n" +"POT-Creation-Date: 2015-02-18 19:35-0600\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -452,6 +452,10 @@ msgid "Are you sure you want to unpublish this renkan ?" msgstr "Êtes-vous certain(e) de vouloir dépublier ce Renkan ?" +#: templates/renkan_edit.html:67 +msgid "Ressources" +msgstr "Ressources" + #: templates/renkan_edit.html:184 msgid "Change organisation" msgstr "Changer de disposition" @@ -694,6 +698,10 @@ msgid "Mot de passe (Verification)" msgstr "Mot de passe (vérification)" -#: views/profile.py:421 views/profile.py:487 +#: views/profile.py:423 +msgid "Plus de Ressources" +msgstr "Plus de Ressources" + +#: views/profile.py:432 views/profile.py:511 msgid "Period" msgstr "Période" diff -r ca7df977504f -r a74ec9e02042 src/hdalab/locale/it/LC_MESSAGES/django.mo Binary file src/hdalab/locale/it/LC_MESSAGES/django.mo has changed diff -r ca7df977504f -r a74ec9e02042 src/hdalab/locale/it/LC_MESSAGES/django.po --- a/src/hdalab/locale/it/LC_MESSAGES/django.po Wed Feb 18 16:22:38 2015 +0100 +++ b/src/hdalab/locale/it/LC_MESSAGES/django.po Thu Feb 19 02:43:46 2015 +0100 @@ -7,7 +7,7 @@ msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2015-02-18 04:16-0600\n" +"POT-Creation-Date: 2015-02-18 19:35-0600\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -437,6 +437,10 @@ msgid "Are you sure you want to unpublish this renkan ?" msgstr "" +#: templates/renkan_edit.html:67 +msgid "Ressources" +msgstr "" + #: templates/renkan_edit.html:184 msgid "Change organisation" msgstr "" @@ -676,7 +680,11 @@ msgid "Mot de passe (Verification)" msgstr "" -#: views/profile.py:421 views/profile.py:487 +#: views/profile.py:423 +msgid "Plus de Ressources" +msgstr "" + +#: views/profile.py:432 views/profile.py:511 msgid "Period" msgstr "" diff -r ca7df977504f -r a74ec9e02042 src/hdalab/locale/ja/LC_MESSAGES/django.mo Binary file src/hdalab/locale/ja/LC_MESSAGES/django.mo has changed diff -r ca7df977504f -r a74ec9e02042 src/hdalab/locale/ja/LC_MESSAGES/django.po --- a/src/hdalab/locale/ja/LC_MESSAGES/django.po Wed Feb 18 16:22:38 2015 +0100 +++ b/src/hdalab/locale/ja/LC_MESSAGES/django.po Thu Feb 19 02:43:46 2015 +0100 @@ -7,7 +7,7 @@ msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2015-02-18 04:16-0600\n" +"POT-Creation-Date: 2015-02-18 19:35-0600\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Language-Team: LANGUAGE \n" "Language: \n" @@ -438,6 +438,10 @@ msgid "Are you sure you want to unpublish this renkan ?" msgstr "" +#: templates/renkan_edit.html:67 +msgid "Ressources" +msgstr "" + #: templates/renkan_edit.html:184 msgid "Change organisation" msgstr "" @@ -677,7 +681,11 @@ msgid "Mot de passe (Verification)" msgstr "" -#: views/profile.py:421 views/profile.py:487 +#: views/profile.py:423 +msgid "Plus de Ressources" +msgstr "" + +#: views/profile.py:432 views/profile.py:511 msgid "Period" msgstr "" diff -r ca7df977504f -r a74ec9e02042 src/hdalab/locale/zh-tw/LC_MESSAGES/django.mo Binary file src/hdalab/locale/zh-tw/LC_MESSAGES/django.mo has changed diff -r ca7df977504f -r a74ec9e02042 src/hdalab/locale/zh-tw/LC_MESSAGES/django.po --- a/src/hdalab/locale/zh-tw/LC_MESSAGES/django.po Wed Feb 18 16:22:38 2015 +0100 +++ b/src/hdalab/locale/zh-tw/LC_MESSAGES/django.po Thu Feb 19 02:43:46 2015 +0100 @@ -8,7 +8,7 @@ msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2015-02-18 04:16-0600\n" +"POT-Creation-Date: 2015-02-18 19:35-0600\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -438,6 +438,10 @@ msgid "Are you sure you want to unpublish this renkan ?" msgstr "" +#: templates/renkan_edit.html:67 +msgid "Ressources" +msgstr "" + #: templates/renkan_edit.html:184 msgid "Change organisation" msgstr "" @@ -677,7 +681,11 @@ msgid "Mot de passe (Verification)" msgstr "" -#: views/profile.py:421 views/profile.py:487 +#: views/profile.py:423 +msgid "Plus de Ressources" +msgstr "" + +#: views/profile.py:432 views/profile.py:511 msgid "Period" msgstr "" diff -r ca7df977504f -r a74ec9e02042 src/hdalab/templates/renkan_edit.html --- a/src/hdalab/templates/renkan_edit.html Wed Feb 18 16:22:38 2015 +0100 +++ b/src/hdalab/templates/renkan_edit.html Thu Feb 19 02:43:46 2015 +0100 @@ -64,14 +64,14 @@ bins: [ { type: "ResourceList", - title: "Ressources", + title: "{% trans 'Ressources' %}", list: [ - { - url: "http://www.histoiredesarts.culture.fr/", - title: "Histoire des arts", - description: "Portail Histoire des arts sur culture.fr", - image: "http://www.culture.fr/extension/culture_fr/design/culture/images/favicon.ico" - } + { + url: "http://www.histoiredesarts.culture.fr/", + title: "Histoire des arts", + description: "Portail Histoire des arts sur culture.fr", + image: "http://www.culture.fr/extension/culture_fr/design/culture/images/favicon.ico" + } ] } ], diff -r ca7df977504f -r a74ec9e02042 src/hdalab/views/ajax.py --- a/src/hdalab/views/ajax.py Wed Feb 18 16:22:38 2015 +0100 +++ b/src/hdalab/views/ajax.py Thu Feb 19 02:43:46 2015 +0100 @@ -222,7 +222,7 @@ for t in qslist: if hasattr(t, 'dbpedia_fields'): dbfields = t.dbpedia_fields - resobj = {'original_label':t.label, 'url':t.dbpedia_uri} + resobj = {'original_label':t.label, 'url':t.wikipedia_url} if count_notices_bool: resobj['nb'] = t.nb resobj['thumbnail'] = dbfields.thumbnail if dbfields is not None else None @@ -381,7 +381,8 @@ 'order': ts.order, 'match': match_tag, 'translated_label': translations.get(ts.tag.dbpedia_fields.id, ts.tag.label) if ts.tag.dbpedia_fields is not None else ts.tag.label, - 'url': ts.tag.dbpedia_uri}) + 'url': ts.tag.dbpedia_uri, + 'wkpd_url': ts.tag.wikipedia_url}) if match_tag: contenus[ts.datasheet_id]['score'] += 2*max_tag_order - ts.order @@ -413,7 +414,8 @@ 'score': tag.nb, 'thumbnail': dbpediafields[tag.id].thumbnail if tag.id in dbpediafields else None, 'translated_label': translations.get(dbpediafields[tag.id].id, tag.label) if tag.id in dbpediafields else tag.label, - 'url': tag.dbpedia_uri} for tag in tagqslist] + 'url': tag.dbpedia_uri, + 'wkpd_url': tag.wikipedia_url} for tag in tagqslist] countryqs = countryqs.annotate(nb=Count('includes__tag__taggedsheet')) countries = dict([(country.dbpedia_uri, country.nb) for country in countryqs]) diff -r ca7df977504f -r a74ec9e02042 src/hdalab/views/profile.py --- a/src/hdalab/views/profile.py Wed Feb 18 16:22:38 2015 +0100 +++ b/src/hdalab/views/profile.py Thu Feb 19 02:43:46 2015 +0100 @@ -256,19 +256,23 @@ translations = {} if lang not in no_translate_langs: transqs = DbpediaFieldsTranslation.objects.filter(master__in = [ot.tag.dbpedia_fields if hasattr(ot.tag, 'dbpedia_fields') and ot.tag.dbpedia_fields else None for ot in ordered_tags], language_code = lang) - translations = dict([(trans.master_id,trans.label) for trans in transqs]) + translations = dict([(trans.master_id,trans) for trans in transqs]) for ot in ordered_tags: t = ot.tag img_url = t.dbpedia_fields.thumbnail if hasattr(t, 'dbpedia_fields') and t.dbpedia_fields and t.dbpedia_fields.thumbnail else None if img_url is None and t.category is not None: img_url = cat_dict[t.category.label] - + translation_obj = translations.get(t.dbpedia_fields.id, None) if t.dbpedia_fields else None + translation = { + 'label': translation_obj.label if translation_obj and translation_obj.label else t.label, + 'abstract': translation_obj.abstract if translation_obj and translation_obj.abstract else '', + } content["nodes"].append({ "id": unicode(uuid.uuid1()), - "title": translations.get(t.dbpedia_fields.id, t.label) if hasattr(t, 'dbpedia_fields') and t.dbpedia_fields else t.label, - "description": t.dbpedia_uri, - "uri": "", + "title": translation['label'], + "description": translation['abstract'], + "uri": t.wikipedia_url, "position": np.get_place("tags"), "image": img_url, "size": 0, @@ -319,7 +323,7 @@ translations = {} if lang not in no_translate_langs: transqs = DbpediaFieldsTranslation.objects.filter(master__in = [t.dbpedia_fields if hasattr(t, 'dbpedia_fields') and t.dbpedia_fields else None for t in all_tags], language_code = lang) - translations = dict([(trans.master_id,trans.label) for trans in transqs]) + translations = dict([(trans.master_id,trans) for trans in transqs]) # Prepare Node placer : np = CircleNodePlacer() @@ -329,6 +333,7 @@ np = LineNodePlacer() np.init({"datasheet": (1, len(notices)), "tags": (2, len(all_tags))}) + # Place notices for n in notices: @@ -349,13 +354,19 @@ # Place tags for t in all_tags: img_url = t.dbpedia_fields.thumbnail if hasattr(t, 'dbpedia_fields') and t.dbpedia_fields and t.dbpedia_fields.thumbnail else None + translation_obj = translations.get(t.dbpedia_fields.id, None) if t.dbpedia_fields else None + translation = { + 'label': translation_obj.label if translation_obj and translation_obj.label else t.label, + 'abstract': translation_obj.abstract if translation_obj and translation_obj.abstract else '', + } + if img_url is None and t.category is not None: img_url = cat_dict[t.category.label] content["nodes"].append({ "id": tag_uuid_dict[t.pk], - "title": translations.get(t.dbpedia_fields.id, t.label) if hasattr(t, 'dbpedia_fields') and t.dbpedia_fields else t.label, - "description": "", - "uri": t.dbpedia_uri, + "title": translation['label'], + "description": translation['abstract'], + "uri": t.wikipedia_url, "position": np.get_place("tags"), "image": img_url, "size": 0, @@ -409,7 +420,7 @@ content["bins"] = { "type": "ResourceList", - "title": "Plus de Ressources", + "title": _("Plus de Ressources"), #TODO: Translate "list": filter_output_to_bin["contents"] } @@ -430,7 +441,7 @@ for tt in filter_output["tags"]: if tt["label"]==t["label"]: thumbnail_url = tt["thumbnail"] - related_tags.append({"label": t["label"], "thumbnail":thumbnail_url, "id":t["id"], "url":t["url"]}) + related_tags.append({"label": t["label"], "thumbnail":thumbnail_url, "id":t["id"], "url":t["url"], 'wkpd_url': t['wkpd_url']}) all_labels.append(t["label"]) related_tags_dict[c["id"]].append(t["id"]) @@ -463,16 +474,29 @@ len_tags += 1 np.init({"tags": (1, len_tags), "datasheet": (2, len(filter_output["contents"])), "related": (3, len(related_tags)), "northwest":(3 if shape=="circle" else 1, 1)}) + #get tag abstract and label translations + + tags_id = [t.id for t in all_tags] + [t['id'] for t in related_tags] + translations = {} + transqs = DbpediaFieldsTranslation.objects.filter(master__tag__in = tags_id, language_code = lang) + translations = dict([(trans.master.tag.id,trans) for trans in transqs]) + + for t in all_tags: img_url = t.dbpedia_fields.thumbnail if hasattr(t, 'dbpedia_fields') and t.dbpedia_fields and t.dbpedia_fields.thumbnail else None if img_url is None and t.category is not None: img_url = cat_dict[t.category.label] + translation_obj = translations.get(t.id, None) + translation = { + 'label': filter_output["tagtranslations"][t.label] if t.label in filter_output["tagtranslations"] else t.label, + 'abstract': translation_obj.abstract if translation_obj else "" + } content["nodes"].append({ "id": unicode(uuid.uuid1()), - "title": filter_output["tagtranslations"][t.label] if t.label in filter_output["tagtranslations"] else t.label, - "description": t.dbpedia_uri, - "uri": t.dbpedia_uri, + "title": translation['label'], + "description": translation['abstract'], + "uri": t.wikipedia_url, "position": np.get_place("tags"), "image": img_url, "size": 0, @@ -512,11 +536,17 @@ }) for t in related_tags: + translation_obj = translations.get(t['id'], None) + translation = { + 'label': filter_output["tagtranslations"][t["label"]], + 'abstract': translation_obj.abstract if translation_obj else "" + } + content["nodes"].append({ "id": t["id"], - "title": filter_output["tagtranslations"][t["label"]], - "description": "", - "uri": t["url"], + "title": translation['label'], + "description": translation['abstract'], + "uri": t["wkpd_url"], "position": np.get_place("related"), "image": t["thumbnail"], "size": 0,