ramifice 0.8.12__py3-none-any.whl → 0.8.13__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.
@@ -26,9 +26,11 @@ __all__ = (
26
26
  "DEFAULT_LOCALE",
27
27
  "CURRENT_LOCALE",
28
28
  "LANGUAGES",
29
- "change_locale",
29
+ "add_languages",
30
+ "_",
30
31
  "gettext",
31
32
  "ngettext",
33
+ "change_locale",
32
34
  )
33
35
 
34
36
  import copy
@@ -48,10 +50,20 @@ CURRENT_LOCALE: str = copy.deepcopy(DEFAULT_LOCALE)
48
50
  # List of supported languages.
49
51
  LANGUAGES: frozenset[str] = frozenset(("en", "ru"))
50
52
 
51
- if not DEFAULT_LOCALE in LANGUAGES:
52
- msg = "ERROR: DEFAULT_LOCALE is not included in the LANGUAGES!"
53
- logger.error(msg)
54
- raise PanicError(msg)
53
+
54
+ def add_languages(
55
+ default_locale: str,
56
+ languages: frozenset[str],
57
+ ) -> None:
58
+ """Ramifice - Add languages."""
59
+ global DEFAULT_LOCALE, LANGUAGES
60
+ if not default_locale in languages:
61
+ msg = "DEFAULT_LOCALE is not included in the LANGUAGES!"
62
+ logger.error(msg)
63
+ raise PanicError(msg)
64
+ DEFAULT_LOCALE = default_locale
65
+ LANGUAGES = languages
66
+
55
67
 
56
68
  # Add translations for Ramifice.
57
69
  ramifice_translations: dict[str, NullTranslations] = {
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ramifice
3
- Version: 0.8.12
3
+ Version: 0.8.13
4
4
  Summary: ORM-pseudo-like API MongoDB for Python language.
5
5
  Project-URL: Homepage, https://github.com/kebasyaty/ramifice
6
6
  Project-URL: Documentation, https://kebasyaty.github.io/ramifice/
@@ -260,8 +260,10 @@ if __name__ == "__main__":
260
260
  ```python
261
261
  from ramifice import translations
262
262
 
263
- translations.DEFAULT_LOCALE = "en" # For Ramifice by default = "en"
264
- LANGUAGES = frozenset(("en", "ru")) # For Ramifice by default = ["en", "ru"]
263
+ translations.add_languages(
264
+ default_locale="en", # For Ramifice by default = "en"
265
+ languages=frozenset(("en", "ru")), # For Ramifice by default = ["en", "ru"]
266
+ )
265
267
  ```
266
268
 
267
269
  ```shell
@@ -286,8 +288,10 @@ uv run pybabel compile -d config/translations/custom
286
288
  ```python
287
289
  from ramifice import translations
288
290
 
289
- translations.DEFAULT_LOCALE = "en" # For Ramifice by default = "en"
290
- translations.LANGUAGES = frozenset(("en", "ru", "de", "de_ch")) # For Ramifice by default = ["en", "ru"]
291
+ translations.add_languages(
292
+ default_locale="en", # For Ramifice by default = "en"
293
+ languages=frozenset(("en", "ru", "de", "de_ch")), # For Ramifice by default = ["en", "ru"]
294
+ )
291
295
  ```
292
296
 
293
297
  ```shell
@@ -71,14 +71,14 @@ ramifice/utils/errors.py,sha256=OBoTuVLkMbtt-wdOZKY6eByNwAmaQvu1FHhfUi-aU9k,1978
71
71
  ramifice/utils/fixtures.py,sha256=fmC87O0EE-EHsDqSOMD0mCSehKncMazzPuIfm7cO1tI,3351
72
72
  ramifice/utils/migration.py,sha256=Q_kDRdMMtkYX4mB8RoLD2sIOej8rr9yhqz-Aip57VYU,11553
73
73
  ramifice/utils/tools.py,sha256=LZyA715HnkNO7TcBu4Ia29A6Ko3n-F2BRULzIyNKt9o,3279
74
- ramifice/utils/translations.py,sha256=gI-3R-xcOfONF11VTxmya0upXdE5ALoetTibEfyqlf0,4424
74
+ ramifice/utils/translations.py,sha256=hIEXrc_53zx8wMnC7RnsIkqmh_SWJcxKQGl-TXGy3c4,4698
75
75
  ramifice/utils/unit.py,sha256=7I48948JfUSxHS78aN7VfFi5nMi5DUi2cgaDu15dn7s,2601
76
76
  ramifice/utils/mixins/__init__.py,sha256=1W6HoabjN73crpzJ_rmhI10KM9C2RbPZn5Em6Gi9Aig,283
77
77
  ramifice/utils/mixins/add_valid.py,sha256=vYq4wGdpfA4iLMts7G0NvDALZBwupOScsajDFWCmmYg,472
78
78
  ramifice/utils/mixins/hooks.py,sha256=h8coNstWWHI4VwPgpjx0NWTj93-5NDAGtav0VFh-fk4,1031
79
79
  ramifice/utils/mixins/indexing.py,sha256=WVLxmkLKg-C_LHn2hq6LJuOkSr9eS-XUUvCMgK-pKYo,387
80
80
  ramifice/utils/mixins/json_converter.py,sha256=qBqFYol3Pbq1kX33EWB6FsYUL3AGSdYNtQE97HQ9jy4,1225
81
- ramifice-0.8.12.dist-info/METADATA,sha256=bQXSVotn2jXPctHCF-GICVspqxbwwBtqCdKSv2sssK4,20328
82
- ramifice-0.8.12.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
83
- ramifice-0.8.12.dist-info/licenses/LICENSE,sha256=LrEL0aTZx90HDwFUQCJutORiDjJL9AnuVvCtspXIqt4,1095
84
- ramifice-0.8.12.dist-info/RECORD,,
81
+ ramifice-0.8.13.dist-info/METADATA,sha256=MPb7W8bLK3cwGVfNc8iZai1EiXoy35pc_a8pccd9_Z8,20361
82
+ ramifice-0.8.13.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
83
+ ramifice-0.8.13.dist-info/licenses/LICENSE,sha256=LrEL0aTZx90HDwFUQCJutORiDjJL9AnuVvCtspXIqt4,1095
84
+ ramifice-0.8.13.dist-info/RECORD,,