Skip to content

Commit b630983

Browse files
author
Hans-christian
committed
feat(multilingual) Add multi lingual support for english and dutch
1 parent d51ddab commit b630983

File tree

4 files changed

+229
-5
lines changed

4 files changed

+229
-5
lines changed

ckanext/gdi_userportal/logic/action/translation_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import logging
99
from typing import Any, Dict, List, Optional
1010

11-
from ckan.common import config, request
11+
from ckan.common import config
1212

1313
# -*- coding: utf-8 -*-
1414
from ckan.plugins import toolkit

ckanext/gdi_userportal/plugin.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,14 @@ def update_config(self, config_):
7676
def update_config_schema(self, schema):
7777
ignore_missing = toolkit.get_validator("ignore_missing")
7878
unicode_safe = toolkit.get_validator("unicode_safe")
79+
int_validator = toolkit.get_validator("int_validator")
7980
schema.update(
80-
{"ckanext.gdi_userportal.intro_text": [ignore_missing, unicode_safe]}
81+
{
82+
"ckanext.gdi_userportal.intro_text": [ignore_missing, unicode_safe],
83+
"ckan.harvest.timeout": [ignore_missing, int_validator],
84+
"ckan.harvest.mq.type": [ignore_missing, unicode_safe],
85+
"ckan.harvest.mq.hostname": [ignore_missing, unicode_safe],
86+
}
8187
)
8288
return schema
8389

ckanext/gdi_userportal/scheming/schemas/gdi_userportal.yaml renamed to ckanext/gdi_userportal/scheming/schemas/dataset_multilingual.yaml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ dataset_fields:
1414
- field_name: title_translated
1515
label: Title
1616
preset: fluent_core_translated
17-
required: true
1817
help_text: A descriptive title for the dataset.
1918

2019
- field_name: name
@@ -24,7 +23,6 @@ dataset_fields:
2423

2524
- field_name: notes_translated
2625
label: Description
27-
required: true
2826
preset: fluent_core_translated
2927
form_snippet: fluent_markdown.html
3028
display_snippet: fluent_markdown.html
@@ -173,7 +171,17 @@ dataset_fields:
173171
help_text: End of the time period that the dataset covers.
174172

175173
- field_name: in_series
176-
preset: dataset_series_in_series
174+
label: In series
175+
form_snippet: multiple_select.html
176+
display_snippet: multiple_choice.html
177+
validators: ignore_missing series_validator
178+
output_validators: scheming_multiple_choice_output
179+
convert: convert_to_extras
180+
choices_helper: in_series_choices
181+
form_select_attrs:
182+
data-module: autocomplete
183+
class: ~
184+
help_text: Link this dataset to one or more dataset series.
177185

178186
- field_name: version
179187
label: Version
Lines changed: 210 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,210 @@
1+
scheming_version: 2
2+
dataset_type: dataset_series
3+
about: Multilingual DCAT-AP Dataset Series schema with Fluent support
4+
about_url: http://github.com/ckan/ckanext-dcat
5+
form_languages: [en, nl]
6+
7+
dataset_fields:
8+
9+
- field_name: title_translated
10+
label:
11+
en: Title
12+
nl: Titel
13+
preset: fluent_core_translated
14+
help_text: A descriptive title for the dataset series in each language.
15+
16+
- field_name: name
17+
label: URL
18+
preset: dataset_slug
19+
form_placeholder: eg. my-dataset-series
20+
21+
- field_name: notes_translated
22+
label:
23+
en: Description
24+
nl: Beschrijving
25+
preset: fluent_core_translated
26+
form_snippet: fluent_markdown.html
27+
display_snippet: fluent_markdown.html
28+
help_text: A free-text account of the dataset series.
29+
30+
- field_name: tags_translated
31+
label:
32+
en: Keywords
33+
nl: Trefwoorden
34+
preset: fluent_tags
35+
help_text: Keywords or tags describing the dataset series, per language.
36+
37+
- field_name: contact
38+
label: Contact points
39+
repeating_label: Contact point
40+
repeating_subfields:
41+
42+
- field_name: uri
43+
label: URI
44+
45+
- field_name: name
46+
label: Name
47+
48+
- field_name: name_translated
49+
label: Name (translations)
50+
preset: fluent_core_translated
51+
help_text: Localised name of the contact point.
52+
53+
- field_name: email
54+
label: Email
55+
display_snippet: email.html
56+
57+
- field_name: url
58+
label: URL
59+
display_snippet: link.html
60+
help_text: Contact information for enquiries about the dataset series.
61+
62+
- field_name: publisher
63+
label: Publisher
64+
repeating_label: Publisher
65+
repeating_once: true
66+
repeating_subfields:
67+
68+
- field_name: uri
69+
label: URI
70+
71+
- field_name: name
72+
label: Name
73+
74+
- field_name: name_translated
75+
label: Name (translations)
76+
preset: fluent_core_translated
77+
help_text: Localised name of the publisher.
78+
79+
- field_name: email
80+
label: Email
81+
display_snippet: email.html
82+
83+
- field_name: url
84+
label: URL
85+
display_snippet: link.html
86+
87+
- field_name: type
88+
label: Type
89+
90+
- field_name: identifier
91+
label: Identifier
92+
help_text: Unique identifier for the publisher, such as a ROR ID.
93+
help_text: Entity responsible for ensuring the coherency of the dataset series.
94+
95+
- field_name: creator
96+
label: Creator
97+
repeating_label: Creator
98+
repeating_once: true
99+
repeating_subfields:
100+
101+
- field_name: uri
102+
label: URI
103+
help_text: URI of the creator, if available.
104+
105+
- field_name: name
106+
label: Name
107+
help_text: Name of the entity or person who created the dataset series.
108+
109+
- field_name: name_translated
110+
label: Name (translations)
111+
preset: fluent_core_translated
112+
help_text: Localised name of the creator.
113+
114+
- field_name: email
115+
label: Email
116+
display_snippet: email.html
117+
help_text: Contact email of the creator.
118+
119+
- field_name: url
120+
label: URL
121+
display_snippet: link.html
122+
help_text: URL for more information about the creator.
123+
124+
- field_name: type
125+
label: Type
126+
help_text: Type of creator (e.g., Organisation, Person).
127+
128+
- field_name: identifier
129+
label: Identifier
130+
help_text: Unique identifier for the creator, such as an ORCID or ROR ID.
131+
132+
- field_name: owner_org
133+
label: Organization
134+
preset: dataset_organization
135+
help_text: The CKAN organization the dataset series belongs to.
136+
137+
- field_name: applicable_legislation
138+
label: Applicable legislation
139+
preset: multiple_text
140+
validators: ignore_missing scheming_multiple_text
141+
help_text: The legislation that mandates the creation or management of the dataset series.
142+
143+
- field_name: temporal_coverage
144+
label: Temporal coverage
145+
repeating_subfields:
146+
147+
- field_name: start
148+
label: Start
149+
preset: dcat_date
150+
151+
- field_name: end
152+
label: End
153+
preset: dcat_date
154+
help_text: The temporal period or periods the dataset series covers.
155+
156+
- field_name: spatial_coverage
157+
label: Spatial coverage
158+
repeating_subfields:
159+
160+
- field_name: uri
161+
label: URI
162+
163+
- field_name: text
164+
label: Label
165+
166+
- field_name: geom
167+
label: Geometry
168+
169+
- field_name: bbox
170+
label: Bounding Box
171+
172+
- field_name: centroid
173+
label: Centroid
174+
help_text: A geographic region that is covered by the dataset series.
175+
176+
- field_name: series_order_field
177+
preset: dataset_series_order
178+
help_text: If the series is ordered, the field in the member datasets that will be used for sorting.
179+
180+
- field_name: series_order_type
181+
preset: dataset_series_order_type
182+
help_text: The type of sorting that needs to be performed on series members.
183+
184+
185+
resource_fields:
186+
187+
- field_name: url
188+
label: URL
189+
preset: resource_url_upload
190+
191+
- field_name: name_translated
192+
label:
193+
en: Name
194+
nl: Naam
195+
preset: fluent_core_translated
196+
help_text: A descriptive title for the resource.
197+
198+
- field_name: description_translated
199+
label:
200+
en: Description
201+
nl: Beschrijving
202+
preset: fluent_core_translated
203+
form_snippet: fluent_markdown.html
204+
display_snippet: fluent_markdown.html
205+
help_text: A free-text account of the resource.
206+
207+
- field_name: format
208+
label: Format
209+
preset: resource_format_autocomplete
210+
help_text: File format. If not provided it will be guessed.

0 commit comments

Comments
 (0)