pyi18t-tools 0.6.0__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.
Files changed (32) hide show
  1. pyi18t_tools-0.6.0/.gitignore +123 -0
  2. pyi18t_tools-0.6.0/LICENCE.md +12 -0
  3. pyi18t_tools-0.6.0/LICENSE.md +12 -0
  4. pyi18t_tools-0.6.0/PKG-INFO +109 -0
  5. pyi18t_tools-0.6.0/README.md +79 -0
  6. pyi18t_tools-0.6.0/pyproject.toml +165 -0
  7. pyi18t_tools-0.6.0/src/i18n_tools/__init__.py +60 -0
  8. pyi18t_tools-0.6.0/src/i18n_tools/__static__.py +82 -0
  9. pyi18t_tools-0.6.0/src/i18n_tools/api.py +81 -0
  10. pyi18t_tools-0.6.0/src/i18n_tools/config.py +937 -0
  11. pyi18t_tools-0.6.0/src/i18n_tools/converter.py +1318 -0
  12. pyi18t_tools-0.6.0/src/i18n_tools/core.py +11 -0
  13. pyi18t_tools-0.6.0/src/i18n_tools/exceptions.py +51 -0
  14. pyi18t_tools-0.6.0/src/i18n_tools/fallback.py +11 -0
  15. pyi18t_tools-0.6.0/src/i18n_tools/formatter.py +23 -0
  16. pyi18t_tools-0.6.0/src/i18n_tools/loaders/__init__.py +80 -0
  17. pyi18t_tools-0.6.0/src/i18n_tools/loaders/handler.py +908 -0
  18. pyi18t_tools-0.6.0/src/i18n_tools/loaders/loader.py +804 -0
  19. pyi18t_tools-0.6.0/src/i18n_tools/loaders/utils.py +616 -0
  20. pyi18t_tools-0.6.0/src/i18n_tools/locale.py +106 -0
  21. pyi18t_tools-0.6.0/src/i18n_tools/locales/_i18n_tools/i18n_tools.json +0 -0
  22. pyi18t_tools-0.6.0/src/i18n_tools/locales/_i18n_tools/i18n_tools.toml +0 -0
  23. pyi18t_tools-0.6.0/src/i18n_tools/locales/_i18n_tools/i18n_tools.yaml +0 -0
  24. pyi18t_tools-0.6.0/src/i18n_tools/locales/api.json +0 -0
  25. pyi18t_tools-0.6.0/src/i18n_tools/locales/config.json +0 -0
  26. pyi18t_tools-0.6.0/src/i18n_tools/models/__init__.py +58 -0
  27. pyi18t_tools-0.6.0/src/i18n_tools/models/author.py +161 -0
  28. pyi18t_tools-0.6.0/src/i18n_tools/models/corpus.py +2517 -0
  29. pyi18t_tools-0.6.0/src/i18n_tools/models/repository.py +739 -0
  30. pyi18t_tools-0.6.0/src/i18n_tools/models/translator.py +285 -0
  31. pyi18t_tools-0.6.0/src/i18n_tools/patterns.py +31 -0
  32. pyi18t_tools-0.6.0/src/i18n_tools/sync.py +77 -0
@@ -0,0 +1,123 @@
1
+ # Django #
2
+ *.log
3
+ #*.pot
4
+ *.pyc
5
+ __pycache__
6
+ db.sqlite3
7
+ media
8
+
9
+ # Backup files #
10
+ *.bak
11
+
12
+ # If you are using PyCharm #
13
+ .idea/**/workspace.xml
14
+ .idea/**/tasks.xml
15
+ .idea/dictionaries
16
+ .idea/**/dataSources/
17
+ .idea/**/dataSources.ids
18
+ .idea/**/dataSources.xml
19
+ .idea/**/dataSources.local.xml
20
+ .idea/**/sqlDataSources.xml
21
+ .idea/**/dynamic.xml
22
+ .idea/**/uiDesigner.xml
23
+ .idea/**/gradle.xml
24
+ .idea/**/libraries
25
+ *.iws /out/
26
+
27
+ # Python #
28
+ *.py[cod]
29
+ *$py.class
30
+
31
+ # Distribution / packaging
32
+ .Python build/
33
+ develop-eggs/
34
+ dist/
35
+ downloads/
36
+ eggs/
37
+ .eggs/
38
+ lib/
39
+ lib64/
40
+ parts/
41
+ sdist/
42
+ var/
43
+ wheels/
44
+ *.egg-info/
45
+ .installed.cfg
46
+ *.egg
47
+ *.manifest
48
+ *.spec
49
+
50
+ # Installer logs
51
+ pip-log.txt
52
+ pip-delete-this-directory.txt
53
+
54
+ # Unit test / coverage reports
55
+ htmlcov/
56
+ .tox/
57
+ .coverage
58
+ .coverage.*
59
+ .cache
60
+ .pytest_cache/
61
+ nosetests.xml
62
+ coverage.xml
63
+ *.cover
64
+ .hypothesis/
65
+ tests/coverage/
66
+ coverage/
67
+
68
+
69
+ # Jupyter Notebook
70
+ .ipynb_checkpoints
71
+
72
+ # pyenv
73
+ .python-version
74
+
75
+ # celery
76
+ celerybeat-schedule.*
77
+
78
+ # SageMath parsed files
79
+ *.sage.py
80
+
81
+ # Environments
82
+ .env
83
+ .venv
84
+ env/
85
+ venv/
86
+ ENV/
87
+ env.bak/
88
+ venv.bak/
89
+
90
+ # mkdocs documentation
91
+ /site
92
+
93
+ # mypy
94
+ .mypy_cache/
95
+
96
+ # Sublime Text #
97
+ *.tmlanguage.cache
98
+ *.tmPreferences.cache
99
+ *.stTheme.cache
100
+ *.sublime-workspace
101
+ *.sublime-project
102
+
103
+ # sftp configuration file
104
+ sftp-config.json
105
+
106
+ # Package control specific files Package
107
+ Control.last-run
108
+ Control.ca-list
109
+ Control.ca-bundle
110
+ Control.system-ca-bundle
111
+ GitHub.sublime-settings
112
+
113
+ # Visual Studio Code #
114
+ .vscode/*
115
+ !.vscode/settings.json
116
+ !.vscode/tasks.json
117
+ !.vscode/launch.json
118
+ !.vscode/extensions.json
119
+ .history
120
+
121
+ # Dia autosave
122
+
123
+ *.autosave
@@ -0,0 +1,12 @@
1
+ Licence CeCILL-C
2
+
3
+ **[English version](LICENSE.md)**
4
+
5
+ ---
6
+
7
+ Ce module python permet de gérer la traduction d'applications via un format de fichiers de traduction propre,
8
+ conçu pour coexister avec les standards existants comme gettext (`.po`/`.mo`) et i18next. Ce module est développé
9
+ sous la licence [CeCILL-C](http://www.cecill.info/licences/Licence_CeCILL-C_V1-fr.html).
10
+
11
+ Cette licence n'est pas contaminante pour les autres modules si vous vous en servez. Cependant, si vous y
12
+ apportez des modifications, vous devrez le soumettre au préalable ce qui permettra de l'améliorer.
@@ -0,0 +1,12 @@
1
+ CeCILL-C License
2
+
3
+ **[Version française](LICENCE.md)**
4
+
5
+ ---
6
+
7
+ This python module manages application translations through a dedicated translation file format, designed to
8
+ coexist with existing standards such as gettext (`.po`/`.mo`) and i18next. This module has been developed under
9
+ the [CeCILL-C](http://www.cecill.info/licences/Licence_CeCILL-C_V1-en.html) license.
10
+
11
+ This license does not contaminate other modules if you use this one. However, if you
12
+ make any modifications to it, you'll need to submit them beforehand, which will enable us to improve it.
@@ -0,0 +1,109 @@
1
+ Metadata-Version: 2.4
2
+ Name: pyi18t-tools
3
+ Version: 0.6.0
4
+ Summary: Toolbox to manage localized messages with json and gettext functions.
5
+ Project-URL: Homepage, https://github.com/biface/i18n
6
+ Project-URL: Repository, https://github.com/biface/i18n.git
7
+ Project-URL: Issues, https://github.com/biface/i18n/issues
8
+ Author: biface
9
+ License-File: LICENCE.md
10
+ License-File: LICENSE.md
11
+ Classifier: Development Status :: 2 - Pre-Alpha
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: License :: CeCILL-C Free Software License Agreement (CECILL-C)
14
+ Classifier: Operating System :: OS Independent
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Topic :: Utilities
17
+ Requires-Python: >=3.10
18
+ Requires-Dist: babel
19
+ Requires-Dist: email-validator
20
+ Requires-Dist: langcodes
21
+ Requires-Dist: ndict-tools>=1.2.0
22
+ Requires-Dist: pyyaml
23
+ Requires-Dist: requests
24
+ Requires-Dist: toml
25
+ Requires-Dist: validators
26
+ Provides-Extra: test
27
+ Requires-Dist: pytest; extra == 'test'
28
+ Requires-Dist: pytest-cov; extra == 'test'
29
+ Description-Content-Type: text/markdown
30
+
31
+ ![Python](https://img.shields.io/badge/Language-python-green.svg)
32
+ ![Codecov](https://img.shields.io/codecov/c/github/biface/i18n)
33
+
34
+ --------------
35
+ # i18n-tools
36
+
37
+ **[Version française](README.fr.md)** (lecteur français et francophones)
38
+
39
+ ---
40
+
41
+ ## English reader and ROW
42
+
43
+ ### Description
44
+
45
+ The **i18n-tools** project aims to simplify and modernize translation management in Python applications. It introduces a **new flexible translation file format**, independent of any dominant language, designed to coexist with existing standards such as **gettext** (`.po`/`.mo` files) and **i18next**.
46
+
47
+ The goal is to provide a **modular**, **adaptable**, and **language-agnostic** solution, with native support for **translation variants**, **multiple plurals**, and transparent language fallback management.
48
+
49
+ ---
50
+
51
+ ### Roadmap
52
+
53
+ The project follows a progression by deliverable value. Each version is independently usable.
54
+
55
+ | Milestone | Description | Status |
56
+ |-------------|----------------------------------------------------------------------------------------------|----------------|
57
+ | **v0.1.x** | Foundational cleanup — fix blocking bugs | ✅ Delivered |
58
+ | **v0.2.x** | Loaders ↔ models bridge — `Book.load()`, `.i18t` extension, partial `Config → Repository` | ✅ Delivered |
59
+ | **v0.3.x** | Complete model hierarchy — `Corpus`, `FallbackBook`, `Encyclopaedia`, exceptions | ✅ Delivered |
60
+ | **v0.4.x** | Quality and coverage — error handling, circular imports, Sphinx/Furo init | ✅ Delivered |
61
+ | **v0.5.0** | Architecture & layering hardening — DD-06 boundary sealed, `Config → Repository` completed | ✅ Delivered |
62
+ | **v0.6.x** | CI/CD & repository hygiene — `uv`/`tox-uv`, `basedpyright`, `.codecov.yml` | 🔶 In progress |
63
+ | **v0.7.x** | Test coverage — ≥ 80% enforced across the package | 🔵 Planned |
64
+ | **v0.8.0** | Orchestration — `core.py` high-level entry point, `fallback.py` language chain resolution | 🔵 Planned |
65
+ | **v0.9.0** | Formatting & CLI — `formatter.py` complete with `PluralRule`, CLI/REPL | 🔵 Planned |
66
+ | **v0.10.0** | Module architecture and main object components review | 🔵 Planned |
67
+ | **v1.0.0** | Freeze & verification — `.i18t` format frozen, public API frozen, full Sphinx docs published | 🔵 Planned |
68
+ | **v1.x** | gettext interoperability — `.po`/`.mo` import/export via Babel | 🔵 Horizon |
69
+ | **v2.x** | Third-party formats — i18next and others, central conversion hub | 🔵 Horizon |
70
+ | **v3.x** | Complete CLI, stable API, Rust/JavaScript ports | 🔵 Horizon |
71
+
72
+ ---
73
+
74
+ ### Features
75
+
76
+ | Feature | v0.2.x | v0.9.0 | v1.0.0 | v1.x | v2.x |
77
+ |---------------------------------------------|--------|--------|--------|------|------|
78
+ | Native `.i18t` format (JSON/YAML) | ✅ | ✅ | ✅ | ✅ | ✅ |
79
+ | Language-neutral identifiers | ✅ | ✅ | ✅ | ✅ | ✅ |
80
+ | Variants and multiple plurals | ✅ | ✅ | ✅ | ✅ | ✅ |
81
+ | Load a `Book` from `.i18t` | ✅ | ✅ | ✅ | ✅ | ✅ |
82
+ | Save a `Book` to `.i18t` | ✅ | ✅ | ✅ | ✅ | ✅ |
83
+ | Complete hierarchy (Corpus, Encyclopaedia) | ✅ | ✅ | ✅ | ✅ | ✅ |
84
+ | Language fallback management | ✅ | ✅ | ✅ | ✅ | ✅ |
85
+ | Interpolation and active plural rules | ❌ | ✅ | ✅ | ✅ | ✅ |
86
+ | CLI/REPL interface | ❌ | ✅ | ✅ | ✅ | ✅ |
87
+ | `.po`/`.mo` import/export (Babel/gettext) | ❌ | ❌ | ❌ | ✅ | ✅ |
88
+ | i18next conversion | ❌ | ❌ | ❌ | ❌ | ✅ |
89
+
90
+ ---
91
+
92
+ ### Why This Project?
93
+
94
+ - **Flexibility**: a format designed to adapt to all translation needs, without linguistic constraints — no language is dominant.
95
+ - **Expressiveness**: native support for contextual variants (gender, register, context) and business plurals beyond CLDR rules.
96
+ - **Extensibility**: layered architecture enabling conversion to existing standards (gettext, i18next) without modifying the models.
97
+ - **Interoperability**: bridge with the Babel ecosystem for progressive compatibility with existing tools.
98
+
99
+ ---
100
+
101
+ ### License
102
+
103
+ See the [license.md](LICENSE.md) file.
104
+
105
+ ---
106
+
107
+ ### Contact
108
+
109
+ For any questions or contributions, open a [GitHub issue](https://github.com/biface/i18n/issues).
@@ -0,0 +1,79 @@
1
+ ![Python](https://img.shields.io/badge/Language-python-green.svg)
2
+ ![Codecov](https://img.shields.io/codecov/c/github/biface/i18n)
3
+
4
+ --------------
5
+ # i18n-tools
6
+
7
+ **[Version française](README.fr.md)** (lecteur français et francophones)
8
+
9
+ ---
10
+
11
+ ## English reader and ROW
12
+
13
+ ### Description
14
+
15
+ The **i18n-tools** project aims to simplify and modernize translation management in Python applications. It introduces a **new flexible translation file format**, independent of any dominant language, designed to coexist with existing standards such as **gettext** (`.po`/`.mo` files) and **i18next**.
16
+
17
+ The goal is to provide a **modular**, **adaptable**, and **language-agnostic** solution, with native support for **translation variants**, **multiple plurals**, and transparent language fallback management.
18
+
19
+ ---
20
+
21
+ ### Roadmap
22
+
23
+ The project follows a progression by deliverable value. Each version is independently usable.
24
+
25
+ | Milestone | Description | Status |
26
+ |-------------|----------------------------------------------------------------------------------------------|----------------|
27
+ | **v0.1.x** | Foundational cleanup — fix blocking bugs | ✅ Delivered |
28
+ | **v0.2.x** | Loaders ↔ models bridge — `Book.load()`, `.i18t` extension, partial `Config → Repository` | ✅ Delivered |
29
+ | **v0.3.x** | Complete model hierarchy — `Corpus`, `FallbackBook`, `Encyclopaedia`, exceptions | ✅ Delivered |
30
+ | **v0.4.x** | Quality and coverage — error handling, circular imports, Sphinx/Furo init | ✅ Delivered |
31
+ | **v0.5.0** | Architecture & layering hardening — DD-06 boundary sealed, `Config → Repository` completed | ✅ Delivered |
32
+ | **v0.6.x** | CI/CD & repository hygiene — `uv`/`tox-uv`, `basedpyright`, `.codecov.yml` | 🔶 In progress |
33
+ | **v0.7.x** | Test coverage — ≥ 80% enforced across the package | 🔵 Planned |
34
+ | **v0.8.0** | Orchestration — `core.py` high-level entry point, `fallback.py` language chain resolution | 🔵 Planned |
35
+ | **v0.9.0** | Formatting & CLI — `formatter.py` complete with `PluralRule`, CLI/REPL | 🔵 Planned |
36
+ | **v0.10.0** | Module architecture and main object components review | 🔵 Planned |
37
+ | **v1.0.0** | Freeze & verification — `.i18t` format frozen, public API frozen, full Sphinx docs published | 🔵 Planned |
38
+ | **v1.x** | gettext interoperability — `.po`/`.mo` import/export via Babel | 🔵 Horizon |
39
+ | **v2.x** | Third-party formats — i18next and others, central conversion hub | 🔵 Horizon |
40
+ | **v3.x** | Complete CLI, stable API, Rust/JavaScript ports | 🔵 Horizon |
41
+
42
+ ---
43
+
44
+ ### Features
45
+
46
+ | Feature | v0.2.x | v0.9.0 | v1.0.0 | v1.x | v2.x |
47
+ |---------------------------------------------|--------|--------|--------|------|------|
48
+ | Native `.i18t` format (JSON/YAML) | ✅ | ✅ | ✅ | ✅ | ✅ |
49
+ | Language-neutral identifiers | ✅ | ✅ | ✅ | ✅ | ✅ |
50
+ | Variants and multiple plurals | ✅ | ✅ | ✅ | ✅ | ✅ |
51
+ | Load a `Book` from `.i18t` | ✅ | ✅ | ✅ | ✅ | ✅ |
52
+ | Save a `Book` to `.i18t` | ✅ | ✅ | ✅ | ✅ | ✅ |
53
+ | Complete hierarchy (Corpus, Encyclopaedia) | ✅ | ✅ | ✅ | ✅ | ✅ |
54
+ | Language fallback management | ✅ | ✅ | ✅ | ✅ | ✅ |
55
+ | Interpolation and active plural rules | ❌ | ✅ | ✅ | ✅ | ✅ |
56
+ | CLI/REPL interface | ❌ | ✅ | ✅ | ✅ | ✅ |
57
+ | `.po`/`.mo` import/export (Babel/gettext) | ❌ | ❌ | ❌ | ✅ | ✅ |
58
+ | i18next conversion | ❌ | ❌ | ❌ | ❌ | ✅ |
59
+
60
+ ---
61
+
62
+ ### Why This Project?
63
+
64
+ - **Flexibility**: a format designed to adapt to all translation needs, without linguistic constraints — no language is dominant.
65
+ - **Expressiveness**: native support for contextual variants (gender, register, context) and business plurals beyond CLDR rules.
66
+ - **Extensibility**: layered architecture enabling conversion to existing standards (gettext, i18next) without modifying the models.
67
+ - **Interoperability**: bridge with the Babel ecosystem for progressive compatibility with existing tools.
68
+
69
+ ---
70
+
71
+ ### License
72
+
73
+ See the [license.md](LICENSE.md) file.
74
+
75
+ ---
76
+
77
+ ### Contact
78
+
79
+ For any questions or contributions, open a [GitHub issue](https://github.com/biface/i18n/issues).
@@ -0,0 +1,165 @@
1
+ # =============================================================================
2
+ # pyproject.toml — i18n-tools
3
+ # =============================================================================
4
+ # Build system, project metadata, runtime dependencies, optional extras,
5
+ # and development dependency groups (PEP 735, managed by uv).
6
+ #
7
+ # Tool configuration (flake8, isort, pytest) is also consolidated here.
8
+ # tox configuration lives in tox.ini (phase 1); merge planned for a later
9
+ # cycle once the CI pipeline is stable.
10
+ #
11
+ # Dependency groups:
12
+ # uv sync --group dev — full development toolchain (tox, quality, tests)
13
+ # uv sync --group docs — Sphinx documentation build only
14
+ # =============================================================================
15
+
16
+ # -----------------------------------------------------------------------------
17
+ # Build system
18
+ # -----------------------------------------------------------------------------
19
+ [build-system]
20
+ requires = ["hatchling"]
21
+ build-backend = "hatchling.build"
22
+
23
+ # Explicit package location — required since [project].name
24
+ # ("pyi18t-tools") no longer matches the src/ folder name
25
+ # ("i18n_tools"). hatchling's default src-layout auto-detection derives
26
+ # the expected folder from the project name; without this override it
27
+ # would look for src/pyi18t_tools/ and find nothing. The importable
28
+ # module stays `i18n_tools` regardless of the PyPI distribution name —
29
+ # no code changes needed anywhere else.
30
+ [tool.hatch.build.targets.wheel]
31
+ packages = ["src/i18n_tools"]
32
+
33
+ [tool.hatch.build.targets.sdist]
34
+ include = [
35
+ "src/i18n_tools",
36
+ ]
37
+
38
+ # -----------------------------------------------------------------------------
39
+ # Project metadata
40
+ # -----------------------------------------------------------------------------
41
+ [project]
42
+ # Distribution name on PyPI/TestPyPI — "i18n-tools" was rejected by
43
+ # TestPyPI ("too similar to an existing project", likely RF-i18n-tool,
44
+ # one character away after normalization). "pyi18t-tools" ties to the
45
+ # project's own .i18t format (DD-10) rather than a personal name, and
46
+ # adds enough edit distance from the crowded i18n-tool(s)/i18tool
47
+ # namespace to be safe (no exact or near match found on PyPI at the
48
+ # time of writing — final confirmation only comes from the actual
49
+ # upload, PyPI's similarity check is not publicly documented).
50
+ # The importable package remains `i18n_tools` (src/i18n_tools/) —
51
+ # `pip install pyi18t-tools` + `import i18n_tools`, unchanged.
52
+ name = "pyi18t-tools"
53
+ version = "0.6.0"
54
+ authors = [
55
+ { name = "biface" },
56
+ ]
57
+ description = "Toolbox to manage localized messages with json and gettext functions."
58
+ readme = "README.md"
59
+ requires-python = ">=3.10"
60
+ classifiers = [
61
+ "Development Status :: 2 - Pre-Alpha",
62
+ "Intended Audience :: Developers",
63
+ "License :: CeCILL-C Free Software License Agreement (CECILL-C)",
64
+ "Programming Language :: Python :: 3",
65
+ "Operating System :: OS Independent",
66
+ "Topic :: Utilities",
67
+ ]
68
+
69
+ # -----------------------------------------------------------------------------
70
+ # Runtime dependencies — required by any consumer of the package
71
+ # -----------------------------------------------------------------------------
72
+ dependencies = [
73
+ "ndict-tools>=1.2.0",
74
+ "babel",
75
+ "langcodes", # IETF tag normalisation — locale.py (DD-14)
76
+ "email-validator", # email validation — config.py
77
+ "toml", # .toml file loading — loaders/utils.py
78
+ "PyYAML", # .yaml / .i18t file loading — loaders/utils.py
79
+ "requests", # HTTP calls — api.py (validate_api_url)
80
+ "validators", # URL syntax check — api.py (validate_url_format, DD-37)
81
+ ]
82
+
83
+ # -----------------------------------------------------------------------------
84
+ # Project URLs
85
+ # -----------------------------------------------------------------------------
86
+ [project.urls]
87
+ Homepage = "https://github.com/biface/i18n"
88
+ Repository = "https://github.com/biface/i18n.git"
89
+ Issues = "https://github.com/biface/i18n/issues"
90
+
91
+ # -----------------------------------------------------------------------------
92
+ # Optional extras — for consumers who want to run the test suite
93
+ # without the full development toolchain
94
+ # -----------------------------------------------------------------------------
95
+ [project.optional-dependencies]
96
+ test = [
97
+ "pytest",
98
+ "pytest-cov",
99
+ ]
100
+
101
+ # -----------------------------------------------------------------------------
102
+ # Development dependency groups (PEP 735) — managed exclusively by uv
103
+ # Not installed when a user does `pip install pyi18t-tools`
104
+ #
105
+ # Usage:
106
+ # uv sync --group dev → installs tox, quality tools, test runners
107
+ # uv sync --group docs → installs Sphinx and theme
108
+ # uv sync --group dev --group docs → both at once
109
+ # -----------------------------------------------------------------------------
110
+ [dependency-groups]
111
+ dev = [
112
+ # tox orchestration
113
+ "tox>=4.0",
114
+ "tox-uv",
115
+ # test runners
116
+ "pytest",
117
+ "pytest-cov",
118
+ # quality — static analysis
119
+ "basedpyright",
120
+ # quality — linting and formatting
121
+ "flake8",
122
+ "black",
123
+ "isort",
124
+ # quality — security
125
+ "bandit",
126
+ ]
127
+ docs = [
128
+ "Sphinx",
129
+ "furo",
130
+ ]
131
+
132
+ # -----------------------------------------------------------------------------
133
+ # Tool configuration
134
+ # -----------------------------------------------------------------------------
135
+
136
+ [tool.basedpyright]
137
+ pythonVersion = "3.10"
138
+ pythonPlatform = "Linux"
139
+ stubPath = "stubs"
140
+ reportMissingTypeStubs = false
141
+ reportUnknownVariableType = false
142
+ reportUnknownMemberType = false
143
+ reportUnknownArgumentType = false
144
+ reportUnknownParameterType = false
145
+ reportAny = false
146
+ reportImportCycles = false
147
+
148
+ [tool.flake8]
149
+ max-line-length = 88
150
+ ignore = ["E501"]
151
+ extend-ignore = ["E203", "W503"]
152
+ exclude = [".tox", ".git", "__pycache__", "build", "dist"]
153
+
154
+ [tool.isort]
155
+ profile = "black"
156
+ line_length = 88
157
+ known_first_party = "i18n_tools"
158
+ multi_line_output = 3
159
+ include_trailing_comma = true
160
+
161
+ [tool.pytest.ini_options]
162
+ markers = [
163
+ "network: mark test as requiring real network access (deactivated on dev branches)",
164
+ "timeout: mark test as making slow HTTP calls (excluded from CI)",
165
+ ]
@@ -0,0 +1,60 @@
1
+ """
2
+ i18n-tools main package
3
+ =======================
4
+
5
+ **License:**
6
+ This file is distributed under the terms of the `CeCILL-C Free Software License Agreement
7
+ <https://cecill.info/licences/Licence_CeCILL-C_V1-en.html>`_. By using, modifying, or
8
+ redistributing this file, you agree to comply with the terms of this license.
9
+
10
+ **Author(s):**
11
+ This module is authored and maintained as part of the i18n-tools package.
12
+
13
+ References
14
+ ----------
15
+ - biface/i18n#48 : public API __init__.py (DD-21, DD-22, DD-23)
16
+ """
17
+
18
+ from i18n_tools.__static__ import (
19
+ I18N_TOOLS_CONFIG,
20
+ I18N_TOOLS_LOCALE,
21
+ I18N_TOOLS_MODULE_NAME,
22
+ I18N_TOOLS_ROOT_NAME,
23
+ I18N_TOOLS_TRANSLATION_FILE_EXT,
24
+ __version__,
25
+ )
26
+
27
+ __all__ = [
28
+ # Models
29
+ "Message",
30
+ "Book",
31
+ "Corpus",
32
+ "FallbackBook",
33
+ "Encyclopaedia",
34
+ # Configuration
35
+ "Repository",
36
+ "Config",
37
+ # Constants
38
+ "I18N_TOOLS_CONFIG",
39
+ "I18N_TOOLS_LOCALE",
40
+ "I18N_TOOLS_MODULE_NAME",
41
+ "I18N_TOOLS_ROOT_NAME",
42
+ "I18N_TOOLS_TRANSLATION_FILE_EXT",
43
+ # Version
44
+ "__version__",
45
+ ]
46
+
47
+ from i18n_tools.config import Config # noqa: E402
48
+ from i18n_tools.models import ( # noqa: E402
49
+ Book,
50
+ Corpus,
51
+ Encyclopaedia,
52
+ FallbackBook,
53
+ Message,
54
+ )
55
+ from i18n_tools.models.repository import Repository # noqa: E402
56
+
57
+ # Models, Repository, and Config can now be imported in any order: __version__
58
+ # and the other shared constants live in __static__.py, which internal modules
59
+ # import directly, without going through this file. The former import-order
60
+ # constraint (biface/i18n#47) no longer applies.
@@ -0,0 +1,82 @@
1
+ """
2
+ Static and global variables module
3
+ ==================================
4
+
5
+ """
6
+
7
+ import os
8
+ from pathlib import Path
9
+ from typing import Literal
10
+
11
+ __version__ = "0.6.0"
12
+ """
13
+ This variable stores the package version. It lives here (rather than in
14
+ ``__init__.py``) so that internal modules can depend on it without creating
15
+ a circular import back through the package root. Internal consumers should
16
+ import this module (``from i18n_tools import __static__``) and read
17
+ ``__static__.__version__`` rather than copy-importing the name, so that an
18
+ override made after import time (``i18n_tools.__static__.__version__ = ...``)
19
+ remains visible everywhere consistently.
20
+ """
21
+
22
+ I18N_TRANSLATION_FORMAT = {"json", "yaml"}
23
+ """
24
+ This format defines the set of standard storage files for translations
25
+ """
26
+ TranslationFileFormat = Literal["json", "yaml"]
27
+ """
28
+ This format defines a generic type for standard storage files for translations
29
+ """
30
+ I18N_TOOLS_EXT_SET = ("i18t", "itl")
31
+ """
32
+ This variable stores dedicated translation file extensions for i18n-tools
33
+ """
34
+ I18N_TOOLS_TRANSLATION_FILE_EXT = "i18t"
35
+ """
36
+ This variable is used to store the default 4 letters translation file extension. Since the file format could be
37
+ either JSON or YAML, translation file will be _domain.[json|yaml].i18n_
38
+ """
39
+ I18N_TOOLS_LOCALE = "locales"
40
+ """
41
+ This variable is used to store the name of the locale directory as the translation repository root in the project.
42
+ """
43
+ I18N_TOOLS_MESSAGES = "LC_MESSAGES"
44
+ """
45
+ This variable is used to store the name of the locale directory container of translation domains in the project.
46
+ """
47
+ I18N_TOOLS_BACKUP = "backup"
48
+ """
49
+ This variable is used to store the name of the backup directory in the project under the config directory.
50
+ """
51
+ I18N_TOOLS_TEMPLATE = "templates"
52
+ """
53
+ This variable is used to store the name of the template directory in the project under the config directory. This is
54
+ mainly used with i18n translation model.
55
+ """
56
+ I18N_TOOLS_CONFIG = "_i18n_tools"
57
+ """
58
+ This variable is used to store the name of the config directory in the project.
59
+ """
60
+
61
+ I18N_TOOLS_ROOT = Path(__file__).resolve().parent
62
+ """
63
+ This variable is used to store the absolute path of the root directory of the i18n-tools package.
64
+ """
65
+ I18N_TOOLS_MODULE_NAME = os.path.basename(I18N_TOOLS_ROOT)
66
+ """
67
+ This variable is used to store the name of the i18n-tools package.
68
+ """
69
+ I18N_TOOLS_ROOT_NAME = os.path.dirname(I18N_TOOLS_ROOT)
70
+ """
71
+ This variable is used to store the name of the parent directory of the i18n-tools package.
72
+ """
73
+ I18N_TOOLS_CONFIG_DIR = str(
74
+ Path(__file__).resolve().parent / I18N_TOOLS_LOCALE / I18N_TOOLS_CONFIG
75
+ )
76
+ """
77
+ This variable is used to store the absolute path of the config directory in the project.
78
+ """
79
+ I18N_TOOLS_CONFIG_FILE = "i18n_tools.yaml"
80
+ """
81
+ This variable is used to define the name and format of the i18n_tools configuration file.
82
+ """