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