1 /* 2 * Copyright (C) 2003, 2006, 2009, 2010 Apple Inc. All rights reserved. 3 * Copyright (C) 2010 Igalia S.L 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 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. 13 * 14 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, 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 COMPUTER, 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. 25 */ 26 27 #include "config.h" 28 #include "LocalizedStrings.h" 29 30 #include "IntSize.h" 31 #include "LocalizationStrategy.h" 32 #include "PlatformStrategies.h" 33 #include "PlatformString.h" 34 35 namespace WebCore { 36 37 #if USE(PLATFORM_STRATEGIES) 38 39 String inputElementAltText() 40 { 41 return platformStrategies()->localizationStrategy()->inputElementAltText(); 42 } 43 44 String resetButtonDefaultLabel() 45 { 46 return platformStrategies()->localizationStrategy()->resetButtonDefaultLabel(); 47 } 48 49 String searchableIndexIntroduction() 50 { 51 return platformStrategies()->localizationStrategy()->searchableIndexIntroduction(); 52 } 53 54 String submitButtonDefaultLabel() 55 { 56 return platformStrategies()->localizationStrategy()->submitButtonDefaultLabel(); 57 } 58 59 String fileButtonChooseFileLabel() 60 { 61 return platformStrategies()->localizationStrategy()->fileButtonChooseFileLabel(); 62 } 63 64 String fileButtonNoFileSelectedLabel() 65 { 66 return platformStrategies()->localizationStrategy()->fileButtonNoFileSelectedLabel(); 67 } 68 69 String defaultDetailsSummaryText() 70 { 71 return platformStrategies()->localizationStrategy()->defaultDetailsSummaryText(); 72 } 73 74 #if PLATFORM(MAC) 75 String copyImageUnknownFileLabel() 76 { 77 return platformStrategies()->localizationStrategy()->copyImageUnknownFileLabel(); 78 } 79 #endif 80 81 #if ENABLE(CONTEXT_MENUS) 82 String contextMenuItemTagOpenLinkInNewWindow() 83 { 84 return platformStrategies()->localizationStrategy()->contextMenuItemTagOpenLinkInNewWindow(); 85 } 86 87 String contextMenuItemTagDownloadLinkToDisk() 88 { 89 return platformStrategies()->localizationStrategy()->contextMenuItemTagDownloadLinkToDisk(); 90 } 91 92 String contextMenuItemTagCopyLinkToClipboard() 93 { 94 return platformStrategies()->localizationStrategy()->contextMenuItemTagCopyLinkToClipboard(); 95 } 96 97 String contextMenuItemTagOpenImageInNewWindow() 98 { 99 return platformStrategies()->localizationStrategy()->contextMenuItemTagOpenImageInNewWindow(); 100 } 101 102 String contextMenuItemTagDownloadImageToDisk() 103 { 104 return platformStrategies()->localizationStrategy()->contextMenuItemTagDownloadImageToDisk(); 105 } 106 107 String contextMenuItemTagCopyImageToClipboard() 108 { 109 return platformStrategies()->localizationStrategy()->contextMenuItemTagCopyImageToClipboard(); 110 } 111 112 #if PLATFORM(QT) || PLATFORM(GTK) 113 String contextMenuItemTagCopyImageUrlToClipboard() 114 { 115 return platformStrategies()->localizationStrategy()->contextMenuItemTagCopyImageUrlToClipboard(); 116 } 117 #endif 118 119 String contextMenuItemTagOpenFrameInNewWindow() 120 { 121 return platformStrategies()->localizationStrategy()->contextMenuItemTagOpenFrameInNewWindow(); 122 } 123 124 String contextMenuItemTagCopy() 125 { 126 return platformStrategies()->localizationStrategy()->contextMenuItemTagCopy(); 127 } 128 129 String contextMenuItemTagGoBack() 130 { 131 return platformStrategies()->localizationStrategy()->contextMenuItemTagGoBack(); 132 } 133 134 String contextMenuItemTagGoForward() 135 { 136 return platformStrategies()->localizationStrategy()->contextMenuItemTagGoForward(); 137 } 138 139 String contextMenuItemTagStop() 140 { 141 return platformStrategies()->localizationStrategy()->contextMenuItemTagStop(); 142 } 143 144 String contextMenuItemTagReload() 145 { 146 return platformStrategies()->localizationStrategy()->contextMenuItemTagReload(); 147 } 148 149 String contextMenuItemTagCut() 150 { 151 return platformStrategies()->localizationStrategy()->contextMenuItemTagCut(); 152 } 153 154 String contextMenuItemTagPaste() 155 { 156 return platformStrategies()->localizationStrategy()->contextMenuItemTagPaste(); 157 } 158 159 #if PLATFORM(QT) 160 String contextMenuItemTagSelectAll() 161 { 162 return platformStrategies()->localizationStrategy()->contextMenuItemTagSelectAll(); 163 } 164 #endif 165 166 String contextMenuItemTagNoGuessesFound() 167 { 168 return platformStrategies()->localizationStrategy()->contextMenuItemTagNoGuessesFound(); 169 } 170 171 String contextMenuItemTagIgnoreSpelling() 172 { 173 return platformStrategies()->localizationStrategy()->contextMenuItemTagIgnoreSpelling(); 174 } 175 176 String contextMenuItemTagLearnSpelling() 177 { 178 return platformStrategies()->localizationStrategy()->contextMenuItemTagLearnSpelling(); 179 } 180 181 #if PLATFORM(MAC) 182 String contextMenuItemTagSearchInSpotlight() 183 { 184 return platformStrategies()->localizationStrategy()->contextMenuItemTagSearchInSpotlight(); 185 } 186 #endif 187 188 String contextMenuItemTagSearchWeb() 189 { 190 return platformStrategies()->localizationStrategy()->contextMenuItemTagSearchWeb(); 191 } 192 193 String contextMenuItemTagLookUpInDictionary(const String& selectedString) 194 { 195 return platformStrategies()->localizationStrategy()->contextMenuItemTagLookUpInDictionary(selectedString); 196 } 197 198 String contextMenuItemTagOpenLink() 199 { 200 return platformStrategies()->localizationStrategy()->contextMenuItemTagOpenLink(); 201 } 202 203 String contextMenuItemTagIgnoreGrammar() 204 { 205 return platformStrategies()->localizationStrategy()->contextMenuItemTagIgnoreGrammar(); 206 } 207 208 String contextMenuItemTagSpellingMenu() 209 { 210 return platformStrategies()->localizationStrategy()->contextMenuItemTagSpellingMenu(); 211 } 212 213 String contextMenuItemTagShowSpellingPanel(bool show) 214 { 215 return platformStrategies()->localizationStrategy()->contextMenuItemTagShowSpellingPanel(show); 216 } 217 218 String contextMenuItemTagCheckSpelling() 219 { 220 return platformStrategies()->localizationStrategy()->contextMenuItemTagCheckSpelling(); 221 } 222 223 String contextMenuItemTagCheckSpellingWhileTyping() 224 { 225 return platformStrategies()->localizationStrategy()->contextMenuItemTagCheckSpellingWhileTyping(); 226 } 227 228 String contextMenuItemTagCheckGrammarWithSpelling() 229 { 230 return platformStrategies()->localizationStrategy()->contextMenuItemTagCheckGrammarWithSpelling(); 231 } 232 233 String contextMenuItemTagFontMenu() 234 { 235 return platformStrategies()->localizationStrategy()->contextMenuItemTagFontMenu(); 236 } 237 238 #if PLATFORM(MAC) 239 String contextMenuItemTagShowFonts() 240 { 241 return platformStrategies()->localizationStrategy()->contextMenuItemTagShowFonts(); 242 } 243 #endif 244 245 String contextMenuItemTagBold() 246 { 247 return platformStrategies()->localizationStrategy()->contextMenuItemTagBold(); 248 } 249 250 String contextMenuItemTagItalic() 251 { 252 return platformStrategies()->localizationStrategy()->contextMenuItemTagItalic(); 253 } 254 255 String contextMenuItemTagUnderline() 256 { 257 return platformStrategies()->localizationStrategy()->contextMenuItemTagUnderline(); 258 } 259 260 String contextMenuItemTagOutline() 261 { 262 return platformStrategies()->localizationStrategy()->contextMenuItemTagOutline(); 263 } 264 265 #if PLATFORM(MAC) 266 String contextMenuItemTagStyles() 267 { 268 return platformStrategies()->localizationStrategy()->contextMenuItemTagStyles(); 269 } 270 271 String contextMenuItemTagShowColors() 272 { 273 return platformStrategies()->localizationStrategy()->contextMenuItemTagShowColors(); 274 } 275 276 String contextMenuItemTagSpeechMenu() 277 { 278 return platformStrategies()->localizationStrategy()->contextMenuItemTagSpeechMenu(); 279 } 280 281 String contextMenuItemTagStartSpeaking() 282 { 283 return platformStrategies()->localizationStrategy()->contextMenuItemTagStartSpeaking(); 284 } 285 286 String contextMenuItemTagStopSpeaking() 287 { 288 return platformStrategies()->localizationStrategy()->contextMenuItemTagStopSpeaking(); 289 } 290 #endif 291 292 String contextMenuItemTagWritingDirectionMenu() 293 { 294 return platformStrategies()->localizationStrategy()->contextMenuItemTagWritingDirectionMenu(); 295 } 296 297 String contextMenuItemTagTextDirectionMenu() 298 { 299 return platformStrategies()->localizationStrategy()->contextMenuItemTagTextDirectionMenu(); 300 } 301 302 String contextMenuItemTagDefaultDirection() 303 { 304 return platformStrategies()->localizationStrategy()->contextMenuItemTagDefaultDirection(); 305 } 306 307 String contextMenuItemTagLeftToRight() 308 { 309 return platformStrategies()->localizationStrategy()->contextMenuItemTagLeftToRight(); 310 } 311 312 String contextMenuItemTagRightToLeft() 313 { 314 return platformStrategies()->localizationStrategy()->contextMenuItemTagRightToLeft(); 315 } 316 317 #if PLATFORM(MAC) 318 319 String contextMenuItemTagCorrectSpellingAutomatically() 320 { 321 return platformStrategies()->localizationStrategy()->contextMenuItemTagCorrectSpellingAutomatically(); 322 } 323 324 String contextMenuItemTagSubstitutionsMenu() 325 { 326 return platformStrategies()->localizationStrategy()->contextMenuItemTagSubstitutionsMenu(); 327 } 328 329 String contextMenuItemTagShowSubstitutions(bool show) 330 { 331 return platformStrategies()->localizationStrategy()->contextMenuItemTagShowSubstitutions(show); 332 } 333 334 String contextMenuItemTagSmartCopyPaste() 335 { 336 return platformStrategies()->localizationStrategy()->contextMenuItemTagSmartCopyPaste(); 337 } 338 339 String contextMenuItemTagSmartQuotes() 340 { 341 return platformStrategies()->localizationStrategy()->contextMenuItemTagSmartQuotes(); 342 } 343 344 String contextMenuItemTagSmartDashes() 345 { 346 return platformStrategies()->localizationStrategy()->contextMenuItemTagSmartDashes(); 347 } 348 349 String contextMenuItemTagSmartLinks() 350 { 351 return platformStrategies()->localizationStrategy()->contextMenuItemTagSmartLinks(); 352 } 353 354 String contextMenuItemTagTextReplacement() 355 { 356 return platformStrategies()->localizationStrategy()->contextMenuItemTagTextReplacement(); 357 } 358 359 String contextMenuItemTagTransformationsMenu() 360 { 361 return platformStrategies()->localizationStrategy()->contextMenuItemTagTransformationsMenu(); 362 } 363 364 String contextMenuItemTagMakeUpperCase() 365 { 366 return platformStrategies()->localizationStrategy()->contextMenuItemTagMakeUpperCase(); 367 } 368 369 String contextMenuItemTagMakeLowerCase() 370 { 371 return platformStrategies()->localizationStrategy()->contextMenuItemTagMakeLowerCase(); 372 } 373 374 String contextMenuItemTagCapitalize() 375 { 376 return platformStrategies()->localizationStrategy()->contextMenuItemTagCapitalize(); 377 } 378 379 String contextMenuItemTagChangeBack(const String& replacedString) 380 { 381 return platformStrategies()->localizationStrategy()->contextMenuItemTagChangeBack(replacedString); 382 } 383 384 #endif // PLATFORM(MAC) 385 386 String contextMenuItemTagOpenVideoInNewWindow() 387 { 388 return platformStrategies()->localizationStrategy()->contextMenuItemTagOpenVideoInNewWindow(); 389 } 390 391 String contextMenuItemTagOpenAudioInNewWindow() 392 { 393 return platformStrategies()->localizationStrategy()->contextMenuItemTagOpenAudioInNewWindow(); 394 } 395 396 String contextMenuItemTagCopyVideoLinkToClipboard() 397 { 398 return platformStrategies()->localizationStrategy()->contextMenuItemTagCopyVideoLinkToClipboard(); 399 } 400 401 String contextMenuItemTagCopyAudioLinkToClipboard() 402 { 403 return platformStrategies()->localizationStrategy()->contextMenuItemTagCopyAudioLinkToClipboard(); 404 } 405 406 String contextMenuItemTagToggleMediaControls() 407 { 408 return platformStrategies()->localizationStrategy()->contextMenuItemTagToggleMediaControls(); 409 } 410 411 String contextMenuItemTagToggleMediaLoop() 412 { 413 return platformStrategies()->localizationStrategy()->contextMenuItemTagToggleMediaLoop(); 414 } 415 416 String contextMenuItemTagEnterVideoFullscreen() 417 { 418 return platformStrategies()->localizationStrategy()->contextMenuItemTagEnterVideoFullscreen(); 419 } 420 421 String contextMenuItemTagMediaPlay() 422 { 423 return platformStrategies()->localizationStrategy()->contextMenuItemTagMediaPlay(); 424 } 425 426 String contextMenuItemTagMediaPause() 427 { 428 return platformStrategies()->localizationStrategy()->contextMenuItemTagMediaPause(); 429 } 430 431 String contextMenuItemTagMediaMute() 432 { 433 return platformStrategies()->localizationStrategy()->contextMenuItemTagMediaMute(); 434 } 435 436 String contextMenuItemTagInspectElement() 437 { 438 return platformStrategies()->localizationStrategy()->contextMenuItemTagInspectElement(); 439 } 440 441 #endif // ENABLE(CONTEXT_MENUS) 442 443 String searchMenuNoRecentSearchesText() 444 { 445 return platformStrategies()->localizationStrategy()->searchMenuNoRecentSearchesText(); 446 } 447 448 String searchMenuRecentSearchesText () 449 { 450 return platformStrategies()->localizationStrategy()->searchMenuRecentSearchesText (); 451 } 452 453 String searchMenuClearRecentSearchesText() 454 { 455 return platformStrategies()->localizationStrategy()->searchMenuClearRecentSearchesText(); 456 } 457 458 String AXWebAreaText() 459 { 460 return platformStrategies()->localizationStrategy()->AXWebAreaText(); 461 } 462 463 String AXLinkText() 464 { 465 return platformStrategies()->localizationStrategy()->AXLinkText(); 466 } 467 468 String AXListMarkerText() 469 { 470 return platformStrategies()->localizationStrategy()->AXListMarkerText(); 471 } 472 473 String AXImageMapText() 474 { 475 return platformStrategies()->localizationStrategy()->AXImageMapText(); 476 } 477 478 String AXHeadingText() 479 { 480 return platformStrategies()->localizationStrategy()->AXHeadingText(); 481 } 482 483 String AXDefinitionListTermText() 484 { 485 return platformStrategies()->localizationStrategy()->AXDefinitionListTermText(); 486 } 487 488 String AXDefinitionListDefinitionText() 489 { 490 return platformStrategies()->localizationStrategy()->AXDefinitionListDefinitionText(); 491 } 492 493 #if PLATFORM(MAC) 494 String AXARIAContentGroupText(const String& ariaType) 495 { 496 return platformStrategies()->localizationStrategy()->AXARIAContentGroupText(ariaType); 497 } 498 #endif 499 500 String AXButtonActionVerb() 501 { 502 return platformStrategies()->localizationStrategy()->AXButtonActionVerb(); 503 } 504 505 String AXRadioButtonActionVerb() 506 { 507 return platformStrategies()->localizationStrategy()->AXRadioButtonActionVerb(); 508 } 509 510 String AXTextFieldActionVerb() 511 { 512 return platformStrategies()->localizationStrategy()->AXTextFieldActionVerb(); 513 } 514 515 String AXCheckedCheckBoxActionVerb() 516 { 517 return platformStrategies()->localizationStrategy()->AXCheckedCheckBoxActionVerb(); 518 } 519 520 String AXUncheckedCheckBoxActionVerb() 521 { 522 return platformStrategies()->localizationStrategy()->AXUncheckedCheckBoxActionVerb(); 523 } 524 525 String AXLinkActionVerb() 526 { 527 return platformStrategies()->localizationStrategy()->AXLinkActionVerb(); 528 } 529 530 String AXMenuListPopupActionVerb() 531 { 532 return platformStrategies()->localizationStrategy()->AXMenuListPopupActionVerb(); 533 } 534 535 String AXMenuListActionVerb() 536 { 537 return platformStrategies()->localizationStrategy()->AXMenuListActionVerb(); 538 } 539 540 String missingPluginText() 541 { 542 return platformStrategies()->localizationStrategy()->missingPluginText(); 543 } 544 545 String crashedPluginText() 546 { 547 return platformStrategies()->localizationStrategy()->crashedPluginText(); 548 } 549 550 String multipleFileUploadText(unsigned numberOfFiles) 551 { 552 return platformStrategies()->localizationStrategy()->multipleFileUploadText(numberOfFiles); 553 } 554 555 String unknownFileSizeText() 556 { 557 return platformStrategies()->localizationStrategy()->unknownFileSizeText(); 558 } 559 560 #if PLATFORM(WIN) 561 String uploadFileText() 562 { 563 return platformStrategies()->localizationStrategy()->uploadFileText(); 564 } 565 566 String allFilesText() 567 { 568 return platformStrategies()->localizationStrategy()->allFilesText(); 569 } 570 #endif 571 572 #if PLATFORM(MAC) 573 String keygenMenuItem512() 574 { 575 return platformStrategies()->localizationStrategy()->keygenMenuItem512(); 576 } 577 578 String keygenMenuItem1024() 579 { 580 return platformStrategies()->localizationStrategy()->keygenMenuItem1024(); 581 } 582 583 String keygenMenuItem2048() 584 { 585 return platformStrategies()->localizationStrategy()->keygenMenuItem2048(); 586 } 587 588 String keygenKeychainItemName(const String& host) 589 { 590 return platformStrategies()->localizationStrategy()->keygenKeychainItemName(host); 591 } 592 593 #endif 594 595 String imageTitle(const String& filename, const IntSize& size) 596 { 597 return platformStrategies()->localizationStrategy()->imageTitle(filename, size); 598 } 599 600 String mediaElementLoadingStateText() 601 { 602 return platformStrategies()->localizationStrategy()->mediaElementLoadingStateText(); 603 } 604 605 String mediaElementLiveBroadcastStateText() 606 { 607 return platformStrategies()->localizationStrategy()->mediaElementLiveBroadcastStateText(); 608 } 609 610 String localizedMediaControlElementString(const String& controlName) 611 { 612 return platformStrategies()->localizationStrategy()->localizedMediaControlElementString(controlName); 613 } 614 615 String localizedMediaControlElementHelpText(const String& controlName) 616 { 617 return platformStrategies()->localizationStrategy()->localizedMediaControlElementHelpText(controlName); 618 } 619 620 String localizedMediaTimeDescription(float time) 621 { 622 return platformStrategies()->localizationStrategy()->localizedMediaTimeDescription(time); 623 } 624 625 String validationMessageValueMissingText() 626 { 627 return platformStrategies()->localizationStrategy()->validationMessageValueMissingText(); 628 } 629 630 String validationMessageValueMissingForCheckboxText() 631 { 632 return platformStrategies()->localizationStrategy()->validationMessageValueMissingText(); 633 } 634 635 String validationMessageValueMissingForFileText() 636 { 637 return platformStrategies()->localizationStrategy()->validationMessageValueMissingText(); 638 } 639 640 String validationMessageValueMissingForMultipleFileText() 641 { 642 return platformStrategies()->localizationStrategy()->validationMessageValueMissingText(); 643 } 644 645 String validationMessageValueMissingForRadioText() 646 { 647 return platformStrategies()->localizationStrategy()->validationMessageValueMissingText(); 648 } 649 650 String validationMessageValueMissingForSelectText() 651 { 652 return platformStrategies()->localizationStrategy()->validationMessageValueMissingText(); 653 } 654 655 String validationMessageTypeMismatchText() 656 { 657 return platformStrategies()->localizationStrategy()->validationMessageTypeMismatchText(); 658 } 659 660 String validationMessageTypeMismatchForEmailText() 661 { 662 return platformStrategies()->localizationStrategy()->validationMessageTypeMismatchText(); 663 } 664 665 String validationMessageTypeMismatchForMultipleEmailText() 666 { 667 return platformStrategies()->localizationStrategy()->validationMessageTypeMismatchText(); 668 } 669 670 String validationMessageTypeMismatchForURLText() 671 { 672 return platformStrategies()->localizationStrategy()->validationMessageTypeMismatchText(); 673 } 674 675 String validationMessagePatternMismatchText() 676 { 677 return platformStrategies()->localizationStrategy()->validationMessagePatternMismatchText(); 678 } 679 680 String validationMessageTooLongText(int, int) 681 { 682 return platformStrategies()->localizationStrategy()->validationMessageTooLongText(); 683 } 684 685 String validationMessageRangeUnderflowText(const String&) 686 { 687 return platformStrategies()->localizationStrategy()->validationMessageRangeUnderflowText(); 688 } 689 690 String validationMessageRangeOverflowText(const String&) 691 { 692 return platformStrategies()->localizationStrategy()->validationMessageRangeOverflowText(); 693 } 694 695 String validationMessageStepMismatchText(const String&, const String&) 696 { 697 return platformStrategies()->localizationStrategy()->validationMessageStepMismatchText(); 698 } 699 700 #endif // USE(PLATFORM_STRATEGIES) 701 702 #if !PLATFORM(MAC) && !PLATFORM(WIN) 703 String localizedString(const char* key) 704 { 705 return String::fromUTF8(key, strlen(key)); 706 } 707 #endif 708 709 } // namespace WebCore 710