Rubber-stamped by Brady Eidson.
[webbrowser.git] / WebCore / platform / qt / Localizations.cpp
blob1768502d4ffc059b6cf644eb619da950958a1cd2
1 /*
2 * Copyright (C) 2007 Staikos Computing Services Inc. <info@staikos.net>
3 * Copyright (C) 2007 Apple Inc. All rights reserved.
5 * All rights reserved.
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
16 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
19 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
20 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
21 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
22 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
23 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
24 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 #include "config.h"
31 #include "IntSize.h"
32 #include "LocalizedStrings.h"
33 #include "NotImplemented.h"
34 #include "PlatformString.h"
36 #include <QCoreApplication>
37 #include <QLocale>
39 namespace WebCore {
41 String submitButtonDefaultLabel()
43 return QCoreApplication::translate("QWebPage", "Submit", "default label for Submit buttons in forms on web pages");
46 String inputElementAltText()
48 return QCoreApplication::translate("QWebPage", "Submit", "Submit (input element) alt text for <input> elements with no alt, title, or value");
51 String resetButtonDefaultLabel()
53 return QCoreApplication::translate("QWebPage", "Reset", "default label for Reset buttons in forms on web pages");
56 String defaultLanguage()
58 QLocale locale;
59 return locale.name().replace("_", "-");
62 String searchableIndexIntroduction()
64 return QCoreApplication::translate("QWebPage", "This is a searchable index. Enter search keywords: ", "text that appears at the start of nearly-obsolete web pages in the form of a 'searchable index'");
67 String fileButtonChooseFileLabel()
69 return QCoreApplication::translate("QWebPage", "Choose File", "title for file button used in HTML forms");
72 String fileButtonNoFileSelectedLabel()
74 return QCoreApplication::translate("QWebPage", "No file selected", "text to display in file button used in HTML forms when no file is selected");
77 String contextMenuItemTagOpenLinkInNewWindow()
79 return QCoreApplication::translate("QWebPage", "Open in New Window", "Open in New Window context menu item");
82 String contextMenuItemTagDownloadLinkToDisk()
84 return QCoreApplication::translate("QWebPage", "Save Link...", "Download Linked File context menu item");
87 String contextMenuItemTagCopyLinkToClipboard()
89 return QCoreApplication::translate("QWebPage", "Copy Link", "Copy Link context menu item");
92 String contextMenuItemTagOpenImageInNewWindow()
94 return QCoreApplication::translate("QWebPage", "Open Image", "Open Image in New Window context menu item");
97 String contextMenuItemTagDownloadImageToDisk()
99 return QCoreApplication::translate("QWebPage", "Save Image", "Download Image context menu item");
102 String contextMenuItemTagCopyImageToClipboard()
104 return QCoreApplication::translate("QWebPage", "Copy Image", "Copy Link context menu item");
107 String contextMenuItemTagOpenFrameInNewWindow()
109 return QCoreApplication::translate("QWebPage", "Open Frame", "Open Frame in New Window context menu item");
112 String contextMenuItemTagCopy()
114 return QCoreApplication::translate("QWebPage", "Copy", "Copy context menu item");
117 String contextMenuItemTagGoBack()
119 return QCoreApplication::translate("QWebPage", "Go Back", "Back context menu item");
122 String contextMenuItemTagGoForward()
124 return QCoreApplication::translate("QWebPage", "Go Forward", "Forward context menu item");
127 String contextMenuItemTagStop()
129 return QCoreApplication::translate("QWebPage", "Stop", "Stop context menu item");
132 String contextMenuItemTagReload()
134 return QCoreApplication::translate("QWebPage", "Reload", "Reload context menu item");
137 String contextMenuItemTagCut()
139 return QCoreApplication::translate("QWebPage", "Cut", "Cut context menu item");
142 String contextMenuItemTagPaste()
144 return QCoreApplication::translate("QWebPage", "Paste", "Paste context menu item");
147 String contextMenuItemTagNoGuessesFound()
149 return QCoreApplication::translate("QWebPage", "No Guesses Found", "No Guesses Found context menu item");
152 String contextMenuItemTagIgnoreSpelling()
154 return QCoreApplication::translate("QWebPage", "Ignore", "Ignore Spelling context menu item");
157 String contextMenuItemTagLearnSpelling()
159 return QCoreApplication::translate("QWebPage", "Add To Dictionary", "Learn Spelling context menu item");
162 String contextMenuItemTagSearchWeb()
164 return QCoreApplication::translate("QWebPage", "Search The Web", "Search The Web context menu item");
167 String contextMenuItemTagLookUpInDictionary()
169 return QCoreApplication::translate("QWebPage", "Look Up In Dictionary", "Look Up in Dictionary context menu item");
172 String contextMenuItemTagOpenLink()
174 return QCoreApplication::translate("QWebPage", "Open Link", "Open Link context menu item");
177 String contextMenuItemTagIgnoreGrammar()
179 return QCoreApplication::translate("QWebPage", "Ignore", "Ignore Grammar context menu item");
182 String contextMenuItemTagSpellingMenu()
184 return QCoreApplication::translate("QWebPage", "Spelling", "Spelling and Grammar context sub-menu item");
187 String contextMenuItemTagShowSpellingPanel(bool show)
189 return show ? QCoreApplication::translate("QWebPage", "Show Spelling and Grammar", "menu item title") :
190 QCoreApplication::translate("QWebPage", "Hide Spelling and Grammar", "menu item title");
193 String contextMenuItemTagCheckSpelling()
195 return QCoreApplication::translate("QWebPage", "Check Spelling", "Check spelling context menu item");
198 String contextMenuItemTagCheckSpellingWhileTyping()
200 return QCoreApplication::translate("QWebPage", "Check Spelling While Typing", "Check spelling while typing context menu item");
203 String contextMenuItemTagCheckGrammarWithSpelling()
205 return QCoreApplication::translate("QWebPage", "Check Grammar With Spelling", "Check grammar with spelling context menu item");
208 String contextMenuItemTagFontMenu()
210 return QCoreApplication::translate("QWebPage", "Fonts", "Font context sub-menu item");
213 String contextMenuItemTagBold()
215 return QCoreApplication::translate("QWebPage", "Bold", "Bold context menu item");
218 String contextMenuItemTagItalic()
220 return QCoreApplication::translate("QWebPage", "Italic", "Italic context menu item");
223 String contextMenuItemTagUnderline()
225 return QCoreApplication::translate("QWebPage", "Underline", "Underline context menu item");
228 String contextMenuItemTagOutline()
230 return QCoreApplication::translate("QWebPage", "Outline", "Outline context menu item");
233 String contextMenuItemTagWritingDirectionMenu()
235 return QCoreApplication::translate("QWebPage", "Direction", "Writing direction context sub-menu item");
238 String contextMenuItemTagTextDirectionMenu()
240 return QCoreApplication::translate("QWebPage", "Text Direction", "Text direction context sub-menu item");
243 String contextMenuItemTagDefaultDirection()
245 return QCoreApplication::translate("QWebPage", "Default", "Default writing direction context menu item");
248 String contextMenuItemTagLeftToRight()
250 return QCoreApplication::translate("QWebPage", "Left to Right", "Left to Right context menu item");
253 String contextMenuItemTagRightToLeft()
255 return QCoreApplication::translate("QWebPage", "Right to Left", "Right to Left context menu item");
258 String contextMenuItemTagInspectElement()
260 return QCoreApplication::translate("QWebPage", "Inspect", "Inspect Element context menu item");
263 String searchMenuNoRecentSearchesText()
265 return QCoreApplication::translate("QWebPage", "No recent searches", "Label for only item in menu that appears when clicking on the search field image, when no searches have been performed");
268 String searchMenuRecentSearchesText()
270 return QCoreApplication::translate("QWebPage", "Recent searches", "label for first item in the menu that appears when clicking on the search field image, used as embedded menu title");
273 String searchMenuClearRecentSearchesText()
275 return QCoreApplication::translate("QWebPage", "Clear recent searches", "menu item in Recent Searches menu that empties menu's contents");
278 String AXWebAreaText()
280 return String();
283 String AXLinkText()
285 return String();
288 String AXListMarkerText()
290 return String();
293 String AXImageMapText()
295 return String();
298 String AXHeadingText()
300 return String();
303 String AXDefinitionListTermText()
305 return String();
308 String AXDefinitionListDefinitionText()
310 return String();
313 String AXButtonActionVerb()
315 return String();
318 String AXRadioButtonActionVerb()
320 return String();
323 String AXTextFieldActionVerb()
325 return String();
328 String AXCheckedCheckBoxActionVerb()
330 return String();
333 String AXUncheckedCheckBoxActionVerb()
335 return String();
338 String AXLinkActionVerb()
340 return String();
343 String multipleFileUploadText(unsigned)
345 return String();
348 String unknownFileSizeText()
350 return QCoreApplication::translate("QWebPage", "Unknown", "Unknown filesize FTP directory listing item");
353 String imageTitle(const String& filename, const IntSize& size)
355 return QCoreApplication::translate("QWebPage", "%1 (%2x%3 pixels)", "Title string for images").arg(filename).arg(size.width()).arg(size.height());
358 String mediaElementLoadingStateText()
360 return QCoreApplication::translate("QWebPage", "Loading...", "Media controller status message when the media is loading");
363 String mediaElementLiveBroadcastStateText()
365 return QCoreApplication::translate("QWebPage", "Live Broadcast", "Media controller status message when watching a live broadcast");
368 #if ENABLE(VIDEO)
370 String localizedMediaControlElementString(const String& name)
372 if (name == "AudioElement")
373 return QCoreApplication::translate("QWebPage", "Audio Element", "Media controller element");
374 if (name == "VideoElement")
375 return QCoreApplication::translate("QWebPage", "Video Element", "Media controller element");
376 if (name == "MuteButton")
377 return QCoreApplication::translate("QWebPage", "Mute Button", "Media controller element");
378 if (name == "UnMuteButton")
379 return QCoreApplication::translate("QWebPage", "Unmute Button", "Media controller element");
380 if (name == "PlayButton")
381 return QCoreApplication::translate("QWebPage", "Play Button", "Media controller element");
382 if (name == "PauseButton")
383 return QCoreApplication::translate("QWebPage", "Pause Button", "Media controller element");
384 if (name == "Slider")
385 return QCoreApplication::translate("QWebPage", "Slider", "Media controller element");
386 if (name == "SliderThumb")
387 return QCoreApplication::translate("QWebPage", "Slider Thumb", "Media controller element");
388 if (name == "RewindButton")
389 return QCoreApplication::translate("QWebPage", "Rewind Button", "Media controller element");
390 if (name == "ReturnToRealtimeButton")
391 return QCoreApplication::translate("QWebPage", "Return to Real-time Button", "Media controller element");
392 if (name == "CurrentTimeDisplay")
393 return QCoreApplication::translate("QWebPage", "Elapsed Time", "Media controller element");
394 if (name == "TimeRemainingDisplay")
395 return QCoreApplication::translate("QWebPage", "Remaining Time", "Media controller element");
396 if (name == "StatusDisplay")
397 return QCoreApplication::translate("QWebPage", "Status Display", "Media controller element");
398 if (name == "FullscreenButton")
399 return QCoreApplication::translate("QWebPage", "Fullscreen Button", "Media controller element");
400 if (name == "SeekForwardButton")
401 return QCoreApplication::translate("QWebPage", "Seek Forward Button", "Media controller element");
402 if (name == "SeekBackButton")
403 return QCoreApplication::translate("QWebPage", "Seek Back Button", "Media controller element");
405 return String();
408 String localizedMediaControlElementHelpText(const String& name)
410 if (name == "AudioElement")
411 return QCoreApplication::translate("QWebPage", "Audio element playback controls and status display", "Media controller element");
412 if (name == "VideoElement")
413 return QCoreApplication::translate("QWebPage", "Video element playback controls and status display", "Media controller element");
414 if (name == "MuteButton")
415 return QCoreApplication::translate("QWebPage", "Mute audio tracks", "Media controller element");
416 if (name == "UnMuteButton")
417 return QCoreApplication::translate("QWebPage", "Unmute audio tracks", "Media controller element");
418 if (name == "PlayButton")
419 return QCoreApplication::translate("QWebPage", "Begin playback", "Media controller element");
420 if (name == "PauseButton")
421 return QCoreApplication::translate("QWebPage", "Pause playback", "Media controller element");
422 if (name == "Slider")
423 return QCoreApplication::translate("QWebPage", "Movie time scrubber", "Media controller element");
424 if (name == "SliderThumb")
425 return QCoreApplication::translate("QWebPage", "Movie time scrubber thumb", "Media controller element");
426 if (name == "RewindButton")
427 return QCoreApplication::translate("QWebPage", "Rewind movie", "Media controller element");
428 if (name == "ReturnToRealtimeButton")
429 return QCoreApplication::translate("QWebPage", "Return streaming movie to real-time", "Media controller element");
430 if (name == "CurrentTimeDisplay")
431 return QCoreApplication::translate("QWebPage", "Current movie time", "Media controller element");
432 if (name == "TimeRemainingDisplay")
433 return QCoreApplication::translate("QWebPage", "Remaining movie time", "Media controller element");
434 if (name == "StatusDisplay")
435 return QCoreApplication::translate("QWebPage", "Current movie status", "Media controller element");
436 if (name == "FullscreenButton")
437 return QCoreApplication::translate("QWebPage", "Play movie in full-screen mode", "Media controller element");
438 if (name == "SeekForwardButton")
439 return QCoreApplication::translate("QWebPage", "Seek quickly back", "Media controller element");
440 if (name == "SeekBackButton")
441 return QCoreApplication::translate("QWebPage", "Seek quickly forward", "Media controller element");
443 ASSERT_NOT_REACHED();
444 return String();
447 String localizedMediaTimeDescription(float time)
449 if (!isfinite(time))
450 return QCoreApplication::translate("QWebPage", "Indefinite time", "Media time description");
452 int seconds = (int)fabsf(time);
453 int days = seconds / (60 * 60 * 24);
454 int hours = seconds / (60 * 60);
455 int minutes = (seconds / 60) % 60;
456 seconds %= 60;
458 if (days) {
459 return QCoreApplication::translate("QWebPage", "%1 days %2 hours %3 minutes %4 seconds", "Media time description").arg(days).arg(hours).arg(minutes).arg(seconds);
462 if (hours) {
463 return QCoreApplication::translate("QWebPage", "%1 hours %2 minutes %3 seconds", "Media time description").arg(hours).arg(minutes).arg(seconds);
466 if (minutes) {
467 return QCoreApplication::translate("QWebPage", "%1 minutes %2 seconds", "Media time description").arg(minutes).arg(seconds);
470 return QCoreApplication::translate("QWebPage", "%1 seconds", "Media time description").arg(seconds);
472 #endif // ENABLE(VIDEO)
474 String validationMessageValueMissingText()
476 notImplemented();
477 return String();
480 String validationMessageTypeMismatchText()
482 notImplemented();
483 return String();
486 String validationMessagePatternMismatchText()
488 notImplemented();
489 return String();
492 String validationMessageTooLongText()
494 notImplemented();
495 return String();
498 String validationMessageRangeUnderflowText()
500 notImplemented();
501 return String();
504 String validationMessageRangeOverflowText()
506 notImplemented();
507 return String();
510 String validationMessageStepMismatchText()
512 notImplemented();
513 return String();
517 // vim: ts=4 sw=4 et