Language Customisation only working once

Re: Language Customisation only working once

by David Mudrák -
Number of replies: 0
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers Picture of Plugins guardians Picture of Testers Picture of Translators

Hmm. This will need some debugging. I can't do it on my own as I do not have IIS setup available. After the first successful check-in (save), make sure that the local language folder was created and it holds the customized translation. Then go and edit the file admin/tool/customlang/locallib.php (in 2.2) or admin/report/customlang/locallib.php (in 2.1 and 2.0). Find the method

public static function checkin($lang) {

and near the line 229 right after the fulldelete() call insert the break point:

fulldelete(self::get_localpack_location($lang));
die('Execution stopped for debugging #1'); // INSERT THIS LINE
foreach ($files as $component => $strings) {

Try to translate something again and save the customized strings. The debugging message should appear. Go into the moodledata and check if the folder containing your language customization is still there or if it was deleted. It should be deleted. If so, then remove the break point and put it into dump_strings() method in the same file. Locate the line 285 and insert the breakpoint there:

die('Execution stopped for debugging #2'); // INSERT THIS LINE
if (!$f = fopen($filepath, 'w')) {
    debugging('Unable to write '.s($filepath));

Reload the page to see the new debugging message. In this moment we need to check that the folder for local languages was recreated and what permissions it has set. IIS process has to have permission to write into it (again, I do not know much about IIS and Windows world so I can't help you much particularly here).