Help files in localised language pack

Help files in localised language pack

von Terry Wade -
Anzahl Antworten: 6

I am customising version 1.6.3+ and have created a localised version of en_utf8 in my moodledata/lang/en_utf8_local folder. This all works fine so far with locally customised strings being used where they are defined in the local pack.

But - I can't find a way to get localised help files working. If I put them in my local moodledata/lang/en_utf8_local/help they are not found. The problem seems to be that help.php is looking up the current language and getting 'en_utf8'  - as that is what is loaded, and goes looking in the 'moodle/lang/en_utf8' folder. Should the system be checking first to see if there is an 'en_utf8_local' folder and setting the operating language to that instead of 'en_utf8'? 

Also been looking at the problem with editing the help files through the admin/language interface (local or normal moodle/lang/en_utf8/help). I get the message that in order to edit these files I need to have the lang pack in my moodledata/lang folder. On looking at the code I see that in langdoc.php around line 51 it says:

$langdir = "CFG->dataroot/lang/$currentlang";

where $currentlang is 'en_utf8'. As the help files are under either 'moodle/lang/en_utf8' or 'moodledata/lang/en_utf8_local' the system has no chance of finding them for editing??

I've had a good look around these forums but can't find much on localised help files - so am in need of some help on this one.

Thanks

Terry Wade

Als Antwort auf Terry Wade

Re: Help files in localised language pack

von David Mudrák -
Nutzerbild von Core developers Nutzerbild von Documentation writers Nutzerbild von Moodle HQ Nutzerbild von Particularly helpful Moodlers Nutzerbild von Peer reviewers Nutzerbild von Plugin developers Nutzerbild von Plugins guardians Nutzerbild von Testers Nutzerbild von Translators
Hi Terry.

Unfortunately, you are right traurig. Current (1.7) help.php does not use _local lang packs and admin/langdoc.php tool is missing "switch to _local" feature. Thus you are not able to display or create local modifications of help files.

I have reported this as improvement requests MDL-8089 and MDL-8090 and assigned them to myself. I will look at it during next week.

Thank you for your post.
Als Antwort auf David Mudrák

Re: Help files in localised language pack

von David Mudrák -
Nutzerbild von Core developers Nutzerbild von Documentation writers Nutzerbild von Moodle HQ Nutzerbild von Particularly helpful Moodlers Nutzerbild von Peer reviewers Nutzerbild von Plugin developers Nutzerbild von Plugins guardians Nutzerbild von Testers Nutzerbild von Translators
MDL-8089 should be quite easy to implement. Please, edit your help.php according to the patch published in the bug tracker. Then copy modified help files into lang/en_utf8_local/help in your datadir. Please, let me know how it works.
Als Antwort auf David Mudrák

Re: Help files in localised language pack

von David Mudrák -
Nutzerbild von Core developers Nutzerbild von Documentation writers Nutzerbild von Moodle HQ Nutzerbild von Particularly helpful Moodlers Nutzerbild von Peer reviewers Nutzerbild von Plugin developers Nutzerbild von Plugins guardians Nutzerbild von Testers Nutzerbild von Translators
The patch implementing MDL-8089 is now commited in HEAD (rev 1.36)
Als Antwort auf David Mudrák

Re: Help files in localised language pack

von Terry Wade -

Hi David,

Thanks for taking this one on - I'm still working in 1.6.3+ (very localised version so we won't be moving to a later base for a while). I'll have a go at patching my version and see what happens.

I ended up with a workaround by creating a 'new' language pack rather than a localised version of en_utf8 - worked fine except that I was caught out at first by the 10 char limit on the language pack name when recorded in the database table.

Might take a little while before I can test it out though - I'll let you know

Thanks again

Terry

Als Antwort auf David Mudrák

Re: Help files in localised language pack

von Gisela Hillenbrand -
Nutzerbild von Documentation writers
Hi David,

I had the same problem as Terry.
So I implemented your patch MDL-8089. It works fine if in the course settings no language is forced. It doesn't work if a language is selected in the course settings. So it seems that your patch must also be added in the else branch. I tried the following code and it worked:

// Get the list of parent languages.
if (empty($forcelang)) {
$langs = array(current_language(),
get_string('parentlanguage'), 'en_utf8'); // Fallback

+ // _local language packs take precedence
+ $xlangs = array();
+ foreach ($langs as $lang) {
+ $xlangs[] = $lang . '_local';
+ $xlangs[] = $lang;
+ }
+ $langs = $xlangs;
+ unset($xlangs);
} else {
$langs = array($forcelang);
+ $xlangs = array();
+ foreach ($langs as $lang) {
+ $xlangs[] = $lang . '_local';
+ $xlangs[] = $lang;
+ }
+ $langs = $xlangs;
+ unset($xlangs);
}

Sorry, I don't get the code formatted better.

Could you please check this.

Gisela

Als Antwort auf Gisela Hillenbrand

Re: Help files in localised language pack

von David Mudrák -
Nutzerbild von Core developers Nutzerbild von Documentation writers Nutzerbild von Moodle HQ Nutzerbild von Particularly helpful Moodlers Nutzerbild von Peer reviewers Nutzerbild von Plugin developers Nutzerbild von Plugins guardians Nutzerbild von Testers Nutzerbild von Translators
Thank you, Gisela. I have modified your patch a bit in order not to use the same code in both branches. So the "_local" additions are made just after the "if forcelang" statement. Committed in 1.38