- 🇵🇱Poland Pozi
I am new to the topic and was able to add new translation by commenting out those lines from #126 patch:
if ($resource_langcode !== $parsed_langcode) { $message = 'Translation resource language mismatch: "%s" (request metadata) vs "%s" (request payload).'; throw new UnprocessableEntityHttpException(sprintf($message, $resource_langcode, $parsed_langcode)); }
@b.khouy you can add transaltion either by using queryParam "lang_code" or by setting POST request "Content-Language", of course both set to translation destination language. Sending PATCH request to whatever entity endpoint language modifies default language.
BTW, "successful" translation adding returned error 500 with details: "Cannot get a version identifier for a non-versionable resource.".
Moreover with enabled jsonapi_translation module JSON:API GET translation stopped working, it always returns default language.
- 🇬🇧United Kingdom sam.foster
Hey guys,
What is the current state of play for this issue? We have Drupal 8.9.2 and are using JSON:API to create English nodes, but we need to create translations of those nodes into Welsh. The Content Type is correctly set up to allow translation, and we can of course create a translation with the GUI, but is this now possible using the JSON:API module or via some other means?
Can any of these patches here be successfully applied to deliver such functionality? I've tried patching in the drupal/core section of my composer.json but the patch won't apply. Is that because it is now in the core or is it because the patches no longer work with the current version I have as part of Drupal 8.9.2?
Any pointers will be greatly appreciated
Cheers
Sam
- 🇬🇧United Kingdom sam.foster
Guys
Any update at all - can REST API actually create translated nodes and establish the relationship between the original node and the translated one?
If not are there any work arounds?
Surely someone out there knows something?
Thanks
Sam
- 🇺🇸United States bradjones1 Digital Nomad Life
Hi Sam - This is not an area I'm actively working on, yet I can speak to your repeated requests for an update. Drupal is maintained by open-source contributors and there's no dedicated paid developers working on JSON:API specifically. You mention "REST API" which would be something different from JSON:API module, but i'm guessing you're talking about the items in this issue. There is some work on this already, as you can see on this issue... but it's waiting on people (maybe people like you?) to help finish it up.
I can say that if there are ever updates, you'll see them here. If this is important to your use case, you can help us get this done, or I'm sure there are developers experienced in this area who would be open to doing sponsored work.
- 🇳🇱Netherlands bbrala Netherlands
A little note about this we need to take into consideration. If we add a query parameter, the JSON:API specification has some rules around them. They need to be a valid member name, but also contain a special character. See:
- 🇺🇸United States bradjones1 Digital Nomad Life
Per #143 My read is that it must contain at least one non a-z character, but a capital letter suffices.
It is RECOMMENDED that a capital letter (e.g. camelCasing) be used to satisfy the above requirement.
So not much of a strong requirement but something we should enforce.
- 🇮🇹Italy plach Venezia
- 🇳🇱Netherlands bbrala Netherlands
yeah langCode is fine.
Would've loved to be able to sit with you, but the fact this week is the kids vacation made that too hard :(
- 🇮🇹Italy plach Venezia
@gabesullice
Addressed your reviews at https://www.drupal.org/project/drupal/issues/3199697#mr1591-note220760 📌 Add JSON:API Translation experimental module Needs work