2 * Copyright (C) 2003, 2006, 2009, 2010, 2012, 2013 Apple Inc. All rights reserved.
3 * Copyright (C) 2010 Igalia S.L
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
14 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
15 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
17 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
18 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
19 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
20 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
21 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
22 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 #include "LocalizedStrings.h"
31 #include "NotImplemented.h"
32 #include "TextBreakIterator.h"
33 #include <wtf/MathExtras.h>
34 #include <wtf/unicode/CharacterNames.h>
37 #include <wtf/RetainPtr.h>
41 #include "WebCoreSystemInterface.h"
46 // We can't use String::format for two reasons:
47 // 1) It doesn't handle non-ASCII characters in the format string.
48 // 2) It doesn't handle the %2$d syntax.
49 // Note that because |format| is used as the second parameter to va_start, it cannot be a reference
50 // type according to section 18.7/3 of the C++ N1905 standard.
51 static String formatLocalizedString(String format, ...)
55 va_start(arguments, format);
58 #pragma clang diagnostic push
59 #pragma clang diagnostic ignored "-Wformat-nonliteral"
61 RetainPtr<CFStringRef> result = adoptCF(CFStringCreateWithFormatAndArguments(0, 0, format.createCFString().get(), arguments));
63 #pragma clang diagnostic pop
74 #if ENABLE(CONTEXT_MENUS)
75 static String truncatedStringForLookupMenuItem(const String& original)
77 if (original.isEmpty())
80 // Truncate the string if it's too long. This is in consistency with AppKit.
81 unsigned maxNumberOfGraphemeClustersInLookupMenuItem = 24;
82 DEPRECATED_DEFINE_STATIC_LOCAL(String, ellipsis, (&horizontalEllipsis, 1));
84 String trimmed = original.stripWhiteSpace();
85 unsigned numberOfCharacters = numCharactersInGraphemeClusters(trimmed, maxNumberOfGraphemeClustersInLookupMenuItem);
86 return numberOfCharacters == trimmed.length() ? trimmed : trimmed.left(numberOfCharacters) + ellipsis;
90 String inputElementAltText()
92 return WEB_UI_STRING_KEY("Submit", "Submit (input element)", "alt text for <input> elements with no alt, title, or value");
95 String resetButtonDefaultLabel()
97 return WEB_UI_STRING("Reset", "default label for Reset buttons in forms on web pages");
100 String searchableIndexIntroduction()
102 return WEB_UI_STRING("This is a searchable index. Enter search keywords: ",
103 "text that appears at the start of nearly-obsolete web pages in the form of a 'searchable index'");
106 String submitButtonDefaultLabel()
108 return WEB_UI_STRING("Submit", "default label for Submit buttons in forms on web pages");
111 String fileButtonChooseFileLabel()
113 return WEB_UI_STRING("Choose File", "title for a single file chooser button used in HTML forms");
116 String fileButtonChooseMultipleFilesLabel()
118 return WEB_UI_STRING("Choose Files", "title for a multiple file chooser button used in HTML forms. This title should be as short as possible.");
121 String fileButtonNoFileSelectedLabel()
123 return WEB_UI_STRING("no file selected", "text to display in file button used in HTML forms when no file is selected");
126 String fileButtonNoFilesSelectedLabel()
128 return WEB_UI_STRING("no files selected", "text to display in file button used in HTML forms when no files are selected and the button allows multiple files to be selected");
131 String defaultDetailsSummaryText()
133 return WEB_UI_STRING("Details", "text to display in <details> tag when it has no <summary> child");
137 String copyImageUnknownFileLabel()
139 return WEB_UI_STRING("unknown", "Unknown filename");
143 #if ENABLE(CONTEXT_MENUS)
144 String contextMenuItemTagOpenLinkInNewWindow()
146 return WEB_UI_STRING("Open Link in New Window", "Open in New Window context menu item");
149 String contextMenuItemTagDownloadLinkToDisk()
151 return WEB_UI_STRING("Download Linked File", "Download Linked File context menu item");
154 String contextMenuItemTagCopyLinkToClipboard()
156 return WEB_UI_STRING("Copy Link", "Copy Link context menu item");
159 String contextMenuItemTagOpenImageInNewWindow()
161 return WEB_UI_STRING("Open Image in New Window", "Open Image in New Window context menu item");
164 String contextMenuItemTagDownloadImageToDisk()
166 return WEB_UI_STRING("Download Image", "Download Image context menu item");
169 String contextMenuItemTagCopyImageToClipboard()
171 return WEB_UI_STRING("Copy Image", "Copy Image context menu item");
174 String contextMenuItemTagOpenFrameInNewWindow()
176 return WEB_UI_STRING("Open Frame in New Window", "Open Frame in New Window context menu item");
179 String contextMenuItemTagCopy()
181 return WEB_UI_STRING("Copy", "Copy context menu item");
184 String contextMenuItemTagGoBack()
186 return WEB_UI_STRING("Back", "Back context menu item");
189 String contextMenuItemTagGoForward()
191 return WEB_UI_STRING("Forward", "Forward context menu item");
194 String contextMenuItemTagStop()
196 return WEB_UI_STRING("Stop", "Stop context menu item");
199 String contextMenuItemTagReload()
201 return WEB_UI_STRING("Reload", "Reload context menu item");
204 String contextMenuItemTagCut()
206 return WEB_UI_STRING("Cut", "Cut context menu item");
209 String contextMenuItemTagPaste()
211 return WEB_UI_STRING("Paste", "Paste context menu item");
214 String contextMenuItemTagNoGuessesFound()
216 return WEB_UI_STRING("No Guesses Found", "No Guesses Found context menu item");
219 String contextMenuItemTagIgnoreSpelling()
221 return WEB_UI_STRING("Ignore Spelling", "Ignore Spelling context menu item");
224 String contextMenuItemTagLearnSpelling()
226 return WEB_UI_STRING("Learn Spelling", "Learn Spelling context menu item");
230 String contextMenuItemTagSearchInSpotlight()
232 return WEB_UI_STRING("Search in Spotlight", "Search in Spotlight context menu item");
236 String contextMenuItemTagSearchWeb()
239 RetainPtr<CFStringRef> searchProviderName = adoptCF(wkCopyDefaultSearchProviderDisplayName());
240 return formatLocalizedString(WEB_UI_STRING("Search with %@", "Search with search provider context menu item with provider name inserted"), searchProviderName.get());
242 return WEB_UI_STRING("Search with Google", "Search with Google context menu item");
246 String contextMenuItemTagLookUpInDictionary(const String& selectedString)
249 RetainPtr<CFStringRef> selectedCFString = truncatedStringForLookupMenuItem(selectedString).createCFString();
250 return formatLocalizedString(WEB_UI_STRING("Look Up “%@”", "Look Up context menu item with selected word"), selectedCFString.get());
252 return WEB_UI_STRING("Look Up “<selection>”", "Look Up context menu item with selected word").replace("<selection>", truncatedStringForLookupMenuItem(selectedString));
256 String contextMenuItemTagOpenLink()
258 return WEB_UI_STRING("Open Link", "Open Link context menu item");
261 String contextMenuItemTagIgnoreGrammar()
263 return WEB_UI_STRING("Ignore Grammar", "Ignore Grammar context menu item");
266 String contextMenuItemTagSpellingMenu()
268 return WEB_UI_STRING("Spelling and Grammar", "Spelling and Grammar context sub-menu item");
271 String contextMenuItemTagShowSpellingPanel(bool show)
274 return WEB_UI_STRING("Show Spelling and Grammar", "menu item title");
275 return WEB_UI_STRING("Hide Spelling and Grammar", "menu item title");
278 String contextMenuItemTagCheckSpelling()
280 return WEB_UI_STRING("Check Document Now", "Check spelling context menu item");
283 String contextMenuItemTagCheckSpellingWhileTyping()
285 return WEB_UI_STRING("Check Spelling While Typing", "Check spelling while typing context menu item");
288 String contextMenuItemTagCheckGrammarWithSpelling()
290 return WEB_UI_STRING("Check Grammar With Spelling", "Check grammar with spelling context menu item");
293 String contextMenuItemTagFontMenu()
295 return WEB_UI_STRING("Font", "Font context sub-menu item");
299 String contextMenuItemTagShowFonts()
301 return WEB_UI_STRING("Show Fonts", "Show fonts context menu item");
305 String contextMenuItemTagBold()
307 return WEB_UI_STRING("Bold", "Bold context menu item");
310 String contextMenuItemTagItalic()
312 return WEB_UI_STRING("Italic", "Italic context menu item");
315 String contextMenuItemTagUnderline()
317 return WEB_UI_STRING("Underline", "Underline context menu item");
320 String contextMenuItemTagOutline()
322 return WEB_UI_STRING("Outline", "Outline context menu item");
326 String contextMenuItemTagStyles()
328 return WEB_UI_STRING("Styles...", "Styles context menu item");
331 String contextMenuItemTagShowColors()
333 return WEB_UI_STRING("Show Colors", "Show colors context menu item");
336 String contextMenuItemTagSpeechMenu()
338 return WEB_UI_STRING("Speech", "Speech context sub-menu item");
341 String contextMenuItemTagStartSpeaking()
343 return WEB_UI_STRING("Start Speaking", "Start speaking context menu item");
346 String contextMenuItemTagStopSpeaking()
348 return WEB_UI_STRING("Stop Speaking", "Stop speaking context menu item");
352 String contextMenuItemTagWritingDirectionMenu()
354 return WEB_UI_STRING("Paragraph Direction", "Paragraph direction context sub-menu item");
357 String contextMenuItemTagTextDirectionMenu()
359 return WEB_UI_STRING("Selection Direction", "Selection direction context sub-menu item");
362 String contextMenuItemTagDefaultDirection()
364 return WEB_UI_STRING("Default", "Default writing direction context menu item");
367 String contextMenuItemTagLeftToRight()
369 return WEB_UI_STRING("Left to Right", "Left to Right context menu item");
372 String contextMenuItemTagRightToLeft()
374 return WEB_UI_STRING("Right to Left", "Right to Left context menu item");
379 String contextMenuItemTagCorrectSpellingAutomatically()
381 return WEB_UI_STRING("Correct Spelling Automatically", "Correct Spelling Automatically context menu item");
384 String contextMenuItemTagSubstitutionsMenu()
386 return WEB_UI_STRING("Substitutions", "Substitutions context sub-menu item");
389 String contextMenuItemTagShowSubstitutions(bool show)
392 return WEB_UI_STRING("Show Substitutions", "menu item title");
393 return WEB_UI_STRING("Hide Substitutions", "menu item title");
396 String contextMenuItemTagSmartCopyPaste()
398 return WEB_UI_STRING("Smart Copy/Paste", "Smart Copy/Paste context menu item");
401 String contextMenuItemTagSmartQuotes()
403 return WEB_UI_STRING("Smart Quotes", "Smart Quotes context menu item");
406 String contextMenuItemTagSmartDashes()
408 return WEB_UI_STRING("Smart Dashes", "Smart Dashes context menu item");
411 String contextMenuItemTagSmartLinks()
413 return WEB_UI_STRING("Smart Links", "Smart Links context menu item");
416 String contextMenuItemTagTextReplacement()
418 return WEB_UI_STRING("Text Replacement", "Text Replacement context menu item");
421 String contextMenuItemTagTransformationsMenu()
423 return WEB_UI_STRING("Transformations", "Transformations context sub-menu item");
426 String contextMenuItemTagMakeUpperCase()
428 return WEB_UI_STRING("Make Upper Case", "Make Upper Case context menu item");
431 String contextMenuItemTagMakeLowerCase()
433 return WEB_UI_STRING("Make Lower Case", "Make Lower Case context menu item");
436 String contextMenuItemTagCapitalize()
438 return WEB_UI_STRING("Capitalize", "Capitalize context menu item");
441 String contextMenuItemTagChangeBack(const String& replacedString)
444 return replacedString;
447 #endif // PLATFORM(COCOA)
449 String contextMenuItemTagOpenVideoInNewWindow()
451 return WEB_UI_STRING("Open Video in New Window", "Open Video in New Window context menu item");
454 String contextMenuItemTagOpenAudioInNewWindow()
456 return WEB_UI_STRING("Open Audio in New Window", "Open Audio in New Window context menu item");
459 String contextMenuItemTagDownloadVideoToDisk()
461 return WEB_UI_STRING("Download Video", "Download Video To Disk context menu item");
464 String contextMenuItemTagDownloadAudioToDisk()
466 return WEB_UI_STRING("Download Audio", "Download Audio To Disk context menu item");
469 String contextMenuItemTagCopyVideoLinkToClipboard()
471 return WEB_UI_STRING("Copy Video Address", "Copy Video Address Location context menu item");
474 String contextMenuItemTagCopyAudioLinkToClipboard()
476 return WEB_UI_STRING("Copy Audio Address", "Copy Audio Address Location context menu item");
479 String contextMenuItemTagToggleMediaControls()
481 return WEB_UI_STRING("Controls", "Media Controls context menu item");
484 String contextMenuItemTagShowMediaControls()
486 return WEB_UI_STRING("Show Controls", "Show Media Controls context menu item");
489 String contextMenuItemTagHideMediaControls()
491 return WEB_UI_STRING("Hide Controls", "Hide Media Controls context menu item");
494 String contextMenuItemTagToggleMediaLoop()
496 return WEB_UI_STRING("Loop", "Media Loop context menu item");
499 String contextMenuItemTagEnterVideoFullscreen()
501 return WEB_UI_STRING("Enter Full Screen", "Video Enter Fullscreen context menu item");
504 String contextMenuItemTagExitVideoFullscreen()
506 return WEB_UI_STRING("Exit Full Screen", "Video Exit Fullscreen context menu item");
509 String contextMenuItemTagMediaPlay()
511 return WEB_UI_STRING("Play", "Media Play context menu item");
514 String contextMenuItemTagMediaPause()
516 return WEB_UI_STRING("Pause", "Media Pause context menu item");
519 String contextMenuItemTagMediaMute()
521 return WEB_UI_STRING("Mute", "Media Mute context menu item");
524 String contextMenuItemTagInspectElement()
526 return WEB_UI_STRING("Inspect Element", "Inspect Element context menu item");
529 #endif // ENABLE(CONTEXT_MENUS)
532 String searchMenuNoRecentSearchesText()
534 return WEB_UI_STRING("No recent searches", "Label for only item in menu that appears when clicking on the search field image, when no searches have been performed");
537 String searchMenuRecentSearchesText()
539 return WEB_UI_STRING("Recent Searches", "label for first item in the menu that appears when clicking on the search field image, used as embedded menu title");
542 String searchMenuClearRecentSearchesText()
544 return WEB_UI_STRING("Clear Recent Searches", "menu item in Recent Searches menu that empties menu's contents");
547 String AXWebAreaText()
549 return WEB_UI_STRING("HTML content", "accessibility role description for web area");
554 return WEB_UI_STRING("link", "accessibility role description for link");
557 String AXListMarkerText()
559 return WEB_UI_STRING("list marker", "accessibility role description for list marker");
562 String AXImageMapText()
564 return WEB_UI_STRING("image map", "accessibility role description for image map");
567 String AXHeadingText()
569 return WEB_UI_STRING("heading", "accessibility role description for headings");
572 String AXDefinitionText()
574 return WEB_UI_STRING("definition", "role description of ARIA definition role");
577 String AXDescriptionListText()
579 return WEB_UI_STRING("description list", "accessibility role description of a description list");
582 String AXDescriptionListTermText()
584 return WEB_UI_STRING("term", "term word of a description list");
587 String AXDescriptionListDetailText()
589 return WEB_UI_STRING("description", "description detail");
592 String AXFooterRoleDescriptionText()
594 return WEB_UI_STRING("footer", "accessibility role description for a footer");
597 String AXFileUploadButtonText()
599 return WEB_UI_STRING("file upload button", "accessibility role description for a file upload button");
602 String AXSearchFieldCancelButtonText()
604 return WEB_UI_STRING("cancel", "accessibility description for a search field cancel button");
607 String AXButtonActionVerb()
609 return WEB_UI_STRING("press", "Verb stating the action that will occur when a button is pressed, as used by accessibility");
612 String AXRadioButtonActionVerb()
614 return WEB_UI_STRING("select", "Verb stating the action that will occur when a radio button is clicked, as used by accessibility");
617 String AXTextFieldActionVerb()
619 return WEB_UI_STRING("activate", "Verb stating the action that will occur when a text field is selected, as used by accessibility");
622 String AXCheckedCheckBoxActionVerb()
624 return WEB_UI_STRING("uncheck", "Verb stating the action that will occur when a checked checkbox is clicked, as used by accessibility");
627 String AXUncheckedCheckBoxActionVerb()
629 return WEB_UI_STRING("check", "Verb stating the action that will occur when an unchecked checkbox is clicked, as used by accessibility");
632 String AXLinkActionVerb()
634 return WEB_UI_STRING("jump", "Verb stating the action that will occur when a link is clicked, as used by accessibility");
637 String AXMenuListPopupActionVerb()
643 String AXMenuListActionVerb()
649 String AXListItemActionVerb()
654 #endif // !PLATFORM(IOS)
657 String AXARIAContentGroupText(const String& ariaType)
659 if (ariaType == "ARIAApplicationAlert")
660 return WEB_UI_STRING("alert", "An ARIA accessibility group that acts as an alert.");
661 if (ariaType == "ARIAApplicationAlertDialog")
662 return WEB_UI_STRING("alert dialog", "An ARIA accessibility group that acts as an alert dialog.");
663 if (ariaType == "ARIAApplicationDialog")
664 return WEB_UI_STRING("dialog", "An ARIA accessibility group that acts as an dialog.");
665 if (ariaType == "ARIAApplicationLog")
666 return WEB_UI_STRING("log", "An ARIA accessibility group that acts as a console log.");
667 if (ariaType == "ARIAApplicationMarquee")
668 return WEB_UI_STRING("marquee", "An ARIA accessibility group that acts as a marquee.");
669 if (ariaType == "ARIAApplicationStatus")
670 return WEB_UI_STRING("application status", "An ARIA accessibility group that acts as a status update.");
671 if (ariaType == "ARIAApplicationTimer")
672 return WEB_UI_STRING("timer", "An ARIA accessibility group that acts as an updating timer.");
673 if (ariaType == "ARIADocument")
674 return WEB_UI_STRING("document", "An ARIA accessibility group that acts as a document.");
675 if (ariaType == "ARIADocumentArticle")
676 return WEB_UI_STRING("article", "An ARIA accessibility group that acts as an article.");
677 if (ariaType == "ARIADocumentNote")
678 return WEB_UI_STRING("note", "An ARIA accessibility group that acts as a note in a document.");
679 if (ariaType == "ARIADocumentRegion")
680 return WEB_UI_STRING("region", "An ARIA accessibility group that acts as a distinct region in a document.");
681 if (ariaType == "ARIALandmarkApplication")
682 return WEB_UI_STRING("application", "An ARIA accessibility group that acts as an application.");
683 if (ariaType == "ARIALandmarkBanner")
684 return WEB_UI_STRING("banner", "An ARIA accessibility group that acts as a banner.");
685 if (ariaType == "ARIALandmarkComplementary")
686 return WEB_UI_STRING("complementary", "An ARIA accessibility group that acts as a region of complementary information.");
687 if (ariaType == "ARIALandmarkContentInfo")
688 return WEB_UI_STRING("content information", "An ARIA accessibility group that contains content.");
689 if (ariaType == "ARIALandmarkMain")
690 return WEB_UI_STRING("main", "An ARIA accessibility group that is the main portion of the website.");
691 if (ariaType == "ARIALandmarkNavigation")
692 return WEB_UI_STRING("navigation", "An ARIA accessibility group that contains the main navigation elements of a website.");
693 if (ariaType == "ARIALandmarkSearch")
694 return WEB_UI_STRING("search", "An ARIA accessibility group that contains a search feature of a website.");
695 if (ariaType == "ARIAUserInterfaceTooltip")
696 return WEB_UI_STRING("tooltip", "An ARIA accessibility group that acts as a tooltip.");
697 if (ariaType == "ARIATabPanel")
698 return WEB_UI_STRING("tab panel", "An ARIA accessibility group that contains the content of a tab.");
699 if (ariaType == "ARIADocumentMath")
700 return WEB_UI_STRING("math", "An ARIA accessibility group that contains mathematical symbols.");
704 String AXHorizontalRuleDescriptionText()
706 return WEB_UI_STRING("separator", "accessibility role description for a horizontal rule [<hr>]");
709 #endif // PLATFORM(COCOA)
711 String missingPluginText()
713 return WEB_UI_STRING("Missing Plug-in", "Label text to be used when a plugin is missing");
716 String crashedPluginText()
718 return WEB_UI_STRING("Plug-in Failure", "Label text to be used if plugin host process has crashed");
721 String blockedPluginByContentSecurityPolicyText()
723 return WEB_UI_STRING_KEY("Blocked Plug-in", "Blocked Plug-In (Blocked by page's Content Security Policy)", "Label text to be used if plugin is blocked by a page's Content Security Policy");
726 String insecurePluginVersionText()
728 return WEB_UI_STRING_KEY("Blocked Plug-in", "Blocked Plug-In (Insecure plug-in)", "Label text to be used when an insecure plug-in version was blocked from loading");
731 String multipleFileUploadText(unsigned numberOfFiles)
733 return formatLocalizedString(WEB_UI_STRING("%d files", "Label to describe the number of files selected in a file upload control that allows multiple files"), numberOfFiles);
736 String unknownFileSizeText()
738 return WEB_UI_STRING_KEY("Unknown", "Unknown (filesize)", "Unknown filesize FTP directory listing item");
742 String uploadFileText()
748 String allFilesText()
756 String builtInPDFPluginName()
758 // Also exposed to DOM.
759 return WEB_UI_STRING("WebKit built-in PDF", "Pseudo plug-in name, visible in the Installed Plug-ins page in Safari.");
762 String pdfDocumentTypeDescription()
764 // Also exposed to DOM.
765 return WEB_UI_STRING("Portable Document Format", "Description of the primary type supported by the PDF pseudo plug-in. Visible in the Installed Plug-ins page in Safari.");
768 String postScriptDocumentTypeDescription()
770 // Also exposed to DOM.
771 return WEB_UI_STRING("PostScript", "Description of the PostScript type supported by the PDF pseudo plug-in. Visible in the Installed Plug-ins page in Safari.");
774 String keygenMenuItem512()
776 return WEB_UI_STRING("512 (Low Grade)", "Menu item title for KEYGEN pop-up menu");
779 String keygenMenuItem1024()
781 return WEB_UI_STRING("1024 (Medium Grade)", "Menu item title for KEYGEN pop-up menu");
784 String keygenMenuItem2048()
786 return WEB_UI_STRING("2048 (High Grade)", "Menu item title for KEYGEN pop-up menu");
789 String keygenKeychainItemName(const String& host)
791 return formatLocalizedString(WEB_UI_STRING("Key from %@", "Name of keychain key generated by the KEYGEN tag"), host.createCFString().get());
797 String htmlSelectMultipleItems(size_t count)
801 return WEB_UI_STRING("0 Items", "Present the element <select multiple> when no <option> items are selected (iOS only)");
803 return WEB_UI_STRING("1 Item", "Present the element <select multiple> when a single <option> is selected (iOS only)");
805 return formatLocalizedString(WEB_UI_STRING("%zu Items", "Present the number of selected <option> items in a <select multiple> element (iOS only)"), count);
809 String fileButtonChooseMediaFileLabel()
811 return WEB_UI_STRING("Choose Media (Single)", "Title for file button used in HTML forms for media files");
814 String fileButtonChooseMultipleMediaFilesLabel()
816 return WEB_UI_STRING("Choose Media (Multiple)", "Title for file button used in HTML5 forms for multiple media files");
819 String fileButtonNoMediaFileSelectedLabel()
821 return WEB_UI_STRING("no media selected (single)", "Text to display in file button used in HTML forms for media files when no media file is selected");
824 String fileButtonNoMediaFilesSelectedLabel()
826 return WEB_UI_STRING("no media selected (multiple)", "Text to display in file button used in HTML forms for media files when no media files are selected and the button allows multiple files to be selected");
830 String imageTitle(const String& filename, const IntSize& size)
833 RetainPtr<CFLocaleRef> locale = adoptCF(CFLocaleCopyCurrent());
834 RetainPtr<CFNumberFormatterRef> formatter = adoptCF(CFNumberFormatterCreate(0, locale.get(), kCFNumberFormatterDecimalStyle));
836 int widthInt = size.width();
837 RetainPtr<CFNumberRef> width = adoptCF(CFNumberCreate(0, kCFNumberIntType, &widthInt));
838 RetainPtr<CFStringRef> widthString = adoptCF(CFNumberFormatterCreateStringWithNumber(0, formatter.get(), width.get()));
840 int heightInt = size.height();
841 RetainPtr<CFNumberRef> height = adoptCF(CFNumberCreate(0, kCFNumberIntType, &heightInt));
842 RetainPtr<CFStringRef> heightString = adoptCF(CFNumberFormatterCreateStringWithNumber(0, formatter.get(), height.get()));
844 return formatLocalizedString(WEB_UI_STRING("%@ %@×%@ pixels", "window title for a standalone image (uses multiplication symbol, not x)"), filename.createCFString().get(), widthString.get(), heightString.get());
846 return formatLocalizedString(WEB_UI_STRING("<filename> %d×%d pixels", "window title for a standalone image (uses multiplication symbol, not x)"), size.width(), size.height()).replace("<filename>", filename);
850 String mediaElementLoadingStateText()
852 return WEB_UI_STRING("Loading...", "Media controller status message when the media is loading");
855 String mediaElementLiveBroadcastStateText()
857 return WEB_UI_STRING("Live Broadcast", "Media controller status message when watching a live broadcast");
860 String localizedMediaControlElementString(const String& name)
862 if (name == "AudioElement")
863 return WEB_UI_STRING("audio playback", "accessibility label for audio element controller");
864 if (name == "VideoElement")
865 return WEB_UI_STRING("video playback", "accessibility label for video element controller");
866 if (name == "MuteButton")
867 return WEB_UI_STRING("mute", "accessibility label for mute button");
868 if (name == "UnMuteButton")
869 return WEB_UI_STRING("unmute", "accessibility label for turn mute off button");
870 if (name == "PlayButton")
871 return WEB_UI_STRING("play", "accessibility label for play button");
872 if (name == "PauseButton")
873 return WEB_UI_STRING("pause", "accessibility label for pause button");
874 if (name == "Slider")
875 return WEB_UI_STRING("movie time", "accessibility label for timeline slider");
876 if (name == "SliderThumb")
877 return WEB_UI_STRING("timeline slider thumb", "accessibility label for timeline thumb");
878 if (name == "RewindButton")
879 return WEB_UI_STRING("back 30 seconds", "accessibility label for seek back 30 seconds button");
880 if (name == "ReturnToRealtimeButton")
881 return WEB_UI_STRING("return to realtime", "accessibility label for return to real time button");
882 if (name == "CurrentTimeDisplay")
883 return WEB_UI_STRING("elapsed time", "accessibility label for elapsed time display");
884 if (name == "TimeRemainingDisplay")
885 return WEB_UI_STRING("remaining time", "accessibility label for time remaining display");
886 if (name == "StatusDisplay")
887 return WEB_UI_STRING("status", "accessibility label for movie status");
888 if (name == "EnterFullscreenButton")
889 return WEB_UI_STRING("enter fullscreen", "accessibility label for enter fullscreen button");
890 if (name == "ExitFullscreenButton")
891 return WEB_UI_STRING("exit fullscreen", "accessibility label for exit fullscreen button");
892 if (name == "SeekForwardButton")
893 return WEB_UI_STRING("fast forward", "accessibility label for fast forward button");
894 if (name == "SeekBackButton")
895 return WEB_UI_STRING("fast reverse", "accessibility label for fast reverse button");
896 if (name == "ShowClosedCaptionsButton")
897 return WEB_UI_STRING("show closed captions", "accessibility label for show closed captions button");
898 if (name == "HideClosedCaptionsButton")
899 return WEB_UI_STRING("hide closed captions", "accessibility label for hide closed captions button");
901 // FIXME: the ControlsPanel container should never be visible in the accessibility hierarchy.
902 if (name == "ControlsPanel")
905 ASSERT_NOT_REACHED();
909 String localizedMediaControlElementHelpText(const String& name)
911 if (name == "AudioElement")
912 return WEB_UI_STRING("audio element playback controls and status display", "accessibility help text for audio element controller");
913 if (name == "VideoElement")
914 return WEB_UI_STRING("video element playback controls and status display", "accessibility help text for video element controller");
915 if (name == "MuteButton")
916 return WEB_UI_STRING("mute audio tracks", "accessibility help text for mute button");
917 if (name == "UnMuteButton")
918 return WEB_UI_STRING("unmute audio tracks", "accessibility help text for un mute button");
919 if (name == "PlayButton")
920 return WEB_UI_STRING("begin playback", "accessibility help text for play button");
921 if (name == "PauseButton")
922 return WEB_UI_STRING("pause playback", "accessibility help text for pause button");
923 if (name == "Slider")
924 return WEB_UI_STRING("movie time scrubber", "accessibility help text for timeline slider");
925 if (name == "SliderThumb")
926 return WEB_UI_STRING("movie time scrubber thumb", "accessibility help text for timeline slider thumb");
927 if (name == "RewindButton")
928 return WEB_UI_STRING("seek movie back 30 seconds", "accessibility help text for jump back 30 seconds button");
929 if (name == "ReturnToRealtimeButton")
930 return WEB_UI_STRING("return streaming movie to real time", "accessibility help text for return streaming movie to real time button");
931 if (name == "CurrentTimeDisplay")
932 return WEB_UI_STRING("current movie time in seconds", "accessibility help text for elapsed time display");
933 if (name == "TimeRemainingDisplay")
934 return WEB_UI_STRING("number of seconds of movie remaining", "accessibility help text for remaining time display");
935 if (name == "StatusDisplay")
936 return WEB_UI_STRING("current movie status", "accessibility help text for movie status display");
937 if (name == "SeekBackButton")
938 return WEB_UI_STRING("seek quickly back", "accessibility help text for fast rewind button");
939 if (name == "SeekForwardButton")
940 return WEB_UI_STRING("seek quickly forward", "accessibility help text for fast forward button");
941 if (name == "FullscreenButton")
942 return WEB_UI_STRING("Play movie in fullscreen mode", "accessibility help text for enter fullscreen button");
943 if (name == "ShowClosedCaptionsButton")
944 return WEB_UI_STRING("start displaying closed captions", "accessibility help text for show closed captions button");
945 if (name == "HideClosedCaptionsButton")
946 return WEB_UI_STRING("stop displaying closed captions", "accessibility help text for hide closed captions button");
948 // The description of this button is descriptive enough that it doesn't require help text.
949 if (name == "EnterFullscreenButton")
952 ASSERT_NOT_REACHED();
956 String localizedMediaTimeDescription(float time)
958 if (!std::isfinite(time))
959 return WEB_UI_STRING("indefinite time", "accessibility help text for an indefinite media controller time value");
961 int seconds = static_cast<int>(fabsf(time));
962 int days = seconds / (60 * 60 * 24);
963 int hours = seconds / (60 * 60);
964 int minutes = (seconds / 60) % 60;
968 return formatLocalizedString(WEB_UI_STRING("%1$d days %2$d hours %3$d minutes %4$d seconds", "accessibility help text for media controller time value >= 1 day"), days, hours, minutes, seconds);
970 return formatLocalizedString(WEB_UI_STRING("%1$d hours %2$d minutes %3$d seconds", "accessibility help text for media controller time value >= 60 minutes"), hours, minutes, seconds);
972 return formatLocalizedString(WEB_UI_STRING("%1$d minutes %2$d seconds", "accessibility help text for media controller time value >= 60 seconds"), minutes, seconds);
973 return formatLocalizedString(WEB_UI_STRING("%1$d seconds", "accessibility help text for media controller time value < 60 seconds"), seconds);
976 String validationMessageValueMissingText()
978 return WEB_UI_STRING("value missing", "Validation message for required form control elements that have no value");
981 String validationMessageValueMissingForCheckboxText()
983 return validationMessageValueMissingText();
986 String validationMessageValueMissingForFileText()
988 return validationMessageValueMissingText();
991 String validationMessageValueMissingForMultipleFileText()
993 return validationMessageValueMissingText();
996 String validationMessageValueMissingForRadioText()
998 return validationMessageValueMissingText();
1001 String validationMessageValueMissingForSelectText()
1003 return validationMessageValueMissingText();
1006 String validationMessageTypeMismatchText()
1008 return WEB_UI_STRING("type mismatch", "Validation message for input form controls with a value not matching type");
1011 String validationMessageTypeMismatchForEmailText()
1013 return validationMessageTypeMismatchText();
1016 String validationMessageTypeMismatchForMultipleEmailText()
1018 return validationMessageTypeMismatchText();
1021 String validationMessageTypeMismatchForURLText()
1023 return validationMessageTypeMismatchText();
1026 String validationMessagePatternMismatchText()
1028 return WEB_UI_STRING("pattern mismatch", "Validation message for input form controls requiring a constrained value according to pattern");
1031 String validationMessageTooLongText(int, int)
1033 return WEB_UI_STRING("too long", "Validation message for form control elements with a value longer than maximum allowed length");
1036 String validationMessageRangeUnderflowText(const String&)
1038 return WEB_UI_STRING("range underflow", "Validation message for input form controls with value lower than allowed minimum");
1041 String validationMessageRangeOverflowText(const String&)
1043 return WEB_UI_STRING("range overflow", "Validation message for input form controls with value higher than allowed maximum");
1046 String validationMessageStepMismatchText(const String&, const String&)
1048 return WEB_UI_STRING("step mismatch", "Validation message for input form controls with value not respecting the step attribute");
1051 String validationMessageBadInputForNumberText()
1054 return validationMessageTypeMismatchText();
1057 String clickToExitFullScreenText()
1059 return WEB_UI_STRING("Click to Exit Full Screen", "Message to display in browser window when in webkit full screen mode.");
1062 #if ENABLE(VIDEO_TRACK)
1063 String textTrackSubtitlesText()
1065 return WEB_UI_STRING("Subtitles", "Menu section heading for subtitles");
1068 String textTrackOffMenuItemText()
1070 return WEB_UI_STRING("Off", "Menu item label for the track that represents disabling closed captions");
1073 String textTrackAutomaticMenuItemText()
1075 return formatLocalizedString(WEB_UI_STRING("Auto (Recommended)", "Menu item label for automatic track selection behavior"));
1078 String textTrackNoLabelText()
1080 return WEB_UI_STRING_KEY("Unknown", "Unknown (text track)", "Menu item label for a text track that has no other name");
1083 String audioTrackNoLabelText()
1085 return WEB_UI_STRING_KEY("Unknown", "Unknown (audio track)", "Menu item label for an audio track that has no other name");
1088 #if PLATFORM(COCOA) || PLATFORM(WIN)
1089 String textTrackCountryAndLanguageMenuItemText(const String& title, const String& country, const String& language)
1091 return formatLocalizedString(WEB_UI_STRING("%@ (%@-%@)", "Text track display name format that includes the country and language of the subtitle, in the form of 'Title (Language-Country)'"), title.createCFString().get(), language.createCFString().get(), country.createCFString().get());
1094 String textTrackLanguageMenuItemText(const String& title, const String& language)
1096 return formatLocalizedString(WEB_UI_STRING("%@ (%@)", "Text track display name format that includes the language of the subtitle, in the form of 'Title (Language)'"), title.createCFString().get(), language.createCFString().get());
1099 String closedCaptionTrackMenuItemText(const String& title)
1101 return formatLocalizedString(WEB_UI_STRING("%@ CC", "Text track contains closed captions"), title.createCFString().get());
1104 String sdhTrackMenuItemText(const String& title)
1106 return formatLocalizedString(WEB_UI_STRING("%@ SDH", "Text track contains subtitles for the deaf and hard of hearing"), title.createCFString().get());
1109 String easyReaderTrackMenuItemText(const String& title)
1111 return formatLocalizedString(WEB_UI_STRING("%@ Easy Reader", "Text track contains simplified (3rd grade level) subtitles"), title.createCFString().get());
1117 String snapshottedPlugInLabelTitle()
1119 return WEB_UI_STRING("Snapshotted Plug-In", "Title of the label to show on a snapshotted plug-in");
1122 String snapshottedPlugInLabelSubtitle()
1124 return WEB_UI_STRING("Click to restart", "Subtitle of the label to show on a snapshotted plug-in");
1127 String useBlockedPlugInContextMenuTitle()
1129 return formatLocalizedString(WEB_UI_STRING("Show in blocked plug-in", "Title of the context menu item to show when PDFPlugin was used instead of a blocked plugin"));
1132 #if ENABLE(SUBTLE_CRYPTO)
1133 String webCryptoMasterKeyKeychainLabel(const String& localizedApplicationName)
1135 return formatLocalizedString(WEB_UI_STRING("%@ WebCrypto Master Key", "Name of application's single WebCrypto master key in Keychain"), localizedApplicationName.createCFString().get());
1138 String webCryptoMasterKeyKeychainComment()
1140 return WEB_UI_STRING("Used to encrypt WebCrypto keys in persistent storage, such as IndexedDB", "Description of WebCrypto master keys in Keychain");
1144 } // namespace WebCore