<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[214723] trunk/Source</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/214723">214723</a></dd>
<dt>Author</dt> <dd>mitz@apple.com</dd>
<dt>Date</dt> <dd>2017-04-01 21:53:39 -0700 (Sat, 01 Apr 2017)</dd>
</dl>
<h3>Log Message</h3>
<pre>[iOS] <input type=file> label should be specified using plural rules
https://bugs.webkit.org/show_bug.cgi?id=170388
Reviewed by Alexey Proskuryakov.
Source/WebCore:
* English.lproj/Localizable.strings: Updated using update-webkit-localizable-strings.
* English.lproj/Localizable.stringsdict: Added an entry for the new key "%lu photo(s) and
%lu video(s)", with plural rules covering all the different combinations in English.
Other localizations may specify additional combinations as needed.
Source/WebKit2:
* UIProcess/ios/forms/WKFileUploadPanel.mm:
(-[WKFileUploadPanel _processMediaInfoDictionaries:atIndex:processedResults:processedImageCount:processedVideoCount:successBlock:failureBlock:]):
Instead of calling -_displayStringForPhotos:videos:, use
+[NSString localizedStringWithFormat:] with the new format string "%lu photo(s) and
%lu video(s)" for which there are plural rules.
(-[WKFileUploadPanel _displayStringForPhotos:videos:]): Deleted.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreEnglishlprojLocalizablestrings">trunk/Source/WebCore/English.lproj/Localizable.strings</a></li>
<li><a href="#trunkSourceWebCoreEnglishlprojLocalizablestringsdict">trunk/Source/WebCore/English.lproj/Localizable.stringsdict</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2UIProcessiosformsWKFileUploadPanelmm">trunk/Source/WebKit2/UIProcess/ios/forms/WKFileUploadPanel.mm</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (214722 => 214723)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2017-04-02 01:56:34 UTC (rev 214722)
+++ trunk/Source/WebCore/ChangeLog        2017-04-02 04:53:39 UTC (rev 214723)
</span><span class="lines">@@ -1,3 +1,16 @@
</span><ins>+2017-04-01 Dan Bernstein <mitz@apple.com>
+
+ [iOS] <input type=file> label should be specified using plural rules
+ https://bugs.webkit.org/show_bug.cgi?id=170388
+
+ Reviewed by Alexey Proskuryakov.
+
+ * English.lproj/Localizable.strings: Updated using update-webkit-localizable-strings.
+
+ * English.lproj/Localizable.stringsdict: Added an entry for the new key "%lu photo(s) and
+ %lu video(s)", with plural rules covering all the different combinations in English.
+ Other localizations may specify additional combinations as needed.
+
</ins><span class="cx"> 2017-04-01 Alexey Proskuryakov <ap@apple.com>
</span><span class="cx">
</span><span class="cx"> Rolling back <https://trac.webkit.org/r214697>, as it made WebKit2.DataDetectionReferenceDate time out.
</span></span></pre></div>
<a id="trunkSourceWebCoreEnglishlprojLocalizablestrings"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/English.lproj/Localizable.strings (214722 => 214723)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/English.lproj/Localizable.strings        2017-04-02 01:56:34 UTC (rev 214722)
+++ trunk/Source/WebCore/English.lproj/Localizable.strings        2017-04-02 04:53:39 UTC (rev 214723)
</span><span class="lines">@@ -1,12 +1,3 @@
</span><del>-/* File Upload multiple photos label */
-"# Photos (file upload on page label for multiple photos)" = "%@ Photos";
-
-/* File Upload images and videos label */
-"# Photos and # Videos (file upload on page label for image and videos)" = "%@ and %@";
-
-/* File Upload multiple videos label */
-"# Videos (file upload on page label for multiple videos)" = "%@ Videos";
-
</del><span class="cx"> /* accessibility help text for media controller time value >= 1 day */
</span><span class="cx"> "%1$d days %2$d hours %3$d minutes %4$d seconds" = "%1$d days %2$d hours %3$d minutes %4$d seconds";
</span><span class="cx">
</span><span class="lines">@@ -67,6 +58,9 @@
</span><span class="cx"> /* Label for PDF page number indicator. */
</span><span class="cx"> "%d of %d" = "%d of %d";
</span><span class="cx">
</span><ins>+/* label next to file upload control; parameters are the number of photos and the number of videos */
+"%lu photo(s) and %lu video(s)" = "%lu photo(s) and %lu video(s)";
+
</ins><span class="cx"> /* window title for a standalone image (uses multiplication symbol, not x) */
</span><span class="cx"> "%s %d×%d pixels" = "%s %d×%d pixels";
</span><span class="cx">
</span><span class="lines">@@ -82,12 +76,6 @@
</span><span class="cx"> /* Present the element <select multiple> when a single <option> is selected (iOS only) */
</span><span class="cx"> "1 Item" = "1 Item";
</span><span class="cx">
</span><del>-/* File Upload single photo label */
-"1 Photo (file upload on page label for one photo)" = "1 Photo";
-
-/* File Upload single video label */
-"1 Video (file upload on page label for one video)" = "1 Video";
-
</del><span class="cx"> /* Option in segmented control for choosing list type in text editing */
</span><span class="cx"> "1. 2. 3." = "1. 2. 3.";
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoreEnglishlprojLocalizablestringsdict"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/English.lproj/Localizable.stringsdict (214722 => 214723)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/English.lproj/Localizable.stringsdict        2017-04-02 01:56:34 UTC (rev 214722)
+++ trunk/Source/WebCore/English.lproj/Localizable.stringsdict        2017-04-02 04:53:39 UTC (rev 214723)
</span><span class="lines">@@ -2,6 +2,61 @@
</span><span class="cx"> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
</span><span class="cx"> <plist version="1.0">
</span><span class="cx"> <dict>
</span><ins>+        <key>%lu photo(s) and %lu video(s)</key>
+        <dict>
+                <key>NSStringLocalizedFormatKey</key>
+                <string>%1$#@photos@</string>
+                <key>photos</key>
+                <dict>
+                        <key>NSStringFormatSpecTypeKey</key>
+                        <string>NSStringPluralRuleType</string>
+                        <key>NSStringFormatValueTypeKey</key>
+                        <string>lu</string>
+                        <key>zero</key>
+                        <string>%2$#@zeroPhotosVideos@</string>
+                        <key>one</key>
+                        <string>%2$#@onePhotoVideos@</string>
+                        <key>other</key>
+                        <string>%2$#@otherPhotosVideos@</string>
+                </dict>
+                <key>zeroPhotosVideos</key>
+                <dict>
+                        <key>NSStringFormatSpecTypeKey</key>
+                        <string>NSStringPluralRuleType</string>
+                        <key>NSStringFormatValueTypeKey</key>
+                        <string>lu</string>
+                        <key>one</key>
+                        <string>1 video</string>
+                        <key>other</key>
+                        <string>%2$lu videos</string>
+                </dict>
+                <key>onePhotoVideos</key>
+                <dict>
+                        <key>NSStringFormatSpecTypeKey</key>
+                        <string>NSStringPluralRuleType</string>
+                        <key>NSStringFormatValueTypeKey</key>
+                        <string>lu</string>
+                        <key>zero</key>
+                        <string>1 photo</string>
+                        <key>one</key>
+                        <string>1 photo and 1 video</string>
+                        <key>other</key>
+                        <string>1 photo and %2$lu videos</string>
+                </dict>
+                <key>otherPhotosVideos</key>
+                <dict>
+                        <key>NSStringFormatSpecTypeKey</key>
+                        <string>NSStringPluralRuleType</string>
+                        <key>NSStringFormatValueTypeKey</key>
+                        <string>lu</string>
+                        <key>zero</key>
+                        <string>%1$lu photos</string>
+                        <key>one</key>
+                        <string>%1$lu photos and 1 video</string>
+                        <key>other</key>
+                        <string>%1$lu photos and %2$lu videos</string>
+                </dict>
+        </dict>
</ins><span class="cx">         <key>Use no more than %d character(s)</key>
</span><span class="cx">         <dict>
</span><span class="cx">                 <key>NSStringLocalizedFormatKey</key>
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (214722 => 214723)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2017-04-02 01:56:34 UTC (rev 214722)
+++ trunk/Source/WebKit2/ChangeLog        2017-04-02 04:53:39 UTC (rev 214723)
</span><span class="lines">@@ -1,5 +1,19 @@
</span><span class="cx"> 2017-04-01 Dan Bernstein <mitz@apple.com>
</span><span class="cx">
</span><ins>+ [iOS] <input type=file> label should be specified using plural rules
+ https://bugs.webkit.org/show_bug.cgi?id=170388
+
+ Reviewed by Alexey Proskuryakov.
+
+ * UIProcess/ios/forms/WKFileUploadPanel.mm:
+ (-[WKFileUploadPanel _processMediaInfoDictionaries:atIndex:processedResults:processedImageCount:processedVideoCount:successBlock:failureBlock:]):
+ Instead of calling -_displayStringForPhotos:videos:, use
+ +[NSString localizedStringWithFormat:] with the new format string "%lu photo(s) and
+ %lu video(s)" for which there are plural rules.
+ (-[WKFileUploadPanel _displayStringForPhotos:videos:]): Deleted.
+
+2017-04-01 Dan Bernstein <mitz@apple.com>
+
</ins><span class="cx"> [Xcode] In engineering builds, linker warns about libwebrtc.dylib’s install name being invalid
</span><span class="cx"> https://bugs.webkit.org/show_bug.cgi?id=170385
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessiosformsWKFileUploadPanelmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/ios/forms/WKFileUploadPanel.mm (214722 => 214723)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/ios/forms/WKFileUploadPanel.mm        2017-04-02 01:56:34 UTC (rev 214722)
+++ trunk/Source/WebKit2/UIProcess/ios/forms/WKFileUploadPanel.mm        2017-04-02 04:53:39 UTC (rev 214723)
</span><span class="lines">@@ -711,7 +711,7 @@
</span><span class="cx"> {
</span><span class="cx"> NSUInteger count = [infos count];
</span><span class="cx"> if (index == count) {
</span><del>- NSString *displayString = [self _displayStringForPhotos:processedImageCount videos:processedVideoCount];
</del><ins>+ 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;
</ins><span class="cx"> successBlock(processedResults, displayString);
</span><span class="cx"> return;
</span><span class="cx"> }
</span><span class="lines">@@ -864,69 +864,6 @@
</span><span class="cx"> [self _uploadItemForJPEGRepresentationOfImage:originalImage successBlock:successBlock failureBlock:failureBlock];
</span><span class="cx"> }
</span><span class="cx">
</span><del>-- (NSString *)_displayStringForPhotos:(NSUInteger)imageCount videos:(NSUInteger)videoCount
-{
- if (!imageCount && !videoCount)
- return nil;
-
- NSString *title;
- NSString *countString;
- NSString *imageString;
- NSString *videoString;
- NSUInteger numberOfTypes = 2;
-
- RetainPtr<NSNumberFormatter> countFormatter = adoptNS([[NSNumberFormatter alloc] init]);
- [countFormatter setLocale:[NSLocale currentLocale]];
- [countFormatter setGeneratesDecimalNumbers:YES];
- [countFormatter setNumberStyle:NSNumberFormatterDecimalStyle];
-
- // Generate the individual counts for each type.
- switch (imageCount) {
- case 0:
- imageString = nil;
- --numberOfTypes;
- break;
- case 1:
- imageString = WEB_UI_STRING_KEY("1 Photo", "1 Photo (file upload on page label for one photo)", "File Upload single photo label");
- break;
- default:
- countString = [countFormatter stringFromNumber:@(imageCount)];
- imageString = [NSString stringWithFormat:WEB_UI_STRING_KEY("%@ Photos", "# Photos (file upload on page label for multiple photos)", "File Upload multiple photos label"), countString];
- break;
- }
-
- switch (videoCount) {
- case 0:
- videoString = nil;
- --numberOfTypes;
- break;
- case 1:
- videoString = WEB_UI_STRING_KEY("1 Video", "1 Video (file upload on page label for one video)", "File Upload single video label");
- break;
- default:
- countString = [countFormatter stringFromNumber:@(videoCount)];
- videoString = [NSString stringWithFormat:WEB_UI_STRING_KEY("%@ Videos", "# Videos (file upload on page label for multiple videos)", "File Upload multiple videos label"), countString];
- break;
- }
-
- // Combine into a single result string if needed.
- switch (numberOfTypes) {
- case 2:
- // FIXME: For localization we should build a complete string. We should have a localized string for each different combination.
- 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];
- break;
- case 1:
- title = imageString ? imageString : videoString;
- break;
- default:
- ASSERT_NOT_REACHED();
- title = nil;
- break;
- }
-
- return [title lowercaseString];
-}
-
</del><span class="cx"> @end
</span><span class="cx">
</span><span class="cx"> #pragma clang diagnostic pop
</span></span></pre>
</div>
</div>
</body>
</html>