Commit 75316569 authored by Robert Lyon's avatar Robert Lyon

Bug 1626281: Pass the 'section' for js lang strings for better debugging.

@TODO: Allow the js lang strings be picked based on on the section
supplied so that name/section make them unique rather than just name

behatnotneeded - existing test will be sufficient

Change-Id: Ie64725702527b7fd9a08749816ea1fd084e95a2d
Signed-off-by: Robert Lyon's avatarRobert Lyon <robertl@catalyst.net.nz>
parent 7de2bdc6
......@@ -207,7 +207,7 @@ function saveitem(itemid) {
var f = $('form');
var name = $('name'+itemid).value;
if (name == '') {
displayMessage(get_string('namedfieldempty',{$getstring['name']}),'error');
displayMessage(get_string('namedfieldempty', 'mahara', {$getstring['name']}), 'error');
return false;
}
......
......@@ -225,11 +225,11 @@ function saveitem(itemid) {
var name = $('name'+itemid).value;
var linkedto = $('linkedto'+itemid).value;
if (name == '') {
displayMessage(get_string('namedfieldempty',{$getstring['name']}),'error');
displayMessage(get_string('namedfieldempty', 'mahara', {$getstring['name']}), 'error');
return false;
}
if (linkedto == '') {
displayMessage(get_string('namedfieldempty',{$getstring['linkedto']}),'error');
displayMessage(get_string('namedfieldempty', ' mahara', {$getstring['linkedto']}), 'error');
return false;
}
......
......@@ -100,7 +100,7 @@ function FileBrowser(idprefix, folderid, config, globalconfig) {
self.nextupload++;
var message = makeMessage(DIV(null,
SPAN({'class': 'icon-spinner icon-pulse icon icon-lg'}), ' ',
get_string('uploadingfiletofolder',e.name,self.foldername)
get_string('uploadingfiletofolder','artefact.file',e.name,self.foldername)
), 'info');
setNodeAttribute(message, 'id', 'uploadstatusline' + self.nextupload);
appendChildNodes(self.id + '_upload_messages', message);
......@@ -116,7 +116,7 @@ function FileBrowser(idprefix, folderid, config, globalconfig) {
var localname = $(self.id + '_userfile').files[i].name;
var message = makeMessage(DIV(null,
SPAN({'class': 'icon-spinner icon-pulse icon icon-lg'}), ' ',
get_string('uploadingfiletofolder',localname,self.foldername)
get_string('uploadingfiletofolder','artefact.file',localname,self.foldername)
), 'ok');
setNodeAttribute(message, 'id', 'uploadstatusline' + self.nextupload);
appendChildNodes(self.id + '_upload_messages', message);
......@@ -174,7 +174,7 @@ function FileBrowser(idprefix, folderid, config, globalconfig) {
message = get_string('nametoolong');
}
else if (self.fileexists(name)) {
message = get_string('filewithnameexists', name);
message = get_string('filewithnameexists', 'artefact.file', name);
}
}
if (message) {
......@@ -200,7 +200,7 @@ function FileBrowser(idprefix, folderid, config, globalconfig) {
message = get_string('nametoolong');
}
else if (self.fileexists(name, this.name.replace(/.*_update\[(\d+)\]$/, '$1'))) {
message = get_string('filewithnameexists', name);
message = get_string('filewithnameexists', 'artefact.file', name);
}
}
if (message) {
......@@ -408,7 +408,7 @@ function FileBrowser(idprefix, folderid, config, globalconfig) {
if (self.filedata[id].childcount > 0) {
warn += get_string('foldernotempty') + ' ';
if (self.filedata[id].profileiconcount > 0) {
warn += get_string('foldercontainsprofileicons', self.filedata[id].profileiconcount) + ' ';
warn += get_string('foldercontainsprofileicons', 'artefact.file', self.filedata[id].profileiconcount) + ' ';
}
warn += get_string('confirmdeletefolderandcontents');
}
......@@ -421,7 +421,7 @@ function FileBrowser(idprefix, folderid, config, globalconfig) {
warn += get_string('defaultprofileicon') + ' ';
}
if (self.filedata[id].attachcount > 0) {
warn += get_string('fileattachedtoportfolioitems', self.filedata[id].attachcount) + ' ';
warn += get_string('fileattachedtoportfolioitems', 'artefact.file', self.filedata[id].attachcount) + ' ';
}
if (self.filedata[id].viewcount > 0) {
warn += get_string('fileappearsinviews') + ' ';
......@@ -533,7 +533,7 @@ function FileBrowser(idprefix, folderid, config, globalconfig) {
if (elemid != moveid) {
var displaytitle = title.find('.display-title').html();
if (typeof displaytitle !== 'undefined') {
var link = $j('<a>').attr('href', '#').html(get_string('moveto', displaytitle));
var link = $j('<a>').attr('href', '#').html(get_string('moveto', 'artefact.file', displaytitle));
link.on('click keydown', function(e) {
if ((e.type === 'click' || e.keyCode === 32) && !e.isDefaultPrevented()) {
self.setfocus = 'changefolder:' + elemid;
......
......@@ -10,7 +10,7 @@
var currentncols = $('#customrow_' + numrows).find('#selectnumcolsrow_' + numrows).val();
var currentcollayout = $('#customrow_' + numrows).find('#selectcollayoutrow_' + numrows).val();
newrow.find('.customrowtitle').html('<strong>' + get_string('rownr', numrows + 1) + '</strong>');
newrow.find('.customrowtitle').html('<strong>' + get_string('rownr', 'view', numrows + 1) + '</strong>');
newrow.attr('id', 'customrow_' + (numrows + 1));
newid = 'selectnumcolsrow_' + (numrows + 1);
......@@ -47,7 +47,7 @@
$('#viewlayout_customlayoutnumrows').val(numrows - 1);
var inc = 1;
$('#customrows .customrow').each(function() {
$(this).find('.customrowtitle').html('<strong>' + get_string('rownr', inc) + '</strong>');
$(this).find('.customrowtitle').html('<strong>' + get_string('rownr', 'view', inc) + '</strong>');
$(this).attr('id', 'customrow_' + inc);
$(this).find('.selectnumcols').attr('id', 'selectnumcolsrow_' + inc);
$(this).find('input').attr('class', 'removecustomrow_' + inc);
......@@ -118,7 +118,7 @@
else {
// make a row for it
var rowtitlediv = $('<h3>').attr('class', 'title');
rowtitlediv.html('<strong>' + get_string('nrrows', numrows) + '</strong>');
rowtitlediv.html('<strong>' + get_string('nrrows', 'view', numrows) + '</strong>');
var rowcontainer = $('<div>').attr({
'id': 'viewlayout_advancedlayoutselect_row' + numrows,
'class': 'fr'
......
......@@ -32,7 +32,11 @@ function get_string(name) {
}
str = str[index];
}
var i = 0;
// Strings should have their 'section' set for easier debugging.
// So we need to ignore args[1] when replacing '%s' for args
// @TODO: get the javascript strings to respect 'section' so that
// strings with same key but different section can be used without clashes.
var i = 1;
return str.replace(/%((%)|s|d)/g, function (m) { return m[2] || args[i++]; });
}
......
......@@ -61,7 +61,7 @@ function checkTextareaMaxLength(elementName, isWysiwyg, maxlength) {
if (isElementDefined(maxlength)) {
var triggerLimit = parseInt(maxlength) + 1;
var errorMessage = get_string('rule.maxlength.maxlength', maxlength);
var errorMessage = get_string('rule.maxlength.maxlength', 'pieform', maxlength);
if (usingParent == true) {
var errorElementsInContainer = textareaContainer.parent().find('.' + errorClass);
......
......@@ -324,7 +324,7 @@
}
});
addblockdialog.find('h4.modal-title').text(get_string('addblock', element.text()));
addblockdialog.find('h4.modal-title').text(get_string('addblock', 'view', element.text()));
computeColumnInputs(addblockdialog);
addblockdialog.find('.block-inner').removeClass('hidden');
addblockdialog.find('.cell-chooser input:first').prop('checked', true);
......@@ -414,7 +414,7 @@
selectbox = $('#addblock_position');
element.find('.column-content .blockinstance .blockinstance-header').each(function() {
options.push(get_string('blockorderafter', $(this).html()));
options.push(get_string('blockorderafter', 'view', $(this).html()));
});
......@@ -713,7 +713,7 @@
label = $('<label>').addClass('cell').attr('for', 'cellchooser_' + value).attr('style', $(cols[j]).attr('style'));
label.append(radio)
.append($('<span>').addClass('pseudolabel mll').html(get_string('cellposition', i + 1, j + 1)));
.append($('<span>').addClass('pseudolabel mll').html(get_string('cellposition', 'view', i + 1, j + 1)));
row.append(label);
......
Markdown is supported
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