tizen beta release
[framework/web/webkit-efl.git] / Source / WebKit / chromium / src / LocalizedStrings.cpp
1 /*
2  * Copyright (C) 2009 Google Inc. All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions are
6  * met:
7  *
8  *     * Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  *     * Redistributions in binary form must reproduce the above
11  * copyright notice, this list of conditions and the following disclaimer
12  * in the documentation and/or other materials provided with the
13  * distribution.
14  *     * Neither the name of Google Inc. nor the names of its
15  * contributors may be used to endorse or promote products derived from
16  * this software without specific prior written permission.
17  *
18  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29  */
30
31 #include "config.h"
32 #include "LocalizedStrings.h"
33
34 #include "IntSize.h"
35 #include "NotImplemented.h"
36
37 #include "WebKit.h"
38 #include "WebKitPlatformSupport.h"
39 #include "WebLocalizedString.h"
40 #include "WebString.h"
41
42 #include <wtf/text/StringBuilder.h>
43 #include <wtf/text/WTFString.h>
44
45 using WebKit::WebLocalizedString;
46 using WebKit::WebString;
47
48 namespace WebCore {
49
50 static String query(WebLocalizedString::Name name)
51 {
52     return WebKit::webKitPlatformSupport()->queryLocalizedString(name);
53 }
54
55 static String query(WebLocalizedString::Name name, const WebString& parameter)
56 {
57     return WebKit::webKitPlatformSupport()->queryLocalizedString(name, parameter);
58 }
59
60 static String query(WebLocalizedString::Name name, const WebString& parameter1, const WebString& parameter2)
61 {
62     return WebKit::webKitPlatformSupport()->queryLocalizedString(name, parameter1, parameter2);
63 }
64
65 String searchableIndexIntroduction()
66 {
67     return query(WebLocalizedString::SearchableIndexIntroduction);
68 }
69
70 String submitButtonDefaultLabel()
71 {
72     return query(WebLocalizedString::SubmitButtonDefaultLabel);
73 }
74
75 String inputElementAltText()
76 {
77     return query(WebLocalizedString::InputElementAltText);
78 }
79
80 String resetButtonDefaultLabel()
81 {
82     return query(WebLocalizedString::ResetButtonDefaultLabel);
83 }
84
85 String fileButtonChooseFileLabel()
86 {
87     return query(WebLocalizedString::FileButtonChooseFileLabel);
88 }
89
90 String fileButtonChooseMultipleFilesLabel()
91 {
92     return query(WebLocalizedString::FileButtonChooseMultipleFilesLabel);
93 }
94
95 String defaultDetailsSummaryText()
96 {
97     return query(WebLocalizedString::DetailsLabel);
98 }
99
100 String fileButtonNoFileSelectedLabel()
101 {
102     return query(WebLocalizedString::FileButtonNoFileSelectedLabel);
103 }
104
105 String fileButtonNoFilesSelectedLabel()
106 {
107     return query(WebLocalizedString::FileButtonNoFileSelectedLabel);
108 }
109
110 String searchMenuNoRecentSearchesText()
111 {
112     return query(WebLocalizedString::SearchMenuNoRecentSearchesText);
113 }
114 String searchMenuRecentSearchesText()
115 {
116     return query(WebLocalizedString::SearchMenuRecentSearchesText);
117 }
118
119 String searchMenuClearRecentSearchesText()
120 {
121     return query(WebLocalizedString::SearchMenuClearRecentSearchesText);
122 }
123
124 String AXWebAreaText()
125 {
126     return query(WebLocalizedString::AXWebAreaText);
127 }
128
129 String AXLinkText()
130 {
131     return query(WebLocalizedString::AXLinkText);
132 }
133
134 String AXListMarkerText()
135 {
136     return query(WebLocalizedString::AXListMarkerText);
137 }
138
139 String AXImageMapText()
140 {
141     return query(WebLocalizedString::AXImageMapText);
142 }
143
144 String AXHeadingText()
145 {
146     return query(WebLocalizedString::AXHeadingText);
147 }
148
149 String AXDefinitionListTermText()
150 {
151     notImplemented();
152     return String("term");
153 }
154
155 String AXDefinitionListDefinitionText()
156 {
157     notImplemented();
158     return String("definition");
159 }
160
161 String AXButtonActionVerb()
162 {
163     return query(WebLocalizedString::AXButtonActionVerb);
164 }
165
166 String AXRadioButtonActionVerb()
167 {
168     return query(WebLocalizedString::AXRadioButtonActionVerb);
169 }
170
171 String AXTextFieldActionVerb()
172 {
173     return query(WebLocalizedString::AXTextFieldActionVerb);
174 }
175
176 String AXCheckedCheckBoxActionVerb()
177 {
178     return query(WebLocalizedString::AXCheckedCheckBoxActionVerb);
179 }
180
181 String AXUncheckedCheckBoxActionVerb()
182 {
183     return query(WebLocalizedString::AXUncheckedCheckBoxActionVerb);
184 }
185
186 String AXLinkActionVerb()
187 {
188     return query(WebLocalizedString::AXLinkActionVerb);
189 }
190
191 String AXMenuListPopupActionVerb()
192 {
193     return String();
194 }
195
196 String AXMenuListActionVerb()
197 {
198     return String();
199 }
200     
201 String missingPluginText()
202 {
203     notImplemented();
204     return String("Missing Plug-in");
205 }
206
207 String crashedPluginText()
208 {
209     notImplemented();
210     return String("Plug-in Failure");
211 }
212
213 String multipleFileUploadText(unsigned numberOfFiles)
214 {
215     return query(WebLocalizedString::MultipleFileUploadText, String::number(numberOfFiles));
216 }
217
218 // Used in FTPDirectoryDocument.cpp
219 String unknownFileSizeText()
220 {
221     return String();
222 }
223
224 // The following two functions are not declared in LocalizedStrings.h.
225 // They are used by the menu for the HTML keygen tag.
226 String keygenMenuHighGradeKeySize()
227 {
228     return query(WebLocalizedString::KeygenMenuHighGradeKeySize);
229 }
230
231 String keygenMenuMediumGradeKeySize()
232 {
233     return query(WebLocalizedString::KeygenMenuMediumGradeKeySize);
234 }
235
236 // Used in ImageDocument.cpp as the title for pages when that page is an image.
237 String imageTitle(const String& filename, const IntSize& size)
238 {
239     StringBuilder result;
240     result.append(filename);
241     result.append(" (");
242     result.append(String::number(size.width()));
243     result.append(static_cast<UChar>(0xD7));  // U+00D7 (multiplication sign)
244     result.append(String::number(size.height()));
245     result.append(')');
246     return result.toString();
247 }
248
249 // We don't use these strings, so they return an empty String. We can't just
250 // make them asserts because webcore still calls them.
251 String contextMenuItemTagOpenLinkInNewWindow() { return String(); }
252 String contextMenuItemTagDownloadLinkToDisk() { return String(); }
253 String contextMenuItemTagCopyLinkToClipboard() { return String(); }
254 String contextMenuItemTagOpenImageInNewWindow() { return String(); }
255 String contextMenuItemTagDownloadImageToDisk() { return String(); }
256 String contextMenuItemTagCopyImageToClipboard() { return String(); }
257 String contextMenuItemTagOpenFrameInNewWindow() { return String(); }
258 String contextMenuItemTagCopy() { return String(); }
259 String contextMenuItemTagGoBack() { return String(); }
260 String contextMenuItemTagGoForward() { return String(); }
261 String contextMenuItemTagStop() { return String(); }
262 String contextMenuItemTagReload() { return String(); }
263 String contextMenuItemTagCut() { return String(); }
264 String contextMenuItemTagPaste() { return String(); }
265 String contextMenuItemTagNoGuessesFound() { return String(); }
266 String contextMenuItemTagIgnoreSpelling() { return String(); }
267 String contextMenuItemTagLearnSpelling() { return String(); }
268 String contextMenuItemTagSearchWeb() { return String(); }
269 String contextMenuItemTagLookUpInDictionary(const String&) { return String(); }
270 String contextMenuItemTagOpenLink() { return String(); }
271 String contextMenuItemTagIgnoreGrammar() { return String(); }
272 String contextMenuItemTagSpellingMenu() { return String(); }
273 String contextMenuItemTagCheckSpelling() { return String(); }
274 String contextMenuItemTagCheckSpellingWhileTyping() { return String(); }
275 String contextMenuItemTagCheckGrammarWithSpelling() { return String(); }
276 String contextMenuItemTagFontMenu() { return String(); }
277 String contextMenuItemTagBold() { return String(); }
278 String contextMenuItemTagItalic() { return String(); }
279 String contextMenuItemTagUnderline() { return String(); }
280 String contextMenuItemTagOutline() { return String(); }
281 String contextMenuItemTagWritingDirectionMenu() { return String(); }
282 String contextMenuItemTagTextDirectionMenu() { return String(); }
283 String contextMenuItemTagDefaultDirection() { return String(); }
284 String contextMenuItemTagLeftToRight() { return String(); }
285 String contextMenuItemTagRightToLeft() { return String(); }
286 String contextMenuItemTagInspectElement() { return String(); }
287 String contextMenuItemTagShowSpellingPanel(bool show) { return String(); }
288 String mediaElementLiveBroadcastStateText() { return String(); }
289 String mediaElementLoadingStateText() { return String(); }
290 String contextMenuItemTagOpenVideoInNewWindow() { return String(); }
291 String contextMenuItemTagOpenAudioInNewWindow() { return String(); }
292 String contextMenuItemTagCopyVideoLinkToClipboard() { return String(); }
293 String contextMenuItemTagCopyAudioLinkToClipboard() { return String(); }
294 String contextMenuItemTagToggleMediaControls() { return String(); }
295 String contextMenuItemTagToggleMediaLoop() { return String(); }
296 String contextMenuItemTagEnterVideoFullscreen() { return String(); }
297 String contextMenuItemTagMediaPlay() { return String(); }
298 String contextMenuItemTagMediaPause() { return String(); }
299 String contextMenuItemTagMediaMute() { return String(); }
300
301 String localizedMediaControlElementString(const String& /*name*/)
302 {
303     // FIXME: to be fixed.
304     return String();
305 }
306
307 String localizedMediaControlElementHelpText(const String& /*name*/)
308 {
309     // FIXME: to be fixed.
310     return String();
311 }
312
313 String localizedMediaTimeDescription(float /*time*/)
314 {
315     // FIXME: to be fixed.
316     return String();
317 }
318
319 String validationMessageValueMissingText()
320 {
321     return query(WebLocalizedString::ValidationValueMissing);
322 }
323
324 String validationMessageValueMissingForCheckboxText()
325 {
326     return query(WebLocalizedString::ValidationValueMissingForCheckbox);
327 }
328
329 String validationMessageValueMissingForFileText()
330 {
331     return query(WebLocalizedString::ValidationValueMissingForFile);
332 }
333
334 String validationMessageValueMissingForMultipleFileText()
335 {
336     return query(WebLocalizedString::ValidationValueMissingForMultipleFile);
337 }
338
339 String validationMessageValueMissingForRadioText()
340 {
341     return query(WebLocalizedString::ValidationValueMissingForRadio);
342 }
343
344 String validationMessageValueMissingForSelectText()
345 {
346     return query(WebLocalizedString::ValidationValueMissingForSelect);
347 }
348
349 String validationMessageTypeMismatchText()
350 {
351     return query(WebLocalizedString::ValidationTypeMismatch);
352 }
353
354 String validationMessageTypeMismatchForEmailText()
355 {
356     return query(WebLocalizedString::ValidationTypeMismatchForEmail);
357 }
358
359 String validationMessageTypeMismatchForMultipleEmailText()
360 {
361     return query(WebLocalizedString::ValidationTypeMismatchForMultipleEmail);
362 }
363
364 String validationMessageTypeMismatchForURLText()
365 {
366     return query(WebLocalizedString::ValidationTypeMismatchForURL);
367 }
368
369 String validationMessagePatternMismatchText()
370 {
371     return query(WebLocalizedString::ValidationPatternMismatch);
372 }
373
374 String validationMessageTooLongText(int valueLength, int maxLength)
375 {
376     return query(WebLocalizedString::ValidationTooLong, String::number(valueLength), String::number(maxLength));
377 }
378
379 String validationMessageRangeUnderflowText(const String& minimum)
380 {
381     return query(WebLocalizedString::ValidationRangeUnderflow, minimum);
382 }
383
384 String validationMessageRangeOverflowText(const String& maximum)
385 {
386     return query(WebLocalizedString::ValidationRangeOverflow, maximum);
387 }
388
389 String validationMessageStepMismatchText(const String& base, const String& step)
390 {
391     return query(WebLocalizedString::ValidationStepMismatch, base, step);
392 }
393
394 } // namespace WebCore