MDL-23514 lang : Adding an option to force language of documentation links

This commit is contained in:
Daniel Neis
2013-06-16 14:51:59 -03:00
committed by Daniel Neis Araujo
parent f192883305
commit 9452cae8dd
3 changed files with 14 additions and 3 deletions
+3
View File
@@ -183,6 +183,9 @@ if ($hassiteconfig) { // speedup for non-admins, add all caps used on this page
// "documentation" settingpage
$temp = new admin_settingpage('documentation', new lang_string('moodledocs'));
$temp->add(new admin_setting_configtext('docroot', new lang_string('docroot', 'admin'), new lang_string('configdocroot', 'admin'), 'http://docs.moodle.org', PARAM_URL));
$ltemp = array('' => get_string('forceno'));
$ltemp += get_string_manager()->get_list_of_translations(true);
$temp->add(new admin_setting_configselect('doclang', get_string('doclang', 'admin'), get_string('configdoclang', 'admin'), '', $ltemp));
$temp->add(new admin_setting_configcheckbox('doctonewwindow', new lang_string('doctonewwindow', 'admin'), new lang_string('configdoctonewwindow', 'admin'), 0));
$ADMIN->add('appearance', $temp);
+2
View File
@@ -193,6 +193,7 @@ $string['configenabledevicedetection'] = 'Enables detection of mobiles, smartpho
$string['configdisableuserimages'] = 'Disable the ability for users to change user profile images.';
$string['configdisplayloginfailures'] = 'This will display information to selected users about previous failed logins.';
$string['configdndallowtextandlinks'] = 'Enable or disable the dragging and dropping of text and links onto a course page, alongside the dragging and dropping of files. Note that the dragging of text into Firefox or between different browsers is unreliable and may result in no data being uploaded, or corrupted text being uploaded.';
$string['configdoclang'] = 'This language will be used in links for the documentation pages.';
$string['configdocroot'] = 'Defines the path to the Moodle Docs. You can change this if you wish to have your own custom online documentation. However, if you do that make sure that the paths in your documentation follow the same format as http://docs.moodle.org.';
$string['configdoctonewwindow'] = 'If you enable this, then links to Moodle Docs will be shown in a new window.';
$string['configeditordictionary'] = 'This value will be used if aspell doesn\'t have dictionary for users own language.';
@@ -442,6 +443,7 @@ $string['disableuserimages'] = 'Disable user profile images';
$string['displayerrorswarning'] = 'Enabling the PHP setting <em>display_errors</em> is not recommended on production sites because some error messages may reveal sensitive information about your server.';
$string['displayloginfailures'] = 'Display login failures to';
$string['dndallowtextandlinks'] = 'Drag and drop upload of text/links';
$string['doclang'] = 'Language for docs';
$string['docroot'] = 'Moodle Docs document root';
$string['doctonewwindow'] = 'Open in new window';
$string['download'] = 'Download';
+9 -3
View File
@@ -643,10 +643,16 @@ function get_docs_url($path = null) {
// that will ensure people end up at the latest version of the docs.
$branch = '.';
}
if (!empty($CFG->docroot)) {
return $CFG->docroot . '/' . $branch . '/' . current_language() . '/' . $path;
if (empty($CFG->doclang)) {
$lang = current_language();
} else {
return 'http://docs.moodle.org/'. $branch . '/' . current_language() . '/' . $path;
$lang = $CFG->doclang;
}
$end = '/' . $branch . '/' . $lang . '/' . $path;
if (empty($CFG->docroot)) {
return 'http://docs.moodle.org'. $end;
} else {
return $CFG->docroot . $end ;
}
}