Upgraded Moodle site not translating some language strings when sending email

Upgraded Moodle site not translating some language strings when sending email

by Luis de Vasconcelos -
Number of replies: 4
A few weeks back I upgraded my Moodle 2.1 site to Moodle 3.5.2 (3.6 wasn't out while we were testing...)

As part of the upgrade I needed to change the language strings that create the emails that get sent to students when they enrol, or are enrolled in courses. I have customized the welcometocoursetext string in the core and enrol_self components to:

Hello {$a->firstname} {$a->lastname},

You have been enrolled in the "{$a->coursename}" course on the {$a->sitename} site. You now have access to this course and can begin your learning path...

The problem is that Moodle is only doing some of those "variable substitutions". Instead of replacing the {$a->sitename}, {$a->firstname} and {$a->lastname} variables with the text linked to those variables the email contains the actual {$a->sitename}, {$a->firstname} and {$a->lastname} variables as text, like this:

Hello {$a->firstname} {$a->lastname},

You have been enrolled in the "Maths 101" course on the {$a->sitename} site. You now have access to this course and can begin your learning path...
So, it's printing those actual variable names instead of the text associated with those respective language variables.  The exception is that Moodle IS correctly translating the {$a->coursename} variable and showing the correct text, "Maths 101".

So, why is Moodle only printing SOME of the language strings?

It should be:

Hello Mary Jane,

You have been enrolled in the "Maths 101" course on the ABC University site. You now have access to this course and can begin your learning path...

I have purged all the Moodle and browser and server caches, but that doesn't seem to help - users still get the emails with those variable names printed in the body of the emails.

My Moodle runs on a cluster of Windows Server 2012 R2 VM's with an F5 load balancer and:
  • IIS 8.5 FastCGI
  • PHP 7.2.9 NTS
  • File cache: Wincache (v2.0.0.8) - configured as the session.save_handler...
  • Opcode Caching : Zend OPcache v7.2.9.0
I'm stumped! Does anyone know how to resolve this?

Thanks.
Average of ratings: -
In reply to Luis de Vasconcelos

Re: Upgraded Moodle site not translating some language strings when sending email

by Luis de Vasconcelos -

And my database is Microsoft SQL Server 2016.

PHP connects to MSSQL using the Microsoft Drivers for PHP for SQL Server  v5.3.0+11108 (SQLSRV)

$CFG->dbtype = 'sqlsrv';

In reply to Luis de Vasconcelos

Re: Upgraded Moodle site not translating some language strings when sending email

by Jamie Biddulph -

Hi Luis,

Looking at a more recent installation of Moodle (3.2.9 on my test site).

It doesn't appear that the strings {$a->firstname} {$a->lastname} are available for welcometocoursetext.

Here is the full string on my test site:

Welcome to {$a->coursename}! If you have not done so already, you should edit your profile page so that we can learn more about you: {$a->profileurl}

Regards,

Jamie

 


Average of ratings: Useful (1)
In reply to Jamie Biddulph

Re: Upgraded Moodle site not translating some language strings when sending email

by Luis de Vasconcelos -

{$a->firstname} and {$a->lastname} were available in previous 2.x versions of Moodle. Have they been removed in some 3.x version?

In reply to Luis de Vasconcelos

Re: Upgraded Moodle site not translating some language strings when sending email

by Helen Foster -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators

Hello Luis,

I checked the timeline of the string welcometocoursetext in AMOS and found no changes since it was added in 2010. I then searched for welcometocoursetext in the tracker and came across MDL-42177 in which I notice you commented.

I also noticed that the documentation Self enrolment mentions two further placeholders that may be used in the welcome message, which may be of help to you?