MDL-24233 report_customlang: display a help for {$a} placeholders

This commit is contained in:
David Mudrak 2010-09-17 18:12:41 +00:00
parent 99d671ebd3
commit 1828f3d5a7
3 changed files with 18 additions and 1 deletions

View file

@ -49,6 +49,11 @@ $string['markuptodate'] = 'mark as up-to-date';
$string['modifiedno'] = 'There are no modified strings to check in.'; $string['modifiedno'] = 'There are no modified strings to check in.';
$string['modifiednum'] = 'There are {$a} modified strings. You must check in them into disk to store them permanently.'; $string['modifiednum'] = 'There are {$a} modified strings. You must check in them into disk to store them permanently.';
$string['nostringsfound'] = 'No strings found, please modify the filter settings'; $string['nostringsfound'] = 'No strings found, please modify the filter settings';
$string['placeholder'] = 'Placeholders';
$string['placeholder_help'] = 'Placeholders are special statements like `{$a}` or `{$a->something}` within the string. They are replaced with a value when the string is actually printed.
It is important to copy them exactly as they are in the original string. Do not translate them nor change their left-to-right orientation.';
$string['placeholderwarning'] = 'string contains a placeholder';
$string['pluginname'] = 'Language customization'; $string['pluginname'] = 'Language customization';
$string['savecheckin'] = 'Save and check in strings into files'; $string['savecheckin'] = 'Save and check in strings into files';
$string['savecontinue'] = 'Save and continue editing'; $string['savecontinue'] = 'Save and continue editing';

View file

@ -75,7 +75,12 @@ class report_customlang_renderer extends plugin_renderer_base {
$cells[1] = new html_table_cell(html_writer::tag('div', s($string->stringid), array('class' => 'stringid'))); $cells[1] = new html_table_cell(html_writer::tag('div', s($string->stringid), array('class' => 'stringid')));
$cells[1]->attributes['class'] = 'stringid'; $cells[1]->attributes['class'] = 'stringid';
// master translation of the string // master translation of the string
$cells[2] = new html_table_cell(html_writer::tag('div', s($string->master), array('class' => 'preformatted'))); $master = html_writer::tag('div', s($string->master), array('class' => 'preformatted'));
if (preg_match('/\{\$a(->.+)?\}/', $string->master)) {
$master .= html_writer::tag('div', $this->help_icon('placeholder', 'report_customlang',
get_string('placeholderwarning', 'report_customlang')), array('class' => 'placeholderinfo'));
}
$cells[2] = new html_table_cell($master);
$cells[2]->attributes['class'] = 'standard master'; $cells[2]->attributes['class'] = 'standard master';
// local customization of the string // local customization of the string
$textarea = html_writer::tag('textarea', s($string->local), array('name'=>'cust['.$string->id.']')); $textarea = html_writer::tag('textarea', s($string->local), array('name'=>'cust['.$string->id.']'));

View file

@ -56,3 +56,10 @@
width: 100%; width: 100%;
min-height: 4em; min-height: 4em;
} }
.path-admin-report-customlang #translator .placeholderinfo {
text-align: center;
border: 1px dotted #ddd;
background-color: #f6f6f6;
margin-top: 0.5em;
}