Issue Details (XML | Word | Printable)

Key: MDL-18273
Type: Bug Bug
Status: Closed Closed
Resolution: Not a bug
Priority: Minor Minor
Assignee: Jerome Mouneyrac
Reporter: Ian Robotham
Votes: 1
Watchers: 5
Operations

Add/Edit UI Mockup to this issue
If you were logged in you would be able to see more operations.
Moodle

Custom Authentication Plugins do not get their language strings in User add/editing screens

Created: 16/Feb/09 11:52 PM   Updated: 03/Nov/09 10:37 PM
Return to search
Component/s: Authentication
Affects Version/s: 1.9.4
Fix Version/s: 1.9.6

File Attachments: 1. Text File MDL-18273 Auth Plugin Language Strings.patch (0.9 kB)
2. Text File MDL-18273.patch (4 kB)

Environment:
Dev: Win XP, XAMPP 1.6.7, PHP 5.2.6
Test: Ubuntu, PHP 5.2.6
Prod: Linux, PHP 5.2.5
Issue Links:
Relates
 

Participants: Darko Miletic, Eloy Lafuente (stronk7), Ian Robotham, Jerome Mouneyrac, Martin Dougiamas and Petr Skoda
Security Level: None
Resolved date: 03/Nov/09
Affected Branches: MOODLE_19_STABLE
Fixed Branches: MOODLE_19_STABLE


 Description  « Hide
In user add & editing, the language strings for custom authentication plugins are not searched for correctly.

See http://moodle.org/mod/forum/discuss.php?d=116543

Will create patch and attach in a while...

 All   Comments   Change History   Version Control      Sort Order: Ascending order - Click to sort in descending order
Ian Robotham added a comment - 17/Feb/09 12:54 AM
Patch for this issue, tested on both our local development & our test servers. Both running Moodle 1.9.4

Eloy Lafuente (stronk7) added a comment - 17/Feb/09 03:46 AM
Uhm... it seems that there are a bunch of places doing the search only against 'auth' lang file.

1) Instead of the suggested patch (that only fixes one place) I would do:

  • Move the logic of auth_plugin_base->get_title() to standalone function auth_get_title() somewhere in datalib or similar.
  • Make auth_plugin_base->get_title() to use the new standalone function
  • Make all occurrences of "auth.*title" in moodle core to use the standalone function.

2) Or alternatively:

  • Leave auth_plugin_base->get_title() unmodified.
  • Instantiate auth plugin and use its get_title() method in all occurrences of moodle core

3) Or, also:

  • Leave auth_plugin_base->get_title() unmodified.
  • Create standalone function auth_get_title() somewhere in datalib or similar.
  • Make all occurrences of "auth.*title" in moodle core to use the standalone function.
    (causes logic to be duplicated)

My +1 for 1) above.

Assigning to Jerome, please await Petr's confirmation before doing anything here. TIA!

Ciao


Petr Skoda added a comment - 04/May/09 04:00 PM
I do not like this kind of custom string handling in general.
I think that in 2.0 there should be a lang file for each plugin including the core plugins

For now I would just hack - base->get_title() to make it search the separate files too
and in 2.0 rewrite the string handling there completely

I personally hate having to instantiate object just to get the title - we do that in blocks for everything and it is a nightmare


Jerome Mouneyrac added a comment - 11/May/09 12:05 PM
Hi Petr,
auth_plugin_base->get_title() already search for separate files, I think you mean that we should use the Eloy 1) suggestion? If no, tell me. I'll fix it this avo following Eloy 1) suggestion.

For information: the bug appears in three different places, and the code is well written in two other places.


Jerome Mouneyrac added a comment - 12/May/09 02:23 PM
I attached a patch I will commit tomorrow after the build

Martin Dougiamas added a comment - 13/May/09 03:10 PM
This accidentally got into the 1.9.5 build, but it looks OK.

What exactly are we doing for this in HEAD?


Petr Skoda added a comment - 13/May/09 03:33 PM
in HEAD we should split auth.php lang file into multiple files separate for each plugin and use standard get_string() support.

Jerome Mouneyrac added a comment - 13/May/09 03:43 PM
I'll commit the current change into HEAD and write a new issue for splitting the auth language file.

Martin Dougiamas added a comment - 14/May/09 10:57 AM
Resolving this then ... Jerome, can you link to the new issue when you make it?

Jerome Mouneyrac added a comment - 14/May/09 01:16 PM
sorry I didn't commit in HEAD yet. I do this now, and create a new issue for 2.0.

Jerome Mouneyrac added a comment - 14/May/09 03:05 PM
Ok fixed on Head too.

Darko Miletic added a comment - 31/Oct/09 09:40 PM
I see this same issue back in Moodle 1.9.6+

What I did was following:
1. Made a stub for new auth plugin
2. Created supposed language files (<MOODLE>/auth/newplugin/lang/en_utf8/auth_newplugin.php)
3. Added strings:
$string['auth_newplugintitle' ] = 'New title';
$string['auth_newplugdescription'] = 'New description';

And it does not work. The only place where string was picked up was plugin title in the admin block (once the plugin was enabled).

In all other places I saw [[auth_title]] and [[auth_description]] instead of [[auth_newplugintitle]] and [[auth_newplugindescription]].


Darko Miletic added a comment - 03/Nov/09 10:31 PM
This was my mistake sorry. Not a bug.

Jerome Mouneyrac added a comment - 03/Nov/09 10:37 PM
No problem Darko