lpa Posted October 9, 2020 Share Posted October 9, 2020 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? Link to comment Share on other sites More sharing options...
dragan Posted October 10, 2020 Share Posted October 10, 2020 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. 1 Link to comment Share on other sites More sharing options...
teppo Posted October 10, 2020 Share Posted October 10, 2020 (edited) 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 October 10, 2020 by teppo Link to comment Share on other sites More sharing options...
lpa Posted October 10, 2020 Author Share Posted October 10, 2020 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. Link to comment Share on other sites More sharing options...
kongondo Posted October 10, 2020 Share Posted October 10, 2020 (edited) 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: Selectors: $pages->find("$your_selector"); foreach(){} -> and capture in values in an $array which you can then echo json_encode($array); OR Selectors: $pageArray = $pages->find("$your_selector"); ->then use $array = $pageArray->explode(['title','body']) -> then echo json_encode($array); OR 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 October 10, 2020 by kongondo added more 3 Link to comment Share on other sites More sharing options...
uiui Posted October 5, 2022 Share Posted October 5, 2022 Is there still no nice solution for this? Link to comment Share on other sites More sharing options...
zoeck Posted October 5, 2022 Share Posted October 5, 2022 4 hours ago, uiui said: Is there still no nice solution for this? There is a relatively new official solution ? https://processwire.com/blog/posts/language-field-export-import/ 1 1 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now