|
24 | 24 | this.vtsLang = this.lang; |
25 | 25 |
|
26 | 26 | // Inject a heading |
27 | | - $heading = $('<h2>').text('Video Transcript Sorter'); // TODO: Localize; intelligently assign proper heading level |
| 27 | + let heading = this.translate( 'vtsHeading', 'Video Transcript Sorter' ); |
| 28 | + $heading = $('<h2>').text( heading ); // TODO: intelligently assign proper heading level |
28 | 29 | $('#able-vts').append($heading); |
29 | 30 |
|
30 | 31 | // Inject an empty div for writing messages |
|
39 | 40 | $instructions = $('<div>',{ |
40 | 41 | 'id': 'able-vts-instructions' |
41 | 42 | }); |
42 | | - $p1 = $('<p>').text('Use the Video Transcript Sorter to modify text tracks:'); |
| 43 | + $p1 = $('<p>').text( this.translate( 'vtsInstructions1', 'Use the Video Transcript Sorter to modify text tracks:' ) ); |
43 | 44 | $ul = $('<ul>'); |
44 | | - $li1 = $('<li>').text('Reorder chapters, descriptions, captions, and/or subtitles so they appear in the proper sequence in Able Player\'s auto-generated transcript.'); |
45 | | - $li2 = $('<li>').text('Modify content or start/end times (all are directly editable within the table).'); |
46 | | - $li3 = $('<li>').text('Add new content, such as chapters or descriptions.'); |
47 | | - $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.'); |
| 45 | + $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.' ) ); |
| 46 | + $li2 = $('<li>').text( this.translate( 'vtsInstructions3', 'Modify content or start/end times (all are directly editable within the table).' ) ); |
| 47 | + $li3 = $('<li>').text( this.translate( 'vtsInstructions4', 'Add new content, such as chapters or descriptions.' ) ); |
| 48 | + $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.' ) ); |
48 | 49 | $ul.append($li1,$li2,$li3); |
49 | 50 | $instructions.append($p1,$ul,$p2); |
50 | 51 | $('#able-vts').append($instructions); |
51 | 52 |
|
52 | 53 | // Inject a fieldset with radio buttons for each language |
53 | 54 | $fieldset = $('<fieldset>'); |
54 | | - $legend = $('<legend>').text('Select a language'); // TODO: Localize this |
| 55 | + $legend = $('<legend>').text( this.translate( 'vtsSelectLanguage', 'Select a language' ) ); |
55 | 56 | $fieldset.append($legend); |
56 | 57 | $fieldWrapper = $( '<div class="vts-lang-selector"></div>' ); |
57 | 58 | for (i in this.langs) { |
|
86 | 87 | $fieldset.append( $fieldWrapper ); |
87 | 88 | $('#able-vts').append($fieldset); |
88 | 89 |
|
89 | | - // Inject a 'Save Changes' button |
| 90 | + // Inject a button to generate new files. |
90 | 91 | $saveButton = $('<button>',{ |
91 | 92 | 'type': 'button', |
92 | 93 | 'id': 'able-vts-save', |
93 | 94 | 'value': 'save' |
94 | | - }).text('Save Changes'); // TODO: Localize this |
| 95 | + }).text( this.translate( 'vtsSave', 'Generate new .vtt files' ) ); |
95 | 96 | $('#able-vts').append($saveButton); |
96 | 97 |
|
97 | 98 | // Inject a table with one row for each cue in the default language |
|
140 | 141 | e.stopPropagation(); |
141 | 142 | if ($(this).attr('value') == 'save') { |
142 | 143 | // replace table with WebVTT output in textarea fields (for copying/pasting) |
143 | | - $(this).attr('value','cancel').text('Return to Editor'); // TODO: Localize this |
| 144 | + $(this).attr('value','cancel').text( this.translate( 'vtsReturn', 'Return to Editor' ) ); |
144 | 145 | $savedTable = $('#able-vts table'); |
145 | 146 | $('#able-vts-instructions').hide(); |
146 | 147 | $('#able-vts > fieldset').hide(); |
|
149 | 150 | thisObj.parseVtsOutput($savedTable); |
150 | 151 | } else { |
151 | 152 | // cancel saving, and restore the table using edited content |
152 | | - $(this).attr('value','save').text('Save Changes'); // TODO: Localize this |
| 153 | + $(this).attr('value','save').text(this.translate( 'vtsSave', 'Generate new .vtt files' ) ); |
153 | 154 | $('#able-vts-output').remove(); |
154 | 155 | $('#able-vts-instructions').show(); |
155 | 156 | $('#able-vts > fieldset').show(); |
156 | 157 | $('#able-vts').append($savedTable); |
157 | 158 | $('#able-vts').append(thisObj.getIconCredit()); |
158 | | - thisObj.showVtsAlert('Cancelling saving. Any edits you made have been restored in the VTS table.'); // TODO: Localize this |
| 159 | + thisObj.showVtsAlert( this.translate( 'vtsCancel', 'Cancelling saving. Any edits you made have been restored in the VTS table.' ) ); |
159 | 160 | } |
160 | 161 | }); |
161 | 162 | } |
|
299 | 300 | 'lang': lang |
300 | 301 | }); |
301 | 302 | $thead = $('<thead>'); |
302 | | - $tr = $('<tr>',{ |
303 | | - 'lang': 'en' // TEMP, until header row is localized |
304 | | - }); |
305 | | - headers = ['Row','Kind','Start','End','Content','Actions']; // TODO: Localize this |
| 303 | + headers = [ |
| 304 | + this.translate( 'vtsRow', 'Row' ), |
| 305 | + this.translate( 'vtsKind', 'Kind' ), |
| 306 | + this.translate( 'vtsStart', 'Start' ), |
| 307 | + this.translate( 'vtsEnd', 'End' ), |
| 308 | + this.translate( 'vtsContent', 'Content' ), |
| 309 | + this.translate( 'vtsActions', 'Actions' ) |
| 310 | + ]; |
306 | 311 | for (i=0; i < headers.length; i++) { |
307 | 312 | $th = $('<th>', { |
308 | 313 | 'scope': 'col' |
|
702 | 707 | this.adjustTimes(newRowNum); |
703 | 708 |
|
704 | 709 | // Announce the insertion |
705 | | - this.showVtsAlert('A new row ' + newRowNum + ' has been inserted'); // TODO: Localize this |
| 710 | + let newAlert = this.translate( 'vtsNewRow', 'A new row %1 has been inserted.', [ newRowNum ] ); |
| 711 | + this.showVtsAlert( newAlert ); |
706 | 712 |
|
707 | 713 | // Place focus in new select field |
708 | 714 | $select.trigger('focus'); |
|
728 | 734 | } |
729 | 735 |
|
730 | 736 | // Announce the deletion |
731 | | - this.showVtsAlert('Row ' + rowNum + ' has been deleted'); // TODO: Localize this |
| 737 | + let newAlert = this.translate( 'vtsDeletedRow', 'Row %1 has been deleted.', [ rowNum ] ); |
| 738 | + this.showVtsAlert( newAlert ); |
732 | 739 |
|
733 | 740 | }; |
734 | 741 |
|
|
759 | 766 | // auto-adjust times |
760 | 767 | this.adjustTimes(otherRowNum); |
761 | 768 |
|
762 | | - // Announce the move (TODO: Localize this) |
763 | | - msg = 'Row ' + rowNum + ' has been moved ' + direction; |
764 | | - msg += ' and is now Row ' + otherRowNum; |
| 769 | + // Announce the move |
| 770 | + msg = this.translate( 'vtsMovedRow', 'Row %1 has been moved %2 and is now Row %3.', [ rowNum, direction, otherRowNum ] ); |
765 | 771 | this.showVtsAlert(msg); |
766 | 772 | }; |
767 | 773 |
|
|
0 commit comments