Jump to content
lpa

Best way to send page content to translators

Recommended Posts

I have a site that will have content translated by a professional translator. I am requested to send the source language content to the translater as some files. The suggested format is .xliff or .wordpress.

I couldn't find any information that ProcessWire would support exporting content as xliff, xml, json or any other format that could be then imported once the translation is completed. 

Does anybody have any solution for this kind of translation exchange format?

 

Share this post


Link to post
Share on other sites

You can go to site/assets/files/1234/ and send these JSON files to the translators. 1234 being the id of the alternative language.

You'll see the language id @ setup/languages/ when you hover over the language edit link (1010 seems to be the default language).

Before that, you'll want to make sure all those JSONs are there, so you'll need to click the "find files to translate" button @ setup/languages/edit/?id=10189 under "Site Translation Files". There's also two buttons there in the bottom-right for downloading all files as CSV or ZIP. When you get the translated JSON files back, you can upload them here as well, and replace the old ones.

  • Like 1

Share this post


Link to post
Share on other sites
36 minutes ago, dragan said:

There's also two buttons there in the bottom-right for downloading all files as CSV or ZIP. When you get the translated JSON files back, you can upload them here as well, and replace the old ones.

Definitely this one. Unless the translator has very specific requirements (i.e. they intend to import the file into some sort of app), CSV export/import is by far the most effortless approach for all parties involved 🙂

Edit: purely out of curiosity tried to run a conversion from ProcessWire's JSON format to other formats (such as PO, the format typically used by WP translation plugins — .wordpress is a new one for me, so not sure if they meant this, or if that's just something I haven't come across yet) using https://localise.biz/free/converter, and it seemed to work fine. Though would need to test properly to make sure that the process is also easy to reverse, and the result can be imported properly.

Conversion done this way would be a bit of a pain, though, since you'd have to convert each file one by one. Unless you happen to have most of your translations in a single file or something like that. Seems like there are decent libraries for this available as well, so a conversion tool would be relatively simple to set up, but again for a one-off case that'd be a lot of extra work 😅

Edited by teppo

Share this post


Link to post
Share on other sites

Thank you for you suggestions. I think i was not clear enough. I know how to translate ProcessWire with language files or how to translate code with translatable strings like __('read more'), but now I should send the content in the title and body fields of my site to the translators. I can't figure out how that would be exported to JSON files and then imported back. 

Share this post


Link to post
Share on other sites
1 hour ago, lpa said:

I should send the content in the title and body fields of my site to the translators.

You can do it manually by either of the following ways:

  1. Selectors: $pages->find("$your_selector"); foreach(){} -> and capture in values in an $array which you can then echo json_encode($array); OR
  2. Selectors: $pageArray = $pages->find("$your_selector"); ->then use $array = $pageArray->explode(['title','body']) -> then echo json_encode($array); OR
  3. Use ProcessWire's (not installed by default) ProcessPagesExportImport module, select the pages you want and optionally the fields you want and export to JSON. Note, it will add other information not necessary for translation, e.g. Page IDs and templates.

#2 is probably easiest and cleanest. Edit:  #3 will allow you to import/update after translations are done.

Edited by kongondo
added more
  • Like 3

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...