Third-party translation automation

default discord avatar
Tinouti
6 months ago
6

Heya payloaders!



Do you know if anyone has already built an automated translation system for Payload, or maybe something similar like some kind of data synchronization with a third party?



Alternatively, any thoughts or recommendations on how to go about building something like this? 👀



From what I gathered from the documentation (I've only just started playing with a local environment), it looks like the

afterChange

(to send strings to a loc provider) and

beforeRead

(to get translations back from the loc provider) hooks alongside some kind of

translationStatus

field (to manage these hooks and do things like prevent users to edit content that's actively being translated) might be a good place to start for a very simple MVP? 🤔

  • discord user avatar
    jacobsfletch
    Payload Team
    6 months ago

    I’m not aware of any automated translation solutions but I think this is a great idea and you could build this out as a plugin quite nicely. The description you provided would work just fine, but if your provider supports “webhooks” of some sort it would be better to fire an update directly from your service in real-time using Payload’s API. This way the translations are saved in

    Payload

    so that requests to your third-party service are limited to only the

    update

    operation. This will avoid unnecessary network requests and potential API quotas. If your translations are instant, you could alternatively use a

    beforeChange

    hook to update the translations of your document in one pass before it’s saved. Give it a shot!!

  • default discord avatar
    Tinouti
    6 months ago

    Ah, some good food for thought in there, thank you! 🙌



    Our provider's a bit... outdated when it comes to their tech and their APIs so I don't believe they have a webhook system, but that would definitely be a better to do it, so I'll double check!



    This feature is a must-have for us if we want to be able to adopt Payload so I'm definitely gonna try to put together a PoC, but being super new to both Payload and Typescript, I have a feeling I'll be back for help at some point during that process. 😄



    I'm also curious and excited to see what these changes (

    https://github.com/payloadcms/payload/discussions/1234

    ) will look like! 👀

  • discord user avatar
    jacobsfletch
    Payload Team
    6 months ago

    Right on! Well there's a lot of people in here ready and willing to support you where needed, myself included, so I think you should go for it. As far as language handling display goes, we've got a lot in store here but nothing to show quite yet. We work directly from community feedback so we should be able to knock out quite a few pain-points at once. If you have any suggestions we're all ears, throw it up on that GitHub discussion if you think of anything.

  • default discord avatar
    Martin R
    6 months ago

    Are the mentioned language handling you have in store breaking changes, as I am currently implementing languages in my site? 😅

  • discord user avatar
    jacobsfletch
    Payload Team
    6 months ago

    No breaking changes, core translation functionality is unchanging, that roadmap item is specifically UI

Open the post
Continue the discussion in Discord
Like what we're doing?
Star us on GitHub!

Star

Connect with the Payload Community on Discord

Discord

online

Can't find what you're looking for?

Get help straight from the Payload team with an Enterprise License.