weblate_schemas 2024.1__tar.gz

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.
@@ -0,0 +1,90 @@
1
+ Changelog
2
+ =========
3
+
4
+ 2024.1
5
+ ------
6
+
7
+ * Released on 9th April 2024.
8
+ * Dropped support for Python 3.7 and 3.8.
9
+ * Added support for Python 3.12.
10
+ * Clarified address field on user data.
11
+
12
+ 2023.3
13
+ ------
14
+
15
+ * Released on 8th June 2023.
16
+ * Added theme to user data.
17
+
18
+ 2023.2
19
+ ------
20
+
21
+ * Released on 2nd March 2023.
22
+ * Fixed project backup with unicode website URLs.
23
+
24
+ 2023.1
25
+ ------
26
+
27
+ * Released on 5th February 2023.
28
+ * Fixed testsuite failure.
29
+ * Added support for Python 3.11 and 3.10.
30
+ * Dropped support for Python 3.6.
31
+ * Fixed project backups schema to allow blank project website.
32
+
33
+ 2022.1
34
+ ------
35
+
36
+ * Released on 17th August 2022.
37
+ * Added validate_schema API.
38
+ * Added caching to schema loading.
39
+ * Added timestamp validation.
40
+ * Switched to CalVer versioning.
41
+ * Added schema for component backups.
42
+
43
+ 0.8
44
+ ---
45
+
46
+ * Released on 25th July 2022.
47
+ * Added schema for project backups.
48
+
49
+ 0.7
50
+ ---
51
+
52
+ * Released on 17th Match 2021.
53
+ * Fixed minor syntax issue in user data schema.
54
+
55
+ 0.6
56
+ ---
57
+
58
+ * Released on 5th Match 2021.
59
+ * Improved examples.
60
+ * Fixed license information.
61
+
62
+ 0.5
63
+ ---
64
+
65
+ * Released on 8th Decemeber 2020.
66
+ * Fixed validation of translation memory entries with newlines.
67
+
68
+ 0.4
69
+ ---
70
+
71
+ * Released on 5th August 2020.
72
+ * Added schema for user downloadable data.
73
+
74
+ 0.3
75
+ ---
76
+
77
+ * Released on 10th March 2020.
78
+ * Switch to more standard naming of schema files (.schema.json).
79
+
80
+ 0.2
81
+ ---
82
+
83
+ * Released on 10th March 2020.
84
+ * Fixed language code validation.
85
+
86
+ 0.1
87
+ ---
88
+
89
+ * Released on 10th March 2020.
90
+ * Initial release.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright © 2012–2023 Michal Čihař
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,9 @@
1
+ include LICENSE
2
+ include ChangeLog
3
+ include README.rst
4
+ include CHANGES.rst
5
+ include requirements-test.txt
6
+ include requirements.txt
7
+ include weblate_schemas/*.py
8
+ recursive-include weblate_schemas/schemas *
9
+ global-exclude *.swp *.swo
@@ -0,0 +1,75 @@
1
+ Metadata-Version: 2.1
2
+ Name: weblate_schemas
3
+ Version: 2024.1
4
+ Summary: A collection of JSON schemas used by Weblate
5
+ Home-page: https://weblate.org/
6
+ Download-URL: https://github.com/WeblateOrg/weblate_schemas
7
+ Author: Michal Čihař
8
+ Author-email: michal@cihar.com
9
+ License: MIT
10
+ Project-URL: Issue Tracker, https://github.com/WeblateOrg/weblate_schemas/issues
11
+ Project-URL: Documentation, https://docs.weblate.org/
12
+ Project-URL: Source Code, https://github.com/WeblateOrg/weblate_schemas
13
+ Project-URL: Twitter, https://twitter.com/WeblateOrg
14
+ Project-URL: Funding, https://weblate.org/donate/
15
+ Keywords: i18n l10n gettext translate weblate
16
+ Platform: any
17
+ Classifier: Development Status :: 5 - Production/Stable
18
+ Classifier: Intended Audience :: Developers
19
+ Classifier: License :: OSI Approved :: MIT License
20
+ Classifier: Operating System :: OS Independent
21
+ Classifier: Programming Language :: Python
22
+ Classifier: Programming Language :: Python :: 3
23
+ Classifier: Programming Language :: Python :: 3 :: Only
24
+ Classifier: Topic :: Software Development :: Internationalization
25
+ Classifier: Topic :: Software Development :: Localization
26
+ Classifier: Topic :: Utilities
27
+ Requires-Python: >=3.9
28
+ Description-Content-Type: text/x-rst
29
+ License-File: LICENSE
30
+
31
+ .. image:: https://s.weblate.org/cdn/Logo-Darktext-borders.png
32
+ :alt: Weblate
33
+ :target: https://weblate.org/
34
+ :height: 80px
35
+
36
+ **Weblate is libre software web-based continuous localization system,
37
+ used by over 2500 libre projects and companies in more than 165 countries.**
38
+
39
+ This module contains schemas used in Weblate exports.
40
+
41
+ .. image:: https://img.shields.io/badge/website-weblate.org-blue.svg
42
+ :alt: Website
43
+ :target: https://weblate.org/
44
+
45
+ .. image:: https://hosted.weblate.org/widgets/weblate/-/svg-badge.svg
46
+ :alt: Translation status
47
+ :target: https://hosted.weblate.org/engage/weblate/?utm_source=widget
48
+
49
+ .. image:: https://bestpractices.coreinfrastructure.org/projects/552/badge
50
+ :alt: CII Best Practices
51
+ :target: https://bestpractices.coreinfrastructure.org/projects/552
52
+
53
+ .. image:: https://img.shields.io/pypi/v/weblate_schemas.svg
54
+ :target: https://pypi.org/project/weblate_schemas/
55
+ :alt: PyPI package
56
+
57
+ .. image:: https://img.shields.io/readthedocs/weblate.svg
58
+ :alt: Documentation
59
+ :target: https://docs.weblate.org/en/latest/schemas.html
60
+
61
+ Installation
62
+ ------------
63
+
64
+ Install using pip:
65
+
66
+ .. code-block:: sh
67
+
68
+ pip3 install weblate_schemas
69
+
70
+ Sources are available at <https://github.com/WeblateOrg/weblate_schemas>.
71
+
72
+ Contributing
73
+ ------------
74
+
75
+ Contributions are welcome! See `documentation <https://docs.weblate.org/en/latest/contributing/modules.html>`__ for more information.
@@ -0,0 +1,45 @@
1
+ .. image:: https://s.weblate.org/cdn/Logo-Darktext-borders.png
2
+ :alt: Weblate
3
+ :target: https://weblate.org/
4
+ :height: 80px
5
+
6
+ **Weblate is libre software web-based continuous localization system,
7
+ used by over 2500 libre projects and companies in more than 165 countries.**
8
+
9
+ This module contains schemas used in Weblate exports.
10
+
11
+ .. image:: https://img.shields.io/badge/website-weblate.org-blue.svg
12
+ :alt: Website
13
+ :target: https://weblate.org/
14
+
15
+ .. image:: https://hosted.weblate.org/widgets/weblate/-/svg-badge.svg
16
+ :alt: Translation status
17
+ :target: https://hosted.weblate.org/engage/weblate/?utm_source=widget
18
+
19
+ .. image:: https://bestpractices.coreinfrastructure.org/projects/552/badge
20
+ :alt: CII Best Practices
21
+ :target: https://bestpractices.coreinfrastructure.org/projects/552
22
+
23
+ .. image:: https://img.shields.io/pypi/v/weblate_schemas.svg
24
+ :target: https://pypi.org/project/weblate_schemas/
25
+ :alt: PyPI package
26
+
27
+ .. image:: https://img.shields.io/readthedocs/weblate.svg
28
+ :alt: Documentation
29
+ :target: https://docs.weblate.org/en/latest/schemas.html
30
+
31
+ Installation
32
+ ------------
33
+
34
+ Install using pip:
35
+
36
+ .. code-block:: sh
37
+
38
+ pip3 install weblate_schemas
39
+
40
+ Sources are available at <https://github.com/WeblateOrg/weblate_schemas>.
41
+
42
+ Contributing
43
+ ------------
44
+
45
+ Contributions are welcome! See `documentation <https://docs.weblate.org/en/latest/contributing/modules.html>`__ for more information.
@@ -0,0 +1,50 @@
1
+ [tool.black]
2
+ target-version = ['py39']
3
+
4
+ [tool.isort]
5
+ profile = "black"
6
+
7
+ [tool.ruff]
8
+ ignore = [
9
+ "D203", # CONFIG: incompatible with D211
10
+ "D212" # CONFIG: incompatible with D213
11
+ ]
12
+ output-format = "github"
13
+ select = [
14
+ "E",
15
+ "F",
16
+ "B",
17
+ "T10",
18
+ "A",
19
+ "C4",
20
+ "C90",
21
+ "YTT",
22
+ "DJ",
23
+ "UP",
24
+ "D",
25
+ "PD",
26
+ "PGH",
27
+ "PL",
28
+ "TRY",
29
+ "RUF",
30
+ "ERA",
31
+ "ICN",
32
+ "ISC",
33
+ "EXE",
34
+ "INP",
35
+ "PIE",
36
+ "G",
37
+ "PYI",
38
+ "Q",
39
+ "SIM",
40
+ "TID",
41
+ "RSE",
42
+ "T20",
43
+ "RET",
44
+ "SLF",
45
+ "N"
46
+ ]
47
+ target-version = "py39"
48
+
49
+ [tool.ruff.mccabe]
50
+ max-complexity = 16
@@ -0,0 +1,4 @@
1
+ -r requirements.txt
2
+ pytest
3
+ pytest-cov
4
+ twine==5.0.0
@@ -0,0 +1,4 @@
1
+ fqdn
2
+ jsonschema
3
+ rfc3987
4
+ strict-rfc3339
@@ -0,0 +1,56 @@
1
+ [metadata]
2
+ name = weblate_schemas
3
+ version = 2024.1
4
+ description = A collection of JSON schemas used by Weblate
5
+ long_description = file: README.rst
6
+ long_description_content_type = text/x-rst
7
+ url = https://weblate.org/
8
+ author = Michal Čihař
9
+ author_email = michal@cihar.com
10
+ license = MIT
11
+ license_file = LICENSE
12
+ platforms = any
13
+ classifiers =
14
+ Development Status :: 5 - Production/Stable
15
+ Intended Audience :: Developers
16
+ License :: OSI Approved :: MIT License
17
+ Operating System :: OS Independent
18
+ Programming Language :: Python
19
+ Programming Language :: Python :: 3
20
+ Programming Language :: Python :: 3 :: Only
21
+ Topic :: Software Development :: Internationalization
22
+ Topic :: Software Development :: Localization
23
+ Topic :: Utilities
24
+ download_url = https://github.com/WeblateOrg/weblate_schemas
25
+ keywords = i18n l10n gettext translate weblate
26
+ project_urls =
27
+ Issue Tracker=https://github.com/WeblateOrg/weblate_schemas/issues
28
+ Documentation=https://docs.weblate.org/
29
+ Source Code=https://github.com/WeblateOrg/weblate_schemas
30
+ Twitter=https://twitter.com/WeblateOrg
31
+ Funding=https://weblate.org/donate/
32
+
33
+ [options]
34
+ packages = find_namespace:
35
+ python_requires = >=3.9
36
+ include_package_data = 1
37
+ zip_safe = 0
38
+
39
+ [flake8]
40
+ max-complexity = 16
41
+ extend-select = E,W1,W2,W3,W504,W505,W6,B
42
+ enable-extensions = B,C,D,DJ,F,G,I,M,N,R,SF,UPS
43
+ extend-ignore = E203
44
+ exclude =
45
+ max-line-length = 88
46
+ per-file-ignores =
47
+
48
+ [pycodestyle]
49
+ extend-select = E,W1,W2,W3,W504,W505,W6
50
+ exclude =
51
+ max-line-length = 88
52
+
53
+ [egg_info]
54
+ tag_build =
55
+ tag_date = 0
56
+
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env python
2
+
3
+ # Copyright © Michal Čihař <michal@weblate.org>
4
+ #
5
+ # SPDX-License-Identifier: MIT
6
+
7
+ """Setup file for easy installation."""
8
+
9
+ from setuptools import setup
10
+
11
+ with open("requirements.txt") as handle:
12
+ REQUIRES = list(handle.read().splitlines())
13
+
14
+ setup(install_requires=REQUIRES)
@@ -0,0 +1,33 @@
1
+ # Copyright © Michal Čihař <michal@weblate.org>
2
+ #
3
+ # SPDX-License-Identifier: MIT
4
+
5
+ """Schemas used by Weblate."""
6
+
7
+ import json
8
+ from pathlib import Path
9
+
10
+ from jsonschema import FormatChecker, validate
11
+
12
+ SCHEMA_BASE = Path(__file__).resolve().parent.joinpath("schemas")
13
+
14
+ SCHEMA_CACHE = {}
15
+
16
+
17
+ def get_path(name: str):
18
+ """Build filename for a schema."""
19
+ return SCHEMA_BASE.joinpath(name)
20
+
21
+
22
+ def load_schema(name: str):
23
+ """Load schema from a disk."""
24
+ if name not in SCHEMA_CACHE:
25
+ with get_path(name).open("r") as handle:
26
+ SCHEMA_CACHE[name] = json.load(handle)
27
+ return SCHEMA_CACHE[name]
28
+
29
+
30
+ def validate_schema(data: dict, name: str):
31
+ """Validate data to match schema."""
32
+ schema = load_schema(name)
33
+ validate(data, schema, format_checker=FormatChecker())
@@ -0,0 +1,245 @@
1
+ {
2
+ "$id": "https://weblate.org/schemas/weblate-backup.schema.json",
3
+ "$schema": "http://json-schema.org/draft-07/schema#",
4
+ "type": "object",
5
+ "definitions": {},
6
+ "title": "Weblate backup",
7
+ "additionalProperties": false,
8
+ "required": [
9
+ "metadata",
10
+ "project",
11
+ "labels"
12
+ ],
13
+ "properties": {
14
+ "metadata": {
15
+ "$id": "#root/metadata",
16
+ "title": "Export metadata",
17
+ "type": "object",
18
+ "required": [
19
+ "version",
20
+ "server",
21
+ "domain",
22
+ "timestamp"
23
+ ],
24
+ "additionalProperties": false,
25
+ "properties": {
26
+ "version": {
27
+ "$id": "#root/metadata/version",
28
+ "title": "Weblate version",
29
+ "type": "string",
30
+ "default": "",
31
+ "examples": [
32
+ "4.13"
33
+ ]
34
+ },
35
+ "server": {
36
+ "$id": "#root/metadata/server",
37
+ "title": "Server name",
38
+ "type": "string",
39
+ "default": "",
40
+ "examples": [
41
+ "Weblate"
42
+ ]
43
+ },
44
+ "domain": {
45
+ "$id": "#root/metadata/domain",
46
+ "title": "Server domain",
47
+ "type": "string",
48
+ "format": "hostname",
49
+ "default": "",
50
+ "examples": [
51
+ "weblate.example.com"
52
+ ]
53
+ },
54
+ "timestamp": {
55
+ "$id": "#root/metadata/timestamp",
56
+ "title": "Export timestamp",
57
+ "type": "string",
58
+ "format": "date-time",
59
+ "default": "",
60
+ "examples": [
61
+ "2019-11-18T18:53:54.862Z"
62
+ ]
63
+ }
64
+ }
65
+ },
66
+ "project": {
67
+ "$id": "#root/project",
68
+ "title": "Project",
69
+ "type": "object",
70
+ "additionalProperties": false,
71
+ "required": [
72
+ "name",
73
+ "slug",
74
+ "web",
75
+ "instructions",
76
+ "access_control",
77
+ "language_aliases",
78
+ "set_language_team",
79
+ "use_shared_tm",
80
+ "contribute_shared_tm",
81
+ "translation_review",
82
+ "source_review",
83
+ "enable_hooks"
84
+ ],
85
+ "properties": {
86
+ "name": {
87
+ "$id": "#root/project/name",
88
+ "title": "Project name",
89
+ "type": "string",
90
+ "default": "",
91
+ "examples": [
92
+ "Hello"
93
+ ]
94
+ },
95
+ "slug": {
96
+ "$id": "#root/project/slug",
97
+ "title": "URL slug",
98
+ "type": "string",
99
+ "default": "",
100
+ "examples": [
101
+ "hello"
102
+ ]
103
+ },
104
+ "web": {
105
+ "$id": "#root/project/web",
106
+ "title": "",
107
+ "anyOf": [
108
+ {
109
+ "type": "string",
110
+ "format": "iri"
111
+ },
112
+ {
113
+ "type": "string",
114
+ "maxLength": 0
115
+ }
116
+ ],
117
+ "default": "Project website",
118
+ "examples": [
119
+ "https://weblate.org/"
120
+ ]
121
+ },
122
+ "instructions": {
123
+ "$id": "#root/project/instructions",
124
+ "title": "Translation instructions",
125
+ "type": "string",
126
+ "default": ""
127
+ },
128
+ "access_control": {
129
+ "$id": "#root/project/access_control",
130
+ "title": "Access control",
131
+ "type": "integer",
132
+ "enum": [
133
+ 0,
134
+ 1,
135
+ 100,
136
+ 200
137
+ ],
138
+ "default": 0,
139
+ "examples": [
140
+ 0
141
+ ]
142
+ },
143
+ "language_aliases": {
144
+ "$id": "#root/project/language_aliases",
145
+ "title": "Language aliases",
146
+ "type": "string",
147
+ "default": "",
148
+ "examples": [
149
+ ""
150
+ ]
151
+ },
152
+ "set_language_team": {
153
+ "$id": "#root/project/set_language_team",
154
+ "title": "Set \"Language-Team\" header",
155
+ "type": "boolean",
156
+ "default": false
157
+ },
158
+ "use_shared_tm": {
159
+ "$id": "#root/project/use_shared_tm",
160
+ "title": "Use shared translation memory",
161
+ "type": "boolean",
162
+ "default": false
163
+ },
164
+ "contribute_shared_tm": {
165
+ "$id": "#root/project/contribute_shared_tm",
166
+ "title": "Contribute to shared translation memory",
167
+ "type": "boolean",
168
+ "default": false
169
+ },
170
+ "translation_review": {
171
+ "$id": "#root/project/translation_review",
172
+ "title": "Enable reviews",
173
+ "type": "boolean",
174
+ "default": false
175
+ },
176
+ "source_review": {
177
+ "$id": "#root/project/source_review",
178
+ "title": "Enable source reviews",
179
+ "type": "boolean",
180
+ "default": false
181
+ },
182
+ "enable_hooks": {
183
+ "$id": "#root/project/enable_hooks",
184
+ "title": "Enable hooks",
185
+ "type": "boolean",
186
+ "default": false
187
+ }
188
+ }
189
+ },
190
+ "labels": {
191
+ "$id": "#root/labels",
192
+ "title": "Project labels",
193
+ "type": "array",
194
+ "default": [],
195
+ "items": {
196
+ "$id": "#root/labels/items",
197
+ "title": "Items",
198
+ "type": "object",
199
+ "required": [
200
+ "name",
201
+ "color"
202
+ ],
203
+ "additionalProperties": false,
204
+ "properties": {
205
+ "name": {
206
+ "$id": "#root/auditlog/items/name",
207
+ "title": "Label name",
208
+ "type": "string",
209
+ "default": "",
210
+ "examples": [
211
+ "Label"
212
+ ]
213
+ },
214
+ "color": {
215
+ "$id": "#root/auditlog/items/color",
216
+ "title": "Color",
217
+ "type": "string",
218
+ "default": "",
219
+ "examples": [
220
+ "navy"
221
+ ],
222
+ "enum": [
223
+ "navy",
224
+ "blue",
225
+ "aqua",
226
+ "teal",
227
+ "olive",
228
+ "green",
229
+ "lime",
230
+ "yellow",
231
+ "orange",
232
+ "red",
233
+ "maroon",
234
+ "fuchsia",
235
+ "purple",
236
+ "black",
237
+ "gray",
238
+ "silver"
239
+ ]
240
+ }
241
+ }
242
+ }
243
+ }
244
+ }
245
+ }