use interpolation for some translations in js

This commit is contained in:
scambra 2012-09-26 07:46:04 +02:00
parent e7c9d5fe54
commit c814a7a841
3 changed files with 17 additions and 17 deletions

View File

@ -189,9 +189,9 @@ var FileList={
checkName:function(oldName, newName, isNewFile) { checkName:function(oldName, newName, isNewFile) {
if (isNewFile || $('tr').filterAttr('data-file', newName).length > 0) { if (isNewFile || $('tr').filterAttr('data-file', newName).length > 0) {
if (isNewFile) { if (isNewFile) {
$('#notification').html(escapeHTML(newName)+' '+t('files', 'already exists')+'<span class="replace">'+t('files', 'replace')+'</span><span class="suggest">'+t('files', 'suggest name')+'</span><span class="cancel">'+t('files', 'cancel')+'</span>'); $('#notification').html(t('files', '{new_name} already exists', {new_name: escapeHTML(newName)})+'<span class="replace">'+t('files', 'replace')+'</span><span class="suggest">'+t('files', 'suggest name')+'</span><span class="cancel">'+t('files', 'cancel')+'</span>');
} else { } else {
$('#notification').html(escapeHTML(newName)+' '+t('files', 'already exists')+'<span class="replace">'+t('files', 'replace')+'</span><span class="cancel">'+t('files', 'cancel')+'</span>'); $('#notification').html(t('files', '{new_name} already exists', {new_name: escapeHTML(newName)})+'<span class="replace">'+t('files', 'replace')+'</span><span class="cancel">'+t('files', 'cancel')+'</span>');
} }
$('#notification').data('oldName', oldName); $('#notification').data('oldName', oldName);
$('#notification').data('newName', newName); $('#notification').data('newName', newName);
@ -238,9 +238,9 @@ var FileList={
FileList.finishReplace(); FileList.finishReplace();
}; };
if (isNewFile) { if (isNewFile) {
$('#notification').html(t('files', 'replaced')+' '+newName+'<span class="undo">'+t('files', 'undo')+'</span>'); $('#notification').html(t('files', 'replaced {new_name}', {new_name: newName})+'<span class="undo">'+t('files', 'undo')+'</span>');
} else { } else {
$('#notification').html(t('files', 'replaced')+' '+newName+' '+t('files', 'with')+' '+oldName+'<span class="undo">'+t('files', 'undo')+'</span>'); $('#notification').html(t('files', 'replaced {new_name} with {old_name}', {new_name: newName}, {old_name: oldName})+'<span class="undo">'+t('files', 'undo')+'</span>');
} }
$('#notification').fadeIn(); $('#notification').fadeIn();
}, },
@ -272,9 +272,9 @@ var FileList={
} else { } else {
// NOTE: Temporary fix to change the text to unshared for files in root of Shared folder // NOTE: Temporary fix to change the text to unshared for files in root of Shared folder
if ($('#dir').val() == '/Shared') { if ($('#dir').val() == '/Shared') {
$('#notification').html(t('files', 'unshared')+' '+ escapeHTML(files) +'<span class="undo">'+t('files', 'undo')+'</span>'); $('#notification').html(t('files', 'unshared {files}', {'files': escapeHTML(files)})+'<span class="undo">'+t('files', 'undo')+'</span>');
} else { } else {
$('#notification').html(t('files', 'deleted')+' '+ escapeHTML(files)+'<span class="undo">'+t('files', 'undo')+'</span>'); $('#notification').html(t('files', 'deleted {files}', {'files': escapeHTML(files)})+'<span class="undo">'+t('files', 'undo')+'</span>');
} }
$('#notification').fadeIn(); $('#notification').fadeIn();
} }

View File

@ -262,7 +262,7 @@ $(document).ready(function() {
uploadtext.text(t('files', '1 file uploading')); uploadtext.text(t('files', '1 file uploading'));
uploadtext.show(); uploadtext.show();
} else { } else {
uploadtext.text(currentUploads + ' ' + t('files', 'files uploading')); uploadtext.text(t('files', '{count} files uploading', {count: currentUploads}));
} }
} }
} }
@ -307,7 +307,7 @@ $(document).ready(function() {
uploadtext.text(''); uploadtext.text('');
uploadtext.hide(); uploadtext.hide();
} else { } else {
uploadtext.text(currentUploads + ' ' + t('files', 'files uploading')); uploadtext.text(t('files', '{count} files uploading', {count: currentUploads}));
} }
}) })
.error(function(jqXHR, textStatus, errorThrown) { .error(function(jqXHR, textStatus, errorThrown) {
@ -322,7 +322,7 @@ $(document).ready(function() {
uploadtext.text(''); uploadtext.text('');
uploadtext.hide(); uploadtext.hide();
} else { } else {
uploadtext.text(currentUploads + ' ' + t('files', 'files uploading')); uploadtext.text(t('files', '{count} files uploading', {count: currentUploads}));
} }
$('#notification').hide(); $('#notification').hide();
$('#notification').text(t('files', 'Upload cancelled.')); $('#notification').text(t('files', 'Upload cancelled.'));
@ -678,7 +678,7 @@ function scanFiles(force,dir){
var scannerEventSource=new OC.EventSource(OC.filePath('files','ajax','scan.php'),{force:force,dir:dir}); var scannerEventSource=new OC.EventSource(OC.filePath('files','ajax','scan.php'),{force:force,dir:dir});
scanFiles.cancel=scannerEventSource.close.bind(scannerEventSource); scanFiles.cancel=scannerEventSource.close.bind(scannerEventSource);
scannerEventSource.listen('scanning',function(data){ scannerEventSource.listen('scanning',function(data){
$('#scan-count').text(data.count + ' ' + t('files', 'files scanned')); $('#scan-count').text(t('files', '{count} files scanned', {count: data.count}));
$('#scan-current').text(data.file+'/'); $('#scan-current').text(data.file+'/');
}); });
scannerEventSource.listen('success',function(success){ scannerEventSource.listen('success',function(success){
@ -788,9 +788,9 @@ function procesSelection(){
var selection=''; var selection='';
if(selectedFolders.length>0){ if(selectedFolders.length>0){
if(selectedFolders.length==1){ if(selectedFolders.length==1){
selection+='1 '+t('files','folder'); selection+=t('files','1 folder');
}else{ }else{
selection+=selectedFolders.length+' '+t('files','folders'); selection+=t('files','{count} folders',{count: selectedFolders.length});
} }
if(selectedFiles.length>0){ if(selectedFiles.length>0){
selection+=' & '; selection+=' & ';
@ -798,9 +798,9 @@ function procesSelection(){
} }
if(selectedFiles.length>0){ if(selectedFiles.length>0){
if(selectedFiles.length==1){ if(selectedFiles.length==1){
selection+='1 '+t('files','file'); selection+=t('files','1 file');
}else{ }else{
selection+=selectedFiles.length+' '+t('files','files'); selection+=t('files','{count} files',{count: selectedFiles.length});
} }
} }
$('#headerName>span.name').text(selection); $('#headerName>span.name').text(selection);

View File

@ -127,9 +127,9 @@ OC.Share={
var html = '<div id="dropdown" class="drop" data-item-type="'+itemType+'" data-item-source="'+itemSource+'">'; var html = '<div id="dropdown" class="drop" data-item-type="'+itemType+'" data-item-source="'+itemSource+'">';
if (data.reshare) { if (data.reshare) {
if (data.reshare.share_type == OC.Share.SHARE_TYPE_GROUP) { if (data.reshare.share_type == OC.Share.SHARE_TYPE_GROUP) {
html += '<span class="reshare">'+t('core', 'Shared with you and the group')+' '+data.reshare.share_with+' '+t('core', 'by')+' '+data.reshare.uid_owner+'</span>'; html += '<span class="reshare">'+t('core', 'Shared with you and the group {group} by {owner}', {group: data.reshare.share_with, owner: data.reshare.uid_owner})+'</span>';
} else { } else {
html += '<span class="reshare">'+t('core', 'Shared with you by')+' '+data.reshare.uid_owner+'</span>'; html += '<span class="reshare">'+t('core', 'Shared with you by {owner}', {owner: data.reshare.uid_owner})+'</span>';
} }
html += '<br />'; html += '<br />';
} }
@ -247,7 +247,7 @@ OC.Share={
if (collectionList.length > 0) { if (collectionList.length > 0) {
$(collectionList).append(', '+shareWith); $(collectionList).append(', '+shareWith);
} else { } else {
var html = '<li style="clear: both;" data-collection="'+item+'">'+t('core', 'Shared in')+' '+item+' '+t('core', 'with')+' '+shareWith+'</li>'; var html = '<li style="clear: both;" data-collection="'+item+'">'+t('core', 'Shared in {item} with {user}', {'item': item, user: shareWith})+'</li>';
$('#shareWithList').prepend(html); $('#shareWithList').prepend(html);
} }
} else { } else {