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