How to integrate text traslations on the fly?

How to integrate text traslations on the fly?

by Christoph Künkel -
Number of replies: 5

Not sure if this is the right place. 

We have been using moodle 1.9 extensively for more than 15 years. During this time, we did a number of core patches to make it behave like we needed.  One of the things we did was to integrate on-the-fly translations based on deepl.  That means, that pages (mainly book and lesson content) are translated when they are displayed (and cached then of course).  This has the beauty that translations are done based on the result of any filters that may have been applied to the content (and which in our case may have user-specific results).  Also, translations for a specific language are done only when and if someone wants to display it.

Foremost: does something like this already exist in moodle 4.5? 

If not (which is my impression), would it be a good idea to implement it as a filter plugin?  Way back when in 1.9, I implemented it as a patch to the book and lesson modules.  The reason mainly was that the formatting of the translation results should be different depending on the content type.  For example, in books, we have the original text and the translation displayed side-by-side, aligned by paragraph. This might not be appropriate for filtered text in other contexts.

Thanks for any advice!

Christoph

Average of ratings: -
In reply to Christoph Künkel

Re: How to integrate text traslations on the fly?

by Dave Foord -
Picture of Particularly helpful Moodlers
Hi Chris - I am currently doing a lot of work in getting translations to work reliably in Moodle, so welcome to my World.

Firstly there is a Deepl plugin out there https://moodle.org/plugins/local_deepler - it is really new, and was a bit buggy before Christmas when I looked at it last, but the developer has been working on it, and I see a new version came out in January - so it may be working better now. This is a local plugin rather than a filter plugin, and it basically adds the {mlang} tags around the translated content in conjunction with the https://moodle.org/plugins/filter_multilang2 plugin (which is a filter). It looks really smart so I am really hopeful that this will be good.

But - A problem that I keep running into though is this one: https://tracker.moodle.org/browse/MDL-83985 - please go and vote for this, as this is something that is going to keep holding Moodle back if if isn't addressed, and this is problematic if you have lots of languages.

Don't waste time looking at the official Moodle translation plugin (https://moodle.org/plugins/filter_translations) it is a nightmare to use, and lots of problems.

As an aside, I am working with a professional translation company who are developing an API based plugin, that will allow a connection between Moodle and their translation management system. Once set up, we ask them to translate a certain course into a chosen language, they quote for how much the translation will cost - if agreeable and they proceed, they do the translation then reinject the translated text back into the live course (again using the {mlang} tags. This obviously has a cost each time as using a professional company, but the work is translated by humans rather than a computer, so for niche or technical subjects may be safer/better. If you are interested in this - then subscribe to be blog at https://davefoord.wordpress.com/ as I will be posting about this once I have made progress. (there are some other language based posts on there which may be of interest)
Average of ratings: Useful (2)
In reply to Dave Foord

Re: How to integrate text traslations on the fly?

by Christoph Künkel -
Hi Dave,

I was looking at mlang back in moodle 1.9 and decided not to use it. Main reason is that in my opinion, having multiple languages within a single text field/column is calling for trouble (just like the one you are running into in MDL.83985).
 
Also (at least in 19, I didn't look at it in 45), editing such tagged text is a pain.
 
Finally, we have found that translating training material automatically is sometimes misleading and it helps to present the original material (which we always write in English) along with the translation (I'll be attaching a sample screenshot).  This obviously is good for books and lessons but not for many other types of text.  In other words: translation output/format depends on the type of text and I am not aware that a text filter has a chance to know the type of text that it is translating.
 
Do you think that it is worth while looking at the "local plugin" type for this?  This is something I believe did not exist in 19.
 
Christoph
Attachment xlation.png
In reply to Christoph Künkel

Re: How to integrate text traslations on the fly?

by Dave Foord -
Picture of Particularly helpful Moodlers
It looks like we are talking cross purposes. You are wanting the English text to be visible with the translated text next to it. What I am describing is a mechanism, where Moodle recognises what the user has set as their preferred language in their preferences, and then it displays the content in that language only.

So my suggestions may not be applicable for what you want.

With the Deepl plugin, you could use this as a way of getting the text translated - you would then have to go into page/item and manually remove the {mlang} tags and replace these with whatever formatting you want to create the desired side-by-side effect.
In reply to Christoph Künkel

Re: How to integrate text traslations on the fly?

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
Moodle Academy has tools for translating the content of their site, which they have shared. Have a look for that. (Sorry, I don't have links handy.)
In reply to Tim Hunt

Re: How to integrate text traslations on the fly?

by Dave Foord -
Picture of Particularly helpful Moodlers

The mechanism that the Moodle Academy has implemented (which uses this plugin https://moodle.org/plugins/filter_translations) has lots of issues, I supported a client that used this widely - but we have given up, as caused so many problems. I will save you a lot of pain by recommending you don't go down that particular route.

The biggest problem, is once an item (e.g. a Moodle page) has been translated, if anyone comes in and edits that item in any way (e.g. corrects a spelling, or changes the restriction access etc) it wipes the translations from that page so over a period of time, a course that was once 100% translated into a second language gradually has more and more bits that have lost translation.

There is also a cost associated as you need to connect the translation to something that has a monthly charge (I forget the details) - but everytime a user from a different language accesses an item, it triggers a cost, even if the content on that page isn't in that language - our monthly bill very quickly increased exponentially from something manageable to something that blue the half the teams budget. We also found that quizzes were particularly problematic, the randomistion of questions (especially ones with images in them) were costing us huge amounts of money as each time a user accessed a question, this counted as a new item that triggered a cost.

And finally, the translators have to have full editing rights on the course, which introduces its own set of problems.

Caveat - I notice there has been an updated release to the plugin since I last used it, so some of the above may have been resolved, but I doubt if they have resolved all the issues.

My blogpost on this topic - https://davefoord.wordpress.com/2024/09/24/the-different-ways-to-make-a-moodle-course-multi-lingual/ may be of interest.

Average of ratings: Useful (1)