Commit 585cb16c authored by Tobias Zeuch's avatar Tobias Zeuch Committed by Robert Lyon
Browse files

enable translation for strings in customlayout.js



Bug 1371460: Some strings still where hard coded in English in htdocs/js/customlayout.js. This patch puts them into lang/en.utf8/view.php for translation and adds them to the smarty-template in layout.php

Change-Id: I182673f18de2ca5d50d4cfa0f4461a4699695bd5
Signed-off-by: default avatarTobias Zeuch <tobias.zeuch@kit.edu>
parent 4a2e4ed3
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
var newrow = $('#customrow_' + numrows).clone(); var newrow = $('#customrow_' + numrows).clone();
var currentncols = $('#customrow_' + numrows).find('#selectnumcolsrow_' + numrows).val(); var currentncols = $('#customrow_' + numrows).find('#selectnumcolsrow_' + numrows).val();
var currentcollayout = $('#customrow_' + numrows).find('#selectcollayoutrow_' + numrows).val(); var currentcollayout = $('#customrow_' + numrows).find('#selectcollayoutrow_' + numrows).val();
$(newrow).find('.customrowtitle').html('<strong>Row ' + (numrows + 1) + '</strong>'); $(newrow).find('.customrowtitle').html('<strong>' + get_string('rownr', numrows + 1) + '</strong>');
$(newrow).attr('id', 'customrow_' + (numrows + 1)); $(newrow).attr('id', 'customrow_' + (numrows + 1));
$(newrow).find('#selectnumcolsrow_' + numrows).attr('value', currentncols); $(newrow).find('#selectnumcolsrow_' + numrows).attr('value', currentncols);
$(newrow).find('#selectnumcolsrow_' + numrows).attr('id', 'selectnumcolsrow_' + (numrows + 1)); $(newrow).find('#selectnumcolsrow_' + numrows).attr('id', 'selectnumcolsrow_' + (numrows + 1));
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
$('#viewlayout_customlayoutnumrows').val(numrows - 1); $('#viewlayout_customlayoutnumrows').val(numrows - 1);
var inc = 1; var inc = 1;
$('#customrows .customrow').each(function() { $('#customrows .customrow').each(function() {
$(this).find('.customrowtitle').html('<strong>Row ' + inc + '</strong>'); $(this).find('.customrowtitle').html('<strong>' + get_string('rownr', inc) + '</strong>');
$(this).attr('id', 'customrow_' + inc); $(this).attr('id', 'customrow_' + inc);
$(this).find('.selectnumcols').attr('id', 'selectnumcolsrow_' + inc); $(this).find('.selectnumcols').attr('id', 'selectnumcolsrow_' + inc);
$(this).find('input').attr('class', 'removecustomrow_' + inc); $(this).find('input').attr('class', 'removecustomrow_' + inc);
...@@ -109,7 +109,7 @@ ...@@ -109,7 +109,7 @@
else { else {
// make a row for it // make a row for it
var rowtitlediv = $('<h3>').attr('class', 'title'); var rowtitlediv = $('<h3>').attr('class', 'title');
rowtitlediv.html('<strong>' + numrows + ' rows</strong>'); rowtitlediv.html('<strong>' + get_string('nrrows', numrows) + '</strong>');
var rowcontainer = $('<div>').attr({ var rowcontainer = $('<div>').attr({
'id': 'viewlayout_advancedlayoutselect_row' + numrows, 'id': 'viewlayout_advancedlayoutselect_row' + numrows,
'class': 'fr' 'class': 'fr'
...@@ -221,7 +221,7 @@ ...@@ -221,7 +221,7 @@
'title': data.data.alttext 'title': data.data.alttext
}); });
if (data.data.newimage) { if (data.data.newimage) {
$('#custompreview').html('<p>Generating preview...</p>'); $('#custompreview').html('<p>' + get_string('generatingpreview', 'view') + '</p>');
// delay to allow image to be written to disk // delay to allow image to be written to disk
setTimeout(function() { setTimeout(function() {
$('#custompreview').html(pi); $('#custompreview').html(pi);
......
...@@ -239,6 +239,12 @@ $string['cellposition'] = 'Row %s Column %s'; ...@@ -239,6 +239,12 @@ $string['cellposition'] = 'Row %s Column %s';
$string['blockorder'] = 'Position'; $string['blockorder'] = 'Position';
$string['blockordertop'] = 'Top of column'; $string['blockordertop'] = 'Top of column';
$string['blockorderafter'] = 'After "%s"'; $string['blockorderafter'] = 'After "%s"';
$string['rownr'] = 'Row %s';
$string['nrrows'] = array(
'%s row',
'%s rows',
);
$string['generatingpreview'] = 'Generating preview...';
$string['addnewblockhere'] = 'Add new block here'; $string['addnewblockhere'] = 'Add new block here';
$string['add'] = 'Add'; $string['add'] = 'Add';
......
...@@ -160,7 +160,7 @@ $layoutform = pieform($layoutform); ...@@ -160,7 +160,7 @@ $layoutform = pieform($layoutform);
$javascript = array('jquery','js/jquery/jquery-ui/js/jquery-ui-1.8.19.custom.min.js', 'js/customlayout.js','js/jquery/modernizr.custom.js'); $javascript = array('jquery','js/jquery/jquery-ui/js/jquery-ui-1.8.19.custom.min.js', 'js/customlayout.js','js/jquery/modernizr.custom.js');
$stylesheets[] = '<link rel="stylesheet" type="text/css" href="' . get_config('wwwroot') . 'js/jquery/jquery-ui/css/custom-theme/jquery-ui-1.8.20.custom.css?v=' . get_config('release'). '">'; $stylesheets[] = '<link rel="stylesheet" type="text/css" href="' . get_config('wwwroot') . 'js/jquery/jquery-ui/css/custom-theme/jquery-ui-1.8.20.custom.css?v=' . get_config('release'). '">';
$smarty = smarty($javascript, $stylesheets, array('view' => array('Row', 'removethisrow')), array('sidebars' => false)); $smarty = smarty($javascript, $stylesheets, array('view' => array('Row', 'removethisrow', 'rownr', 'nrrows', 'generatingpreview')), array('sidebars' => false));
$smarty->assign('INLINEJAVASCRIPT', $inlinejavascript); $smarty->assign('INLINEJAVASCRIPT', $inlinejavascript);
$smarty->assign('form', $layoutform); $smarty->assign('form', $layoutform);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment