diff --git a/ted_sws/notice_packager/resources/templates/mets_xml_dmd_rdf.jinja2 b/ted_sws/notice_packager/resources/templates/mets_xml_dmd_rdf.jinja2
index eadfd390..775d1467 100644
--- a/ted_sws/notice_packager/resources/templates/mets_xml_dmd_rdf.jinja2
+++ b/ted_sws/notice_packager/resources/templates/mets_xml_dmd_rdf.jinja2
@@ -20,7 +20,7 @@
{{ notice.public_number_document }}
{{ notice.public_number_edition }}
- {% for lang in mets.languages %}
+ {% for lang in work.title %}
{{ work.title[lang] }}
{% endfor %}
{{ work.datetime_transmission }}
@@ -43,7 +43,7 @@
{# #}
- {% for lang in mets.languages %}
+ {% for lang in expression.title %}
{{ expression.title[lang] }}
{% endfor %}
diff --git a/ted_sws/notice_packager/services/metadata_transformer.py b/ted_sws/notice_packager/services/metadata_transformer.py
index 59d87f52..e6857d55 100644
--- a/ted_sws/notice_packager/services/metadata_transformer.py
+++ b/ted_sws/notice_packager/services/metadata_transformer.py
@@ -70,10 +70,9 @@ def from_notice_metadata(cls, notice_metadata: NormalisedMetadata) -> PackagerMe
metadata.work.resource_type = PROCUREMENT_NOTICE
metadata.work.date_document = publication_date
metadata.work.uri = publication_notice_uri(metadata.notice.id, notice_metadata)
- # TODO: If no title found in english get a random one
- title_search = [title.text for title in notice_metadata.title if title.language == LANGUAGE.upper()]
- if len(title_search) > 0:
- metadata.work.title = {LANGUAGE: title_search[0]}
+ metadata.work.title = {}
+ if notice_metadata.title:
+ metadata.work.title = {title[1]: title[0] for title in notice_metadata.title}
metadata.work.dataset_version = _date.strftime('%Y%m%d') + '-' + _revision
metadata.work.procurement_public_issued_by_country = notice_metadata.country_of_buyer
# metadata.work.procurement_public_url_etendering = notice_metadata.uri_list
diff --git a/tests/test_data/notice_packager/template_metadata.json b/tests/test_data/notice_packager/template_metadata.json
index 9123d3cd..e97980da 100644
--- a/tests/test_data/notice_packager/template_metadata.json
+++ b/tests/test_data/notice_packager/template_metadata.json
@@ -39,7 +39,8 @@
"dataset_published_by_agent": "EURUN",
"datetime_transmission": "2023-03-09T18:28:54.806241",
"title": {
- "en": "Construction work"
+ "en": "Construction work",
+ "ro": "Lucrari de constructie"
},
"date_creation": "2023-03-09",
"concept_type_dataset": "TEST_DATA",
diff --git a/tests/test_data/notice_packager/templates/2021_S_004_003545_0.mets.xml.dmd.rdf b/tests/test_data/notice_packager/templates/2021_S_004_003545_0.mets.xml.dmd.rdf
index 92db3102..7a4226f3 100644
--- a/tests/test_data/notice_packager/templates/2021_S_004_003545_0.mets.xml.dmd.rdf
+++ b/tests/test_data/notice_packager/templates/2021_S_004_003545_0.mets.xml.dmd.rdf
@@ -22,6 +22,8 @@
2021004
Construction work
+
+ Lucrari de constructie
2023-03-09T18:28:54.806241
diff --git a/tests/unit/notice_packager/test_template_generator.py b/tests/unit/notice_packager/test_template_generator.py
index f4a3c2b8..330b63fd 100644
--- a/tests/unit/notice_packager/test_template_generator.py
+++ b/tests/unit/notice_packager/test_template_generator.py
@@ -6,7 +6,6 @@
# Email: kalean.bl@gmail.com
""" """
-import difflib
import re
import pytest