A question on how to create a custom translation provider
I am trying to build my own version of the passthrough provider due to the error I get when I try to use the existing one (see here for details). I've gotten it to show up as an option, but I'm having trouble getting the status to update during the Check operation. I believe I can set the status with the TranslationJobService, but I'm not sure how to inject that service into the provider. How should this be done?
Hopefully, I've answered the question on the other post,
but for completeness:
You should be able to include TranstionJobService to the constructor of your connector and it will be injected by Umbraco's light inject implementation.
but in a provider, you don't need to set the status via the service (in fact you probably shouldn't). you set the job status
and return the job object in the attempt - Translation Manager then actually does a complete check of the items in a job to calculate the real status of the job (it checks to see if all values are marked as translated).
so setting the job status in the job, doesn't actually mean it will stay as what you set it if Translation Manager doesn't think it should be.
(i appreciate this is hard because the code is closed, i am writing up a bit more documentation on connectors, that will hopefully help with this stuff)
A question on how to create a custom translation provider
I am trying to build my own version of the passthrough provider due to the error I get when I try to use the existing one (see here for details). I've gotten it to show up as an option, but I'm having trouble getting the status to update during the Check operation. I believe I can set the status with the TranslationJobService, but I'm not sure how to inject that service into the provider. How should this be done?
Hi
Hopefully, I've answered the question on the other post,
but for completeness:
You should be able to include TranstionJobService to the constructor of your connector and it will be injected by Umbraco's light inject implementation.
but in a provider, you don't need to set the status via the service (in fact you probably shouldn't). you set the job status
and return the job object in the attempt - Translation Manager then actually does a complete check of the items in a job to calculate the real status of the job (it checks to see if all values are marked as translated).
so setting the job status in the job, doesn't actually mean it will stay as what you set it if Translation Manager doesn't think it should be.
(i appreciate this is hard because the code is closed, i am writing up a bit more documentation on connectors, that will hopefully help with this stuff)
as an example :
this is the v8 passthrough connectors check function:
*
MarkAsTranslated
is a function that recurses in to the Target value and sets the theTranslated
value on all inner items.Thanks for that code snippet. That clears up my confusion.
is working on a reply...