6

We are working with WorldServer and I was wondering if an event is thrown when a Translation comes back from WorldServer in the status Translated?

If one ore more translated components in a job is of a specific Schema, I want to trigger a page publish. The code to trigger a page publish is already finished. But the issue is, can I subscribe for the 'Translation is Finished' Event? I guess the Translation Job will be passed as a parameter, but does someone know how to get the components in that Job?

I guess it will look like this:

EventSystem.Subscribe<TranslationJob, TranslationEventArgs>(OnTranslationFinished, EventPhases.TransactionCommitted);

2 Answers 2

3

The Translation Manager has an event that is raised when the state of the translation job changes. This includes the state change to Completed (if all items are succesfully translated) or Canceled (if one or more items where not succesfully translated).

But there is indeed not an easy way to see which items where included in the job. It would be possible to subscribe to the translation job resolve event and persist the list of items to a file or database for use when the job is completed. This is a bit more work than the alternative of using the TOM.NET event system, but it would allow you to wait until all items are back before you peform your action.

As other have mentioned you can use the TOM.net event system as well. I would use the check-in event instead of save. To determine if it is Translation Manager returning data look at the SessionContextData. It will have the application id set to "TranslationManager".

A third option that might fit some use cases is using a workflow on the target items - it would require a lot of configuration though so I expect most use cases are better served with an event.

1
  • Lars, Welcome to the Tridion Stack Exchange Site and thanks for this great answer! Mar 18, 2013 at 22:24
5

As far as I know there is no such thing as TranslationEventArgs, at least not derived from TcmEventArgs. I wouldn't expect it either, because Tridion itself doesn't "know" anything about translation per se.

However, that shouldn't be a problem for you, as presumably when a component is translated, it is saved, so there will be a Tridion event fired. So the signature you're looking for would be more like:

EventSystem.Subscribe<Component, SaveEventArgs>

Obviously, when you process this event, you'll need to write code that distinguishes between a translation save and some other kind. I'd expect that for this you can rely on your BluePrint design. It's usual to have the untranslated version of a component in a different publication to the translated version.

3
  • 1
    Also, maybe you can check the user saving the item in the event? I believe the World Server Connector uses a translation user for saving items.
    – robrtc
    Mar 17, 2013 at 18:05
  • "Tridion itself doesn't "know" anything about translation per se". Don't forget about Translation Manager, which does know the status of a translation job. Maybe the OP can clarify whether he talks straight to WorldServer or uses Tridion's Translation Manager for that integration. Mar 17, 2013 at 20:34
  • By "Tridion" I meant the core product, and not add-ons like Translation Manager. Would an add-on be able to fire an event? Is there a means of making EventSystem.Subscribe aware of such an event? I'm not familiar enough with this architecture to know the answers to these questions. Mar 17, 2013 at 21:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.