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