Sl10n

Latest version: v0.3.0.0

Safety actively analyzes 623657 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

0.3.0.0

- `SL10n` can now detect unfilled localization strings.
- Unfilled strings are either empty or equal to their key.
- `warnings.UnfilledLocaleKey` propogates when an unfilled key detected.
- `pimpl.ORJSONImpl` is now deprecated.
- According to my benchmarks, `orjson` makes no significant load/dump speeds difference for our use case. Because it makes absolute no sense to have a dedicated `ParsingImpl` for it.
Use `pimpl.JSONImpl` with one of the supported packages instead (e.g. built-in `json`).


Also I updated the docs look and added a new "Locale containers" page.
- Most notably, `ParsingImpl` methods have been documented.

0.2.0.0

- **Introducing of Parsing Implementations**
- Instead of passing modules directly into SL10n, now you can use parsing implementations:
python
from sl10n import SL10n, SLocale
from sl10n.pimpl import JSONImpl
import ujson not a stdlib

...

sl10n = Sl10n(MyLocale, parsing_impl=JSONImpl(ujson))

This allows me to add compatibility with more modules in the future and also **you** to add custom parsing implementations.
Just subclass the `sl10n.pimpl.ParsingImpl` and implement your `load` and `dump` methods.
- `json`, `simplejson` and `ujson` use `JSONImpl`.
- `python-rapidjson` now marked as supported and uses `JSONImpl`.
- Added support for `orjson` - use `ORJSONImpl` for it.
- Simple demonstation of each usage:
python
from sl10n.pimpl import JSONImpl, ORJSONImpl

JSONImpl(json)
JSONImpl(simplejson)
JSONImpl(ujson)
JSONImpl(rapidjson) `python-rapidjson` in pip
ORJSONImpl() for `orjson`

- New modifier - `lang_code`
- Changes `lang_code` property of respected locale container.
- Doesn't change the access key in `SL10n.locale(key)` - be aware!
- `json_impl` argument in `SL10n.__init__` was renamed to `parsing_impl` to better mirror new changes
- `UnexpectedLocale` warning was renamed to `UndefinedLocale`

0.1.0.2

- Fixed dynamic key access

0.1.0.1

Links

Releases

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.