MDL-24233 report_customlang: display a help for {$a} placeholders
authorDavid Mudrak <david.mudrak@gmail.com>
Fri, 17 Sep 2010 18:12:41 +0000 (18:12 +0000)
committerDavid Mudrak <david.mudrak@gmail.com>
Fri, 17 Sep 2010 18:12:41 +0000 (18:12 +0000)
admin/report/customlang/lang/en/report_customlang.php
admin/report/customlang/renderer.php
admin/report/customlang/styles.css

index 4d3b7ad..d90acae 100644 (file)
@@ -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';
index 4304e38..2f8b3a1 100644 (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]->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.']'));
index a7e7a4a..15f6ad5 100644 (file)
     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;
+}