robert Posted September 29, 2021 Share Posted September 29, 2021 I created a companion module for Fluency to translate all fields on a page at once: https://github.com/robertweiss/ProcessTranslatePage You can find the corresponding conversation about it in the Fluency thread (link below), but I decided to add the module to the official list so others who have a need for this have an easier time finding it. 2 1 Link to comment Share on other sites More sharing options...
Roych Posted October 7, 2021 Share Posted October 7, 2021 Hello, I always get this error after instaling the module, any ideas? Notice: Undefined index: pw_language_1022 ---- site/modules/ProcessTranslatePage/ProcessTranslatePage.module.php on line 115 Thank you R Link to comment Share on other sites More sharing options...
robert Posted October 7, 2021 Author Share Posted October 7, 2021 Hi Roych, thanks for your feedback! I found the bug – I falsely assumed that the default language id in processwire is always 1022 (which is obviously not the case …). I pushed a bugfix to the github repo (https://github.com/robertweiss/ProcessTranslatePage) and changed the version to 0.0.3. Could you try the bugfix and see if it works for you now? 1 Link to comment Share on other sites More sharing options...
Roych Posted October 7, 2021 Share Posted October 7, 2021 Thank you, It looks like it is working great now. Great module btw! ? R 1 Link to comment Share on other sites More sharing options...
robert Posted October 27, 2021 Author Share Posted October 27, 2021 Just released v0.5 which includes the following new features: Exclude fields: choose fields which should not be translated Exclude languages: choose languages which should not be translated to Show Single Target Language Buttons: Show all target languages as single buttons in the save dropdown instead of having only one button for all translations Thanks to @Ivan Gretsky for proposing these additions! 1 Link to comment Share on other sites More sharing options...
theoretic Posted October 27, 2021 Share Posted October 27, 2021 Hello Robert! Thanks for a perfect module! I've made some changes to it (e.g. possibility to set the source language in module settings), how can i collaborate with You? 1 Link to comment Share on other sites More sharing options...
robert Posted October 28, 2021 Author Share Posted October 28, 2021 Oh cool, sounds good ? Your addition might be a good fit for the open issue by Ivan Gretsky: https://github.com/robertweiss/ProcessTranslatePage/issues/3 – would it be an option for you to fork my repository on Github so we can merge via a pull request? 1 Link to comment Share on other sites More sharing options...
studioweb Posted December 1, 2021 Share Posted December 1, 2021 Hi Robert, nice work! Feature request: a option to translate the page/seo names. This should only be translated once so there should be a way to save this into the page meta data perhaps ;) Link to comment Share on other sites More sharing options...
robert Posted December 3, 2021 Author Share Posted December 3, 2021 @studiowebThanks ? To prevent possible misunderstandings: you’re talking about the $page->name field, right? This is indeed a special case as it is the only translatable system field I could think of. I would suggest the following mechanism: only translate the page name if the target language name is identical to the source language (and therefore: not translated yet) – and allow users to switch it off in the settings to prevent possible conflicts with other modules modifying the name field on save (e.g. ProcessSetupPageName). Link to comment Share on other sites More sharing options...
robert Posted December 7, 2021 Author Share Posted December 7, 2021 @studioweb I had a deeper look into the page->name feature request and decided to not include the automatic translation of this field. As I suspected in my last post, there exists already a better solution for this ? If you install the module https://processwire.com/modules/process-setup-page-name/ and activate its option ›Update the name of existing pages‹, the name field will be updated in all languages whenever you change the corresponding field (normally title). 1 Link to comment Share on other sites More sharing options...
robert Posted December 7, 2021 Author Share Posted December 7, 2021 v0.6 is released with the following changes: New setting: Source language (thx for the idea to @Ivan Gretsky and for the pull request to @theoretic) Languages for source and exclude can only be selected if they have been defined in the fluency config first I had to do some refactoring of the translation strings and the module config, so please validate/correct your settings after the update to v0.6! 2 Link to comment Share on other sites More sharing options...
bernhard Posted December 7, 2021 Share Posted December 7, 2021 Any screenshots to get a quick impression? ? Link to comment Share on other sites More sharing options...
robert Posted December 8, 2021 Author Share Posted December 8, 2021 @bernhardSure ? Module Config (sorry for the mixed labeling, I have the german language pack installed ? ): Publish + Translate to all target languages at once: Publish + Translate to single languages (on the left side of the arrow: source language, right: all available (aka not excluded) target languages): 1 1 Link to comment Share on other sites More sharing options...
bernhard Posted December 8, 2021 Share Posted December 8, 2021 Very nice, thx, I'll try that asap on my new website ? Does it translate all fields after save or only ones that changed during page edit? Sorry if that was already mentioned - I didn't find that information. Link to comment Share on other sites More sharing options...
robert Posted December 9, 2021 Author Share Posted December 9, 2021 Translating only changed fields is quite a good idea, I just added it in v0.7 ? New radio option: Write Mode (replaces the checkbox Overwrite Existing Translation) Translate only if target field is empty Translate only changed fields Overwrite all target fields Caution: the »Changed fields«-option support is currently only one level deep. If you change any value inside a Repeater(-Matrix) or FieldsetPage field, the complete field will be translated. If anybody knows how to get the names of nested fields that changed inside the afterPages::saved hook, please let me know ? 1 Link to comment Share on other sites More sharing options...
ngrmm Posted October 7, 2024 Share Posted October 7, 2024 @robert it seems that this module does not work with the latest PW version Schwerwiegender Fehler: Uncaught TypeError: Cannot access offset of type string on string in site/modules/ProcessTranslatePage/ProcessTranslatePage.module.php:189 #0 site/modules/ProcessTranslatePage/ProcessTranslatePage.module.php(59): ProcessTranslatePage->setLanguages() #1 site/modules/ProcessTranslatePage/ProcessTranslatePage.module.php(41): ProcessTranslatePage->initSettings() #2 wire/core/ModulesLoader.php (168): ProcessTranslatePage->init() #3 wire/core/ModulesLoader.php (100): ModulesLoader->initModule() #4 wire/core/ModulesLoader.php (111): ModulesLoader->triggerInit() #5 wire/core/Modules.php (338): ModulesLoader->triggerInit() #6 wire/core/ProcessWire.php (775): Modules->triggerInit() #7 wire/core/Wire.php (413): ProcessWire->___init() #8 wire/core/WireHooks.php (968): Wire->_callMethod() #9 wire/core/Wire.php (484): WireHooks->runHooks() #10 wire/core/ProcessWire.php (909): Wire->__call() #11 wire/core/ProcessWire.php (665): ProcessWire->__call() #12 wire/core/ProcessWire.php (613): ProcessWire->setStatus() #13 wire/core/ProcessWire.php (315): ProcessWire->load() #14 index.php (52): ProcessWire->__construct() #15 {main} thrown (Zeile 189 in site/modules/ProcessTranslatePage/ProcessTranslatePage.module.php) Diese Fehlermeldung wurde angezeigt wegen: Sie sind als Superuser angemeldet. Fehler wurde protokolliert. Link to comment Share on other sites More sharing options...
FireWire Posted October 8, 2024 Share Posted October 8, 2024 @ngrmm Hey there, Fluency author here. I submitted a PR that makes ProcessTranslatePage compatible with the new major release of Fluency. It hasn't been merged yet, but you should have success using this module with these changes. https://github.com/robertweiss/ProcessTranslatePage/pull/10 4 1 Link to comment Share on other sites More sharing options...
robert Posted October 9, 2024 Author Share Posted October 9, 2024 Yes, this seems to be the problem. ProcessTranslatePage works with the latest Processwire version, but not with Fluency V2 (yet). @FireWiresorry for the long wait, I did not have time to merge your PR yet, but thanks a lot for your effort! 2 Link to comment Share on other sites More sharing options...
FireWire Posted October 9, 2024 Share Posted October 9, 2024 @robert No probs! It was a good exercise to test the quality of my code and make sure the API acted as expected 🙂 1 Link to comment Share on other sites More sharing options...
Ivan Gretsky Posted May 19 Share Posted May 19 Good day, @robert! We have been using your module for a long time. Thank you for making it! We have even extended you classes for our own modules: a form on edit page to configure how the page has to be translated on save; a Lister action for mass transtlation. Now I have updated Fluency to a newer version (211). @FireWire has made a major rework. And you module no longer works. I have not examined the new Fluency's features. Maybe they already do all the things you wonderful module does... I see that the incompatibility has already been reported and @FireWire even created a PR (which seems to have issues and needs some work to be merged). Could you please look into this and update the module? If you find some time... 🙏 Link to comment Share on other sites More sharing options...
FireWire Posted May 19 Share Posted May 19 @Ivan Gretsky I'm stuck under a lot of work and deadlines. If you are able to test and provide any info that would help me debug that would make a fix much easier on my part. See if there are any logs generated, dev tools console errors, or share any exceptions you're receiving when attempting to translate. Is your issue related to the potential namespace issue that is noted under the comments of the PR? I missed the Github notifications on that so I'm just becoming aware of it now. 1 Link to comment Share on other sites More sharing options...
Ivan Gretsky Posted May 20 Share Posted May 20 13 hours ago, FireWire said: @Ivan Gretsky I'm stuck under a lot of work and deadlines. If you are able to test and provide any info that would help me debug that would make a fix much easier on my part. See if there are any logs generated, dev tools console errors, or share any exceptions you're receiving when attempting to translate. Is your issue related to the potential namespace issue that is noted under the comments of the PR? I missed the Github notifications on that so I'm just becoming aware of it now. I have not tested the module with PR merged. Just seen it in the last moment before creating an issue in github repo about compatibility. I am waiting for @robert to share his thoughts on this. Maybe he is already in the process of working with your PR. Will ping him on github too. Link to comment Share on other sites More sharing options...
robert Posted May 20 Author Share Posted May 20 Hi @Ivan Gretsky and @FireWire, Sorry it took me so much time to respond to the big Fluency update. To be honest, I already refactored my module a couple of months ago to work without any dependencies (except the DeepL API), so Fluency is no longer necessary to use it. Since I only did this refactor for one client, I need to remove some customizations before I can push the new version to Github. I don’t expect this to take too long, so I’m hopeful that I’ll be able to release Version 1.0 for you to test tomorrow or thursday 😊. Thanks for your patience! 3 Link to comment Share on other sites More sharing options...
Ivan Gretsky Posted May 20 Share Posted May 20 What a twist!!! 1 Link to comment Share on other sites More sharing options...
robert Posted May 22 Author Share Posted May 22 Hello everyone, I'm excited to announce that Version 1.0 of ProcessTranslatePage is now available on GitHub: https://github.com/robertweiss/ProcessTranslatePage Please note that there are some breaking changes in this update. I recommend uninstalling and then reinstalling the module to ensure everything works smoothly. You can use the same DeepL API key that you use with Fluency. After installation, you will (hopefully) see two new fields for the language template. However, only the 'translate_locale' field is required for the module to function properly. Thanks for your patience, I hope you find this update useful! 4 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