oarepo-runtime 1.9.2__py3-none-any.whl → 1.9.4__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- oarepo_runtime/records/dumpers/multilingual_dumper.py +6 -4
- oarepo_runtime/services/schema/i18n.py +22 -7
- oarepo_runtime/translations/cs/LC_MESSAGES/messages.mo +0 -0
- oarepo_runtime/translations/cs/LC_MESSAGES/messages.po +16 -0
- oarepo_runtime/translations/en/LC_MESSAGES/messages.po +21 -0
- oarepo_runtime/translations/messages.pot +36 -17
- {oarepo_runtime-1.9.2.dist-info → oarepo_runtime-1.9.4.dist-info}/METADATA +1 -1
- {oarepo_runtime-1.9.2.dist-info → oarepo_runtime-1.9.4.dist-info}/RECORD +12 -12
- {oarepo_runtime-1.9.2.dist-info → oarepo_runtime-1.9.4.dist-info}/WHEEL +0 -0
- {oarepo_runtime-1.9.2.dist-info → oarepo_runtime-1.9.4.dist-info}/entry_points.txt +0 -0
- {oarepo_runtime-1.9.2.dist-info → oarepo_runtime-1.9.4.dist-info}/licenses/LICENSE +0 -0
- {oarepo_runtime-1.9.2.dist-info → oarepo_runtime-1.9.4.dist-info}/top_level.txt +0 -0
@@ -18,15 +18,17 @@ class MultilingualDumper(SearchDumperExt):
|
|
18
18
|
def dump(self, record, data):
|
19
19
|
for path in self.path_traversal.iter(data):
|
20
20
|
rec = path[-1].current
|
21
|
-
|
22
|
-
|
21
|
+
lang = rec.get("lang", None)
|
22
|
+
if lang and lang in self.SUPPORTED_LANGS:
|
23
|
+
el_name = path[-1].key + "_" + lang
|
23
24
|
path[-1].parent_data.setdefault(el_name, []).append(rec["value"])
|
24
25
|
return data
|
25
26
|
|
26
27
|
def load(self, data, record_cls):
|
27
28
|
for path in self.path_traversal.iter(data):
|
28
29
|
rec = path[-1].current
|
29
|
-
|
30
|
-
|
30
|
+
lang = rec.get("lang", None)
|
31
|
+
if lang and lang in self.SUPPORTED_LANGS:
|
32
|
+
el_name = path[-1].key + "_" + lang
|
31
33
|
path[-1].parent_data.pop(el_name, None)
|
32
34
|
return data
|
@@ -2,7 +2,8 @@ from functools import lru_cache
|
|
2
2
|
|
3
3
|
import langcodes
|
4
4
|
from invenio_base.utils import obj_or_import_string
|
5
|
-
from
|
5
|
+
from invenio_i18n import gettext as _
|
6
|
+
from marshmallow import Schema, ValidationError, fields, pre_load, validates
|
6
7
|
|
7
8
|
"""
|
8
9
|
Marshmallow schema for multilingual strings. Consider moving this file to a library, not generating
|
@@ -14,18 +15,32 @@ it for each project.
|
|
14
15
|
def get_i18n_schema(
|
15
16
|
lang_name, value_name, value_field="marshmallow_utils.fields.SanitizedHTML"
|
16
17
|
):
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
18
|
+
class I18nMixin:
|
19
|
+
@validates(lang_name)
|
20
|
+
def validate_lang(self, value):
|
21
|
+
if value != "_" and not langcodes.Language.get(value).is_valid():
|
22
|
+
raise ValidationError("Invalid language code")
|
23
|
+
|
24
|
+
@pre_load
|
25
|
+
def pre_load_func(self, data, **kwargs):
|
26
|
+
errors = {}
|
27
|
+
if not data.get(lang_name) or not data.get(value_name):
|
28
|
+
errors[lang_name] = [_("Both language and text must be provided.")]
|
29
|
+
errors[value_name] = [_("Both language and text must be provided.")]
|
30
|
+
|
31
|
+
if errors:
|
32
|
+
raise ValidationError(errors)
|
33
|
+
return data
|
21
34
|
|
22
35
|
value_field_class = obj_or_import_string(value_field)
|
23
36
|
|
24
37
|
return type(
|
25
38
|
f"I18nSchema_{lang_name}_{value_name}",
|
26
|
-
(
|
39
|
+
(
|
40
|
+
I18nMixin,
|
41
|
+
Schema,
|
42
|
+
),
|
27
43
|
{
|
28
|
-
"validate_lang": validate_lang,
|
29
44
|
lang_name: fields.String(required=True),
|
30
45
|
value_name: value_field_class(required=True),
|
31
46
|
},
|
Binary file
|
@@ -67,3 +67,19 @@ msgstr "omezený přístup"
|
|
67
67
|
#: /Users/m/w/cesnet/oarepo-runtime/oarepo_runtime/services/schema/ui.py:155
|
68
68
|
msgid "access.status.metadata-only"
|
69
69
|
msgstr "pouze metadata"
|
70
|
+
|
71
|
+
#: /Users/m/w/cesnet/oarepo-runtime/oarepo_runtime/services/search.py:105
|
72
|
+
msgid "Recently updated"
|
73
|
+
msgstr ""
|
74
|
+
|
75
|
+
#: /Users/m/w/cesnet/oarepo-runtime/oarepo_runtime/services/search.py:109
|
76
|
+
msgid "Least recently updated"
|
77
|
+
msgstr ""
|
78
|
+
|
79
|
+
#: /Users/m/w/cesnet/oarepo-runtime/oarepo_runtime/services/search.py:121
|
80
|
+
msgid "Version"
|
81
|
+
msgstr ""
|
82
|
+
|
83
|
+
#: /Users/m/w/cesnet/oarepo-runtime/oarepo_runtime/services/schema/i18n.py:28
|
84
|
+
msgid "Both language and text must be provided."
|
85
|
+
msgstr "Musí být vyplněn jazyk i hodnota."
|
@@ -66,3 +66,24 @@ msgstr "restricted access"
|
|
66
66
|
#: /Users/m/w/cesnet/oarepo-runtime/oarepo_runtime/services/schema/ui.py:155
|
67
67
|
msgid "access.status.metadata-only"
|
68
68
|
msgstr "metadata only access"
|
69
|
+
|
70
|
+
#: /Users/m/w/cesnet/oarepo-runtime/oarepo_runtime/services/search.py:105
|
71
|
+
msgid "Recently updated"
|
72
|
+
msgstr ""
|
73
|
+
|
74
|
+
#: /Users/m/w/cesnet/oarepo-runtime/oarepo_runtime/services/search.py:109
|
75
|
+
msgid "Least recently updated"
|
76
|
+
msgstr ""
|
77
|
+
|
78
|
+
#: /Users/m/w/cesnet/oarepo-runtime/oarepo_runtime/services/search.py:121
|
79
|
+
msgid "Version"
|
80
|
+
msgstr ""
|
81
|
+
|
82
|
+
#: /Users/m/w/cesnet/oarepo-runtime/oarepo_runtime/services/schema/i18n.py:30
|
83
|
+
#, python-brace-format
|
84
|
+
msgid "Both '{lang_name}' and '{value_name}' fields must be provided."
|
85
|
+
msgstr ""
|
86
|
+
|
87
|
+
#: /Users/m/w/cesnet/oarepo-runtime/oarepo_runtime/services/schema/i18n.py:28
|
88
|
+
msgid "Both language and text must be provided."
|
89
|
+
msgstr ""
|
@@ -8,7 +8,7 @@ msgid ""
|
|
8
8
|
msgstr ""
|
9
9
|
"Project-Id-Version: PROJECT VERSION\n"
|
10
10
|
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
|
11
|
-
"POT-Creation-Date: 2025-
|
11
|
+
"POT-Creation-Date: 2025-07-29 15:53+0200\n"
|
12
12
|
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
13
13
|
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
14
14
|
"Language-Team: LANGUAGE <LL@li.org>\n"
|
@@ -17,56 +17,75 @@ msgstr ""
|
|
17
17
|
"Content-Transfer-Encoding: 8bit\n"
|
18
18
|
"Generated-By: Babel 2.17.0\n"
|
19
19
|
|
20
|
-
#: /
|
21
|
-
#: /
|
20
|
+
#: /Users/m/w/cesnet/oarepo-runtime/oarepo_runtime/services/search.py:80
|
21
|
+
#: /Users/m/w/cesnet/oarepo-runtime/oarepo_runtime/services/search.py:224
|
22
22
|
msgid "By Title"
|
23
23
|
msgstr ""
|
24
24
|
|
25
|
-
#: /
|
26
|
-
#: /
|
25
|
+
#: /Users/m/w/cesnet/oarepo-runtime/oarepo_runtime/services/search.py:84
|
26
|
+
#: /Users/m/w/cesnet/oarepo-runtime/oarepo_runtime/services/search.py:101
|
27
|
+
#: /Users/m/w/cesnet/oarepo-runtime/oarepo_runtime/translations/default_translations.py:5
|
27
28
|
msgid "Best match"
|
28
29
|
msgstr ""
|
29
30
|
|
30
|
-
#: /
|
31
|
-
#: /
|
31
|
+
#: /Users/m/w/cesnet/oarepo-runtime/oarepo_runtime/services/search.py:88
|
32
|
+
#: /Users/m/w/cesnet/oarepo-runtime/oarepo_runtime/services/search.py:113
|
33
|
+
#: /Users/m/w/cesnet/oarepo-runtime/oarepo_runtime/translations/default_translations.py:3
|
32
34
|
msgid "Newest"
|
33
35
|
msgstr ""
|
34
36
|
|
35
|
-
#: /
|
36
|
-
#: /
|
37
|
+
#: /Users/m/w/cesnet/oarepo-runtime/oarepo_runtime/services/search.py:92
|
38
|
+
#: /Users/m/w/cesnet/oarepo-runtime/oarepo_runtime/services/search.py:117
|
39
|
+
#: /Users/m/w/cesnet/oarepo-runtime/oarepo_runtime/translations/default_translations.py:4
|
37
40
|
msgid "Oldest"
|
38
41
|
msgstr ""
|
39
42
|
|
40
|
-
#: /
|
43
|
+
#: /Users/m/w/cesnet/oarepo-runtime/oarepo_runtime/services/search.py:105
|
44
|
+
msgid "Recently updated"
|
45
|
+
msgstr ""
|
46
|
+
|
47
|
+
#: /Users/m/w/cesnet/oarepo-runtime/oarepo_runtime/services/search.py:109
|
48
|
+
msgid "Least recently updated"
|
49
|
+
msgstr ""
|
50
|
+
|
51
|
+
#: /Users/m/w/cesnet/oarepo-runtime/oarepo_runtime/services/search.py:121
|
52
|
+
msgid "Version"
|
53
|
+
msgstr ""
|
54
|
+
|
55
|
+
#: /Users/m/w/cesnet/oarepo-runtime/oarepo_runtime/services/schema/i18n.py:28
|
56
|
+
msgid "Both language and text must be provided."
|
57
|
+
msgstr ""
|
58
|
+
|
59
|
+
#: /Users/m/w/cesnet/oarepo-runtime/oarepo_runtime/services/schema/ui.py:155
|
41
60
|
msgid "True"
|
42
61
|
msgstr ""
|
43
62
|
|
44
|
-
#: /
|
63
|
+
#: /Users/m/w/cesnet/oarepo-runtime/oarepo_runtime/services/schema/ui.py:155
|
45
64
|
msgid "False"
|
46
65
|
msgstr ""
|
47
66
|
|
48
|
-
#: /
|
67
|
+
#: /Users/m/w/cesnet/oarepo-runtime/oarepo_runtime/services/schema/ui.py:175
|
49
68
|
msgid "access.status.open"
|
50
69
|
msgstr ""
|
51
70
|
|
52
|
-
#: /
|
71
|
+
#: /Users/m/w/cesnet/oarepo-runtime/oarepo_runtime/services/schema/ui.py:176
|
53
72
|
msgid "access.status.embargoed"
|
54
73
|
msgstr ""
|
55
74
|
|
56
|
-
#: /
|
75
|
+
#: /Users/m/w/cesnet/oarepo-runtime/oarepo_runtime/services/schema/ui.py:177
|
57
76
|
msgid "access.status.restricted"
|
58
77
|
msgstr ""
|
59
78
|
|
60
|
-
#: /
|
79
|
+
#: /Users/m/w/cesnet/oarepo-runtime/oarepo_runtime/services/schema/ui.py:178
|
61
80
|
msgid "access.status.metadata-only"
|
62
81
|
msgstr ""
|
63
82
|
|
64
|
-
#: /
|
83
|
+
#: /Users/m/w/cesnet/oarepo-runtime/oarepo_runtime/services/schema/validation.py:35
|
65
84
|
#, python-format
|
66
85
|
msgid "Invalid value %(identifier)s of identifier type %(type)s"
|
67
86
|
msgstr ""
|
68
87
|
|
69
|
-
#: /
|
88
|
+
#: /Users/m/w/cesnet/oarepo-runtime/oarepo_runtime/translations/default_translations.py:6
|
70
89
|
msgid "Contact"
|
71
90
|
msgstr ""
|
72
91
|
|
@@ -58,7 +58,7 @@ oarepo_runtime/records/drafts.py,sha256=8BRmxXcKyVMBQbMMhVScPS_T7lwvR8kGKYQAxaVa
|
|
58
58
|
oarepo_runtime/records/pid_providers.py,sha256=V9KIeffLoFwjh7PDEBkpmVQb2j7w9pgKr9OlHV5g8S4,736
|
59
59
|
oarepo_runtime/records/dumpers/__init__.py,sha256=OmzNhLdMNKibmCksnj9eTX9xPBG30dziiK3j3bAAp3k,233
|
60
60
|
oarepo_runtime/records/dumpers/edtf_interval.py,sha256=8bE3JlaR7b33rxDc7LW9R8jcwNI66Zb07Jee6YUmlrE,1231
|
61
|
-
oarepo_runtime/records/dumpers/multilingual_dumper.py,sha256=
|
61
|
+
oarepo_runtime/records/dumpers/multilingual_dumper.py,sha256=vcoY25VZSyo3q7Zgexo0IOkE6xq1yTAM3uq7GZcSgUQ,1162
|
62
62
|
oarepo_runtime/records/entity_resolvers/__init__.py,sha256=UiiIT54pUu9j7qPAPfqVp4UTnXnppp0c_LtKbFnyt6Y,383
|
63
63
|
oarepo_runtime/records/entity_resolvers/proxies.py,sha256=P9c8JeHc25i_v8uXxTMHNlMNTFskET6dTM0VVMfLfyk,2097
|
64
64
|
oarepo_runtime/records/mappings/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -129,7 +129,7 @@ oarepo_runtime/services/relations/errors.py,sha256=VtlOKq9MEUeJ4IsiZhY7lWoshrusA
|
|
129
129
|
oarepo_runtime/services/relations/mapping.py,sha256=D7IYk83SXVgTv-0ohSnHOCzvCwbFLXJsayO1eQfQn0U,1285
|
130
130
|
oarepo_runtime/services/schema/__init__.py,sha256=5u8wTvon4W6ODJNRJhRNChmQHAZTXwo6LV2mYRYs-EM,1377
|
131
131
|
oarepo_runtime/services/schema/cf.py,sha256=-m9seIH5VYUdxDsJlPVXS0-8f7xkpN7YfW1q9E1GacI,475
|
132
|
-
oarepo_runtime/services/schema/i18n.py,sha256=
|
132
|
+
oarepo_runtime/services/schema/i18n.py,sha256=49hPDKSUubtwVRT1_k--ftMkmE0oD4_VGP2CJ1sEGnM,2186
|
133
133
|
oarepo_runtime/services/schema/i18n_ui.py,sha256=MnEDW0gcZPvEODbJ6XzldxNCJ2suhfmdHQ4wkcAG6zA,2179
|
134
134
|
oarepo_runtime/services/schema/i18n_validation.py,sha256=fyMTi2Rw-KiHv7c7HN61zGxRVa9sAjAEEkAL5wUyKNo,236
|
135
135
|
oarepo_runtime/services/schema/marshmallow.py,sha256=iAMMH5MlYs59qetXAHOROvERNScfVqY9TrEIJejHCuw,1421
|
@@ -141,22 +141,22 @@ oarepo_runtime/services/schema/rdm_ui.py,sha256=ffjl20tvRcuX3FNINOhGJWX84aTNEzJO
|
|
141
141
|
oarepo_runtime/services/schema/ui.py,sha256=ff2AfK-G0fArlVHHKsDagPhu9NkMj6DPcVK4NycEO8c,8216
|
142
142
|
oarepo_runtime/services/schema/validation.py,sha256=aRfeR-2D1XXYqI3_U5FHoFvJrYjZlpM8nB35-M_u3Qs,2300
|
143
143
|
oarepo_runtime/translations/default_translations.py,sha256=060GBlA1ghWxfeumo6NqxCCZDb-6OezOuF6pr-_GEOQ,104
|
144
|
-
oarepo_runtime/translations/messages.pot,sha256=
|
145
|
-
oarepo_runtime/translations/cs/LC_MESSAGES/messages.mo,sha256=
|
146
|
-
oarepo_runtime/translations/cs/LC_MESSAGES/messages.po,sha256=
|
144
|
+
oarepo_runtime/translations/messages.pot,sha256=7Sf8l_70GjmKnXKYioUFp8Z65qtW57BgR9N9NlwmiNU,3013
|
145
|
+
oarepo_runtime/translations/cs/LC_MESSAGES/messages.mo,sha256=OxKvpWhjhv6WfhamLBrJ315vq7w1qVAhDoWRIk1qhAc,1138
|
146
|
+
oarepo_runtime/translations/cs/LC_MESSAGES/messages.po,sha256=BtgVxnFb2xMl0j5vnSDHjQmTnDfuV5zEqcwJpHs9bTc,2568
|
147
147
|
oarepo_runtime/translations/en/LC_MESSAGES/messages.mo,sha256=tq5pTCpH7cuzdwrQlpTMjS1jlnoV0dWDlK9mGcKT338,673
|
148
|
-
oarepo_runtime/translations/en/LC_MESSAGES/messages.po,sha256=
|
148
|
+
oarepo_runtime/translations/en/LC_MESSAGES/messages.po,sha256=oWFA5kjT-sBNoZ3UIzYS03GQOvri5VqL9NcYnQnYsyQ,2562
|
149
149
|
oarepo_runtime/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
150
150
|
oarepo_runtime/utils/functools.py,sha256=gKS9YZtlIYcDvdNA9cmYO00yjiXBYV1jg8VpcRUyQyg,1324
|
151
151
|
oarepo_runtime/utils/index.py,sha256=ArrUUXB-KowUcUksRKqcFpmqct4bn9alO1zd_kX2tmU,292
|
152
152
|
oarepo_runtime/utils/path.py,sha256=V1NVyk3m12_YLbj7QHYvUpE1wScO78bYsX1LOLeXDkI,3108
|
153
|
-
oarepo_runtime-1.9.
|
153
|
+
oarepo_runtime-1.9.4.dist-info/licenses/LICENSE,sha256=h2uWz0OaB3EN-J1ImdGJZzc7yvfQjvHVYdUhQ-H7ypY,1064
|
154
154
|
tests/marshmallow_to_json/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
155
155
|
tests/marshmallow_to_json/test_datacite_ui_schema.py,sha256=82iLj8nW45lZOUewpWbLX3mpSkpa9lxo-vK-Qtv_1bU,48552
|
156
156
|
tests/marshmallow_to_json/test_simple_schema.py,sha256=izZN9p0v6kovtSZ6AdxBYmK_c6ZOti2_z_wPT_zXIr0,1500
|
157
157
|
tests/pkg_data/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
158
|
-
oarepo_runtime-1.9.
|
159
|
-
oarepo_runtime-1.9.
|
160
|
-
oarepo_runtime-1.9.
|
161
|
-
oarepo_runtime-1.9.
|
162
|
-
oarepo_runtime-1.9.
|
158
|
+
oarepo_runtime-1.9.4.dist-info/METADATA,sha256=CVIJjZW7XgCVhHpzqhlMe-ljTHMwsXtm4Tl3u3a1554,4788
|
159
|
+
oarepo_runtime-1.9.4.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
160
|
+
oarepo_runtime-1.9.4.dist-info/entry_points.txt,sha256=k7O5LZUOGsVeSpB7ulU0txBUNp1CVQG7Q7TJIVTPbzU,491
|
161
|
+
oarepo_runtime-1.9.4.dist-info/top_level.txt,sha256=bHhlkT1_RQC4IkfTQCqA3iN4KCB6cSFQlsXpQMSP-bE,21
|
162
|
+
oarepo_runtime-1.9.4.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|