Bug fixed in web-based language editor

Bug fixed in web-based language editor

by Martin Dougiamas -
Number of replies: 12
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
It seems that there was a bug in admin/lang.php that affects some Windows machines (perhaps all).

The problem is that blank lines in strings get doubled (one becomes two) every time you open the language editor, and then get saved into the language file each time you save. The result for language translators was that longish strings (such as the confirmation email) keep doubling and doubling until they become hundreds of lines long.

To check if it affects you, open moodle.php of your language in a text editor and scroll down to, say, 'emailconfirmation'.

I've just fixed this bug in CVS - it seems to work OK in the tests I did on a Windows machine using Dutch files.

I'd appreciate more testing and even better, fixed checkins for languages that may have this problem. I'll be fixing anything I come across as I get time.

Thanks!
Average of ratings: -
In reply to Martin Dougiamas

Re: Bug fixed in web-based language editor

by Sven Mendler -

Hi Martin,

I have a problem with the emailconfirmation.

When a new user is announced he gets a email to confirm tha account. In these mail is only the firstname displayed.

The lastname is missing there. Have a look at my /lang/de/moodle.php:

$string['emailconfirmation'] = 'Guten Tag $a->firstname $a->lastname,

unter Verw.......";

You can see that there is the variable "$a->lastname" . I don't know where is the error.

The database field "lastname" is filled correctly.

I hope you can help me.

With kind regards

Sven

In reply to Sven Mendler

Re: Bug fixed in web-based language editor

by koen roggemans -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Translators
The $a->lastname shouldn't be there.
It should be

$string['emailconfirmation'] = 'Guten Tag $a->firstname,

unter Verwendung Ihrer ...

I fixed it in CVS, so tomorow it should be in the downloadable de lang pack.
In reply to koen roggemans

Re: Bug fixed in web-based language editor

by Ralf Hilgenstock -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Translators
Hi koen,
can you explain why you deleted this? I think I added this string, but I don't know why it must be deleted.
In reply to koen roggemans

Re: Bug fixed in web-based language editor

by Ralf Hilgenstock -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Translators
Hi Koen,
I tested it on my system. In both cases only the Firstname is printed in the mail. Your tipp seem not to be the solution
Ralf
In reply to Ralf Hilgenstock

Re: Bug fixed in web-based language editor

by Sven Mendler -

hallo ralf,

erst treffen wir uns im deutschen forum und jetzt auch noch hier :~)

es ist wohl nun doch ein bug - oder ?

ich habe es mit unterschiedlichen installationen getestet. immer das gleiche ergebnis. ich würde es auch im source-code ändern. aber bei den eingriffen, die ich bisher gemacht habe, verbaue ich mir langsam die updatefähigkeit.

Vielleicht hat ja doch noch jemand eine lösung.

schönen abend noch

mfg sven

In reply to Sven Mendler

Re: Bug fixed in web-based language editor

by Ralf Hilgenstock -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Translators
Hi Sven,
in this forum we write in english. Then other user can read the text when they have the same problem.

I change in the next day the german  conformation text so that we didn't use a name field.
Ralf

In reply to Ralf Hilgenstock

Re: Bug fixed in web-based language editor

by koen roggemans -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Translators
Ralph, the lastname can never work. It also isn't meant to be there: look at the Englisch example and look in the function wich calls the strings:
(from moodlelib.php)
}

/**
 * Send email to specified user with confirmation text and activation link.
 *
 * @uses $CFG
 * @param user $user A {@link $USER} object
 * @return boolean|string Returns "true" if mail was sent OK, "emailstop" if email
 *          was blocked by user and "false" if there was another sort of error.
 */
 function send_confirmation_email($user) {

    global $CFG;

    $site = get_site();
    $from = get_admin();

    $data->firstname = $user->firstname;
    $data->sitename = $site->fullname;
    $data->link = $CFG->wwwroot .'/login/confirm.php?p='. $user->secret .'&s='. $user->username;
    $data->admin = fullname($from) .' ('. $from->email .')';

    $message = get_string('emailconfirmation', '', $data);
    $subject = get_string('emailconfirmationsubject', '', $site->fullname);

    $messagehtml = text_to_html($message, false, false, true);

    return email_to_user($user, $from, $subject, $message, $messagehtml);

}
In reply to koen roggemans

Re: Bug fixed in web-based language editor

by Ralf Hilgenstock -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Translators
Hi Koen,

I don't speak php. So I don't understood the content of this code.

I think the code should be changed  that the confirmation text can be used with firtsname and last name of the user.
An alternative is to change the  german text, that we didn't use a name field. That is not the best solution, but I can accept it.

Ralf
In reply to koen roggemans

Re: Bug fixed in web-based language editor

by Sven Mendler -

Hi Koen,

here a suggestion. It's a quick and dirty - solution but I can't wait for a bug fixing:

function send_confirmation_email($user) {

global

With kind regards
Sven

$CFG;
$site = get_site();
$from = get_admin();
$user_address= $user->firstname." ".$user->lastname;
$data->firstname = $user_address;
...
}
In reply to Sven Mendler

Re: Bug fixed in web-based language editor

by koen roggemans -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Translators
That might work. If you want it in the main code -> file it as a feature request in the bugtracker.