weblate_schemas 0.2__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.
@@ -0,0 +1,39 @@
1
+ # -*- coding: utf-8 -*-
2
+ #
3
+ # Copyright © 2012 - 2020 Michal Čihař <michal@cihar.com>
4
+ #
5
+ # This file is part of Weblate weblate_schemas
6
+ # <https://github.com/WeblateOrg/weblate_schemas>
7
+ #
8
+ # This program is free software: you can redistribute it and/or modify
9
+ # it under the terms of the GNU General Public License as published by
10
+ # the Free Software Foundation, either version 3 of the License, or
11
+ # (at your option) any later version.
12
+ #
13
+ # This program is distributed in the hope that it will be useful,
14
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
+ # GNU General Public License for more details.
17
+ #
18
+ # You should have received a copy of the GNU General Public License
19
+ # along with this program. If not, see <https://www.gnu.org/licenses/>.
20
+ #
21
+ """Schemas used by Weblate."""
22
+
23
+ __version__ = "0.2"
24
+
25
+ import json
26
+ from pathlib import Path
27
+
28
+ SCHEMA_BASE = Path(__file__).resolve().parent.joinpath("schemas")
29
+
30
+
31
+ def get_path(name):
32
+ """Build filename for a schema."""
33
+ return SCHEMA_BASE.joinpath(name)
34
+
35
+
36
+ def load_schema(name):
37
+ """Load schema from a disk."""
38
+ with get_path(name).open("r") as handle:
39
+ return json.load(handle)
@@ -0,0 +1,87 @@
1
+ {
2
+ "definitions": {},
3
+ "$schema": "http://json-schema.org/draft-07/schema#",
4
+ "$id": "https://weblate.org/schemas/weblate-memory.jsonschema",
5
+ "type": "array",
6
+ "title": "Weblate Translation Memory Schema",
7
+ "items": {
8
+ "$id": "#/items",
9
+ "type": "object",
10
+ "title": "The Transaltion Memory Schema",
11
+ "required": [
12
+ "source_language",
13
+ "target_language",
14
+ "source",
15
+ "target",
16
+ "origin",
17
+ "category"
18
+ ],
19
+ "properties": {
20
+ "source_language": {
21
+ "$id": "#/items/properties/source_language",
22
+ "type": "string",
23
+ "title": "The Source Language",
24
+ "description": "ISO 639-1 / ISO 639-2 / IETF BCP 47",
25
+ "default": "",
26
+ "examples": [
27
+ "en"
28
+ ],
29
+ "pattern": "^([^ ]+)$"
30
+ },
31
+ "target_language": {
32
+ "$id": "#/items/properties/target_language",
33
+ "type": "string",
34
+ "title": "The Target Language",
35
+ "description": "ISO 639-1 / ISO 639-2 / IETF BCP 47",
36
+ "default": "",
37
+ "examples": [
38
+ "cs"
39
+ ],
40
+ "pattern": "^([^ ]+)$"
41
+ },
42
+ "source": {
43
+ "$id": "#/items/properties/source",
44
+ "type": "string",
45
+ "title": "The Source String",
46
+ "default": "",
47
+ "examples": [
48
+ "Hello"
49
+ ],
50
+ "pattern": "^(.+)$"
51
+ },
52
+ "target": {
53
+ "$id": "#/items/properties/target",
54
+ "type": "string",
55
+ "title": "The Target String",
56
+ "default": "",
57
+ "examples": [
58
+ "Ahoj"
59
+ ],
60
+ "pattern": "^(.+)$"
61
+ },
62
+ "origin": {
63
+ "$id": "#/items/properties/origin",
64
+ "type": "string",
65
+ "title": "The String Origin",
66
+ "description": "Filename or component name",
67
+ "default": "",
68
+ "examples": [
69
+ "test"
70
+ ],
71
+ "pattern": "^(.*)$"
72
+ },
73
+ "category": {
74
+ "$id": "#/items/properties/category",
75
+ "type": "integer",
76
+ "title": "The String Category",
77
+ "description": "1 is global, 2 is shared, 10000000+ are project specific, 20000000+ are user specific",
78
+ "default": 1,
79
+ "minimum": 0,
80
+ "examples": [
81
+ 1
82
+ ]
83
+ }
84
+ },
85
+ "additionalProperties": false
86
+ }
87
+ }
@@ -0,0 +1,35 @@
1
+ # -*- coding: utf-8 -*-
2
+ #
3
+ # Copyright © 2012 - 2020 Michal Čihař <michal@cihar.com>
4
+ #
5
+ # This file is part of Weblate weblate_schemas
6
+ # <https://github.com/WeblateOrg/weblate_schemas>
7
+ #
8
+ # This program is free software: you can redistribute it and/or modify
9
+ # it under the terms of the GNU General Public License as published by
10
+ # the Free Software Foundation, either version 3 of the License, or
11
+ # (at your option) any later version.
12
+ #
13
+ # This program is distributed in the hope that it will be useful,
14
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
+ # GNU General Public License for more details.
17
+ #
18
+ # You should have received a copy of the GNU General Public License
19
+ # along with this program. If not, see <https://www.gnu.org/licenses/>.
20
+ #
21
+ """Test schemas loader."""
22
+
23
+ from weblate_schemas import get_path, load_schema
24
+
25
+
26
+ def test_filename():
27
+ """Test filename calculation."""
28
+ filename = get_path("weblate-memory.jsonschema")
29
+ assert "weblate-memory.jsonschema" in filename.parts
30
+
31
+
32
+ def test_load():
33
+ """Test schema loading."""
34
+ schema = load_schema("weblate-memory.jsonschema")
35
+ assert isinstance(schema, dict)
@@ -0,0 +1,30 @@
1
+ # -*- coding: utf-8 -*-
2
+ #
3
+ # Copyright © 2012 - 2020 Michal Čihař <michal@cihar.com>
4
+ #
5
+ # This file is part of Weblate weblate_schemas
6
+ # <https://github.com/WeblateOrg/weblate_schemas>
7
+ #
8
+ # This program is free software: you can redistribute it and/or modify
9
+ # it under the terms of the GNU General Public License as published by
10
+ # the Free Software Foundation, either version 3 of the License, or
11
+ # (at your option) any later version.
12
+ #
13
+ # This program is distributed in the hope that it will be useful,
14
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
+ # GNU General Public License for more details.
17
+ #
18
+ # You should have received a copy of the GNU General Public License
19
+ # along with this program. If not, see <https://www.gnu.org/licenses/>.
20
+ #
21
+ """Test schemas are valid."""
22
+
23
+ from jsonschema import validate
24
+
25
+ from weblate_schemas import load_schema
26
+
27
+
28
+ def test_memory():
29
+ """Test memory schema being valid."""
30
+ validate([], load_schema("weblate-memory.jsonschema"))
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2020 Weblate
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,73 @@
1
+ Metadata-Version: 2.1
2
+ Name: weblate-schemas
3
+ Version: 0.2
4
+ Summary: A collection of schemas used by Weblate
5
+ Home-page: https://weblate.org/
6
+ Author: Michal Čihař
7
+ Author-email: michal@cihar.com
8
+ License: GPLv3+
9
+ Download-URL: https://github.com/WeblateOrg/weblate_schemas
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
+ Keywords: i18n l10n gettext translate weblate
15
+ Platform: any
16
+ Classifier: Development Status :: 5 - Production/Stable
17
+ Classifier: Intended Audience :: Developers
18
+ Classifier: License :: OSI Approved :: MIT License
19
+ Classifier: Operating System :: OS Independent
20
+ Classifier: Programming Language :: Python
21
+ Classifier: Programming Language :: Python :: 3
22
+ Classifier: Programming Language :: Python :: 3.5
23
+ Classifier: Programming Language :: Python :: 3.6
24
+ Classifier: Programming Language :: Python :: 3.7
25
+ Classifier: Programming Language :: Python :: 3.8
26
+ Classifier: Topic :: Software Development :: Internationalization
27
+ Classifier: Topic :: Software Development :: Localization
28
+ Classifier: Topic :: Utilities
29
+ Description-Content-Type: text/x-rst
30
+ Requires-Dist: jsonschema
31
+
32
+ .. image:: https://s.weblate.org/cdn/Logo-Darktext-borders.png
33
+ :alt: Weblate
34
+ :target: https://weblate.org/
35
+ :height: 80px
36
+
37
+ **Weblate is a copylefted libre software web-based continuous localization system,
38
+ used by over 1150 libre projects and companies in more than 115 countries.**
39
+
40
+ This module contains schemas used in Weblate exports.
41
+
42
+ .. image:: https://img.shields.io/badge/website-weblate.org-blue.svg
43
+ :alt: Website
44
+ :target: https://weblate.org/
45
+
46
+ .. image:: https://hosted.weblate.org/widgets/weblate/-/svg-badge.svg
47
+ :alt: Translation status
48
+ :target: https://hosted.weblate.org/engage/weblate/?utm_source=widget
49
+
50
+ .. image:: https://bestpractices.coreinfrastructure.org/projects/552/badge
51
+ :alt: CII Best Practices
52
+ :target: https://bestpractices.coreinfrastructure.org/projects/552
53
+
54
+ .. image:: https://img.shields.io/pypi/v/weblate_schemas.svg
55
+ :target: https://pypi.org/project/weblate_schemas/
56
+ :alt: PyPI package
57
+
58
+ .. image:: https://img.shields.io/readthedocs/weblate.svg
59
+ :alt: Documentation
60
+ :target: https://docs.weblate.org/en/latest/schemas.html
61
+
62
+ Installation
63
+ ------------
64
+
65
+ Install using pip:
66
+
67
+ .. code-block:: sh
68
+
69
+ pip3 install weblate_schemas
70
+
71
+ Sources are available at <https://github.com/WeblateOrg/weblate_schemas>.
72
+
73
+
@@ -0,0 +1,9 @@
1
+ weblate_schemas/__init__.py,sha256=MAvQ27GqkemVemWokLticLfYCVcD7FTnSXXNvPSfq44,1219
2
+ weblate_schemas/test_loader.py,sha256=8MPRzDL8YH7nC9jz7h8qWl99px9SKhemfh6bqYb7I9s,1213
3
+ weblate_schemas/test_valid.py,sha256=bAnJksvhbblu5NDhIqBxYo7XFDXOSoN5Ljoy5AvTKq0,1051
4
+ weblate_schemas/schemas/weblate-memory.jsonschema,sha256=DmimSb2-UgCZ8TKVF6OZosRgPVhC-MquVHSXx2UVRRE,2263
5
+ weblate_schemas-0.2.dist-info/LICENSE,sha256=3-S3J_4gSoFMNx_XF7Upp2xPqd9RJhxnFVAXRTsbtaM,1064
6
+ weblate_schemas-0.2.dist-info/METADATA,sha256=z2oDoQwrlZ6FnxonE5l2Hrt3URpskeMYYHfVtT_LahQ,2576
7
+ weblate_schemas-0.2.dist-info/WHEEL,sha256=g4nMs7d-Xl9-xC9XovUrsDHGXt-FT0E17Yqo92DEfvY,92
8
+ weblate_schemas-0.2.dist-info/top_level.txt,sha256=ODeWWba5cU1lrbN8rG9xjn-MEH0H1h17As3YtEANiDQ,16
9
+ weblate_schemas-0.2.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: bdist_wheel (0.34.2)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1 @@
1
+ weblate_schemas