Changeset 214723 in webkit
- Timestamp:
- Apr 1, 2017, 9:53:39 PM (8 years ago)
- Location:
- trunk/Source
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r214722 r214723 1 2017-04-01 Dan Bernstein <mitz@apple.com> 2 3 [iOS] <input type=file> label should be specified using plural rules 4 https://bugs.webkit.org/show_bug.cgi?id=170388 5 6 Reviewed by Alexey Proskuryakov. 7 8 * English.lproj/Localizable.strings: Updated using update-webkit-localizable-strings. 9 10 * English.lproj/Localizable.stringsdict: Added an entry for the new key "%lu photo(s) and 11 %lu video(s)", with plural rules covering all the different combinations in English. 12 Other localizations may specify additional combinations as needed. 13 1 14 2017-04-01 Alexey Proskuryakov <ap@apple.com> 2 15 -
trunk/Source/WebCore/English.lproj/Localizable.strings
r214720 r214723 1 /* File Upload multiple photos label */2 "# Photos (file upload on page label for multiple photos)" = "%@ Photos";3 4 /* File Upload images and videos label */5 "# Photos and # Videos (file upload on page label for image and videos)" = "%@ and %@";6 7 /* File Upload multiple videos label */8 "# Videos (file upload on page label for multiple videos)" = "%@ Videos";9 10 1 /* accessibility help text for media controller time value >= 1 day */ 11 2 "%1$d days %2$d hours %3$d minutes %4$d seconds" = "%1$d days %2$d hours %3$d minutes %4$d seconds"; … … 68 59 "%d of %d" = "%d of %d"; 69 60 61 /* label next to file upload control; parameters are the number of photos and the number of videos */ 62 "%lu photo(s) and %lu video(s)" = "%lu photo(s) and %lu video(s)"; 63 70 64 /* window title for a standalone image (uses multiplication symbol, not x) */ 71 65 "%s %d×%d pixels" = "%s %d×%d pixels"; … … 83 77 "1 Item" = "1 Item"; 84 78 85 /* File Upload single photo label */86 "1 Photo (file upload on page label for one photo)" = "1 Photo";87 88 /* File Upload single video label */89 "1 Video (file upload on page label for one video)" = "1 Video";90 91 79 /* Option in segmented control for choosing list type in text editing */ 92 80 "1. 2. 3." = "1. 2. 3."; -
trunk/Source/WebCore/English.lproj/Localizable.stringsdict
r210447 r214723 3 3 <plist version="1.0"> 4 4 <dict> 5 <key>%lu photo(s) and %lu video(s)</key> 6 <dict> 7 <key>NSStringLocalizedFormatKey</key> 8 <string>%1$#@photos@</string> 9 <key>photos</key> 10 <dict> 11 <key>NSStringFormatSpecTypeKey</key> 12 <string>NSStringPluralRuleType</string> 13 <key>NSStringFormatValueTypeKey</key> 14 <string>lu</string> 15 <key>zero</key> 16 <string>%2$#@zeroPhotosVideos@</string> 17 <key>one</key> 18 <string>%2$#@onePhotoVideos@</string> 19 <key>other</key> 20 <string>%2$#@otherPhotosVideos@</string> 21 </dict> 22 <key>zeroPhotosVideos</key> 23 <dict> 24 <key>NSStringFormatSpecTypeKey</key> 25 <string>NSStringPluralRuleType</string> 26 <key>NSStringFormatValueTypeKey</key> 27 <string>lu</string> 28 <key>one</key> 29 <string>1 video</string> 30 <key>other</key> 31 <string>%2$lu videos</string> 32 </dict> 33 <key>onePhotoVideos</key> 34 <dict> 35 <key>NSStringFormatSpecTypeKey</key> 36 <string>NSStringPluralRuleType</string> 37 <key>NSStringFormatValueTypeKey</key> 38 <string>lu</string> 39 <key>zero</key> 40 <string>1 photo</string> 41 <key>one</key> 42 <string>1 photo and 1 video</string> 43 <key>other</key> 44 <string>1 photo and %2$lu videos</string> 45 </dict> 46 <key>otherPhotosVideos</key> 47 <dict> 48 <key>NSStringFormatSpecTypeKey</key> 49 <string>NSStringPluralRuleType</string> 50 <key>NSStringFormatValueTypeKey</key> 51 <string>lu</string> 52 <key>zero</key> 53 <string>%1$lu photos</string> 54 <key>one</key> 55 <string>%1$lu photos and 1 video</string> 56 <key>other</key> 57 <string>%1$lu photos and %2$lu videos</string> 58 </dict> 59 </dict> 5 60 <key>Use no more than %d character(s)</key> 6 61 <dict> -
trunk/Source/WebKit2/ChangeLog
r214718 r214723 1 2017-04-01 Dan Bernstein <mitz@apple.com> 2 3 [iOS] <input type=file> label should be specified using plural rules 4 https://bugs.webkit.org/show_bug.cgi?id=170388 5 6 Reviewed by Alexey Proskuryakov. 7 8 * UIProcess/ios/forms/WKFileUploadPanel.mm: 9 (-[WKFileUploadPanel _processMediaInfoDictionaries:atIndex:processedResults:processedImageCount:processedVideoCount:successBlock:failureBlock:]): 10 Instead of calling -_displayStringForPhotos:videos:, use 11 +[NSString localizedStringWithFormat:] with the new format string "%lu photo(s) and 12 %lu video(s)" for which there are plural rules. 13 (-[WKFileUploadPanel _displayStringForPhotos:videos:]): Deleted. 14 1 15 2017-04-01 Dan Bernstein <mitz@apple.com> 2 16 -
trunk/Source/WebKit2/UIProcess/ios/forms/WKFileUploadPanel.mm
r213570 r214723 712 712 NSUInteger count = [infos count]; 713 713 if (index == count) { 714 NSString *displayString = [self _displayStringForPhotos:processedImageCount videos:processedVideoCount];714 NSString *displayString = (processedImageCount || processedVideoCount) ? [NSString localizedStringWithFormat:WEB_UI_NSSTRING(@"%lu photo(s) and %lu video(s)", "label next to file upload control; parameters are the number of photos and the number of videos"), (unsigned long)processedImageCount, (unsigned long)processedVideoCount] : nil; 715 715 successBlock(processedResults, displayString); 716 716 return; … … 865 865 } 866 866 867 - (NSString *)_displayStringForPhotos:(NSUInteger)imageCount videos:(NSUInteger)videoCount868 {869 if (!imageCount && !videoCount)870 return nil;871 872 NSString *title;873 NSString *countString;874 NSString *imageString;875 NSString *videoString;876 NSUInteger numberOfTypes = 2;877 878 RetainPtr<NSNumberFormatter> countFormatter = adoptNS([[NSNumberFormatter alloc] init]);879 [countFormatter setLocale:[NSLocale currentLocale]];880 [countFormatter setGeneratesDecimalNumbers:YES];881 [countFormatter setNumberStyle:NSNumberFormatterDecimalStyle];882 883 // Generate the individual counts for each type.884 switch (imageCount) {885 case 0:886 imageString = nil;887 --numberOfTypes;888 break;889 case 1:890 imageString = WEB_UI_STRING_KEY("1 Photo", "1 Photo (file upload on page label for one photo)", "File Upload single photo label");891 break;892 default:893 countString = [countFormatter stringFromNumber:@(imageCount)];894 imageString = [NSString stringWithFormat:WEB_UI_STRING_KEY("%@ Photos", "# Photos (file upload on page label for multiple photos)", "File Upload multiple photos label"), countString];895 break;896 }897 898 switch (videoCount) {899 case 0:900 videoString = nil;901 --numberOfTypes;902 break;903 case 1:904 videoString = WEB_UI_STRING_KEY("1 Video", "1 Video (file upload on page label for one video)", "File Upload single video label");905 break;906 default:907 countString = [countFormatter stringFromNumber:@(videoCount)];908 videoString = [NSString stringWithFormat:WEB_UI_STRING_KEY("%@ Videos", "# Videos (file upload on page label for multiple videos)", "File Upload multiple videos label"), countString];909 break;910 }911 912 // Combine into a single result string if needed.913 switch (numberOfTypes) {914 case 2:915 // FIXME: For localization we should build a complete string. We should have a localized string for each different combination.916 title = [NSString stringWithFormat:WEB_UI_STRING_KEY("%@ and %@", "# Photos and # Videos (file upload on page label for image and videos)", "File Upload images and videos label"), imageString, videoString];917 break;918 case 1:919 title = imageString ? imageString : videoString;920 break;921 default:922 ASSERT_NOT_REACHED();923 title = nil;924 break;925 }926 927 return [title lowercaseString];928 }929 930 867 @end 931 868
Note:
See TracChangeset
for help on using the changeset viewer.