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 Share Posted October 7 @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 Share Posted October 8 @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 Author Share Posted October 9 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! 1 Link to comment Share on other sites More sharing options...
FireWire Posted October 9 Share Posted October 9 @robert No probs! It was a good exercise to test the quality of my code and make sure the API acted as expected 🙂 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