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 48 static String query(WebLocalizedString::Name name) 49 { 50 return WebKit::webKitClient()->queryLocalizedString(name); 51 } 52 53 static String query(WebLocalizedString::Name name, int numericValue) 54 { 55 return WebKit::webKitClient()->queryLocalizedString(name, numericValue); 56 } 57 58 String searchableIndexIntroduction() 59 { 60 return query(WebLocalizedString::SearchableIndexIntroduction); 61 } 62 63 String submitButtonDefaultLabel() 64 { 65 return query(WebLocalizedString::SubmitButtonDefaultLabel); 66 } 67 68 String inputElementAltText() 69 { 70 return query(WebLocalizedString::InputElementAltText); 71 } 72 73 String resetButtonDefaultLabel() 74 { 75 return query(WebLocalizedString::ResetButtonDefaultLabel); 76 } 77 78 String fileButtonChooseFileLabel() 79 { 80 return query(WebLocalizedString::FileButtonChooseFileLabel); 81 } 82 83 String fileButtonNoFileSelectedLabel() 84 { 85 return query(WebLocalizedString::FileButtonNoFileSelectedLabel); 86 } 87 88 String searchMenuNoRecentSearchesText() 89 { 90 return query(WebLocalizedString::SearchMenuNoRecentSearchesText); 91 } 92 String searchMenuRecentSearchesText() 93 { 94 return query(WebLocalizedString::SearchMenuRecentSearchesText); 95 } 96 String searchMenuClearRecentSearchesText() 97 { 98 return query(WebLocalizedString::SearchMenuClearRecentSearchesText); 99 } 100 101 String AXWebAreaText() 102 { 103 return query(WebLocalizedString::AXWebAreaText); 104 } 105 106 String AXLinkText() 107 { 108 return query(WebLocalizedString::AXLinkText); 109 } 110 111 String AXListMarkerText() 112 { 113 return query(WebLocalizedString::AXListMarkerText); 114 } 115 116 String AXImageMapText() 117 { 118 return query(WebLocalizedString::AXImageMapText); 119 } 120 121 String AXHeadingText() 122 { 123 return query(WebLocalizedString::AXHeadingText); 124 } 125 126 String AXDefinitionListTermText() 127 { 128 notImplemented(); 129 return String("term"); 130 } 131 132 String AXDefinitionListDefinitionText() 133 { 134 notImplemented(); 135 return String("definition"); 136 } 137 138 String AXButtonActionVerb() 139 { 140 return query(WebLocalizedString::AXButtonActionVerb); 141 } 142 143 String AXRadioButtonActionVerb() 144 { 145 return query(WebLocalizedString::AXRadioButtonActionVerb); 146 } 147 148 String AXTextFieldActionVerb() 149 { 150 return query(WebLocalizedString::AXTextFieldActionVerb); 151 } 152 153 String AXCheckedCheckBoxActionVerb() 154 { 155 return query(WebLocalizedString::AXCheckedCheckBoxActionVerb); 156 } 157 158 String AXUncheckedCheckBoxActionVerb() 159 { 160 return query(WebLocalizedString::AXUncheckedCheckBoxActionVerb); 161 } 162 163 String AXLinkActionVerb() 164 { 165 return query(WebLocalizedString::AXLinkActionVerb); 166 } 167 168 String AXMenuListPopupActionVerb() 169 { 170 return String(); 171 } 172 173 String AXMenuListActionVerb() 174 { 175 return String(); 176 } 177 178 String multipleFileUploadText(unsigned numberOfFiles) 179 { 180 return query(WebLocalizedString::MultipleFileUploadText, numberOfFiles); 181 } 182 183 // Used in FTPDirectoryDocument.cpp 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. 191 String keygenMenuHighGradeKeySize() 192 { 193 return query(WebLocalizedString::KeygenMenuHighGradeKeySize); 194 } 195 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. 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. 217 String contextMenuItemTagOpenLinkInNewWindow() { return String(); } 218 String contextMenuItemTagDownloadLinkToDisk() { return String(); } 219 String contextMenuItemTagCopyLinkToClipboard() { return String(); } 220 String contextMenuItemTagOpenImageInNewWindow() { return String(); } 221 String contextMenuItemTagDownloadImageToDisk() { return String(); } 222 String contextMenuItemTagCopyImageToClipboard() { return String(); } 223 String contextMenuItemTagOpenFrameInNewWindow() { return String(); } 224 String contextMenuItemTagCopy() { return String(); } 225 String contextMenuItemTagGoBack() { return String(); } 226 String contextMenuItemTagGoForward() { return String(); } 227 String contextMenuItemTagStop() { return String(); } 228 String contextMenuItemTagReload() { return String(); } 229 String contextMenuItemTagCut() { return String(); } 230 String contextMenuItemTagPaste() { return String(); } 231 String contextMenuItemTagNoGuessesFound() { return String(); } 232 String contextMenuItemTagIgnoreSpelling() { return String(); } 233 String contextMenuItemTagLearnSpelling() { return String(); } 234 String contextMenuItemTagSearchWeb() { return String(); } 235 String contextMenuItemTagLookUpInDictionary() { return String(); } 236 String contextMenuItemTagOpenLink() { return String(); } 237 String contextMenuItemTagIgnoreGrammar() { return String(); } 238 String contextMenuItemTagSpellingMenu() { return String(); } 239 String contextMenuItemTagCheckSpelling() { return String(); } 240 String contextMenuItemTagCheckSpellingWhileTyping() { return String(); } 241 String contextMenuItemTagCheckGrammarWithSpelling() { return String(); } 242 String contextMenuItemTagFontMenu() { return String(); } 243 String contextMenuItemTagBold() { return String(); } 244 String contextMenuItemTagItalic() { return String(); } 245 String contextMenuItemTagUnderline() { return String(); } 246 String contextMenuItemTagOutline() { return String(); } 247 String contextMenuItemTagWritingDirectionMenu() { return String(); } 248 String contextMenuItemTagTextDirectionMenu() { return String(); } 249 String contextMenuItemTagDefaultDirection() { return String(); } 250 String contextMenuItemTagLeftToRight() { return String(); } 251 String contextMenuItemTagRightToLeft() { return String(); } 252 String contextMenuItemTagInspectElement() { return String(); } 253 String contextMenuItemTagShowSpellingPanel(bool show) { return String(); } 254 String mediaElementLiveBroadcastStateText() { return String(); } 255 String mediaElementLoadingStateText() { return String(); } 256 257 String localizedMediaControlElementString(const String& /*name*/) 258 { 259 // FIXME: to be fixed. 260 return String(); 261 } 262 263 String localizedMediaControlElementHelpText(const String& /*name*/) 264 { 265 // FIXME: to be fixed. 266 return String(); 267 } 268 269 String localizedMediaTimeDescription(float /*time*/) 270 { 271 // FIXME: to be fixed. 272 return String(); 273 } 274 275 String validationMessageValueMissingText() 276 { 277 notImplemented(); 278 return String(); 279 } 280 281 String validationMessageTypeMismatchText() 282 { 283 notImplemented(); 284 return String(); 285 } 286 287 String validationMessagePatternMismatchText() 288 { 289 notImplemented(); 290 return String(); 291 } 292 293 String validationMessageTooLongText() 294 { 295 notImplemented(); 296 return String(); 297 } 298 299 String validationMessageRangeUnderflowText() 300 { 301 notImplemented(); 302 return String(); 303 } 304 305 String validationMessageRangeOverflowText() 306 { 307 notImplemented(); 308 return String(); 309 } 310 311 String validationMessageStepMismatchText() 312 { 313 notImplemented(); 314 return String(); 315 } 316 317 } // namespace WebCore 318