Changeset 167596 in webkit
- Timestamp:
- Apr 21, 2014 11:06:20 AM (10 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 1 deleted
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r167595 r167596 1 2014-04-18 Dean Jackson <dino@apple.com> 2 3 [Media] Clean up localized strings in controls 4 https://bugs.webkit.org/show_bug.cgi?id=131857 5 <rdar://problem/16663005> 6 7 Reviewed by Eric Carlson. 8 9 There is no need for separate localization files 10 on OS X and iOS. Move the small number of iOS-specific 11 localizations into a shared file. 12 13 We also don't need a function to return a static table. 14 Ultimately I think we want a top-level WebKit object that 15 hold the table, but for now use a global variable 16 called UIStringTable. Since we're in an isolated world, we 17 won't clash with anything. 18 19 I noticed a few cases were we grab a localized string and 20 then instantly run a replacement on it. This should be 21 supported directly in the UIString() accessor. 22 23 * English.lproj/mediaControlsLocalizedStrings.js: Add iOS strings. Just 24 use a static table. 25 (mediaControlsLocalizedStrings): Deleted. 26 * English.lproj/mediaControlsLocalizedStringsiOS.js: Removed. 27 * Modules/mediacontrols/mediaControlsApple.js: 28 (Controller.prototype.extend): Fix braces. 29 (Controller.prototype.UIString): Use the string table, and allow replacement. 30 (Controller.prototype.createControls): Use new UIString replacement. 31 * Modules/mediacontrols/mediaControlsiOS.js: 32 (ControllerIOS.prototype.updateWirelessPlaybackStatus): Use new UIString. 33 (ControllerIOS.prototype.UIString): Deleted. Use the parent class version. 34 * WebCore.xcodeproj/project.pbxproj: Remove file from Resources. 35 * rendering/RenderThemeIOS.mm: 36 (WebCore::RenderThemeIOS::mediaControlsScript): No need to include the iOS 37 specific localization file. 38 1 39 2014-04-21 Brent Fulgham <bfulgham@apple.com> 2 40 -
trunk/Source/WebCore/English.lproj/mediaControlsLocalizedStrings.js
r167145 r167596 1 function mediaControlsLocalizedStrings() { 2 return { 3 'Aborted': 'Aborted', 4 'Audio Playback': 'Audio Playback', 5 'Captions': 'Captions', 6 'Display Full Screen': 'Display Full Screen', 7 'Duration': 'Duration', 8 'Elapsed': 'Elapsed', 9 'Error': 'Error', 10 'Exit Full Screen': 'Exit Full Screen', 11 'Fast Forward': 'Fast Forward', 12 'Loading': 'Loading', 13 'Maximum Volume': 'Maximum Volume', 14 'Minimum Volume': 'Minimum Volume', 15 'Mute': 'Mute', 16 'Pause': 'Pause', 17 'Play': 'Play', 18 'Remaining': 'Remaining', 19 'Rewind': 'Rewind', 20 'Rewind %%sec%% Seconds': 'Rewind %%sec%% Seconds', 21 'Stalled': 'Stalled', 22 'Subtitles': 'Subtitles', 23 'Suspended': 'Suspended', 24 'Unmute': 'Unmute', 25 'Video Playback': 'Video Playback', 26 'Volume': 'Volume', 27 'Waiting': 'Waiting' 28 } 1 var UIStringTable = { 2 '##WIRELESS_PLAYBACK_DEVICE_TYPE##': 'AirPlay', 3 '##WIRELESS_PLAYBACK_DEVICE_NAME##': 'This video is playing on “##DEVICE_NAME##”.', 4 5 '##TVOUT_DEVICE_TYPE##': 'TV Connected', 6 '##TVOUT_DEVICE_NAME##': 'This video is playing on the TV.', 7 8 'Aborted': 'Aborted', 9 'Audio Playback': 'Audio Playback', 10 'Captions': 'Captions', 11 'Display Full Screen': 'Display Full Screen', 12 'Duration': 'Duration', 13 'Elapsed': 'Elapsed', 14 'Error': 'Error', 15 'Exit Full Screen': 'Exit Full Screen', 16 'Fast Forward': 'Fast Forward', 17 'Loading': 'Loading', 18 'Maximum Volume': 'Maximum Volume', 19 'Minimum Volume': 'Minimum Volume', 20 'Mute': 'Mute', 21 'Pause': 'Pause', 22 'Play': 'Play', 23 'Remaining': 'Remaining', 24 'Rewind': 'Rewind', 25 'Rewind ##sec## Seconds': 'Rewind ##sec## Seconds', 26 'Stalled': 'Stalled', 27 'Subtitles': 'Subtitles', 28 'Suspended': 'Suspended', 29 'Unmute': 'Unmute', 30 'Video Playback': 'Video Playback', 31 'Volume': 'Volume', 32 'Waiting': 'Waiting' 29 33 }; -
trunk/Source/WebCore/Modules/mediacontrols/mediaControlsApple.js
r167145 r167596 100 100 }, 101 101 102 extend: function(child) { 102 extend: function(child) 103 { 103 104 for (var property in this) { 104 105 if (!child.hasOwnProperty(property)) … … 107 108 }, 108 109 109 // Localized string accessor 110 UIString: function(s){ 111 if (!this.localizedStrings) 112 this.localizedStrings = mediaControlsLocalizedStrings(); 113 114 if (this.localizedStrings[s]) 115 return this.localizedStrings[s]; 116 117 console.error("Localized string \"" + s + "\" not found."); 110 UIString: function(developmentString, replaceString, replacementString) 111 { 112 var localized = UIStringTable[developmentString]; 113 if (replaceString && replacementString) 114 return localized.replace(replaceString, replacementString); 115 116 if (localized) 117 return localized; 118 119 console.error("Localization for string \"" + developmentString + "\" not found."); 118 120 return "LOCALIZED STRING NOT FOUND"; 119 121 }, … … 265 267 var rewindButton = this.controls.rewindButton = document.createElement('button'); 266 268 rewindButton.setAttribute('pseudo', '-webkit-media-controls-rewind-button'); 267 rewindButton.setAttribute('aria-label', this.UIString('Rewind %%sec%% Seconds').replace('%%sec%%', this.RewindAmount));269 rewindButton.setAttribute('aria-label', this.UIString('Rewind ##sec## Seconds', '##sec##', this.RewindAmount)); 268 270 this.listenFor(rewindButton, 'click', this.handleRewindButtonClicked); 269 271 -
trunk/Source/WebCore/Modules/mediacontrols/mediaControlsiOS.js
r167145 r167596 63 63 }, 64 64 65 UIString: function(s){66 var string = Controller.prototype.UIString.call(this, s);67 if (string)68 return string;69 70 if (!this.localizedStrings)71 this.localizedStrings = mediaControlsLocalizedStringsiOS();72 73 if (this.localizedStrings[s])74 return this.localizedStrings[s];75 76 console.error("Localized string \"" + s + "\" not found.");77 return "LOCALIZED STRING NOT FOUND";78 },79 80 65 shouldHaveStartPlaybackButton: function() { 81 66 var allowsInline = this.host.mediaPlaybackAllowsInline; … … 122 107 var type = this.host.externalDeviceType; 123 108 if (type == "airplay") { 124 deviceType = this.UIString('## AIRPLAY_DEVICE_TYPE##');125 deviceName = this.UIString('## AIRPLAY_DEVICE_NAME##').replace('##DEVICE_NAME##', this.host.externalDeviceDisplayName);109 deviceType = this.UIString('##WIRELESS_PLAYBACK_DEVICE_TYPE##'); 110 deviceName = this.UIString('##WIRELESS_PLAYBACK_DEVICE_NAME##', '##DEVICE_NAME##', this.host.externalDeviceDisplayName); 126 111 } else if (type == "tvout") { 127 112 deviceType = this.UIString('##TVOUT_DEVICE_TYPE##'); … … 425 410 426 411 Object.create(Controller.prototype).extend(ControllerIOS.prototype); 427 Object.defineProperty(ControllerIOS.prototype, 'constructor', { enumerable: false, value:ControllerIOS });412 Object.defineProperty(ControllerIOS.prototype, 'constructor', { enumerable: false, value: ControllerIOS }); -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r167530 r167596 2291 2291 7A0E771F10C00DB100A0276E /* JSInspectorFrontendHost.h in Headers */ = {isa = PBXBuildFile; fileRef = 7A0E771D10C00DB100A0276E /* JSInspectorFrontendHost.h */; }; 2292 2292 7A1D7FCB18F85F0F00C385AD /* mediaControlsLocalizedStrings.js in Resources */ = {isa = PBXBuildFile; fileRef = 7A1D7FC918F85F0F00C385AD /* mediaControlsLocalizedStrings.js */; }; 2293 7A1D7FCE18F86E5600C385AD /* mediaControlsLocalizedStringsiOS.js in Resources */ = {isa = PBXBuildFile; fileRef = 7A1D7FCC18F86E5600C385AD /* mediaControlsLocalizedStringsiOS.js */; };2294 2293 7A1F2B52126C61B20006A7E6 /* InspectorClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7A1F2B51126C61B20006A7E6 /* InspectorClient.cpp */; }; 2295 2294 7A24587B1021EAF4000A00AA /* InspectorDOMAgent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7A2458791021EAF4000A00AA /* InspectorDOMAgent.cpp */; }; … … 9328 9327 7A0E771D10C00DB100A0276E /* JSInspectorFrontendHost.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSInspectorFrontendHost.h; sourceTree = "<group>"; }; 9329 9328 7A1D7FCA18F85F0F00C385AD /* English */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.javascript; name = English; path = English.lproj/mediaControlsLocalizedStrings.js; sourceTree = SOURCE_ROOT; }; 9330 7A1D7FCD18F86E5600C385AD /* English */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.javascript; name = English; path = English.lproj/mediaControlsLocalizedStringsiOS.js; sourceTree = SOURCE_ROOT; };9331 9329 7A1F2B51126C61B20006A7E6 /* InspectorClient.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InspectorClient.cpp; sourceTree = "<group>"; }; 9332 9330 7A2458791021EAF4000A00AA /* InspectorDOMAgent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InspectorDOMAgent.cpp; sourceTree = "<group>"; }; … … 14605 14603 isa = PBXGroup; 14606 14604 children = ( 14607 7A1D7FCC18F86E5600C385AD /* mediaControlsLocalizedStringsiOS.js */,14608 7A1D7FC918F85F0F00C385AD /* mediaControlsLocalizedStrings.js */,14609 14605 CD0DBB3E142274E600280263 /* audio */, 14610 14606 65998A650E5F5FD3004E097A /* images */, … … 14623 14619 85136C8C0AED665800F90A3D /* linkCursor.png */, 14624 14620 BCAD1808131C7A0D00990406 /* Localizable.strings */, 14621 7A1D7FC918F85F0F00C385AD /* mediaControlsLocalizedStrings.js */, 14625 14622 93153BE114195A5700FCF5BE /* missingImage.png */, 14626 14623 93153BD914181F7A00FCF5BE /* missingImage@2x.png */, … … 26448 26445 buildActionMask = 2147483647; 26449 26446 files = ( 26450 7A1D7FCE18F86E5600C385AD /* mediaControlsLocalizedStringsiOS.js in Resources */,26451 26447 46F9D5DD0B0D60170028EE36 /* aliasCursor.png in Resources */, 26452 26448 46D4F2490AF97E810035385A /* cellCursor.png in Resources */, … … 29591 29587 sourceTree = "<group>"; 29592 29588 }; 29593 7A1D7FCC18F86E5600C385AD /* mediaControlsLocalizedStringsiOS.js */ = {29594 isa = PBXVariantGroup;29595 children = (29596 7A1D7FCD18F86E5600C385AD /* English */,29597 );29598 name = mediaControlsLocalizedStringsiOS.js;29599 sourceTree = "<group>";29600 };29601 29589 BCAD1808131C7A0D00990406 /* Localizable.strings */ = { 29602 29590 isa = PBXVariantGroup; -
trunk/Source/WebCore/rendering/RenderThemeIOS.mm
r167145 r167596 1227 1227 scriptBuilder.append([NSString stringWithContentsOfFile:[[NSBundle bundleForClass:[WebCoreRenderThemeBundle class]] pathForResource:@"mediaControlsLocalizedStrings" ofType:@"js"] encoding:NSUTF8StringEncoding error:nil]); 1228 1228 scriptBuilder.append([NSString stringWithContentsOfFile:[[NSBundle bundleForClass:[WebCoreRenderThemeBundle class]] pathForResource:@"mediaControlsApple" ofType:@"js"] encoding:NSUTF8StringEncoding error:nil]); 1229 scriptBuilder.append([NSString stringWithContentsOfFile:[[NSBundle bundleForClass:[WebCoreRenderThemeBundle class]] pathForResource:@"mediaControlsLocalizedStringsiOS" ofType:@"js"] encoding:NSUTF8StringEncoding error:nil]);1230 1229 scriptBuilder.append([NSString stringWithContentsOfFile:[[NSBundle bundleForClass:[WebCoreRenderThemeBundle class]] pathForResource:@"mediaControlsiOS" ofType:@"js"] encoding:NSUTF8StringEncoding error:nil]); 1231 1230 m_mediaControlsScript = scriptBuilder.toString();
Note: See TracChangeset
for help on using the changeset viewer.