Jump to content

Fluency - The complete translation enhancement suite for ProcessWire


FireWire

Recommended Posts

Release 0.9.0b is up. This solves the global excluded strings issue, also updated to work with DeepL's new documented method.

The excluded strings field now uses a || (double pipe) separator rather than a comma since a comma is punctuation that could be present in an excluded string.

This also has two features suggested by @bernhard. The icon next to the translate button under fields is now a button itself that opens up the translation tool. The translate button itself is now styled by the admin theme as a link so changes to the admin colors will carry over.

https://github.com/SkyLundy/Fluency/releases/tag/v0.9.0b

  • Like 3
Link to comment
Share on other sites

Great update, thx @FireWire !

Another small thing to improve the UX:

4zMOtBk.png

Hovering the translation icon shows the help on hover after some time. If you add "uk-tooltip" to that element you'll get an instant tooltip on hover styled by uikit:

haWHhWc.png

That's really a small thing but still a little nicer I think.

Another one, maybe more helpful:

When clicking that icon you end up on the translation modal. There you need to select the language from the

I thought it might make sense to suggest the installed languages here, but that might not be so easy, as they might be named differently than in deepl (eg Deutsch vs German)

But I found another hardcoded color 😄 

CBvalit.png

  • Like 1
Link to comment
Share on other sites

Hey @FireWire another little suggestion:

V1wzOfm.png

The config shows two languages for this site, but when opening the translator it shows this:

UzmaTBa.png

This site has only two languages and when using the translator it's most likely because I want to translate something from German to English or vice versa.

It would be great if "translate to" had "English (British)" preselected. And it would be great to add a little button between those fields to flip them. Similar to route calculation services where you can flip route from a --> b with a single click to b --> a

Thx again for this really awesome module.

Link to comment
Share on other sites

Another one that would boost my workflow:

ZUoDc9a.png

Guess what I want to do... Translate it to english 🙂 But that needs two clicks, one on "english" and one on "translate".

Why not show all available languages right beside "Translation Available"? I guess that's the case 99% of the time - you enter text in the default language and want to translate it to other languages.

What about something like this?

Translation Rready | Translate to: EN, ES, GR or to all languages

I know it's a very small thing, but for me when working with RockPageBuilder I have Text usually split into many blocks, so that means a lot of clicks for translating blocks and if I could half that amount that would be very welcome 🙂 

PS: A problem with that approach would be that you don't see the result of the translation whereas with how it is now you instantly see the result because you are on the right tab. Maybe it could jump to the tab after translation? Not sure how that would work for the "all languages" though, but I guess it would still be nicer to click "translate to all" and then click through all the tabs to check the result rather than clicking every language and translating it one by one...

Link to comment
Share on other sites

33 minutes ago, bernhard said:

Another one that would boost my workflow:

ZUoDc9a.png

Guess what I want to do... Translate it to english 🙂 But that needs two clicks, one on "english" and one on "translate".

Why not show all available languages right beside "Translation Available"? I guess that's the case 99% of the time - you enter text in the default language and want to translate it to other languages.

What about something like this?

Translation Rready | Translate to: EN, ES, GR or to all languages

I know it's a very small thing, but for me when working with RockPageBuilder I have Text usually split into many blocks, so that means a lot of clicks for translating blocks and if I could half that amount that would be very welcome 🙂 

PS: A problem with that approach would be that you don't see the result of the translation whereas with how it is now you instantly see the result because you are on the right tab. Maybe it could jump to the tab after translation? Not sure how that would work for the "all languages" though, but I guess it would still be nicer to click "translate to all" and then click through all the tabs to check the result rather than clicking every language and translating it one by one...

Translate to all languages is on the roadmap. Very desirable feature but a lot of new code separate from the existing buttons/translating UI/error handling. I have an implementation in mind but didn't want it to hold up releasing the module, especially since it was so long overdue. I know this can be really annoying and I want to have this feature implemented as well.

I had plans for a "Translate to All Languages" but not buttons for individual languages since it could lead to content that doesn't match between languages. Also want to keep it dead simple for the end user. Open to thoughts on this.

I think that the way that tabs show that content has been modified is a good way to know that the content for another language has been updated. Some thoughts about switching to a tab after translation:

  • The person translating the content likely doesn't know how to speak the language they are translating to
  • If they need to go back and edit the content again there's an extra click to get back to the language they do speak
  • The change indicators on the tabs are bound to the state of the Inputfield independent of the translation function, so you can trust that the content has been translated
  • When the "Translate to All Languages" button is implemented, all of the tabs will show that they have been updated so it will be easy to see
50 minutes ago, bernhard said:

Hey @FireWire another little suggestion:

V1wzOfm.png

The config shows two languages for this site, but when opening the translator it shows this:

UzmaTBa.png

This site has only two languages and when using the translator it's most likely because I want to translate something from German to English or vice versa.

It would be great if "translate to" had "English (British)" preselected. And it would be great to add a little button between those fields to flip them. Similar to route calculation services where you can flip route from a --> b with a single click to b --> a

Thx again for this really awesome module.

The flip is a great idea. I left that second select open since it's a "global" translator that provides all of the languages. I don't have any issues with it being pre-selected. Are there instances where you need to use the translator tool rather than on the fields themselves?

Link to comment
Share on other sites

4 hours ago, FireWire said:

The flip is a great idea. I left that second select open since it's a "global" translator that provides all of the languages. I don't have any issues with it being pre-selected. Are there instances where you need to use the translator tool rather than on the fields themselves?

Great. Yeah that's the lowest hanging fruit I guess. Your concerns about my other suggestions make a lot of sense. And I'd not call the way it is "really annoying". It would just be the icing on the cake. But not if it makes things worse, of course, so please take your time to make a good decision - I was just throwing in ideas 🙂 

To the flip: Where that translation screen can be handy is the following. I'm working on my website which will be german as default and english as second language. Some texts have been in english originally because I was working with a non german designer on the website. Now I need to translate those sections into german, which is not possible with Fluency, because it doesn't allow translating from the second to the first language.

I could also use the deepl website for it, but I'm using informal language (eg "Was willst du kaufen?" rather than "Was wollen Sie kaufen?") and the online translator of deepl does not allow me to select that informal version 🙂 I'd have to pay, so it's better to either translate it myself or rewrite the translation after copying. In Fluency I can select the less formal version and I get the correct translation instantly 🙂 

ijq9eNS.png

Link to comment
Share on other sites

19 hours ago, bernhard said:

To the flip: Where that translation screen can be handy is the following. I'm working on my website which will be german as default and english as second language. Some texts have been in english originally because I was working with a non german designer on the website. Now I need to translate those sections into german, which is not possible with Fluency, because it doesn't allow translating from the second to the first language.

This is a great case for including a "Translate to All Languages" button on all language tabs! I didn't think about that. This is a great real-world example. I'll add that to the roadmap.

19 hours ago, bernhard said:

In Fluency I can select the less formal version and I get the correct translation instantly 🙂 

Very awesome to see that feature solve an immediate need!

  • Like 1
Link to comment
Share on other sites

Hey @FireWire me again 🙂 

What is really annoying in the translation process is when the content contains links. Unfortunately deepl can't link know about the different urls for pages in different languages. I don't have very much experience with multilingual sites yet, so I might be missing something?

But for now the process for me is: Write text in german. Click on English tab. Hit translate. Fix all links that are still pointing to german urls.

The annoying part here is that if I fix a typo or change one sentence I can't just hit "translate to english" because that will wipe my links as well. So I have to either translate that sentence manually or fix all links. This is not just annoying but also prone to errors.

I thought maybe it would be possible to check for links in the returned result (eg via Regex or maybe even better via dom parsing) and then loop those links and automatically link them to the english version if one exists and is active. I think that should work well and I'd be happy to sponsor this addition if you help me with pointers on how the module actually works and where the translation takes place.

Maybe we could even make the request that fetches data from deepl hookable so that anything would be possible and so that this feature of automatically converting links could be enabled or disabled via a checkbox in the settings.

  • Like 2
Link to comment
Share on other sites

Idea: What about a shift-click feature that immediately translates the default language to the language that was clicked. We would then have the benefit of one-click translation by maintaining the benefit of instantly seeing the result.

Link to comment
Share on other sites

4 hours ago, bernhard said:

Hey @FireWire me again 🙂 

What is really annoying in the translation process is when the content contains links. Unfortunately deepl can't link know about the different urls for pages in different languages. I don't have very much experience with multilingual sites yet, so I might be missing something?

But for now the process for me is: Write text in german. Click on English tab. Hit translate. Fix all links that are still pointing to german urls.

The annoying part here is that if I fix a typo or change one sentence I can't just hit "translate to english" because that will wipe my links as well. So I have to either translate that sentence manually or fix all links. This is not just annoying but also prone to errors.

I thought maybe it would be possible to check for links in the returned result (eg via Regex or maybe even better via dom parsing) and then loop those links and automatically link them to the english version if one exists and is active. I think that should work well and I'd be happy to sponsor this addition if you help me with pointers on how the module actually works and where the translation takes place.

Maybe we could even make the request that fetches data from deepl hookable so that anything would be possible and so that this feature of automatically converting links could be enabled or disabled via a checkbox in the settings.

Completely agree, glad you brought this up. Working on this now. I might have you take a look at what I put together on the dev branch to get your opinion. I wanted to give it a shot since it presents a few challenges that I'd like to try solving, one of which is this:

<?php 

ProcessWire\PageFinderSyntaxException 

OR values not supported for multi-language 'path' or 'url'

at wire/core/PageFinder.php:3684
   3680 	 * @throws PageFinderSyntaxException
   3681 	 * 
   3682 	 */
   3683 	public function syntaxError($message) {
3684 		throw new PageFinderSyntaxException($message); 
   3685 	}
   3686 }
   3688 /**

Trying to keep this efficient so if there's 5 (or many more) links in a translated text, then it would be preferable to make one $pages->find('{selector}') call rather than looping over them and making multiple calls. Do you think this can be done in one? Will this need a raw SQL query (if that would present a solution)? I think another downside to multiple calls would be that this is querying the "name" column which isn't a MySQL indexed column, so a site with many many pages might experience additional slower performance. The only thing we have to work with in the <a> elements is the href value...

1 hour ago, bernhard said:

Idea: What about a shift-click feature that immediately translates the default language to the language that was clicked. We would then have the benefit of one-click translation by maintaining the benefit of instantly seeing the result.

Whoa there cowboy, we're really stacking up new features here and I can't keep up 🤣

  • Like 1
Link to comment
Share on other sites

3 hours ago, FireWire said:

Trying to keep this efficient so if there's 5 (or many more) links in a translated text, then it would be preferable to make one $pages->find('{selector}') call rather than looping over them and making multiple calls. Do you think this can be done in one? Will this need a raw SQL query (if that would present a solution)? I think another downside to multiple calls would be that this is querying the "name" column which isn't a MySQL indexed column, so a site with many many pages might experience additional slower performance. The only thing we have to work with in the <a> elements is the href value...

Do you really think this could be an issue? I can't tell how that behaves on huge installations but on mine I've quickly tested this and I think looping over all links should be fine:

nJYesfe.png

It takes 225ms for 469 pages, so if there are only a handful in a body field I don't think that it would matter?

Link to comment
Share on other sites

On 10/27/2023 at 7:21 PM, bernhard said:

It takes 225ms for 469 pages, so if there are only a handful in a body field I don't think that it would matter?

Impressive. I was thinking about some of the higher latency I've seen in databases that aren't located on the same server that is hosting ProcessWire. I'm sure it will be fine. I'm sure someone will come back and let me know if it's too slow 😂

Started working on this but have been super busy with work. Will report back here when the release is ready.

  • Like 1
Link to comment
Share on other sites

Links to ProcessWire pages in translated content now point to the localized URL. I'm pretty sure this is good to merge into a release, but extra testing would be the best idea.

@bernhard Pushed to dev branch

https://github.com/SkyLundy/Fluency/tree/development

 

@jacmaes I saw that like on @bernhard's post if you want to take this for a spin as well.

  • Thanks 2
Link to comment
Share on other sites

Bonus! I've added an option to enable "Translate to all languages" for each Inputfield 😎

Enable the new translation button on the module config page. The old style of translation (translating each language from the default language) is still available for those who want to use it.

388249665_Screenshotfrom2023-11-0216-00-05.png.f453838fe73e72d82c69a9ccef30b3e7.png

Translate to all languages at once from the default language
1935215224_Screenshotfrom2023-11-0216-01-53.png.7bde2f6112aa0859a57a90f568439414.png

Translate to all languages at once from any language. This is where the tab indicators come in really handy to indicate the tabs that have received updated/translated content with one click.
1184844244_Screenshotfrom2023-11-0216-12-16.png.671777b8094e4e2849b3830823adb045.png

 

This is on the dev branch as well, so give it a try and tell me what you think.

 

  • Like 3
Link to comment
Share on other sites

On 11/3/2023 at 10:24 AM, bernhard said:

Translate to all is also nice, thanks! 🙂 

Ok I have an update on this one.

Actually I'm not sure about this feature any more. Today I had to translate some elements and I changed the default text, which is german. Then I clicked on the english tab to see what text I have in this field. The field was empty, so I clicked on "translate to all languages", which wiped my german field 😄 

To be honest I'm not sure how useful the "translate to all languages" button is on non-default languages. Also when viewing a non-default language I think there should be a button to pull text from the default language, as that is most likely what you want to do I guess.

But I'm really not sure, just wanted to mention that here before you push something to the main branch...

Link to comment
Share on other sites

2 hours ago, bernhard said:

Ok I have an update on this one.

Actually I'm not sure about this feature any more. Today I had to translate some elements and I changed the default text, which is german. Then I clicked on the english tab to see what text I have in this field. The field was empty, so I clicked on "translate to all languages", which wiped my german field 😄 

This is an oversight on my part- if the field is empty, it shouldn't translate. Problem solved.

The following two issues are solved by a translate to all button on non-default languages, and the translation button type is still an option on the module config page 😎

2 hours ago, bernhard said:

To be honest I'm not sure how useful the "translate to all languages" button is on non-default languages. Also when viewing a non-default language I think there should be a button to pull text from the default language, as that is most likely what you want to do I guess.

On 10/24/2023 at 10:11 PM, bernhard said:

Some texts have been in english originally because I was working with a non german designer on the website. Now I need to translate those sections into german, which is not possible with Fluency, because it doesn't allow translating from the second to the first language

The real point for a "translate to all" button is to make it easier for the end user and to prevent content deviation, where one language says one thing and another language says another. It's very easy for an end user to forget to translate content- so there is no translated content, or the translated content becomes out-of-date. I've seen both of these issues in sites I've built that had people doing SEO work, or just managing content in general.

The "Translate to all languages" and the content change indicators are the best way that I can think of to help people enter content, click translate, and complete their work with the highest amount of accuracy. In my experience non-web people aren't as engrossed in the process of maintaining websites as much as developers are, so unless you make it as simple as possible it increases the likelihood that the website will be poorly maintained.

Also just realized that the new "Translate to all languages" button doesn't work when translating the page's URLs. Will push a fix for that.

  • Like 1
Link to comment
Share on other sites

  • 2 weeks later...

Hi @FireWire,

I need to test it further but I’m posting here first just in case.

Is the module supposed to work for any multi-lang text inputs?
I seem to have an issue with the Profield Table, but I don’t know if you’re using it or not...?

Here are three issues I noticed:
- it makes InputfieldTable’s js crash at some point because of a missing href. I added a quick fix in the module’s js but then...
- the "Translate" button doesn’t do anything
- and it seems to not detect / initiate the InputfieldTable when inside a Repeater.

Let me know if you need more infos

Link to comment
Share on other sites

6 hours ago, monollonom said:

Hi @FireWire,

I need to test it further but I’m posting here first just in case.

Is the module supposed to work for any multi-lang text inputs?
I seem to have an issue with the Profield Table, but I don’t know if you’re using it or not...?

Here are three issues I noticed:
- it makes InputfieldTable’s js crash at some point because of a missing href. I added a quick fix in the module’s js but then...
- the "Translate" button doesn’t do anything
- and it seems to not detect / initiate the InputfieldTable when inside a Repeater.

Let me know if you need more infos

Okay- I'll take a look. Unfortunately I am completely overloaded with work right now so the fix may be a little delayed. Can you switch between the button styles (translate from default vs. translate to all) and see if there's any difference? Really appreciate the help!

  • Like 1
Link to comment
Share on other sites

18 hours ago, monollonom said:

I’m not sure I see the option for the button styles but I’m on version 0.9.1 so maybe that’s why? Should I try the dev version?

Oh heck. Gotcha. I just remembered I hadn't pushed all of the new features to main- so you can ignore that. I'll take a look asap. What version of ProFields are you running?

Link to comment
Share on other sites

  • FireWire changed the title to Fluency - The complete translation enhancement suite for ProcessWire

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
×
×
  • Create New...