2 * Copyright (C) 2009 Google Inc. All rights reserved.
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are
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
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.
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.
32 #include "LocalizedStrings.h"
35 #include "NotImplemented.h"
38 #include "WebKitPlatformSupport.h"
39 #include "WebLocalizedString.h"
40 #include "WebString.h"
42 #include <wtf/text/StringBuilder.h>
43 #include <wtf/text/WTFString.h>
45 using WebKit::WebLocalizedString;
46 using WebKit::WebString;
50 static String query(WebLocalizedString::Name name)
52 return WebKit::webKitPlatformSupport()->queryLocalizedString(name);
55 static String query(WebLocalizedString::Name name, const WebString& parameter)
57 return WebKit::webKitPlatformSupport()->queryLocalizedString(name, parameter);
60 static String query(WebLocalizedString::Name name, const WebString& parameter1, const WebString& parameter2)
62 return WebKit::webKitPlatformSupport()->queryLocalizedString(name, parameter1, parameter2);
65 String searchableIndexIntroduction()
67 return query(WebLocalizedString::SearchableIndexIntroduction);
70 String submitButtonDefaultLabel()
72 return query(WebLocalizedString::SubmitButtonDefaultLabel);
75 String inputElementAltText()
77 return query(WebLocalizedString::InputElementAltText);
80 String resetButtonDefaultLabel()
82 return query(WebLocalizedString::ResetButtonDefaultLabel);
85 String fileButtonChooseFileLabel()
87 return query(WebLocalizedString::FileButtonChooseFileLabel);
90 String fileButtonChooseMultipleFilesLabel()
92 return query(WebLocalizedString::FileButtonChooseMultipleFilesLabel);
95 String defaultDetailsSummaryText()
97 return query(WebLocalizedString::DetailsLabel);
100 String fileButtonNoFileSelectedLabel()
102 return query(WebLocalizedString::FileButtonNoFileSelectedLabel);
105 String fileButtonNoFilesSelectedLabel()
107 return query(WebLocalizedString::FileButtonNoFileSelectedLabel);
110 String searchMenuNoRecentSearchesText()
112 return query(WebLocalizedString::SearchMenuNoRecentSearchesText);
114 String searchMenuRecentSearchesText()
116 return query(WebLocalizedString::SearchMenuRecentSearchesText);
119 String searchMenuClearRecentSearchesText()
121 return query(WebLocalizedString::SearchMenuClearRecentSearchesText);
124 String AXWebAreaText()
126 return query(WebLocalizedString::AXWebAreaText);
131 return query(WebLocalizedString::AXLinkText);
134 String AXListMarkerText()
136 return query(WebLocalizedString::AXListMarkerText);
139 String AXImageMapText()
141 return query(WebLocalizedString::AXImageMapText);
144 String AXHeadingText()
146 return query(WebLocalizedString::AXHeadingText);
149 String AXDefinitionListTermText()
152 return String("term");
155 String AXDefinitionListDefinitionText()
158 return String("definition");
161 String AXButtonActionVerb()
163 return query(WebLocalizedString::AXButtonActionVerb);
166 String AXRadioButtonActionVerb()
168 return query(WebLocalizedString::AXRadioButtonActionVerb);
171 String AXTextFieldActionVerb()
173 return query(WebLocalizedString::AXTextFieldActionVerb);
176 String AXCheckedCheckBoxActionVerb()
178 return query(WebLocalizedString::AXCheckedCheckBoxActionVerb);
181 String AXUncheckedCheckBoxActionVerb()
183 return query(WebLocalizedString::AXUncheckedCheckBoxActionVerb);
186 String AXLinkActionVerb()
188 return query(WebLocalizedString::AXLinkActionVerb);
191 String AXMenuListPopupActionVerb()
196 String AXMenuListActionVerb()
201 String missingPluginText()
204 return String("Missing Plug-in");
207 String crashedPluginText()
210 return String("Plug-in Failure");
213 String multipleFileUploadText(unsigned numberOfFiles)
215 return query(WebLocalizedString::MultipleFileUploadText, String::number(numberOfFiles));
218 // Used in FTPDirectoryDocument.cpp
219 String unknownFileSizeText()
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()
228 return query(WebLocalizedString::KeygenMenuHighGradeKeySize);
231 String keygenMenuMediumGradeKeySize()
233 return query(WebLocalizedString::KeygenMenuMediumGradeKeySize);
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)
239 StringBuilder result;
240 result.append(filename);
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()));
246 return result.toString();
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(); }
301 String localizedMediaControlElementString(const String& /*name*/)
303 // FIXME: to be fixed.
307 String localizedMediaControlElementHelpText(const String& /*name*/)
309 // FIXME: to be fixed.
313 String localizedMediaTimeDescription(float /*time*/)
315 // FIXME: to be fixed.
319 String validationMessageValueMissingText()
321 return query(WebLocalizedString::ValidationValueMissing);
324 String validationMessageValueMissingForCheckboxText()
326 return query(WebLocalizedString::ValidationValueMissingForCheckbox);
329 String validationMessageValueMissingForFileText()
331 return query(WebLocalizedString::ValidationValueMissingForFile);
334 String validationMessageValueMissingForMultipleFileText()
336 return query(WebLocalizedString::ValidationValueMissingForMultipleFile);
339 String validationMessageValueMissingForRadioText()
341 return query(WebLocalizedString::ValidationValueMissingForRadio);
344 String validationMessageValueMissingForSelectText()
346 return query(WebLocalizedString::ValidationValueMissingForSelect);
349 String validationMessageTypeMismatchText()
351 return query(WebLocalizedString::ValidationTypeMismatch);
354 String validationMessageTypeMismatchForEmailText()
356 return query(WebLocalizedString::ValidationTypeMismatchForEmail);
359 String validationMessageTypeMismatchForMultipleEmailText()
361 return query(WebLocalizedString::ValidationTypeMismatchForMultipleEmail);
364 String validationMessageTypeMismatchForURLText()
366 return query(WebLocalizedString::ValidationTypeMismatchForURL);
369 String validationMessagePatternMismatchText()
371 return query(WebLocalizedString::ValidationPatternMismatch);
374 String validationMessageTooLongText(int valueLength, int maxLength)
376 return query(WebLocalizedString::ValidationTooLong, String::number(valueLength), String::number(maxLength));
379 String validationMessageRangeUnderflowText(const String& minimum)
381 return query(WebLocalizedString::ValidationRangeUnderflow, minimum);
384 String validationMessageRangeOverflowText(const String& maximum)
386 return query(WebLocalizedString::ValidationRangeOverflow, maximum);
389 String validationMessageStepMismatchText(const String& base, const String& step)
391 return query(WebLocalizedString::ValidationStepMismatch, base, step);
394 } // namespace WebCore