From e8e4639dce93ada7d5a9322fa9d8495c22894fac Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Fri, 14 Feb 2014 15:23:59 +0000 Subject: [PATCH] wrap more strings --- static/js/contentPanel.js | 6 +++--- static/js/deleteDocumentDialog.js | 8 ++++---- static/js/deleteListDialog.js | 8 ++++---- static/js/documentsPanel.js | 30 +++++++++++++++--------------- static/js/editPanel.js | 2 +- static/js/editor.js | 8 +++----- static/js/folderBrowserList.js | 2 +- static/js/folderPlaceholder.js | 11 ++++------- static/js/infoView.indiancinema.js | 12 ++++++------ static/js/listDialog.js | 5 ++++- static/js/mainMenu.js | 7 +++++-- static/js/mainPanel.js | 2 +- static/js/player.js | 10 ++++------ static/js/timeline.js | 8 +++----- static/js/utils.js | 6 +++--- 15 files changed, 61 insertions(+), 64 deletions(-) diff --git a/static/js/contentPanel.js b/static/js/contentPanel.js index 032bd623..c4550500 100644 --- a/static/js/contentPanel.js +++ b/static/js/contentPanel.js @@ -10,7 +10,7 @@ pandora.ui.contentPanel = function() { resizable: true, resize: [96, 112, 128, 144, 160, 176, 192, 208, 224, 240, 256], size: pandora.user.ui.filtersSize, - tooltip: 'filters ' + tooltip: Ox._('filters') + ' ' + Ox.SYMBOLS.SHIFT + 'F' }, { @@ -26,8 +26,8 @@ pandora.ui.contentPanel = function() { collapsible: true, element: pandora.$ui.browser = pandora.ui.browser(), size: 112 + Ox.UI.SCROLLBAR_SIZE, - tooltip: pandora.site.itemName.singular.toLowerCase() - + ' browser ' + tooltip: Ox._('{0} browser', [Ox._(pandora.site.itemName.singular.toLowerCase())]) + + ' ' + Ox.SYMBOLS.SHIFT + 'B' }, { diff --git a/static/js/deleteDocumentDialog.js b/static/js/deleteDocumentDialog.js index ad34464a..0791abd2 100644 --- a/static/js/deleteDocumentDialog.js +++ b/static/js/deleteDocumentDialog.js @@ -3,12 +3,12 @@ pandora.ui.deleteDocumentDialog = function(files, callback) { - var string = files.length == 1 ? 'Document' : 'Documents', + var string = Ox._(files.length == 1 ? 'Document' : 'Documents'), that = pandora.ui.iconDialog({ buttons: [ Ox.Button({ id: 'keep', - title: Ox._('Keep ' + string) + title: Ox._('Keep {0}', [string]) }).bindEvent({ click: function() { that.close(); @@ -16,7 +16,7 @@ pandora.ui.deleteDocumentDialog = function(files, callback) { }), Ox.Button({ id: 'delete', - title: Ox._('Delete ' + string) + title: Ox._('Delete {0}', [string]) }).bindEvent({ click: function() { that.close(); @@ -33,7 +33,7 @@ pandora.ui.deleteDocumentDialog = function(files, callback) { : Ox._('Are you sure you want to delete {0} documents?', [files.length]), keys: {enter: 'delete', escape: 'keep'}, title: files.length == 1 - ? Ox._('Delete Document') + ? Ox._('Delete {0}', [string]) : Ox._('Delete {0} Documents', [files.length]) }); diff --git a/static/js/deleteListDialog.js b/static/js/deleteListDialog.js index cd7b631d..b86d29c9 100644 --- a/static/js/deleteListDialog.js +++ b/static/js/deleteListDialog.js @@ -14,7 +14,7 @@ pandora.ui.deleteListDialog = function(list) { buttons: [ Ox.Button({ id: 'keep', - title: Ox._('Keep {0}', [folderItem]) + title: Ox._('Keep {0}', [Ox._(folderItem)]) }).bindEvent({ click: function() { that.close(); @@ -22,7 +22,7 @@ pandora.ui.deleteListDialog = function(list) { }), Ox.Button({ id: 'delete', - title: Ox._('Delete {0}', [folderItem]) + title: Ox._('Delete {0}', [Ox._(folderItem)]) }).bindEvent({ click: function() { that.close(); @@ -51,9 +51,9 @@ pandora.ui.deleteListDialog = function(list) { }) ], content: Ox._('Are you sure you want to delete the {0} "{1}"?', - [folderItem.toLowerCase(), listData.name]), + [Ox._(folderItem.toLowerCase()), listData.name]), keys: {enter: 'delete', escape: 'keep'}, - title: Ox._('Delete {0}', [folderItem]) + title: Ox._('Delete {0}', [Ox._(folderItem)]) }); return that; diff --git a/static/js/documentsPanel.js b/static/js/documentsPanel.js index a89e97fe..6a45c336 100644 --- a/static/js/documentsPanel.js +++ b/static/js/documentsPanel.js @@ -235,7 +235,7 @@ pandora.ui.documentsPanel = function(options) { $itemMenu = Ox.MenuButton({ items: isItemView ? [ {id: 'add', title: Ox._( - 'Add Documents to ' + pandora.site.itemName.singular + '...' + 'Add Documents to {0}...', [pandora.site.itemName.singular] ), keyboard: 'control n'}, {}, {id: 'open', title: '', keyboard: 'return'}, @@ -244,13 +244,13 @@ pandora.ui.documentsPanel = function(options) { {}, {id: 'remove', title: '', keyboard: 'delete'} ] : [ - {id: 'upload', title: Ox._('Upload Documents...'), file: {width: 192}}, + {id: 'upload', title: Ox._('Upload {0}...', [Ox._('Documents')]), file: {width: 192}}, {}, {id: 'open', title: '', keyboard: 'return'}, {id: 'add', title: ''}, {id: 'embed', title: Ox._('Embed Document...')}, {}, - {id: 'replace', title: Ox._('Replace Document...')}, + {id: 'replace', title: Ox._('Replace {0}...', [Ox._('Document')])}, {id: 'delete', title: '', keyboard: 'delete'} ], title: 'set', @@ -791,28 +791,28 @@ pandora.ui.documentsPanel = function(options) { return; } var selected = ui.documentsSelection[isItemView ? ui.item : ''] || [], - string = selected.length < 2 ? 'Document' : ' Documents'; + string = Ox._(selected.length < 2 ? 'Document' : 'Documents'); $list.options({selected: selected}); - $itemMenu.setItemTitle('open', Ox._('Open ' + string)) + $itemMenu.setItemTitle('open', Ox._('Open {0}', [string])) [selected.length ? 'enableItem' : 'disableItem']('open'); if (isItemView) { - $itemMenu.setItemTitle('edit', Ox._('Edit ' + string + '...')) + $itemMenu.setItemTitle('edit', Ox._('Edit {0}...', [string])) .setItemTitle('remove', Ox._( - 'Remove ' + string + ' from ' - + pandora.site.itemName.singular + 'Remove {0} from {1}', + [string, Ox._(pandora.site.itemName.singular)] )) [selected.length ? 'enableItem' : 'disableItem']('edit') [selected.length ? 'enableItem' : 'disableItem']('embed') [selected.length ? 'enableItem' : 'disableItem']('remove'); } else { - $itemMenu.setItemTitle('add', Ox._('Add ' + string + ' to ' + ( - hasListSelection ? 'Selected' : 'Current' - ) + ' {0}', [pandora.site.itemName[ + $itemMenu.setItemTitle('add', Ox._('Add {0} to {1} {2}', [ + Ox._(hasListSelection ? 'Selected' : 'Current'), + string, Ox._(pandora.site.itemName[ hasListSelection && ui.listSelection.length > 1 - ? 'plural' : 'singular' - ]])) - .setItemTitle('replace', Ox._('Replace ' + string + '...')) - .setItemTitle('delete', Ox._('Delete ' + string + '...')) + ? 'plural' : 'singular']) + ])) + .setItemTitle('replace', Ox._('Replace {0}...', [string])) + .setItemTitle('delete', Ox._('Delete {0}...', [string])) [selected.length && (hasItemView || hasListSelection) ? 'enableItem' : 'disableItem']('add') [selected.length ? 'enableItem' : 'disableItem']('embed') [selected.length == 1 ? 'enableItem' : 'disableItem']('replace') diff --git a/static/js/editPanel.js b/static/js/editPanel.js index 74f78011..2dd51a5e 100644 --- a/static/js/editPanel.js +++ b/static/js/editPanel.js @@ -143,7 +143,7 @@ pandora.ui.editPanel = function(isEmbed) { ), subtitles: getSubtitles(edit.clips), timeline: ui.videoTimeline, - timelineTooltip: 'timeline ' + Ox.SYMBOLS.SHIFT + 'T', + timelineTooltip: Ox._('timeline') + ' ' + Ox.SYMBOLS.SHIFT + 'T', video: getVideos(), volume: ui.videoVolume, width: pandora.$ui.document.width() - pandora.$ui.mainPanel.size(0) - 1 diff --git a/static/js/editor.js b/static/js/editor.js index 25bb4648..1281e372 100644 --- a/static/js/editor.js +++ b/static/js/editor.js @@ -13,13 +13,11 @@ pandora.ui.editor = function(data) { annotationsRange: ui.annotationsRange, annotationsSize: ui.annotationsSize, annotationsSort: ui.annotationsSort, - annotationsTooltip: Ox._( - 'annotations {0}', - ['' + Ox.SYMBOLS.SHIFT + 'A'] - ), + annotationsTooltip: Ox._('annotations') + + ' ' + Ox.SYMBOLS.SHIFT + 'A', censored: data.censored, censoredIcon: pandora.site.cantPlay.icon, - censoredTooltip: pandora.site.cantPlay.text, + censoredTooltip: Ox._(pandora.site.cantPlay.text), clickLink: pandora.clickLink, cuts: data.cuts || [], duration: data.duration, diff --git a/static/js/folderBrowserList.js b/static/js/folderBrowserList.js index f4f94bfa..1172ec81 100644 --- a/static/js/folderBrowserList.js +++ b/static/js/folderBrowserList.js @@ -129,7 +129,7 @@ pandora.ui.folderBrowserList = function(id, section) { tooltip: function(data) { var checked = id == 'favorite' ? data.subscribed : data.status == 'featured'; return Ox._((checked ? 'Remove from' : 'Add to') - + ' ' + Ox.toTitleCase(id) + ' ' + folderItems); + + ' {0} {1}', [Ox._(Ox.toTitleCase(id)), Ox._(folderItems)]); }, visible: true, width: 16 diff --git a/static/js/folderPlaceholder.js b/static/js/folderPlaceholder.js index 1f761cb0..55a3da12 100644 --- a/static/js/folderPlaceholder.js +++ b/static/js/folderPlaceholder.js @@ -9,13 +9,10 @@ pandora.ui.folderPlaceholder = function(id, section) { }); that.updateText = function(string, isFind) { return that.html( - Ox._( - string != 'volumes' - ? 'No ' + string + ' ' - + (section == 'items' ? 'lists' : section) - + (isFind ? ' found' : '') - : 'No local volumes' - ) + string != 'volumes' + ? Ox._('No {0} {1}' + (isFind ? ' found' : ''), + [Ox._(string), Ox._(section == 'items' ? 'lists' : section)]) + : Ox._('No local volumes') ); }; return that.updateText(id); diff --git a/static/js/infoView.indiancinema.js b/static/js/infoView.indiancinema.js index 4cbc9cdb..fbc798d1 100644 --- a/static/js/infoView.indiancinema.js +++ b/static/js/infoView.indiancinema.js @@ -516,9 +516,9 @@ pandora.ui.infoView = function(data) { key = Ox._(item ? item.title : key); mode = mode || 'text'; if (key == 'alternativeTitles') { - key = 'alternative title' + ( + key = Ox._('Alternative Title' + ( data.alternativeTitles && data.alternativeTitles.length == 1 ? '' : 's' - ); + )); } else if (key == 'keyword') { key = 'keywords' } @@ -528,8 +528,7 @@ pandora.ui.infoView = function(data) { ? Ox.toTitleCase(key) : Ox.Element() .css({marginBottom: '4px', fontWeight: 'bold'}) - .html(Ox.toTitleCase(key) - .replace(' Per ', ' per ')); + .html(Ox.toTitleCase(key).replace(' Per ', ' per ')); } function formatLight(str) { @@ -749,14 +748,15 @@ pandora.ui.infoView = function(data) { var hasCapability = pandora.site.capabilities[capability.name][userLevel] >= rightsLevel, $element = Ox.Theme.formatColorLevel(hasCapability, ['', '']); Ox.Button({ - tooltip: Ox._((canEdit ? Ox.toTitleCase(userLevel) : 'You') + ' ' + tooltip: Ox._('{0} ' + (hasCapability ? 'can' : 'can\'t') + ' ' + Ox.toSlashes(capability.name) .split('/').slice(1).join(' ') .toLowerCase() .replace('see item', 'see the item') .replace('play video', 'play the full video') - .replace('download video', 'download the video')), + .replace('download video', 'download the video'), + [canEdit ? Ox.toTitleCase(userLevel) : Ox._('You')]), title: capability.symbol, type: 'image' }) diff --git a/static/js/listDialog.js b/static/js/listDialog.js index 71c01701..5a8a7665 100644 --- a/static/js/listDialog.js +++ b/static/js/listDialog.js @@ -26,7 +26,10 @@ pandora.ui.listDialog = function(section) { } else if (id == 'icon') { return pandora.$ui.listIconPanel = pandora.ui.listIconPanel(listData); } else if (id == 'query') { - return pandora.$ui.filterForm = pandora.ui.filterForm(listData) + return pandora.$ui.filterForm = pandora.ui.filterForm({ + mode: 'list', + list: listData + }) .bindEvent({ change: function(data) { listData.query = data.query; diff --git a/static/js/mainMenu.js b/static/js/mainMenu.js index bd811188..7f0ceb11 100644 --- a/static/js/mainMenu.js +++ b/static/js/mainMenu.js @@ -196,7 +196,7 @@ pandora.ui.mainMenu = function() { }) } ] }, {}, - { id: 'embed', title: Ox._('Embed...'), disabled: true } + { id: 'embed', title: Ox._('Embed...') } ]}, getSortMenu(), getFindMenu(), @@ -487,6 +487,8 @@ pandora.ui.mainMenu = function() { Ox.Fullscreen.toggle(); } else if (data.id == 'entervideofullscreen') { pandora.$ui.player.options({fullscreen: true}); + } else if (data.id == 'embed') { + pandora.$ui.embedDialog = pandora.ui.embedDialog().open(); } else if (data.id == 'advancedfind') { pandora.$ui.filterDialog = pandora.ui.filterDialog().open(); } else if (data.id == 'findsimilar') { @@ -1026,7 +1028,8 @@ pandora.ui.mainMenu = function() { items: Ox.isUndefined(lists[folder]) ? [{id: 'loading', title: Ox._('Loading...'), disabled: true}] : lists[folder].length == 0 - ? [{id: 'nolists', title: Ox._('No ' + Ox.toTitleCase(folder) + ' ' + itemNamePlural), disabled: true}] + ? [{id: 'nolists', title: Ox._('No {0} {1}', + [Ox._(Ox.toTitleCase(folder)), Ox._(itemNamePlural)]), disabled: true}] : lists[folder].map(function(list) { return { id: 'viewlist' + list.id.replace(/_/g, Ox.char(9)), diff --git a/static/js/mainPanel.js b/static/js/mainPanel.js index 49b217ee..8fe447c3 100644 --- a/static/js/mainPanel.js +++ b/static/js/mainPanel.js @@ -11,7 +11,7 @@ pandora.ui.mainPanel = function() { resizable: true, resize: [192, 256, 320, 384], size: ui.sidebarSize, - tooltip: 'sidebar ' + tooltip: Ox._('sidebar') + ' ' + Ox.SYMBOLS.SHIFT + 'S' }, { diff --git a/static/js/player.js b/static/js/player.js index 3120641d..7a4bdba8 100644 --- a/static/js/player.js +++ b/static/js/player.js @@ -13,13 +13,11 @@ pandora.ui.player = function(data) { annotationsRange: ui.annotationsRange, annotationsSize: ui.annotationsSize, annotationsSort: ui.annotationsSort, - annotationsTooltip: Ox._( - 'annotations {0}', - ['' + Ox.SYMBOLS.SHIFT + 'A'] - ), + annotationsTooltip: Ox._('annotations') + + ' ' + Ox.SYMBOLS.SHIFT + 'A', censored: data.censored, censoredIcon: pandora.site.cantPlay.icon, - censoredTooltip: pandora.site.cantPlay.text, + censoredTooltip: Ox._(pandora.site.cantPlay.text), clickLink: pandora.clickLink, cuts: data.cuts || [], duration: data.duration, @@ -53,7 +51,7 @@ pandora.ui.player = function(data) { smallTimelineURL: pandora.getMediaURL('/' + ui.item + '/timeline16p.jpg'), subtitles: data.subtitles, timeline: ui.videoTimeline, - timelineTooltip: 'timeline ' + Ox.SYMBOLS.SHIFT + 'T', + timelineTooltip: Ox._('timeline') + ' ' + Ox.SYMBOLS.SHIFT + 'T', video: data.video, volume: ui.videoVolume, width: pandora.$ui.document.width() - pandora.$ui.mainPanel.size(0) - 1 diff --git a/static/js/timeline.js b/static/js/timeline.js index 483e10bf..6983380f 100644 --- a/static/js/timeline.js +++ b/static/js/timeline.js @@ -13,13 +13,11 @@ pandora.ui.timeline = function(data) { annotationsRange: ui.annotationsRange, annotationsSize: ui.annotationsSize, annotationsSort: ui.annotationsSort, - annotationsTooltip: Ox._( - 'annotations {0}', - ['' + Ox.SYMBOLS.SHIFT + 'A'] - ), + annotationsTooltip: Ox._('annotations') + + ' ' + Ox.SYMBOLS.SHIFT + 'A', censored: data.censored, censoredIcon: pandora.site.cantPlay.icon, - censoredTooltip: pandora.site.cantPlay.text, + censoredTooltip: Ox._(pandora.site.cantPlay.text), clickLink: pandora.clickLink, cuts: data.cuts || [], duration: data.duration, diff --git a/static/js/utils.js b/static/js/utils.js index 6d0d8716..dbb92815 100644 --- a/static/js/utils.js +++ b/static/js/utils.js @@ -969,10 +969,10 @@ pandora.getClipVideos = function(clip, resolution) { ? pandora.user.ui._list.split(':').slice(1).join(':') : pandora.getAllItemsTitle('items') ); - parts.push(Ox._(Ox.toTitleCase(pandora.user.ui.listView) + ' View')); + parts.push(Ox._("{0} View", [Ox._(Ox.toTitleCase(pandora.user.ui.listView))])); } else { parts.push(itemTitles[pandora.user.ui.item] || pandora.user.ui.item); - parts.push(Ox._(Ox.toTitleCase(pandora.user.ui.itemView) + ' View')); + parts.push(Ox._("{0} View", [Ox._(Ox.toTitleCase(pandora.user.ui.itemView))])); } } else if (pandora.user.ui.section == 'edits') { if (pandora.user.ui.edit) { @@ -1005,7 +1005,7 @@ pandora.getEditTooltip = function(title) { return ( $target.is('a') || $target.parents('a').length ? Ox._('Shift+doubleclick to edit') : Ox._('Doubleclick to edit') - ) + (title ? ' ' + title : ''); + ) + (title ? ' ' + Ox._(title) : ''); } };