WebKit/chromium/src/LocalizedStrings.cpp
changeset 0 4f2f89ce4247
equal deleted inserted replaced
-1:000000000000 0:4f2f89ce4247
       
     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 missingPluginText()
       
   179 {
       
   180     notImplemented();
       
   181     return String("Missing Plug-in");
       
   182 }
       
   183 
       
   184 String crashedPluginText()
       
   185 {
       
   186     notImplemented();
       
   187     return String("Plug-in Failure");
       
   188 }
       
   189 
       
   190 String multipleFileUploadText(unsigned numberOfFiles)
       
   191 {
       
   192     return query(WebLocalizedString::MultipleFileUploadText, numberOfFiles);
       
   193 }
       
   194 
       
   195 // Used in FTPDirectoryDocument.cpp
       
   196 String unknownFileSizeText()
       
   197 {
       
   198     return String();
       
   199 }
       
   200 
       
   201 // The following two functions are not declared in LocalizedStrings.h.
       
   202 // They are used by the menu for the HTML keygen tag.
       
   203 String keygenMenuHighGradeKeySize()
       
   204 {
       
   205     return query(WebLocalizedString::KeygenMenuHighGradeKeySize);
       
   206 }
       
   207 
       
   208 String keygenMenuMediumGradeKeySize()
       
   209 {
       
   210     return query(WebLocalizedString::KeygenMenuMediumGradeKeySize);
       
   211 }
       
   212 
       
   213 // Used in ImageDocument.cpp as the title for pages when that page is an image.
       
   214 String imageTitle(const String& filename, const IntSize& size)
       
   215 {
       
   216     // Note that we cannot use String::format because it works for ASCII only.
       
   217     StringBuilder result;
       
   218     result.append(filename);
       
   219     result.append(" (");
       
   220     result.append(String::number(size.width()));
       
   221     result.append(static_cast<UChar>(0xD7));  // U+00D7 (multiplication sign)
       
   222     result.append(String::number(size.height()));
       
   223     result.append(")");
       
   224     return result.toString();
       
   225 }
       
   226 
       
   227 // We don't use these strings, so they return an empty String. We can't just
       
   228 // make them asserts because webcore still calls them.
       
   229 String contextMenuItemTagOpenLinkInNewWindow() { return String(); }
       
   230 String contextMenuItemTagDownloadLinkToDisk() { return String(); }
       
   231 String contextMenuItemTagCopyLinkToClipboard() { return String(); }
       
   232 String contextMenuItemTagOpenImageInNewWindow() { return String(); }
       
   233 String contextMenuItemTagDownloadImageToDisk() { return String(); }
       
   234 String contextMenuItemTagCopyImageToClipboard() { return String(); }
       
   235 String contextMenuItemTagOpenFrameInNewWindow() { return String(); }
       
   236 String contextMenuItemTagCopy() { return String(); }
       
   237 String contextMenuItemTagGoBack() { return String(); }
       
   238 String contextMenuItemTagGoForward() { return String(); }
       
   239 String contextMenuItemTagStop() { return String(); }
       
   240 String contextMenuItemTagReload() { return String(); }
       
   241 String contextMenuItemTagCut() { return String(); }
       
   242 String contextMenuItemTagPaste() { return String(); }
       
   243 String contextMenuItemTagNoGuessesFound() { return String(); }
       
   244 String contextMenuItemTagIgnoreSpelling() { return String(); }
       
   245 String contextMenuItemTagLearnSpelling() { return String(); }
       
   246 String contextMenuItemTagSearchWeb() { return String(); }
       
   247 String contextMenuItemTagLookUpInDictionary() { return String(); }
       
   248 String contextMenuItemTagOpenLink() { return String(); }
       
   249 String contextMenuItemTagIgnoreGrammar() { return String(); }
       
   250 String contextMenuItemTagSpellingMenu() { return String(); }
       
   251 String contextMenuItemTagCheckSpelling() { return String(); }
       
   252 String contextMenuItemTagCheckSpellingWhileTyping() { return String(); }
       
   253 String contextMenuItemTagCheckGrammarWithSpelling() { return String(); }
       
   254 String contextMenuItemTagFontMenu() { return String(); }
       
   255 String contextMenuItemTagBold() { return String(); }
       
   256 String contextMenuItemTagItalic() { return String(); }
       
   257 String contextMenuItemTagUnderline() { return String(); }
       
   258 String contextMenuItemTagOutline() { return String(); }
       
   259 String contextMenuItemTagWritingDirectionMenu() { return String(); }
       
   260 String contextMenuItemTagTextDirectionMenu() { return String(); }
       
   261 String contextMenuItemTagDefaultDirection() { return String(); }
       
   262 String contextMenuItemTagLeftToRight() { return String(); }
       
   263 String contextMenuItemTagRightToLeft() { return String(); }
       
   264 String contextMenuItemTagInspectElement() { return String(); }
       
   265 String contextMenuItemTagShowSpellingPanel(bool show) { return String(); }
       
   266 String mediaElementLiveBroadcastStateText() { return String(); }
       
   267 String mediaElementLoadingStateText() { return String(); }
       
   268 
       
   269 String localizedMediaControlElementString(const String& /*name*/)
       
   270 {
       
   271     // FIXME: to be fixed.
       
   272     return String();
       
   273 }
       
   274 
       
   275 String localizedMediaControlElementHelpText(const String& /*name*/)
       
   276 {
       
   277     // FIXME: to be fixed.
       
   278     return String();
       
   279 }
       
   280 
       
   281 String localizedMediaTimeDescription(float /*time*/)
       
   282 {
       
   283     // FIXME: to be fixed.
       
   284     return String();
       
   285 }
       
   286 
       
   287 String validationMessageValueMissingText()
       
   288 {
       
   289     notImplemented();
       
   290     return String();
       
   291 }
       
   292 
       
   293 String validationMessageTypeMismatchText()
       
   294 {
       
   295     notImplemented();
       
   296     return String();
       
   297 }
       
   298 
       
   299 String validationMessagePatternMismatchText()
       
   300 {
       
   301     notImplemented();
       
   302     return String();
       
   303 }
       
   304 
       
   305 String validationMessageTooLongText()
       
   306 {
       
   307     notImplemented();
       
   308     return String();
       
   309 }
       
   310 
       
   311 String validationMessageRangeUnderflowText()
       
   312 {
       
   313     notImplemented();
       
   314     return String();
       
   315 }
       
   316 
       
   317 String validationMessageRangeOverflowText()
       
   318 {
       
   319     notImplemented();
       
   320     return String();
       
   321 }
       
   322 
       
   323 String validationMessageStepMismatchText()
       
   324 {
       
   325     notImplemented();
       
   326     return String();
       
   327 }
       
   328 
       
   329 } // namespace WebCore