Home | History | Annotate | Download | only in qt
      1 /*
      2  * Copyright (C) 2007 Staikos Computing Services Inc. <info (at) staikos.net>
      3  * Copyright (C) 2007 Apple Inc.  All rights reserved.
      4  *
      5  * All rights reserved.
      6  *
      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.
     15  *
     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.
     27  */
     28 
     29 #include "config.h"
     30 
     31 #include "IntSize.h"
     32 #include "LocalizedStrings.h"
     33 #include "NotImplemented.h"
     34 #include "PlatformString.h"
     35 #include <wtf/MathExtras.h>
     36 
     37 #include <QCoreApplication>
     38 #include <QLocale>
     39 
     40 namespace WebCore {
     41 
     42 String submitButtonDefaultLabel()
     43 {
     44     return QCoreApplication::translate("QWebPage", "Submit", "default label for Submit buttons in forms on web pages");
     45 }
     46 
     47 String inputElementAltText()
     48 {
     49     return QCoreApplication::translate("QWebPage", "Submit", "Submit (input element) alt text for <input> elements with no alt, title, or value");
     50 }
     51 
     52 String resetButtonDefaultLabel()
     53 {
     54     return QCoreApplication::translate("QWebPage", "Reset", "default label for Reset buttons in forms on web pages");
     55 }
     56 
     57 String defaultLanguage()
     58 {
     59     QLocale locale;
     60     return locale.name().replace("_", "-");
     61 }
     62 
     63 String searchableIndexIntroduction()
     64 {
     65     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'");
     66 }
     67 
     68 String fileButtonChooseFileLabel()
     69 {
     70     return QCoreApplication::translate("QWebPage", "Choose File", "title for file button used in HTML forms");
     71 }
     72 
     73 String fileButtonNoFileSelectedLabel()
     74 {
     75     return QCoreApplication::translate("QWebPage", "No file selected", "text to display in file button used in HTML forms when no file is selected");
     76 }
     77 
     78 String contextMenuItemTagOpenLinkInNewWindow()
     79 {
     80     return QCoreApplication::translate("QWebPage", "Open in New Window", "Open in New Window context menu item");
     81 }
     82 
     83 String contextMenuItemTagDownloadLinkToDisk()
     84 {
     85     return QCoreApplication::translate("QWebPage", "Save Link...", "Download Linked File context menu item");
     86 }
     87 
     88 String contextMenuItemTagCopyLinkToClipboard()
     89 {
     90     return QCoreApplication::translate("QWebPage", "Copy Link", "Copy Link context menu item");
     91 }
     92 
     93 String contextMenuItemTagOpenImageInNewWindow()
     94 {
     95     return QCoreApplication::translate("QWebPage", "Open Image", "Open Image in New Window context menu item");
     96 }
     97 
     98 String contextMenuItemTagDownloadImageToDisk()
     99 {
    100     return QCoreApplication::translate("QWebPage", "Save Image", "Download Image context menu item");
    101 }
    102 
    103 String contextMenuItemTagCopyImageToClipboard()
    104 {
    105     return QCoreApplication::translate("QWebPage", "Copy Image", "Copy Link context menu item");
    106 }
    107 
    108 String contextMenuItemTagOpenFrameInNewWindow()
    109 {
    110     return QCoreApplication::translate("QWebPage", "Open Frame", "Open Frame in New Window context menu item");
    111 }
    112 
    113 String contextMenuItemTagCopy()
    114 {
    115     return QCoreApplication::translate("QWebPage", "Copy", "Copy context menu item");
    116 }
    117 
    118 String contextMenuItemTagGoBack()
    119 {
    120     return QCoreApplication::translate("QWebPage", "Go Back", "Back context menu item");
    121 }
    122 
    123 String contextMenuItemTagGoForward()
    124 {
    125     return QCoreApplication::translate("QWebPage", "Go Forward", "Forward context menu item");
    126 }
    127 
    128 String contextMenuItemTagStop()
    129 {
    130     return QCoreApplication::translate("QWebPage", "Stop", "Stop context menu item");
    131 }
    132 
    133 String contextMenuItemTagReload()
    134 {
    135     return QCoreApplication::translate("QWebPage", "Reload", "Reload context menu item");
    136 }
    137 
    138 String contextMenuItemTagCut()
    139 {
    140     return QCoreApplication::translate("QWebPage", "Cut", "Cut context menu item");
    141 }
    142 
    143 String contextMenuItemTagPaste()
    144 {
    145     return QCoreApplication::translate("QWebPage", "Paste", "Paste context menu item");
    146 }
    147 
    148 String contextMenuItemTagNoGuessesFound()
    149 {
    150     return QCoreApplication::translate("QWebPage", "No Guesses Found", "No Guesses Found context menu item");
    151 }
    152 
    153 String contextMenuItemTagIgnoreSpelling()
    154 {
    155     return QCoreApplication::translate("QWebPage", "Ignore", "Ignore Spelling context menu item");
    156 }
    157 
    158 String contextMenuItemTagLearnSpelling()
    159 {
    160     return QCoreApplication::translate("QWebPage", "Add To Dictionary", "Learn Spelling context menu item");
    161 }
    162 
    163 String contextMenuItemTagSearchWeb()
    164 {
    165     return QCoreApplication::translate("QWebPage", "Search The Web", "Search The Web context menu item");
    166 }
    167 
    168 String contextMenuItemTagLookUpInDictionary()
    169 {
    170     return QCoreApplication::translate("QWebPage", "Look Up In Dictionary", "Look Up in Dictionary context menu item");
    171 }
    172 
    173 String contextMenuItemTagOpenLink()
    174 {
    175     return QCoreApplication::translate("QWebPage", "Open Link", "Open Link context menu item");
    176 }
    177 
    178 String contextMenuItemTagIgnoreGrammar()
    179 {
    180     return QCoreApplication::translate("QWebPage", "Ignore", "Ignore Grammar context menu item");
    181 }
    182 
    183 String contextMenuItemTagSpellingMenu()
    184 {
    185     return QCoreApplication::translate("QWebPage", "Spelling", "Spelling and Grammar context sub-menu item");
    186 }
    187 
    188 String contextMenuItemTagShowSpellingPanel(bool show)
    189 {
    190     return show ? QCoreApplication::translate("QWebPage", "Show Spelling and Grammar", "menu item title") :
    191                   QCoreApplication::translate("QWebPage", "Hide Spelling and Grammar", "menu item title");
    192 }
    193 
    194 String contextMenuItemTagCheckSpelling()
    195 {
    196     return QCoreApplication::translate("QWebPage", "Check Spelling", "Check spelling context menu item");
    197 }
    198 
    199 String contextMenuItemTagCheckSpellingWhileTyping()
    200 {
    201     return QCoreApplication::translate("QWebPage", "Check Spelling While Typing", "Check spelling while typing context menu item");
    202 }
    203 
    204 String contextMenuItemTagCheckGrammarWithSpelling()
    205 {
    206     return QCoreApplication::translate("QWebPage", "Check Grammar With Spelling", "Check grammar with spelling context menu item");
    207 }
    208 
    209 String contextMenuItemTagFontMenu()
    210 {
    211     return QCoreApplication::translate("QWebPage", "Fonts", "Font context sub-menu item");
    212 }
    213 
    214 String contextMenuItemTagBold()
    215 {
    216     return QCoreApplication::translate("QWebPage", "Bold", "Bold context menu item");
    217 }
    218 
    219 String contextMenuItemTagItalic()
    220 {
    221     return QCoreApplication::translate("QWebPage", "Italic", "Italic context menu item");
    222 }
    223 
    224 String contextMenuItemTagUnderline()
    225 {
    226     return QCoreApplication::translate("QWebPage", "Underline", "Underline context menu item");
    227 }
    228 
    229 String contextMenuItemTagOutline()
    230 {
    231     return QCoreApplication::translate("QWebPage", "Outline", "Outline context menu item");
    232 }
    233 
    234 String contextMenuItemTagWritingDirectionMenu()
    235 {
    236     return QCoreApplication::translate("QWebPage", "Direction", "Writing direction context sub-menu item");
    237 }
    238 
    239 String contextMenuItemTagTextDirectionMenu()
    240 {
    241     return QCoreApplication::translate("QWebPage", "Text Direction", "Text direction context sub-menu item");
    242 }
    243 
    244 String contextMenuItemTagDefaultDirection()
    245 {
    246     return QCoreApplication::translate("QWebPage", "Default", "Default writing direction context menu item");
    247 }
    248 
    249 String contextMenuItemTagLeftToRight()
    250 {
    251     return QCoreApplication::translate("QWebPage", "Left to Right", "Left to Right context menu item");
    252 }
    253 
    254 String contextMenuItemTagRightToLeft()
    255 {
    256     return QCoreApplication::translate("QWebPage", "Right to Left", "Right to Left context menu item");
    257 }
    258 
    259 String contextMenuItemTagInspectElement()
    260 {
    261     return QCoreApplication::translate("QWebPage", "Inspect", "Inspect Element context menu item");
    262 }
    263 
    264 String searchMenuNoRecentSearchesText()
    265 {
    266     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");
    267 }
    268 
    269 String searchMenuRecentSearchesText()
    270 {
    271     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");
    272 }
    273 
    274 String searchMenuClearRecentSearchesText()
    275 {
    276     return QCoreApplication::translate("QWebPage", "Clear recent searches", "menu item in Recent Searches menu that empties menu's contents");
    277 }
    278 
    279 String AXWebAreaText()
    280 {
    281     return String();
    282 }
    283 
    284 String AXLinkText()
    285 {
    286     return String();
    287 }
    288 
    289 String AXListMarkerText()
    290 {
    291     return String();
    292 }
    293 
    294 String AXImageMapText()
    295 {
    296     return String();
    297 }
    298 
    299 String AXHeadingText()
    300 {
    301     return String();
    302 }
    303 
    304 String AXDefinitionListTermText()
    305 {
    306     return String();
    307 }
    308 
    309 String AXDefinitionListDefinitionText()
    310 {
    311     return String();
    312 }
    313 
    314 String AXButtonActionVerb()
    315 {
    316     return String();
    317 }
    318 
    319 String AXRadioButtonActionVerb()
    320 {
    321     return String();
    322 }
    323 
    324 String AXTextFieldActionVerb()
    325 {
    326     return String();
    327 }
    328 
    329 String AXCheckedCheckBoxActionVerb()
    330 {
    331     return String();
    332 }
    333 
    334 String AXUncheckedCheckBoxActionVerb()
    335 {
    336     return String();
    337 }
    338 
    339 String AXLinkActionVerb()
    340 {
    341     return String();
    342 }
    343 
    344 String AXMenuListPopupActionVerb()
    345 {
    346     return String();
    347 }
    348 
    349 String AXMenuListActionVerb()
    350 {
    351     return String();
    352 }
    353 
    354 String multipleFileUploadText(unsigned)
    355 {
    356     return String();
    357 }
    358 
    359 String unknownFileSizeText()
    360 {
    361     return QCoreApplication::translate("QWebPage", "Unknown", "Unknown filesize FTP directory listing item");
    362 }
    363 
    364 String imageTitle(const String& filename, const IntSize& size)
    365 {
    366     return QCoreApplication::translate("QWebPage", "%1 (%2x%3 pixels)", "Title string for images").arg(filename).arg(size.width()).arg(size.height());
    367 }
    368 
    369 String mediaElementLoadingStateText()
    370 {
    371     return QCoreApplication::translate("QWebPage", "Loading...", "Media controller status message when the media is loading");
    372 }
    373 
    374 String mediaElementLiveBroadcastStateText()
    375 {
    376     return QCoreApplication::translate("QWebPage", "Live Broadcast", "Media controller status message when watching a live broadcast");
    377 }
    378 
    379 #if ENABLE(VIDEO)
    380 
    381 String localizedMediaControlElementString(const String& name)
    382 {
    383     if (name == "AudioElement")
    384         return QCoreApplication::translate("QWebPage", "Audio Element", "Media controller element");
    385     if (name == "VideoElement")
    386         return QCoreApplication::translate("QWebPage", "Video Element", "Media controller element");
    387     if (name == "MuteButton")
    388         return QCoreApplication::translate("QWebPage", "Mute Button", "Media controller element");
    389     if (name == "UnMuteButton")
    390         return QCoreApplication::translate("QWebPage", "Unmute Button", "Media controller element");
    391     if (name == "PlayButton")
    392         return QCoreApplication::translate("QWebPage", "Play Button", "Media controller element");
    393     if (name == "PauseButton")
    394         return QCoreApplication::translate("QWebPage", "Pause Button", "Media controller element");
    395     if (name == "Slider")
    396         return QCoreApplication::translate("QWebPage", "Slider", "Media controller element");
    397     if (name == "SliderThumb")
    398         return QCoreApplication::translate("QWebPage", "Slider Thumb", "Media controller element");
    399     if (name == "RewindButton")
    400         return QCoreApplication::translate("QWebPage", "Rewind Button", "Media controller element");
    401     if (name == "ReturnToRealtimeButton")
    402         return QCoreApplication::translate("QWebPage", "Return to Real-time Button", "Media controller element");
    403     if (name == "CurrentTimeDisplay")
    404         return QCoreApplication::translate("QWebPage", "Elapsed Time", "Media controller element");
    405     if (name == "TimeRemainingDisplay")
    406         return QCoreApplication::translate("QWebPage", "Remaining Time", "Media controller element");
    407     if (name == "StatusDisplay")
    408         return QCoreApplication::translate("QWebPage", "Status Display", "Media controller element");
    409     if (name == "FullscreenButton")
    410         return QCoreApplication::translate("QWebPage", "Fullscreen Button", "Media controller element");
    411     if (name == "SeekForwardButton")
    412         return QCoreApplication::translate("QWebPage", "Seek Forward Button", "Media controller element");
    413     if (name == "SeekBackButton")
    414         return QCoreApplication::translate("QWebPage", "Seek Back Button", "Media controller element");
    415 
    416     return String();
    417 }
    418 
    419 String localizedMediaControlElementHelpText(const String& name)
    420 {
    421     if (name == "AudioElement")
    422         return QCoreApplication::translate("QWebPage", "Audio element playback controls and status display", "Media controller element");
    423     if (name == "VideoElement")
    424         return QCoreApplication::translate("QWebPage", "Video element playback controls and status display", "Media controller element");
    425     if (name == "MuteButton")
    426         return QCoreApplication::translate("QWebPage", "Mute audio tracks", "Media controller element");
    427     if (name == "UnMuteButton")
    428         return QCoreApplication::translate("QWebPage", "Unmute audio tracks", "Media controller element");
    429     if (name == "PlayButton")
    430         return QCoreApplication::translate("QWebPage", "Begin playback", "Media controller element");
    431     if (name == "PauseButton")
    432         return QCoreApplication::translate("QWebPage", "Pause playback", "Media controller element");
    433     if (name == "Slider")
    434         return QCoreApplication::translate("QWebPage", "Movie time scrubber", "Media controller element");
    435     if (name == "SliderThumb")
    436         return QCoreApplication::translate("QWebPage", "Movie time scrubber thumb", "Media controller element");
    437     if (name == "RewindButton")
    438         return QCoreApplication::translate("QWebPage", "Rewind movie", "Media controller element");
    439     if (name == "ReturnToRealtimeButton")
    440         return QCoreApplication::translate("QWebPage", "Return streaming movie to real-time", "Media controller element");
    441     if (name == "CurrentTimeDisplay")
    442         return QCoreApplication::translate("QWebPage", "Current movie time", "Media controller element");
    443     if (name == "TimeRemainingDisplay")
    444         return QCoreApplication::translate("QWebPage", "Remaining movie time", "Media controller element");
    445     if (name == "StatusDisplay")
    446         return QCoreApplication::translate("QWebPage", "Current movie status", "Media controller element");
    447     if (name == "FullscreenButton")
    448         return QCoreApplication::translate("QWebPage", "Play movie in full-screen mode", "Media controller element");
    449     if (name == "SeekForwardButton")
    450         return QCoreApplication::translate("QWebPage", "Seek quickly back", "Media controller element");
    451     if (name == "SeekBackButton")
    452         return QCoreApplication::translate("QWebPage", "Seek quickly forward", "Media controller element");
    453 
    454     ASSERT_NOT_REACHED();
    455     return String();
    456 }
    457 
    458 String localizedMediaTimeDescription(float time)
    459 {
    460     if (!isfinite(time))
    461         return QCoreApplication::translate("QWebPage", "Indefinite time", "Media time description");
    462 
    463     int seconds = (int)fabsf(time);
    464     int days = seconds / (60 * 60 * 24);
    465     int hours = seconds / (60 * 60);
    466     int minutes = (seconds / 60) % 60;
    467     seconds %= 60;
    468 
    469     if (days) {
    470         return QCoreApplication::translate("QWebPage", "%1 days %2 hours %3 minutes %4 seconds", "Media time description").arg(days).arg(hours).arg(minutes).arg(seconds);
    471     }
    472 
    473     if (hours) {
    474         return QCoreApplication::translate("QWebPage", "%1 hours %2 minutes %3 seconds", "Media time description").arg(hours).arg(minutes).arg(seconds);
    475     }
    476 
    477     if (minutes) {
    478         return QCoreApplication::translate("QWebPage", "%1 minutes %2 seconds", "Media time description").arg(minutes).arg(seconds);
    479     }
    480 
    481     return QCoreApplication::translate("QWebPage", "%1 seconds", "Media time description").arg(seconds);
    482 }
    483 #endif  // ENABLE(VIDEO)
    484 
    485 String validationMessageValueMissingText()
    486 {
    487     notImplemented();
    488     return String();
    489 }
    490 
    491 String validationMessageTypeMismatchText()
    492 {
    493     notImplemented();
    494     return String();
    495 }
    496 
    497 String validationMessagePatternMismatchText()
    498 {
    499     notImplemented();
    500     return String();
    501 }
    502 
    503 String validationMessageTooLongText()
    504 {
    505     notImplemented();
    506     return String();
    507 }
    508 
    509 String validationMessageRangeUnderflowText()
    510 {
    511     notImplemented();
    512     return String();
    513 }
    514 
    515 String validationMessageRangeOverflowText()
    516 {
    517     notImplemented();
    518     return String();
    519 }
    520 
    521 String validationMessageStepMismatchText()
    522 {
    523     notImplemented();
    524     return String();
    525 }
    526 
    527 }
    528 // vim: ts=4 sw=4 et
    529