@@ -5260,7 +5260,7 @@ if (typeof module !== "undefined" && module.exports) {
52605260 continue ;
52615261 }
52625262 var trackSrc = track . src ;
5263- loadingPromise = this . loadTextObject ( trackSrc ) ;
5263+ loadingPromise = this . loadTextObject ( trackSrc ) ;
52645264 loadingPromises . push (
52655265 loadingPromise . catch ( function ( src ) {
52665266
@@ -5282,7 +5282,7 @@ if (typeof module !== "undefined" && module.exports) {
52825282 trackDesc ,
52835283 trackLabel ,
52845284 trackSrc ,
5285- trackText
5285+ data . text
52865286 ) ;
52875287 }
52885288 if ( kind === 'captions' || kind === 'subtitles' ) {
@@ -5765,7 +5765,6 @@ if (typeof module !== "undefined" && module.exports) {
57655765
57665766 AblePlayer . prototype . getYouTubeCaptionTracks = function ( ) {
57675767
5768-
57695768 var deferred = new this . defer ( ) ;
57705769 var promise = deferred . promise ( ) ;
57715770 var thisObj , ytTracks , i , trackLang , trackLabel , isDefaultTrack , apiTriggered = false ;
@@ -10332,19 +10331,16 @@ if (typeof module !== "undefined" && module.exports) {
1033210331 var $resultsSummary = $ ( "<p>" , {
1033310332 class : "able-search-results-summary" ,
1033410333 } ) ;
10335- var resultsSummaryText = this . translate ( 'resultsSummary2' , 'Found' ) ;
10336- resultsSummaryText +=
10337- ' <strong>' + resultsArray . length + '</strong> ' ;
10338- resultsSummaryText += this . translate ( 'resultsSummary3' , 'matching items.' ) + ' ' ;
10339- resultsSummaryText += this . translate ( 'resultsSummary4' , 'Click the time associated with any item to play the video from that point.' ) ;
10334+ var resultsSummaryText = this . translate ( 'resultsSummary2' , 'Found %1 matching items.' , [ '<strong>' + resultsArray . length + '</strong>' ] ) ;
10335+ resultsSummaryText += ' ' + this . translate ( 'resultsSummary3' , 'Click the time associated with any item to play the video from that point.' ) ;
1034010336 $resultsSummary . html ( resultsSummaryText ) ;
1034110337 var $resultsList = $ ( "<ul>" ) ;
1034210338 for ( var i = 0 ; i < resultsArray . length ; i ++ ) {
1034310339 var resultId = "aria-search-result-" + i ;
1034410340 var $resultsItem = $ ( "<li>" , { } ) ;
1034510341 var itemStartTime = this . secondsToTime ( resultsArray [ i ] [ "start" ] ) ;
1034610342 var itemLabel =
10347- this . translate ( 'searchButtonLabel' , 'Play at' ) + ' ' + itemStartTime [ "title" ] ;
10343+ this . translate ( 'searchButtonLabel' , 'Play at %1' , [ itemStartTime [ "title" ] ] ) ;
1034810344 var itemStartSpan = $ ( "<button>" , {
1034910345 class : "able-search-results-time" ,
1035010346 "data-start" : resultsArray [ i ] [ "start" ] ,
@@ -13082,12 +13078,21 @@ if (typeof module !== "undefined" && module.exports) {
1308213078 return langs ;
1308313079 } ;
1308413080
13085- AblePlayer . prototype . translate = function ( key , fallback ) {
13081+ AblePlayer . prototype . translate = function ( key , fallback , args = Array ( ) ) {
13082+ let translation = '' ;
1308613083 if ( this . tt [ key ] ) {
13087- return this . tt [ key ] ;
13084+ translation = this . tt [ key ] ;
1308813085 } else {
13089- return fallback ;
13086+ translation = fallback ;
13087+ }
13088+ if ( args . length > 0 ) {
13089+ args . forEach ( ( val , index ) => {
13090+ let ref = index + 1 ;
13091+ translation = translation . replace ( '%' + ref , val ) ;
13092+ } ) ;
1309013093 }
13094+
13095+ return translation ;
1309113096 }
1309213097
1309313098 AblePlayer . prototype . getTranslationText = function ( ) {
@@ -13210,7 +13215,6 @@ if (typeof module !== "undefined" && module.exports) {
1321013215( function ( $ ) {
1321113216 AblePlayer . prototype . injectVTS = function ( ) {
1321213217
13213-
1321413218 var thisObj , $heading , $instructions , $p1 , $p2 , $ul , $li1 , $li2 , $li3 ,
1321513219 $fieldset , $legend , i , $radioDiv , radioId , $label , $radio , $saveButton , $savedTable ;
1321613220
@@ -13223,7 +13227,8 @@ if (typeof module !== "undefined" && module.exports) {
1322313227
1322413228 this . vtsLang = this . lang ;
1322513229
13226- $heading = $ ( '<h2>' ) . text ( 'Video Transcript Sorter' ) ;
13230+ let heading = this . translate ( 'vtsHeading' , 'Video Transcript Sorter' ) ;
13231+ $heading = $ ( '<h2>' ) . text ( heading ) ;
1322713232 $ ( '#able-vts' ) . append ( $heading ) ;
1322813233
1322913234 this . $vtsAlert = $ ( '<div>' , {
@@ -13236,18 +13241,18 @@ if (typeof module !== "undefined" && module.exports) {
1323613241 $instructions = $ ( '<div>' , {
1323713242 'id' : 'able-vts-instructions'
1323813243 } ) ;
13239- $p1 = $ ( '<p>' ) . text ( ' Use the Video Transcript Sorter to modify text tracks:') ;
13244+ $p1 = $ ( '<p>' ) . text ( this . translate ( 'vtsInstructions1' , ' Use the Video Transcript Sorter to modify text tracks:' ) ) ;
1324013245 $ul = $ ( '<ul>' ) ;
13241- $li1 = $ ( '<li>' ) . text ( ' Reorder chapters, descriptions, captions, and/or subtitles so they appear in the proper sequence in Able Player\'s auto-generated transcript.') ;
13242- $li2 = $ ( '<li>' ) . text ( ' Modify content or start/end times (all are directly editable within the table).') ;
13243- $li3 = $ ( '<li>' ) . text ( ' Add new content, such as chapters or descriptions.') ;
13244- $p2 = $ ( '<p>' ) . text ( ' After editing, click the "Save Changes" button to generate new content for all relevant timed text files. The new text can be copied and pasted into new WebVTT files.') ;
13246+ $li1 = $ ( '<li>' ) . text ( this . translate ( 'vtsInstructions2' , ' Reorder chapters, descriptions, captions, and/or subtitles so they appear in the proper sequence in Able Player\'s auto-generated transcript.' ) ) ;
13247+ $li2 = $ ( '<li>' ) . text ( this . translate ( 'vtsInstructions3' , ' Modify content or start/end times (all are directly editable within the table).' ) ) ;
13248+ $li3 = $ ( '<li>' ) . text ( this . translate ( 'vtsInstructions4' , ' Add new content, such as chapters or descriptions.' ) ) ;
13249+ $p2 = $ ( '<p>' ) . text ( this . translate ( 'vtsInstructions5' , ' After editing, click the "Save Changes" button to generate new content for all relevant timed text files. The new text can be copied and pasted into new WebVTT files.' ) ) ;
1324513250 $ul . append ( $li1 , $li2 , $li3 ) ;
1324613251 $instructions . append ( $p1 , $ul , $p2 ) ;
1324713252 $ ( '#able-vts' ) . append ( $instructions ) ;
1324813253
1324913254 $fieldset = $ ( '<fieldset>' ) ;
13250- $legend = $ ( '<legend>' ) . text ( ' Select a language') ;
13255+ $legend = $ ( '<legend>' ) . text ( this . translate ( 'vtsSelectLanguage' , ' Select a language' ) ) ;
1325113256 $fieldset . append ( $legend ) ;
1325213257 $fieldWrapper = $ ( '<div class="vts-lang-selector"></div>' ) ;
1325313258 for ( i in this . langs ) {
@@ -13275,12 +13280,12 @@ if (typeof module !== "undefined" && module.exports) {
1327513280 }
1327613281 $fieldset . append ( $fieldWrapper ) ;
1327713282 $ ( '#able-vts' ) . append ( $fieldset ) ;
13278-
13283+ let vtsSave = this . translate ( 'vtsSave' , 'Generate new .vtt content' ) ;
1327913284 $saveButton = $ ( '<button>' , {
1328013285 'type' : 'button' ,
1328113286 'id' : 'able-vts-save' ,
1328213287 'value' : 'save'
13283- } ) . text ( 'Save Changes' ) ;
13288+ } ) . text ( vtsSave ) ;
1328413289 $ ( '#able-vts' ) . append ( $saveButton ) ;
1328513290
1328613291 this . injectVtsTable ( 'add' , this . vtsLang ) ;
@@ -13316,21 +13321,21 @@ if (typeof module !== "undefined" && module.exports) {
1331613321 $ ( '#able-vts-save' ) . on ( 'click' , function ( e ) {
1331713322 e . stopPropagation ( ) ;
1331813323 if ( $ ( this ) . attr ( 'value' ) == 'save' ) {
13319- $ ( this ) . attr ( 'value' , 'cancel' ) . text ( ' Return to Editor') ;
13324+ $ ( this ) . attr ( 'value' , 'cancel' ) . text ( this . translate ( 'vtsReturn' , ' Return to Editor' ) ) ;
1332013325 $savedTable = $ ( '#able-vts table' ) ;
1332113326 $ ( '#able-vts-instructions' ) . hide ( ) ;
1332213327 $ ( '#able-vts > fieldset' ) . hide ( ) ;
1332313328 $ ( '#able-vts table' ) . remove ( ) ;
1332413329 $ ( '#able-vts-icon-credit' ) . remove ( ) ;
1332513330 thisObj . parseVtsOutput ( $savedTable ) ;
1332613331 } else {
13327- $ ( this ) . attr ( 'value' , 'save' ) . text ( 'Save Changes' ) ;
13332+ $ ( this ) . attr ( 'value' , 'save' ) . text ( vtsSave ) ;
1332813333 $ ( '#able-vts-output' ) . remove ( ) ;
1332913334 $ ( '#able-vts-instructions' ) . show ( ) ;
1333013335 $ ( '#able-vts > fieldset' ) . show ( ) ;
1333113336 $ ( '#able-vts' ) . append ( $savedTable ) ;
1333213337 $ ( '#able-vts' ) . append ( thisObj . getIconCredit ( ) ) ;
13333- thisObj . showVtsAlert ( ' Cancelling saving. Any edits you made have been restored in the VTS table.') ;
13338+ thisObj . showVtsAlert ( this . translate ( 'vtsCancel' , ' Cancelling saving. Any edits you made have been restored in the VTS table.' ) ) ;
1333413339 }
1333513340 } ) ;
1333613341 }
@@ -13339,7 +13344,6 @@ if (typeof module !== "undefined" && module.exports) {
1333913344
1334013345 AblePlayer . prototype . setupVtsTracks = function ( kind , lang , trackDesc , label , src , contents ) {
1334113346
13342-
1334313347 var srcFile , vtsCues ;
1334413348
1334513349 srcFile = this . getFilenameFromPath ( src ) ;
@@ -13450,11 +13454,16 @@ if (typeof module !== "undefined" && module.exports) {
1345013454 $table = $ ( '<table>' , {
1345113455 'lang' : lang
1345213456 } ) ;
13453- $thead = $ ( '<thead>' ) ;
13454- $tr = $ ( '<tr>' , {
13455- 'lang' : 'en'
13456- } ) ;
13457- headers = [ 'Row' , 'Kind' , 'Start' , 'End' , 'Content' , 'Actions' ] ;
13457+ $thead = $ ( '<thead>' ) ;
13458+ $tr = $ ( '<tr>' ) ;
13459+ headers = [
13460+ this . translate ( 'vtsRow' , 'Row' ) ,
13461+ this . translate ( 'vtsKind' , 'Kind' ) ,
13462+ this . translate ( 'vtsStart' , 'Start' ) ,
13463+ this . translate ( 'vtsEnd' , 'End' ) ,
13464+ this . translate ( 'vtsContent' , 'Content' ) ,
13465+ this . translate ( 'vtsActions' , 'Actions' )
13466+ ] ;
1345813467 for ( i = 0 ; i < headers . length ; i ++ ) {
1345913468 $th = $ ( '<th>' , {
1346013469 'scope' : 'col'
@@ -13808,7 +13817,8 @@ if (typeof module !== "undefined" && module.exports) {
1380813817
1380913818 this . adjustTimes ( newRowNum ) ;
1381013819
13811- this . showVtsAlert ( 'A new row ' + newRowNum + ' has been inserted' ) ;
13820+ let newAlert = this . translate ( 'vtsNewRow' , 'A new row %1 has been inserted.' , [ newRowNum ] ) ;
13821+ this . showVtsAlert ( newAlert ) ;
1381213822
1381313823 $select . trigger ( 'focus' ) ;
1381413824
@@ -13831,7 +13841,8 @@ if (typeof module !== "undefined" && module.exports) {
1383113841 this . updateVtsActionButtons ( $buttons , nextRowNum ) ;
1383213842 }
1383313843
13834- this . showVtsAlert ( 'Row ' + rowNum + ' has been deleted' ) ;
13844+ let newAlert = this . translate ( 'vtsDeletedRow' , 'Row %1 has been deleted.' , [ rowNum ] ) ;
13845+ this . showVtsAlert ( newAlert ) ;
1383513846
1383613847 } ;
1383713848
@@ -13859,8 +13870,7 @@ if (typeof module !== "undefined" && module.exports) {
1385913870
1386013871 this . adjustTimes ( otherRowNum ) ;
1386113872
13862- msg = 'Row ' + rowNum + ' has been moved ' + direction ;
13863- msg += ' and is now Row ' + otherRowNum ;
13873+ msg = this . translate ( 'vtsMovedRow' , 'Row %1 has been moved %2 and is now Row %3.' , [ rowNum , direction , otherRowNum ] ) ;
1386413874 this . showVtsAlert ( msg ) ;
1386513875 } ;
1386613876
@@ -13989,7 +13999,7 @@ if (typeof module !== "undefined" && module.exports) {
1398913999
1399014000 const delay = ( ms ) => new Promise ( resolve => setTimeout ( resolve , ms ) ) ;
1399114001 this . $vtsAlert . text ( message ) . show ( ) ;
13992- delay ( 3000 ) . then ( ( ) => {
14002+ delay ( 10000 ) . then ( ( ) => {
1399314003 this . $vtsAlert . text ( message ) . hide ( )
1399414004 } ) ;
1399514005 } ;
0 commit comments