Issue Details (XML | Word | Printable)

Key: MDL-19468
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Minor Minor
Assignee: Sam Hemelryk
Reporter: Andrea Bicciolo
Votes: 0
Watchers: 4
Operations

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

New auth_xxx language strings breaks backward compatibility

Created: 12/Jun/09 12:46 AM   Updated: 09/Oct/09 03:29 PM
Component/s: Administration
Affects Version/s: 1.9.5
Fix Version/s: None

File Attachments: 1. Text File split.lang.packs.20081008.patch (252 kB)
2. File tool.auth.lang.split.php (12 kB)
3. File tool.auth.lang.split.v2.php (14 kB)

Issue Links:
Relates
 

Database: MySQL
Participants: Andrea Bicciolo, Martin Dougiamas, Sam Hemelryk and Tim Hunt
Security Level: None
QA Assignee: Jerome Mouneyrac
Resolved date: 09/Oct/09
Affected Branches: MOODLE_19_STABLE


 Description  « Hide
The just released new auth_xxx.php language strings as well the reduced auth.php found in th English language pack break backward compatibility when a non-English language pack uses the same schema in 19.x or previous versions of Moodle.

While in Moodle 2.0 the new language strings schema works fine, in previous version of Moodle strings are still searched in auth.php, thus on non-English language all plugins strings default to English.

Workaround:
keep ORPHANED strings in auth.php



 All   Comments   Change History   Version Control      Sort Order: Ascending order - Click to sort in descending order
Tim Hunt added a comment - 30/Jun/09 09:04 AM
Yes, we need to keep orphaned strings in auth.php.

Also, we should automatically create the new auth_xxx.php lang files for all languages - that should be an easy script to write. Much more sensible that translators for 80 different languages doing it manually.

Assigning to Sam.


Tim Hunt added a comment - 30/Jun/09 09:04 AM
I meant to add, related forum discussion: http://moodle.org/mod/forum/discuss.php?d=126835

Andrea Bicciolo added a comment - 30/Jun/09 06:10 PM
Tim,
thanks for the comment. Please make sure automated creation do not overwrite existing file: I have already committed the new splitted aut_xxx.php

Martin Dougiamas added a comment - 02/Oct/09 03:27 PM
In 1.9.5+ the code searches the new auth_xxxx locations.

But yes, creating all the auth_xxx.php files in all lang packs would be a good idea for all those non-English users.

And we need to keep ALL strings in auth.php for compat with 1.8, old 1.9 etc ...


Sam Hemelryk added a comment - 08/Oct/09 02:18 PM
Hi Guys,
I've written a small patch the does the following things for every language pack in Moodle:

1. Copy any strings defined in auth_*.php that are not in auth.php into auth.php
2. Create auth_*.php files if they don't already exist based on the files in en_utf8
3. Copy module specific strings from auth.php to auth_module.php files based on the strings as they exist in en_utf8

This ensures that all language packs have a language file for all auth plugins, and that all auth strings are duplicated in auth.php to ensure backwards compatibility.

If someone could please have a look at the patch just to make sure everything is OK. I've also attached the script I used encase anyone in the future needs to do something similar.

Cheers all
Sam


Sam Hemelryk added a comment - 08/Oct/09 02:20 PM
Added Jerome as QA, thanks Jerome

Martin Dougiamas added a comment - 08/Oct/09 04:25 PM
The format of the resulting files is slightly different to normal ... subtle differences in quoting/string delimeters could cause regressions.

I recommend building up the files in arrays and then using the lang_save_file() function to save them into files. Gives you a shorter script too.

A look at admin/lang.php could be useful too.


Sam Hemelryk added a comment - 09/Oct/09 01:31 PM
Cheers for the feedback Martin.
I have attached the revised tool, it now properly fixes the strings before writing them to the file and uses single quotes rather than double.
I won't attach the new patch as it is very large (1.8M) however I have shown this to Martin and after some testing I will start commiting language pack changes.

Sam Hemelryk added a comment - 09/Oct/09 03:29 PM
Done, and done.
auth_*.php files have been created for all language packs that have an auth.php file, and at the same time language strings for those packs were fixed as required by this issue.
I tested several language packs with a couple of auth methods, and ran lint over every single file that was changed.