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 #include "PlatformString.h"
37 #include "StringBuilder.h"
38
39 #include "WebKit.h"
40 #include "WebKitClient.h"
41 #include "WebLocalizedString.h"
42 #include "WebString.h"
43
44 using WebKit::WebLocalizedString;
45
46 namespace WebCore {
47
query(WebLocalizedString::Name name)48 static String query(WebLocalizedString::Name name)
49 {
50 return WebKit::webKitClient()->queryLocalizedString(name);
51 }
52
query(WebLocalizedString::Name name,int numericValue)53 static String query(WebLocalizedString::Name name, int numericValue)
54 {
55 return WebKit::webKitClient()->queryLocalizedString(name, numericValue);
56 }
57
searchableIndexIntroduction()58 String searchableIndexIntroduction()
59 {
60 return query(WebLocalizedString::SearchableIndexIntroduction);
61 }
62
submitButtonDefaultLabel()63 String submitButtonDefaultLabel()
64 {
65 return query(WebLocalizedString::SubmitButtonDefaultLabel);
66 }
67
inputElementAltText()68 String inputElementAltText()
69 {
70 return query(WebLocalizedString::InputElementAltText);
71 }
72
resetButtonDefaultLabel()73 String resetButtonDefaultLabel()
74 {
75 return query(WebLocalizedString::ResetButtonDefaultLabel);
76 }
77
fileButtonChooseFileLabel()78 String fileButtonChooseFileLabel()
79 {
80 return query(WebLocalizedString::FileButtonChooseFileLabel);
81 }
82
fileButtonNoFileSelectedLabel()83 String fileButtonNoFileSelectedLabel()
84 {
85 return query(WebLocalizedString::FileButtonNoFileSelectedLabel);
86 }
87
searchMenuNoRecentSearchesText()88 String searchMenuNoRecentSearchesText()
89 {
90 return query(WebLocalizedString::SearchMenuNoRecentSearchesText);
91 }
searchMenuRecentSearchesText()92 String searchMenuRecentSearchesText()
93 {
94 return query(WebLocalizedString::SearchMenuRecentSearchesText);
95 }
searchMenuClearRecentSearchesText()96 String searchMenuClearRecentSearchesText()
97 {
98 return query(WebLocalizedString::SearchMenuClearRecentSearchesText);
99 }
100
AXWebAreaText()101 String AXWebAreaText()
102 {
103 return query(WebLocalizedString::AXWebAreaText);
104 }
105
AXLinkText()106 String AXLinkText()
107 {
108 return query(WebLocalizedString::AXLinkText);
109 }
110
AXListMarkerText()111 String AXListMarkerText()
112 {
113 return query(WebLocalizedString::AXListMarkerText);
114 }
115
AXImageMapText()116 String AXImageMapText()
117 {
118 return query(WebLocalizedString::AXImageMapText);
119 }
120
AXHeadingText()121 String AXHeadingText()
122 {
123 return query(WebLocalizedString::AXHeadingText);
124 }
125
AXDefinitionListTermText()126 String AXDefinitionListTermText()
127 {
128 notImplemented();
129 return String("term");
130 }
131
AXDefinitionListDefinitionText()132 String AXDefinitionListDefinitionText()
133 {
134 notImplemented();
135 return String("definition");
136 }
137
AXButtonActionVerb()138 String AXButtonActionVerb()
139 {
140 return query(WebLocalizedString::AXButtonActionVerb);
141 }
142
AXRadioButtonActionVerb()143 String AXRadioButtonActionVerb()
144 {
145 return query(WebLocalizedString::AXRadioButtonActionVerb);
146 }
147
AXTextFieldActionVerb()148 String AXTextFieldActionVerb()
149 {
150 return query(WebLocalizedString::AXTextFieldActionVerb);
151 }
152
AXCheckedCheckBoxActionVerb()153 String AXCheckedCheckBoxActionVerb()
154 {
155 return query(WebLocalizedString::AXCheckedCheckBoxActionVerb);
156 }
157
AXUncheckedCheckBoxActionVerb()158 String AXUncheckedCheckBoxActionVerb()
159 {
160 return query(WebLocalizedString::AXUncheckedCheckBoxActionVerb);
161 }
162
AXLinkActionVerb()163 String AXLinkActionVerb()
164 {
165 return query(WebLocalizedString::AXLinkActionVerb);
166 }
167
AXMenuListPopupActionVerb()168 String AXMenuListPopupActionVerb()
169 {
170 return String();
171 }
172
AXMenuListActionVerb()173 String AXMenuListActionVerb()
174 {
175 return String();
176 }
177
multipleFileUploadText(unsigned numberOfFiles)178 String multipleFileUploadText(unsigned numberOfFiles)
179 {
180 return query(WebLocalizedString::MultipleFileUploadText, numberOfFiles);
181 }
182
183 // Used in FTPDirectoryDocument.cpp
unknownFileSizeText()184 String unknownFileSizeText()
185 {
186 return String();
187 }
188
189 // The following two functions are not declared in LocalizedStrings.h.
190 // They are used by the menu for the HTML keygen tag.
keygenMenuHighGradeKeySize()191 String keygenMenuHighGradeKeySize()
192 {
193 return query(WebLocalizedString::KeygenMenuHighGradeKeySize);
194 }
195
keygenMenuMediumGradeKeySize()196 String keygenMenuMediumGradeKeySize()
197 {
198 return query(WebLocalizedString::KeygenMenuMediumGradeKeySize);
199 }
200
201 // Used in ImageDocument.cpp as the title for pages when that page is an image.
imageTitle(const String & filename,const IntSize & size)202 String imageTitle(const String& filename, const IntSize& size)
203 {
204 // Note that we cannot use String::format because it works for ASCII only.
205 StringBuilder result;
206 result.append(filename);
207 result.append(" (");
208 result.append(String::number(size.width()));
209 result.append(static_cast<UChar>(0xD7)); // U+00D7 (multiplication sign)
210 result.append(String::number(size.height()));
211 result.append(")");
212 return result.toString();
213 }
214
215 // We don't use these strings, so they return an empty String. We can't just
216 // make them asserts because webcore still calls them.
contextMenuItemTagOpenLinkInNewWindow()217 String contextMenuItemTagOpenLinkInNewWindow() { return String(); }
contextMenuItemTagDownloadLinkToDisk()218 String contextMenuItemTagDownloadLinkToDisk() { return String(); }
contextMenuItemTagCopyLinkToClipboard()219 String contextMenuItemTagCopyLinkToClipboard() { return String(); }
contextMenuItemTagOpenImageInNewWindow()220 String contextMenuItemTagOpenImageInNewWindow() { return String(); }
contextMenuItemTagDownloadImageToDisk()221 String contextMenuItemTagDownloadImageToDisk() { return String(); }
contextMenuItemTagCopyImageToClipboard()222 String contextMenuItemTagCopyImageToClipboard() { return String(); }
contextMenuItemTagOpenFrameInNewWindow()223 String contextMenuItemTagOpenFrameInNewWindow() { return String(); }
contextMenuItemTagCopy()224 String contextMenuItemTagCopy() { return String(); }
contextMenuItemTagGoBack()225 String contextMenuItemTagGoBack() { return String(); }
contextMenuItemTagGoForward()226 String contextMenuItemTagGoForward() { return String(); }
contextMenuItemTagStop()227 String contextMenuItemTagStop() { return String(); }
contextMenuItemTagReload()228 String contextMenuItemTagReload() { return String(); }
contextMenuItemTagCut()229 String contextMenuItemTagCut() { return String(); }
contextMenuItemTagPaste()230 String contextMenuItemTagPaste() { return String(); }
contextMenuItemTagNoGuessesFound()231 String contextMenuItemTagNoGuessesFound() { return String(); }
contextMenuItemTagIgnoreSpelling()232 String contextMenuItemTagIgnoreSpelling() { return String(); }
contextMenuItemTagLearnSpelling()233 String contextMenuItemTagLearnSpelling() { return String(); }
contextMenuItemTagSearchWeb()234 String contextMenuItemTagSearchWeb() { return String(); }
contextMenuItemTagLookUpInDictionary()235 String contextMenuItemTagLookUpInDictionary() { return String(); }
contextMenuItemTagOpenLink()236 String contextMenuItemTagOpenLink() { return String(); }
contextMenuItemTagIgnoreGrammar()237 String contextMenuItemTagIgnoreGrammar() { return String(); }
contextMenuItemTagSpellingMenu()238 String contextMenuItemTagSpellingMenu() { return String(); }
contextMenuItemTagCheckSpelling()239 String contextMenuItemTagCheckSpelling() { return String(); }
contextMenuItemTagCheckSpellingWhileTyping()240 String contextMenuItemTagCheckSpellingWhileTyping() { return String(); }
contextMenuItemTagCheckGrammarWithSpelling()241 String contextMenuItemTagCheckGrammarWithSpelling() { return String(); }
contextMenuItemTagFontMenu()242 String contextMenuItemTagFontMenu() { return String(); }
contextMenuItemTagBold()243 String contextMenuItemTagBold() { return String(); }
contextMenuItemTagItalic()244 String contextMenuItemTagItalic() { return String(); }
contextMenuItemTagUnderline()245 String contextMenuItemTagUnderline() { return String(); }
contextMenuItemTagOutline()246 String contextMenuItemTagOutline() { return String(); }
contextMenuItemTagWritingDirectionMenu()247 String contextMenuItemTagWritingDirectionMenu() { return String(); }
contextMenuItemTagTextDirectionMenu()248 String contextMenuItemTagTextDirectionMenu() { return String(); }
contextMenuItemTagDefaultDirection()249 String contextMenuItemTagDefaultDirection() { return String(); }
contextMenuItemTagLeftToRight()250 String contextMenuItemTagLeftToRight() { return String(); }
contextMenuItemTagRightToLeft()251 String contextMenuItemTagRightToLeft() { return String(); }
contextMenuItemTagInspectElement()252 String contextMenuItemTagInspectElement() { return String(); }
contextMenuItemTagShowSpellingPanel(bool show)253 String contextMenuItemTagShowSpellingPanel(bool show) { return String(); }
mediaElementLiveBroadcastStateText()254 String mediaElementLiveBroadcastStateText() { return String(); }
mediaElementLoadingStateText()255 String mediaElementLoadingStateText() { return String(); }
256
localizedMediaControlElementString(const String &)257 String localizedMediaControlElementString(const String& /*name*/)
258 {
259 // FIXME: to be fixed.
260 return String();
261 }
262
localizedMediaControlElementHelpText(const String &)263 String localizedMediaControlElementHelpText(const String& /*name*/)
264 {
265 // FIXME: to be fixed.
266 return String();
267 }
268
localizedMediaTimeDescription(float)269 String localizedMediaTimeDescription(float /*time*/)
270 {
271 // FIXME: to be fixed.
272 return String();
273 }
274
validationMessageValueMissingText()275 String validationMessageValueMissingText()
276 {
277 notImplemented();
278 return String();
279 }
280
validationMessageTypeMismatchText()281 String validationMessageTypeMismatchText()
282 {
283 notImplemented();
284 return String();
285 }
286
validationMessagePatternMismatchText()287 String validationMessagePatternMismatchText()
288 {
289 notImplemented();
290 return String();
291 }
292
validationMessageTooLongText()293 String validationMessageTooLongText()
294 {
295 notImplemented();
296 return String();
297 }
298
validationMessageRangeUnderflowText()299 String validationMessageRangeUnderflowText()
300 {
301 notImplemented();
302 return String();
303 }
304
validationMessageRangeOverflowText()305 String validationMessageRangeOverflowText()
306 {
307 notImplemented();
308 return String();
309 }
310
validationMessageStepMismatchText()311 String validationMessageStepMismatchText()
312 {
313 notImplemented();
314 return String();
315 }
316
317 } // namespace WebCore
318