Skip to main content

extends Django-Modeltranslation and DjangoLDP's serializer and admin to provide i18n capabilities for DjangoLDP models

Project description

# I18nLDPViewSet

I18nLDPViewSet overrides DjangoLDP’s LDPViewSet to provide serialization using the I18nLDPSerializer, instead of the default LDPSerializer

You can activate the custom functionality on your DjangoLDP Model by setting view_set in the Model.Meta: https://git.startinblox.com/djangoldp-packages/djangoldp#view_set

## Client-Side

If you are using Startin’Blox in your client application, please see the [Startin’Blox docs](https://docs.startinblox.com)

If you are writing your own client, a full how-to for requesting from the DjangoLDP viewset is out of the scope of this package README, but the adjustments needed to include a requested language are simple: * for GET requests, simply set the Accept-Language header, following the [HTTP spec](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Language) * for POST requests it is easiest to do the same. For information, it is also possible to submit the langauge in [JSON-LD value-object syntax](https://www.w3.org/TR/json-ld/#value-objects), but the _response_ will be serialized into the HTTP-requested language

Both GET and POST requests currently only accommodate serialization in one language per-request. In POST requests this means that you cannot POST multiple language at the same time

# I18nLDPSerializer

The main functionality of I18n is provided in the serializer, which overrides DjangoLDP’s LDPSerializer to select the activated language content and display this in the context of the response

The language is selected and the data manipulated automatically, based on the request object in the serializer context. A feature to provide the serialization into a language using a setting (without a request object) is TODO

# DjangoLDPI18nAdmin

This admin class simply inherits from DjangoLDPAdmin from DjangoLDP and TranslationAdmin from [Django-Modeltranslation](https://django-modeltranslation.readthedocs.io/en/latest/admin.html) to provide the features from both. It does so without additions

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

djangoldp_i18n-3.0.0.tar.gz (8.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

djangoldp_i18n-3.0.0-py3-none-any.whl (12.2 kB view details)

Uploaded Python 3

File details

Details for the file djangoldp_i18n-3.0.0.tar.gz.

File metadata

  • Download URL: djangoldp_i18n-3.0.0.tar.gz
  • Upload date:
  • Size: 8.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.9.6 readme-renderer/40.0 requests/2.31.0 requests-toolbelt/1.0.0 urllib3/2.0.4 tqdm/4.65.0 importlib-metadata/6.8.0 keyring/24.2.0 rfc3986/2.0.0 colorama/0.4.6 CPython/3.11.4

File hashes

Hashes for djangoldp_i18n-3.0.0.tar.gz
Algorithm Hash digest
SHA256 7a62252b4fd121e4aa52d491d8a965fa3969cf8902adf631d9da66abb3301be8
MD5 ff6e7e38c362de66ae248d391b577497
BLAKE2b-256 3ac78b64e8dac5443fa4428b79dd237dc854399dac7759e1577ff6ce6bb57018

See more details on using hashes here.

File details

Details for the file djangoldp_i18n-3.0.0-py3-none-any.whl.

File metadata

  • Download URL: djangoldp_i18n-3.0.0-py3-none-any.whl
  • Upload date:
  • Size: 12.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.9.6 readme-renderer/40.0 requests/2.31.0 requests-toolbelt/1.0.0 urllib3/2.0.4 tqdm/4.65.0 importlib-metadata/6.8.0 keyring/24.2.0 rfc3986/2.0.0 colorama/0.4.6 CPython/3.11.4

File hashes

Hashes for djangoldp_i18n-3.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 09b565f792dcb5a0559f1f5861fb462fb5c3cc105e6c5c841c113bfaa1b51285
MD5 73f7a73a5ac23378e040312a8b96db5d
BLAKE2b-256 0ba82f9fd57c00fc5ced9b42b45561bcf491365320e2cdbbfd1d39cd0e24c347

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page