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 AXAutoFillButtonText()
609 return WEB_UI_STRING("autofill", "accessibility description for a password field AutoFill button");
612 String AXButtonActionVerb()
614 return WEB_UI_STRING("press", "Verb stating the action that will occur when a button is pressed, as used by accessibility");
617 String AXRadioButtonActionVerb()
619 return WEB_UI_STRING("select", "Verb stating the action that will occur when a radio button is clicked, as used by accessibility");
622 String AXTextFieldActionVerb()
624 return WEB_UI_STRING("activate", "Verb stating the action that will occur when a text field is selected, as used by accessibility");
627 String AXCheckedCheckBoxActionVerb()
629 return WEB_UI_STRING("uncheck", "Verb stating the action that will occur when a checked checkbox is clicked, as used by accessibility");
632 String AXUncheckedCheckBoxActionVerb()
634 return WEB_UI_STRING("check", "Verb stating the action that will occur when an unchecked checkbox is clicked, as used by accessibility");
637 String AXLinkActionVerb()
639 return WEB_UI_STRING("jump", "Verb stating the action that will occur when a link is clicked, as used by accessibility");
642 String AXMenuListPopupActionVerb()
648 String AXMenuListActionVerb()
654 String AXListItemActionVerb()
659 #endif // !PLATFORM(IOS)
662 String AXARIAContentGroupText(const String& ariaType)
664 if (ariaType == "ARIAApplicationAlert")
665 return WEB_UI_STRING("alert", "An ARIA accessibility group that acts as an alert.");
666 if (ariaType == "ARIAApplicationAlertDialog")
667 return WEB_UI_STRING("alert dialog", "An ARIA accessibility group that acts as an alert dialog.");
668 if (ariaType == "ARIAApplicationDialog")
669 return WEB_UI_STRING("dialog", "An ARIA accessibility group that acts as an dialog.");
670 if (ariaType == "ARIAApplicationLog")
671 return WEB_UI_STRING("log", "An ARIA accessibility group that acts as a console log.");
672 if (ariaType == "ARIAApplicationMarquee")
673 return WEB_UI_STRING("marquee", "An ARIA accessibility group that acts as a marquee.");
674 if (ariaType == "ARIAApplicationStatus")
675 return WEB_UI_STRING("application status", "An ARIA accessibility group that acts as a status update.");
676 if (ariaType == "ARIAApplicationTimer")
677 return WEB_UI_STRING("timer", "An ARIA accessibility group that acts as an updating timer.");
678 if (ariaType == "ARIADocument")
679 return WEB_UI_STRING("document", "An ARIA accessibility group that acts as a document.");
680 if (ariaType == "ARIADocumentArticle")
681 return WEB_UI_STRING("article", "An ARIA accessibility group that acts as an article.");
682 if (ariaType == "ARIADocumentNote")
683 return WEB_UI_STRING("note", "An ARIA accessibility group that acts as a note in a document.");
684 if (ariaType == "ARIADocumentRegion")
685 return WEB_UI_STRING("region", "An ARIA accessibility group that acts as a distinct region in a document.");
686 if (ariaType == "ARIALandmarkApplication")
687 return WEB_UI_STRING("application", "An ARIA accessibility group that acts as an application.");
688 if (ariaType == "ARIALandmarkBanner")
689 return WEB_UI_STRING("banner", "An ARIA accessibility group that acts as a banner.");
690 if (ariaType == "ARIALandmarkComplementary")
691 return WEB_UI_STRING("complementary", "An ARIA accessibility group that acts as a region of complementary information.");
692 if (ariaType == "ARIALandmarkContentInfo")
693 return WEB_UI_STRING("content information", "An ARIA accessibility group that contains content.");
694 if (ariaType == "ARIALandmarkMain")
695 return WEB_UI_STRING("main", "An ARIA accessibility group that is the main portion of the website.");
696 if (ariaType == "ARIALandmarkNavigation")
697 return WEB_UI_STRING("navigation", "An ARIA accessibility group that contains the main navigation elements of a website.");
698 if (ariaType == "ARIALandmarkSearch")
699 return WEB_UI_STRING("search", "An ARIA accessibility group that contains a search feature of a website.");
700 if (ariaType == "ARIAUserInterfaceTooltip")
701 return WEB_UI_STRING("tooltip", "An ARIA accessibility group that acts as a tooltip.");
702 if (ariaType == "ARIATabPanel")
703 return WEB_UI_STRING("tab panel", "An ARIA accessibility group that contains the content of a tab.");
704 if (ariaType == "ARIADocumentMath")
705 return WEB_UI_STRING("math", "An ARIA accessibility group that contains mathematical symbols.");
709 String AXHorizontalRuleDescriptionText()
711 return WEB_UI_STRING("separator", "accessibility role description for a horizontal rule [<hr>]");
714 #endif // PLATFORM(COCOA)
716 String missingPluginText()
718 return WEB_UI_STRING("Missing Plug-in", "Label text to be used when a plugin is missing");
721 String crashedPluginText()
723 return WEB_UI_STRING("Plug-in Failure", "Label text to be used if plugin host process has crashed");
726 String blockedPluginByContentSecurityPolicyText()
728 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");
731 String insecurePluginVersionText()
733 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");
736 String multipleFileUploadText(unsigned numberOfFiles)
738 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);
741 String unknownFileSizeText()
743 return WEB_UI_STRING_KEY("Unknown", "Unknown (filesize)", "Unknown filesize FTP directory listing item");
747 String uploadFileText()
753 String allFilesText()
761 String builtInPDFPluginName()
763 // Also exposed to DOM.
764 return WEB_UI_STRING("WebKit built-in PDF", "Pseudo plug-in name, visible in the Installed Plug-ins page in Safari.");
767 String pdfDocumentTypeDescription()
769 // Also exposed to DOM.
770 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.");
773 String postScriptDocumentTypeDescription()
775 // Also exposed to DOM.
776 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.");
779 String keygenMenuItem512()
781 return WEB_UI_STRING("512 (Low Grade)", "Menu item title for KEYGEN pop-up menu");
784 String keygenMenuItem1024()
786 return WEB_UI_STRING("1024 (Medium Grade)", "Menu item title for KEYGEN pop-up menu");
789 String keygenMenuItem2048()
791 return WEB_UI_STRING("2048 (High Grade)", "Menu item title for KEYGEN pop-up menu");
794 String keygenKeychainItemName(const String& host)
796 return formatLocalizedString(WEB_UI_STRING("Key from %@", "Name of keychain key generated by the KEYGEN tag"), host.createCFString().get());
802 String htmlSelectMultipleItems(size_t count)
806 return WEB_UI_STRING("0 Items", "Present the element <select multiple> when no <option> items are selected (iOS only)");
808 return WEB_UI_STRING("1 Item", "Present the element <select multiple> when a single <option> is selected (iOS only)");
810 return formatLocalizedString(WEB_UI_STRING("%zu Items", "Present the number of selected <option> items in a <select multiple> element (iOS only)"), count);
814 String fileButtonChooseMediaFileLabel()
816 return WEB_UI_STRING("Choose Media (Single)", "Title for file button used in HTML forms for media files");
819 String fileButtonChooseMultipleMediaFilesLabel()
821 return WEB_UI_STRING("Choose Media (Multiple)", "Title for file button used in HTML5 forms for multiple media files");
824 String fileButtonNoMediaFileSelectedLabel()
826 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");
829 String fileButtonNoMediaFilesSelectedLabel()
831 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");
835 String imageTitle(const String& filename, const IntSize& size)
838 RetainPtr<CFLocaleRef> locale = adoptCF(CFLocaleCopyCurrent());
839 RetainPtr<CFNumberFormatterRef> formatter = adoptCF(CFNumberFormatterCreate(0, locale.get(), kCFNumberFormatterDecimalStyle));
841 int widthInt = size.width();
842 RetainPtr<CFNumberRef> width = adoptCF(CFNumberCreate(0, kCFNumberIntType, &widthInt));
843 RetainPtr<CFStringRef> widthString = adoptCF(CFNumberFormatterCreateStringWithNumber(0, formatter.get(), width.get()));
845 int heightInt = size.height();
846 RetainPtr<CFNumberRef> height = adoptCF(CFNumberCreate(0, kCFNumberIntType, &heightInt));
847 RetainPtr<CFStringRef> heightString = adoptCF(CFNumberFormatterCreateStringWithNumber(0, formatter.get(), height.get()));
849 return formatLocalizedString(WEB_UI_STRING("%@ %@×%@ pixels", "window title for a standalone image (uses multiplication symbol, not x)"), filename.createCFString().get(), widthString.get(), heightString.get());
851 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);
855 String mediaElementLoadingStateText()
857 return WEB_UI_STRING("Loading...", "Media controller status message when the media is loading");
860 String mediaElementLiveBroadcastStateText()
862 return WEB_UI_STRING("Live Broadcast", "Media controller status message when watching a live broadcast");
865 String localizedMediaControlElementString(const String& name)
867 if (name == "AudioElement")
868 return WEB_UI_STRING("audio playback", "accessibility label for audio element controller");
869 if (name == "VideoElement")
870 return WEB_UI_STRING("video playback", "accessibility label for video element controller");
871 if (name == "MuteButton")
872 return WEB_UI_STRING("mute", "accessibility label for mute button");
873 if (name == "UnMuteButton")
874 return WEB_UI_STRING("unmute", "accessibility label for turn mute off button");
875 if (name == "PlayButton")
876 return WEB_UI_STRING("play", "accessibility label for play button");
877 if (name == "PauseButton")
878 return WEB_UI_STRING("pause", "accessibility label for pause button");
879 if (name == "Slider")
880 return WEB_UI_STRING("movie time", "accessibility label for timeline slider");
881 if (name == "SliderThumb")
882 return WEB_UI_STRING("timeline slider thumb", "accessibility label for timeline thumb");
883 if (name == "RewindButton")
884 return WEB_UI_STRING("back 30 seconds", "accessibility label for seek back 30 seconds button");
885 if (name == "ReturnToRealtimeButton")
886 return WEB_UI_STRING("return to realtime", "accessibility label for return to real time button");
887 if (name == "CurrentTimeDisplay")
888 return WEB_UI_STRING("elapsed time", "accessibility label for elapsed time display");
889 if (name == "TimeRemainingDisplay")
890 return WEB_UI_STRING("remaining time", "accessibility label for time remaining display");
891 if (name == "StatusDisplay")
892 return WEB_UI_STRING("status", "accessibility label for movie status");
893 if (name == "EnterFullscreenButton")
894 return WEB_UI_STRING("enter fullscreen", "accessibility label for enter fullscreen button");
895 if (name == "ExitFullscreenButton")
896 return WEB_UI_STRING("exit fullscreen", "accessibility label for exit fullscreen button");
897 if (name == "SeekForwardButton")
898 return WEB_UI_STRING("fast forward", "accessibility label for fast forward button");
899 if (name == "SeekBackButton")
900 return WEB_UI_STRING("fast reverse", "accessibility label for fast reverse button");
901 if (name == "ShowClosedCaptionsButton")
902 return WEB_UI_STRING("show closed captions", "accessibility label for show closed captions button");
903 if (name == "HideClosedCaptionsButton")
904 return WEB_UI_STRING("hide closed captions", "accessibility label for hide closed captions button");
906 // FIXME: the ControlsPanel container should never be visible in the accessibility hierarchy.
907 if (name == "ControlsPanel")
910 ASSERT_NOT_REACHED();
914 String localizedMediaControlElementHelpText(const String& name)
916 if (name == "AudioElement")
917 return WEB_UI_STRING("audio element playback controls and status display", "accessibility help text for audio element controller");
918 if (name == "VideoElement")
919 return WEB_UI_STRING("video element playback controls and status display", "accessibility help text for video element controller");
920 if (name == "MuteButton")
921 return WEB_UI_STRING("mute audio tracks", "accessibility help text for mute button");
922 if (name == "UnMuteButton")
923 return WEB_UI_STRING("unmute audio tracks", "accessibility help text for un mute button");
924 if (name == "PlayButton")
925 return WEB_UI_STRING("begin playback", "accessibility help text for play button");
926 if (name == "PauseButton")
927 return WEB_UI_STRING("pause playback", "accessibility help text for pause button");
928 if (name == "Slider")
929 return WEB_UI_STRING("movie time scrubber", "accessibility help text for timeline slider");
930 if (name == "SliderThumb")
931 return WEB_UI_STRING("movie time scrubber thumb", "accessibility help text for timeline slider thumb");
932 if (name == "RewindButton")
933 return WEB_UI_STRING("seek movie back 30 seconds", "accessibility help text for jump back 30 seconds button");
934 if (name == "ReturnToRealtimeButton")
935 return WEB_UI_STRING("return streaming movie to real time", "accessibility help text for return streaming movie to real time button");
936 if (name == "CurrentTimeDisplay")
937 return WEB_UI_STRING("current movie time in seconds", "accessibility help text for elapsed time display");
938 if (name == "TimeRemainingDisplay")
939 return WEB_UI_STRING("number of seconds of movie remaining", "accessibility help text for remaining time display");
940 if (name == "StatusDisplay")
941 return WEB_UI_STRING("current movie status", "accessibility help text for movie status display");
942 if (name == "SeekBackButton")
943 return WEB_UI_STRING("seek quickly back", "accessibility help text for fast rewind button");
944 if (name == "SeekForwardButton")
945 return WEB_UI_STRING("seek quickly forward", "accessibility help text for fast forward button");
946 if (name == "FullscreenButton")
947 return WEB_UI_STRING("Play movie in fullscreen mode", "accessibility help text for enter fullscreen button");
948 if (name == "ShowClosedCaptionsButton")
949 return WEB_UI_STRING("start displaying closed captions", "accessibility help text for show closed captions button");
950 if (name == "HideClosedCaptionsButton")
951 return WEB_UI_STRING("stop displaying closed captions", "accessibility help text for hide closed captions button");
953 // The description of this button is descriptive enough that it doesn't require help text.
954 if (name == "EnterFullscreenButton")
957 ASSERT_NOT_REACHED();
961 String localizedMediaTimeDescription(float time)
963 if (!std::isfinite(time))
964 return WEB_UI_STRING("indefinite time", "accessibility help text for an indefinite media controller time value");
966 int seconds = static_cast<int>(fabsf(time));
967 int days = seconds / (60 * 60 * 24);
968 int hours = seconds / (60 * 60);
969 int minutes = (seconds / 60) % 60;
973 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);
975 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);
977 return formatLocalizedString(WEB_UI_STRING("%1$d minutes %2$d seconds", "accessibility help text for media controller time value >= 60 seconds"), minutes, seconds);
978 return formatLocalizedString(WEB_UI_STRING("%1$d seconds", "accessibility help text for media controller time value < 60 seconds"), seconds);
981 String validationMessageValueMissingText()
983 return WEB_UI_STRING("value missing", "Validation message for required form control elements that have no value");
986 String validationMessageValueMissingForCheckboxText()
988 return validationMessageValueMissingText();
991 String validationMessageValueMissingForFileText()
993 return validationMessageValueMissingText();
996 String validationMessageValueMissingForMultipleFileText()
998 return validationMessageValueMissingText();
1001 String validationMessageValueMissingForRadioText()
1003 return validationMessageValueMissingText();
1006 String validationMessageValueMissingForSelectText()
1008 return validationMessageValueMissingText();
1011 String validationMessageTypeMismatchText()
1013 return WEB_UI_STRING("type mismatch", "Validation message for input form controls with a value not matching type");
1016 String validationMessageTypeMismatchForEmailText()
1018 return validationMessageTypeMismatchText();
1021 String validationMessageTypeMismatchForMultipleEmailText()
1023 return validationMessageTypeMismatchText();
1026 String validationMessageTypeMismatchForURLText()
1028 return validationMessageTypeMismatchText();
1031 String validationMessagePatternMismatchText()
1033 return WEB_UI_STRING("pattern mismatch", "Validation message for input form controls requiring a constrained value according to pattern");
1036 String validationMessageTooLongText(int, int)
1038 return WEB_UI_STRING("too long", "Validation message for form control elements with a value longer than maximum allowed length");
1041 String validationMessageRangeUnderflowText(const String&)
1043 return WEB_UI_STRING("range underflow", "Validation message for input form controls with value lower than allowed minimum");
1046 String validationMessageRangeOverflowText(const String&)
1048 return WEB_UI_STRING("range overflow", "Validation message for input form controls with value higher than allowed maximum");
1051 String validationMessageStepMismatchText(const String&, const String&)
1053 return WEB_UI_STRING("step mismatch", "Validation message for input form controls with value not respecting the step attribute");
1056 String validationMessageBadInputForNumberText()
1059 return validationMessageTypeMismatchText();
1062 String clickToExitFullScreenText()
1064 return WEB_UI_STRING("Click to Exit Full Screen", "Message to display in browser window when in webkit full screen mode.");
1067 #if ENABLE(VIDEO_TRACK)
1068 String textTrackSubtitlesText()
1070 return WEB_UI_STRING("Subtitles", "Menu section heading for subtitles");
1073 String textTrackOffMenuItemText()
1075 return WEB_UI_STRING("Off", "Menu item label for the track that represents disabling closed captions");
1078 String textTrackAutomaticMenuItemText()
1080 return formatLocalizedString(WEB_UI_STRING("Auto (Recommended)", "Menu item label for automatic track selection behavior"));
1083 String textTrackNoLabelText()
1085 return WEB_UI_STRING_KEY("Unknown", "Unknown (text track)", "Menu item label for a text track that has no other name");
1088 String audioTrackNoLabelText()
1090 return WEB_UI_STRING_KEY("Unknown", "Unknown (audio track)", "Menu item label for an audio track that has no other name");
1093 #if PLATFORM(COCOA) || PLATFORM(WIN)
1094 String textTrackCountryAndLanguageMenuItemText(const String& title, const String& country, const String& language)
1096 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());
1099 String textTrackLanguageMenuItemText(const String& title, const String& language)
1101 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());
1104 String closedCaptionTrackMenuItemText(const String& title)
1106 return formatLocalizedString(WEB_UI_STRING("%@ CC", "Text track contains closed captions"), title.createCFString().get());
1109 String sdhTrackMenuItemText(const String& title)
1111 return formatLocalizedString(WEB_UI_STRING("%@ SDH", "Text track contains subtitles for the deaf and hard of hearing"), title.createCFString().get());
1114 String easyReaderTrackMenuItemText(const String& title)
1116 return formatLocalizedString(WEB_UI_STRING("%@ Easy Reader", "Text track contains simplified (3rd grade level) subtitles"), title.createCFString().get());
1122 String snapshottedPlugInLabelTitle()
1124 return WEB_UI_STRING("Snapshotted Plug-In", "Title of the label to show on a snapshotted plug-in");
1127 String snapshottedPlugInLabelSubtitle()
1129 return WEB_UI_STRING("Click to restart", "Subtitle of the label to show on a snapshotted plug-in");
1132 String useBlockedPlugInContextMenuTitle()
1134 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"));
1137 #if ENABLE(SUBTLE_CRYPTO)
1138 String webCryptoMasterKeyKeychainLabel(const String& localizedApplicationName)
1140 return formatLocalizedString(WEB_UI_STRING("%@ WebCrypto Master Key", "Name of application's single WebCrypto master key in Keychain"), localizedApplicationName.createCFString().get());
1143 String webCryptoMasterKeyKeychainComment()
1145 return WEB_UI_STRING("Used to encrypt WebCrypto keys in persistent storage, such as IndexedDB", "Description of WebCrypto master keys in Keychain");
1149 } // namespace WebCore