Moodle

Forum email is messed up in Farsi site

Details

  • Type: Bug Bug
  • Status: Open Open
  • Priority: Minor Minor
  • Resolution: Unresolved
  • Affects Version/s: 1.9, 1.9.1, 1.9.2, 1.9.3, 1.9.4
  • Fix Version/s: 2.0.8
  • Component/s: Language
  • Labels:
    None
  • Difficulty:
    Moderate
  • Affected Branches:
    MOODLE_19_STABLE
  • Fixed Branches:
    MOODLE_20_STABLE

Description

Moodle.com Staff:

We received the following from a client using Moodle 1.9.4+:

The format of the email that is sent through a forum in the Farsi site is very messed up. The post looks good in forum, but the email that the students receive is not correct: the text alignment that should be right to left is left to right and also the lines are messed up. How can I fix this problem?

Does email sent by the forum adapt formatting based on the language being used on the site? If not, what do you suggest as a solution?

Regards,
Thom

Issue Links

Activity

Hide
Petr Škoda (skodak) added a comment - - edited

This may be a problem because we do not know in language of text of the forum post - it might be a random mixture of multiple languages each with different lang.

We know:

  • site default language
  • course default language
  • user preferred language

If I remember it correctly we are guessing text direction from user's current (== default profile lang+course forced) language for that specific forum.
But ideally we should know the language and hence the direction from the text itself, but how to do that?

Show
Petr Škoda (skodak) added a comment - - edited This may be a problem because we do not know in language of text of the forum post - it might be a random mixture of multiple languages each with different lang. We know:
  • site default language
  • course default language
  • user preferred language
If I remember it correctly we are guessing text direction from user's current (== default profile lang+course forced) language for that specific forum. But ideally we should know the language and hence the direction from the text itself, but how to do that?
Hide
Martin Dougiamas added a comment -

Apart from that though, we do know the "current" language for the post ... it's what we use to display the words in the header and footer of the email.

So assuming the language is correct, ARE WE ENABLING RTL CORRECTLY IN THE EMAIL?

Show
Martin Dougiamas added a comment - Apart from that though, we do know the "current" language for the post ... it's what we use to display the words in the header and footer of the email. So assuming the language is correct, ARE WE ENABLING RTL CORRECTLY IN THE EMAIL?
Hide
Petr Škoda (skodak) added a comment -

I do not think so, there is "My language" and the UI language of user that posted the text, but the message itself might be written in a completely different language.

Show
Petr Škoda (skodak) added a comment - I do not think so, there is "My language" and the UI language of user that posted the text, but the message itself might be written in a completely different language.
Hide
Dongsheng Cai added a comment -

Martin, we are't enableing RTL in the email at all.
moodle partner Mina Comailian, reported this issue, I added rtl in html email body (get_string('thisdirection')), not sure if we need it.

Show
Dongsheng Cai added a comment - Martin, we are't enableing RTL in the email at all. moodle partner Mina Comailian, reported this issue, I added rtl in html email body (get_string('thisdirection')), not sure if we need it.
Hide
Dongsheng Cai added a comment -

havn't commit yet.

Show
Dongsheng Cai added a comment - havn't commit yet.
Hide
Koen Roggemans added a comment -

Petr, we might not know the language, but I think we know RTL or LTR: Is it possible to enter RTL tekst in an LTR form, unless you are doing something like typing sdrawkcab (backwards)?
If that is indeed not possible, then the textdirection is the direction of the text is the direction the form was where it was filled in, so that is user profiel or course language direction.

Show
Koen Roggemans added a comment - Petr, we might not know the language, but I think we know RTL or LTR: Is it possible to enter RTL tekst in an LTR form, unless you are doing something like typing sdrawkcab (backwards)? If that is indeed not possible, then the textdirection is the direction of the text is the direction the form was where it was filled in, so that is user profiel or course language direction.
Hide
Petr Škoda (skodak) added a comment -

hmm, my default language is English, but if I wanted to type some RTL language I would probably temporarily switch to that language and then just switched back when finished. In this case it would not work, because we do not store the current language anywhere, right?

Show
Petr Škoda (skodak) added a comment - hmm, my default language is English, but if I wanted to type some RTL language I would probably temporarily switch to that language and then just switched back when finished. In this case it would not work, because we do not store the current language anywhere, right?
Hide
Nikhil added a comment -

In that Case, We need to enable/embed at least direction if not language in text being sent , right ?.

Show
Nikhil added a comment - In that Case, We need to enable/embed at least direction if not language in text being sent , right ?.
Hide
Dongsheng Cai added a comment -

What about add an options to forum email, at least we should make chanage language direction possible for admin

Show
Dongsheng Cai added a comment - What about add an options to forum email, at least we should make chanage language direction possible for admin
Hide
Shamim Rezaie added a comment - - edited

I had fixed it by doing the following modification in the text_to_html function located in lib/weblib.php
I changed the following line

return '<p>'.$text.'</p>';

to

return '<p dir="'.get_string('thisdirection').'">'.$text.'</p>';
Show
Shamim Rezaie added a comment - - edited I had fixed it by doing the following modification in the text_to_html function located in lib/weblib.php I changed the following line
return '<p>'.$text.'</p>';
to
return '<p dir="'.get_string('thisdirection').'">'.$text.'</p>';
Hide
Dongsheng Cai added a comment -

Hi, Shamim

the problem is get_string('thisdirection') returns the UI languages, take moodle.org for example, we use english by default, but the content might be any langauges.

Show
Dongsheng Cai added a comment - Hi, Shamim the problem is get_string('thisdirection') returns the UI languages, take moodle.org for example, we use english by default, but the content might be any langauges.

People

Dates

  • Created:
    Updated: