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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file djangoldp_i18n-3.1.1.tar.gz
.
File metadata
- Download URL: djangoldp_i18n-3.1.1.tar.gz
- Upload date:
- Size: 8.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.9.6 readme-renderer/42.0 requests/2.31.0 requests-toolbelt/1.0.0 urllib3/2.1.0 tqdm/4.66.1 importlib-metadata/7.0.1 keyring/24.3.0 rfc3986/2.0.0 colorama/0.4.6 CPython/3.11.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9309509bb3053133a3dafabfdf03039cd39cb2e39cb6e310754aa7c2b49b84e7 |
|
MD5 | 06f9069920af2800b48cd329a4c0a9ba |
|
BLAKE2b-256 | d3946270186378208f2b8257781b095702e62c8a3ea92f97bd379718f055030c |
File details
Details for the file djangoldp_i18n-3.1.1-py3-none-any.whl
.
File metadata
- Download URL: djangoldp_i18n-3.1.1-py3-none-any.whl
- Upload date:
- Size: 12.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.9.6 readme-renderer/42.0 requests/2.31.0 requests-toolbelt/1.0.0 urllib3/2.1.0 tqdm/4.66.1 importlib-metadata/7.0.1 keyring/24.3.0 rfc3986/2.0.0 colorama/0.4.6 CPython/3.11.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9bb5fdbd07ae937b7d496b598b6f020bd782f2c4244e12a4b3f864c9466456b4 |
|
MD5 | b122722fd28b434e8f99522b584fe64b |
|
BLAKE2b-256 | fca7f2acf9050b86f3af5bc56938f9f768168b868932581943cde68352c177c9 |