From 1828f3d5a7e9ac46fd33ca7cfd98d35e164b77ad Mon Sep 17 00:00:00 2001 From: David Mudrak Date: Fri, 17 Sep 2010 18:12:41 +0000 Subject: [PATCH] MDL-24233 report_customlang: display a help for {$a} placeholders --- admin/report/customlang/lang/en/report_customlang.php | 5 +++++ admin/report/customlang/renderer.php | 7 ++++++- admin/report/customlang/styles.css | 7 +++++++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/admin/report/customlang/lang/en/report_customlang.php b/admin/report/customlang/lang/en/report_customlang.php index 4d3b7ad2f6f..d90acaeacc7 100644 --- a/admin/report/customlang/lang/en/report_customlang.php +++ b/admin/report/customlang/lang/en/report_customlang.php @@ -49,6 +49,11 @@ $string['markuptodate'] = 'mark as up-to-date'; $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['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['savecheckin'] = 'Save and check in strings into files'; $string['savecontinue'] = 'Save and continue editing'; diff --git a/admin/report/customlang/renderer.php b/admin/report/customlang/renderer.php index 4304e38a5d6..2f8b3a1abf2 100644 --- a/admin/report/customlang/renderer.php +++ b/admin/report/customlang/renderer.php @@ -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]->attributes['class'] = 'stringid'; // 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'; // local customization of the string $textarea = html_writer::tag('textarea', s($string->local), array('name'=>'cust['.$string->id.']')); diff --git a/admin/report/customlang/styles.css b/admin/report/customlang/styles.css index a7e7a4a54c4..15f6ad572d1 100644 --- a/admin/report/customlang/styles.css +++ b/admin/report/customlang/styles.css @@ -56,3 +56,10 @@ width: 100%; min-height: 4em; } + +.path-admin-report-customlang #translator .placeholderinfo { + text-align: center; + border: 1px dotted #ddd; + background-color: #f6f6f6; + margin-top: 0.5em; +} -- 2.43.0