Skip to content

0.2.0.0

Compare
Choose a tag to compare
@SyberiaK SyberiaK released this 25 Aug 09:04
· 36 commits to main since this release
  • Introducing of Parsing Implementations
    • Instead of passing modules directly into SL10n, now you can use parsing implementations:
      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:
      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