Changeset 228471 in webkit
- Timestamp:
- Feb 14, 2018 10:46:10 AM (6 years ago)
- Location:
- trunk
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r228470 r228471 1 2018-02-14 Antoine Quint <graouts@apple.com> 2 3 [Modern Media Controls] Don't use arrays as values for localisable strings 4 https://bugs.webkit.org/show_bug.cgi?id=182791 5 <rdar://problem/36007262> 6 7 Reviewed by Dean Jackson. 8 9 * media/modern-media-controls/localized-strings/replaced-string-expected.txt: 10 * media/modern-media-controls/localized-strings/replaced-string.html: 11 1 12 2018-02-14 Ryan Haddad <ryanhaddad@apple.com> 2 13 -
trunk/LayoutTests/media/modern-media-controls/localized-strings/replaced-string-expected.txt
r225216 r228471 1 Testing that we can load a replaced stringusing UIString.1 Testing that we can replace strings using UIString. 2 2 3 3 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". 4 4 5 5 6 PASS UIString('Test replaced string' ) is "Value 15 should be printed here"6 PASS UIString('Test replaced string', 15) is "Value 15 should be printed here" 7 7 PASS successfullyParsed is true 8 8 -
trunk/LayoutTests/media/modern-media-controls/localized-strings/replaced-string.html
r225216 r228471 4 4 <script type="text/javascript"> 5 5 6 description("Testing that we can load a replaced stringusing UIString.");6 description("Testing that we can replace strings using UIString."); 7 7 8 UIStrings["##REPLACEMENT_VALUE##"] = "15"; 9 UIStrings["Test replaced string"] = ["Value %s should be printed here", "##REPLACEMENT_VALUE##"]; 8 UIStrings["Test replaced string"] = "Value %s should be printed here"; 10 9 11 shouldBeEqualToString("UIString('Test replaced string' )", "Value 15 should be printed here");10 shouldBeEqualToString("UIString('Test replaced string', 15)", "Value 15 should be printed here"); 12 11 13 12 </script> -
trunk/Source/WebCore/ChangeLog
r228470 r228471 1 2018-02-14 Antoine Quint <graouts@apple.com> 2 3 [Modern Media Controls] Don't use arrays as values for localisable strings 4 https://bugs.webkit.org/show_bug.cgi?id=182791 5 <rdar://problem/36007262> 6 7 Reviewed by Dean Jackson. 8 9 Localization tools expect localizable strings to be specified as key-value pairs where both the key and the pair 10 are plain strings. For the skip buttons, we used an array value to specify a replacement string. We now perform 11 this task in code with a centralized SkipSeconds constant defining the skip amount. 12 13 * English.lproj/modern-media-controls-localized-strings.js: 14 * Modules/modern-media-controls/controls/icon-service.js: 15 * Modules/modern-media-controls/main.js: 16 (UIString): 17 * Modules/modern-media-controls/media/skip-back-support.js: 18 (SkipBackSupport.prototype.buttonWasPressed): 19 * Modules/modern-media-controls/media/skip-forward-support.js: 20 (SkipForwardSupport.prototype.buttonWasPressed): 21 1 22 2018-02-14 Ryan Haddad <ryanhaddad@apple.com> 2 23 -
trunk/Source/WebCore/English.lproj/modern-media-controls-localized-strings.js
r225216 r228471 1 1 const UIStrings = { 2 "##SKIP_AMOUNT##": "15",3 2 "AirPlay": "AirPlay", 4 3 "Audio": "Audio", … … 19 18 "Remaining": "Remaining", 20 19 "Rewind": "Rewind", 21 "Skip Back 15 seconds": ["Skip Back %s seconds", "##SKIP_AMOUNT##"],22 "Skip Forward 15 seconds": ["Skip Forward %s seconds", "##SKIP_AMOUNT##"],20 "Skip Back %s Seconds": "Skip Back %s Seconds", 21 "Skip Forward %s Seconds": "Skip Forward %s Seconds", 23 22 "Subtitles": "Subtitles", 24 23 "This video is playing in picture in picture.": "This video is playing in picture in picture.", -
trunk/Source/WebCore/Modules/modern-media-controls/controls/icon-service.js
r218991 r228471 36 36 Play : { name: "Play", type: "svg", label: UIString("Play") }, 37 37 Rewind : { name: "Rewind", type: "svg", label: UIString("Rewind") }, 38 SkipBack : { name: "SkipBack15", type: "svg", label: UIString("Skip Back 15 seconds") },39 SkipForward : { name: "SkipForward15", type: "svg", label: UIString("Skip Forward 15 seconds") },38 SkipBack : { name: "SkipBack15", type: "svg", label: UIString("Skip Back %s Seconds", SkipSeconds) }, 39 SkipForward : { name: "SkipForward15", type: "svg", label: UIString("Skip Forward %s Seconds", SkipSeconds) }, 40 40 Tracks : { name: "MediaSelector", type: "svg", label: UIString("Media Selection") }, 41 41 Volume : { name: "VolumeHi", type: "svg", label: UIString("Mute") }, -
trunk/Source/WebCore/Modules/modern-media-controls/main.js
r225216 r228471 24 24 */ 25 25 26 const SkipSeconds = 15; 27 26 28 let mediaControlsHost; 27 29 … … 38 40 } 39 41 40 function UIString(stringToLocalize )42 function UIString(stringToLocalize, replacementString) 41 43 { 42 44 let allLocalizedStrings = {}; … … 49 51 return stringToLocalize; 50 52 51 // We allow an array of a string and a replacement. 52 if (Array.isArray(localizedString) && localizedString.length == 2) 53 return localizedString[0].replace("%s", UIString(localizedString[1])); 53 if (replacementString) 54 return localizedString.replace("%s", replacementString); 54 55 55 56 return localizedString; -
trunk/Source/WebCore/Modules/modern-media-controls/media/skip-back-support.js
r217823 r228471 24 24 */ 25 25 26 const SkipBackSeconds = 15;27 28 26 class SkipBackSupport extends MediaControllerSupport 29 27 { … … 44 42 { 45 43 const media = this.mediaController.media; 46 media.currentTime = Math.max(media.currentTime - Skip BackSeconds, media.seekable.start(0));44 media.currentTime = Math.max(media.currentTime - SkipSeconds, media.seekable.start(0)); 47 45 } 48 46 -
trunk/Source/WebCore/Modules/modern-media-controls/media/skip-forward-support.js
r217823 r228471 24 24 */ 25 25 26 const SkipForwardSeconds = 15;27 28 26 class SkipForwardSupport extends MediaControllerSupport 29 27 { … … 44 42 { 45 43 const media = this.mediaController.media; 46 media.currentTime = Math.min(media.currentTime + Skip ForwardSeconds, media.seekable.end(0));44 media.currentTime = Math.min(media.currentTime + SkipSeconds, media.seekable.end(0)); 47 45 } 48 46
Note: See TracChangeset
for help on using the changeset viewer.