Jump to content

ProcessTranslatePage


robert
 Share

Recommended Posts

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.

 

  • Like 2
  • Thanks 1
Link to comment
Share on other sites

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?

  • Thanks 1
Link to comment
Share on other sites

  • 3 weeks later...

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!

  • Like 1
Link to comment
Share on other sites

  • 1 month later...

@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

@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). 

  • Like 1
Link to comment
Share on other sites

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!
  • Like 1
Link to comment
Share on other sites

@bernhardSure 🙂 

Module Config  (sorry for the mixed labeling, I have the german language pack installed 😅 ):

Screenshot-2021-12-08-1006.thumb.jpg.020eb5181156c337424816d91b49f144.jpg

Publish + Translate to all target languages at once:

Screenshot-2021-12-08-1009.thumb.jpg.02cec02ce3d910985ff4dbca2049ae7f.jpg

Publish + Translate to single languages (on the left side of the arrow: source language, right: all available (aka not excluded) target languages):

Screenshot-2021-12-08-1007.thumb.jpg.e78f209b69f2bb0b8da6607982174109.jpg

  • Like 1
  • Thanks 1
Link to comment
Share on other sites

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 🤔

  • Like 1
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...