2 * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
3 * Copyright (C) 2006 Michael Emmel mike.emmel@gmail.com
4 * Copyright (C) 2007 Holger Hans Peter Freyther
5 * Copyright (C) 2008 Christian Dywan <christian@imendio.com>
6 * Copyright (C) 2008 Nuanti Ltd.
7 * Copyright (C) 2010 Igalia S.L
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in the
16 * documentation and/or other materials provided with the distribution.
18 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
19 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
22 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
23 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
25 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
26 * 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.
33 #include "LocalizedStrings.h"
36 #include "NotImplemented.h"
37 #include "PlatformString.h"
38 #include <wtf/text/CString.h>
40 #include <glib/gi18n-lib.h>
46 static const char* gtkStockLabel(const char* stockID)
49 if (!gtk_stock_lookup(stockID, &item))
54 String submitButtonDefaultLabel()
56 return String::fromUTF8(_("Submit"));
59 String inputElementAltText()
61 return String::fromUTF8(_("Submit"));
64 String resetButtonDefaultLabel()
66 return String::fromUTF8(_("Reset"));
69 String defaultDetailsSummaryText()
71 return String::fromUTF8(_("Details"));
74 String searchableIndexIntroduction()
76 return String::fromUTF8(_("This is a searchable index. Enter search keywords: "));
79 String fileButtonChooseFileLabel()
81 return String::fromUTF8(_("Choose File"));
84 String fileButtonChooseMultipleFilesLabel()
86 return String::fromUTF8(_("Choose Files"));
89 String fileButtonNoFileSelectedLabel()
91 return String::fromUTF8(_("(None)"));
94 String contextMenuItemTagOpenLinkInNewWindow()
96 return String::fromUTF8(_("Open Link in New _Window"));
99 String contextMenuItemTagDownloadLinkToDisk()
101 return String::fromUTF8(_("_Download Linked File"));
104 String contextMenuItemTagCopyLinkToClipboard()
106 return String::fromUTF8(_("Copy Link Loc_ation"));
109 String contextMenuItemTagOpenImageInNewWindow()
111 return String::fromUTF8(_("Open _Image in New Window"));
114 String contextMenuItemTagDownloadImageToDisk()
116 return String::fromUTF8(_("Sa_ve Image As"));
119 String contextMenuItemTagCopyImageToClipboard()
121 return String::fromUTF8(_("Cop_y Image"));
124 String contextMenuItemTagCopyImageUrlToClipboard()
126 return String::fromUTF8(_("Copy Image _Address"));
129 String contextMenuItemTagOpenVideoInNewWindow()
131 return String::fromUTF8(_("Open _Video in New Window"));
134 String contextMenuItemTagOpenAudioInNewWindow()
136 return String::fromUTF8(_("Open _Audio in New Window"));
139 String contextMenuItemTagCopyVideoLinkToClipboard()
141 return String::fromUTF8(_("Cop_y Video Link Location"));
144 String contextMenuItemTagCopyAudioLinkToClipboard()
146 return String::fromUTF8(_("Cop_y Audio Link Location"));
149 String contextMenuItemTagToggleMediaControls()
151 return String::fromUTF8(_("_Toggle Media Controls"));
154 String contextMenuItemTagToggleMediaLoop()
156 return String::fromUTF8(_("Toggle Media _Loop Playback"));
159 String contextMenuItemTagEnterVideoFullscreen()
161 return String::fromUTF8(_("Switch Video to _Fullscreen"));
164 String contextMenuItemTagMediaPlay()
166 return String::fromUTF8(_("_Play"));
169 String contextMenuItemTagMediaPause()
171 return String::fromUTF8(_("_Pause"));
174 String contextMenuItemTagMediaMute()
176 return String::fromUTF8(_("_Mute"));
179 String contextMenuItemTagOpenFrameInNewWindow()
181 return String::fromUTF8(_("Open _Frame in New Window"));
184 String contextMenuItemTagCopy()
186 static String stockLabel = String::fromUTF8(gtkStockLabel(GTK_STOCK_COPY));
190 String contextMenuItemTagDelete()
192 static String stockLabel = String::fromUTF8(gtkStockLabel(GTK_STOCK_DELETE));
196 String contextMenuItemTagSelectAll()
198 static String stockLabel = String::fromUTF8(gtkStockLabel(GTK_STOCK_SELECT_ALL));
202 String contextMenuItemTagUnicode()
204 return String::fromUTF8(_("_Insert Unicode Control Character"));
207 String contextMenuItemTagInputMethods()
209 return String::fromUTF8(_("Input _Methods"));
212 String contextMenuItemTagGoBack()
214 static String stockLabel = String::fromUTF8(gtkStockLabel(GTK_STOCK_GO_BACK));
218 String contextMenuItemTagGoForward()
220 static String stockLabel = String::fromUTF8(gtkStockLabel(GTK_STOCK_GO_FORWARD));
224 String contextMenuItemTagStop()
226 static String stockLabel = String::fromUTF8(gtkStockLabel(GTK_STOCK_STOP));
230 String contextMenuItemTagReload()
232 return String::fromUTF8(_("_Reload"));
235 String contextMenuItemTagCut()
237 static String stockLabel = String::fromUTF8(gtkStockLabel(GTK_STOCK_CUT));
241 String contextMenuItemTagPaste()
243 static String stockLabel = String::fromUTF8(gtkStockLabel(GTK_STOCK_PASTE));
247 String contextMenuItemTagNoGuessesFound()
249 return String::fromUTF8(_("No Guesses Found"));
252 String contextMenuItemTagIgnoreSpelling()
254 return String::fromUTF8(_("_Ignore Spelling"));
257 String contextMenuItemTagLearnSpelling()
259 return String::fromUTF8(_("_Learn Spelling"));
262 String contextMenuItemTagSearchWeb()
264 return String::fromUTF8(_("_Search the Web"));
267 String contextMenuItemTagLookUpInDictionary(const String&)
269 return String::fromUTF8(_("_Look Up in Dictionary"));
272 String contextMenuItemTagOpenLink()
274 return String::fromUTF8(_("_Open Link"));
277 String contextMenuItemTagIgnoreGrammar()
279 return String::fromUTF8(_("Ignore _Grammar"));
282 String contextMenuItemTagSpellingMenu()
284 return String::fromUTF8(_("Spelling and _Grammar"));
287 String contextMenuItemTagShowSpellingPanel(bool show)
289 return String::fromUTF8(show ? _("_Show Spelling and Grammar") : _("_Hide Spelling and Grammar"));
292 String contextMenuItemTagCheckSpelling()
294 return String::fromUTF8(_("_Check Document Now"));
297 String contextMenuItemTagCheckSpellingWhileTyping()
299 return String::fromUTF8(_("Check Spelling While _Typing"));
302 String contextMenuItemTagCheckGrammarWithSpelling()
304 return String::fromUTF8(_("Check _Grammar With Spelling"));
307 String contextMenuItemTagFontMenu()
309 return String::fromUTF8(_("_Font"));
312 String contextMenuItemTagBold()
314 static String stockLabel = String::fromUTF8(gtkStockLabel(GTK_STOCK_BOLD));
318 String contextMenuItemTagItalic()
320 static String stockLabel = String::fromUTF8(gtkStockLabel(GTK_STOCK_ITALIC));
324 String contextMenuItemTagUnderline()
326 static String stockLabel = String::fromUTF8(gtkStockLabel(GTK_STOCK_UNDERLINE));
330 String contextMenuItemTagOutline()
332 return String::fromUTF8(_("_Outline"));
335 String contextMenuItemTagInspectElement()
337 return String::fromUTF8(_("Inspect _Element"));
340 String searchMenuNoRecentSearchesText()
342 return String::fromUTF8(_("No recent searches"));
345 String searchMenuRecentSearchesText()
347 return String::fromUTF8(_("Recent searches"));
350 String searchMenuClearRecentSearchesText()
352 return String::fromUTF8(_("_Clear recent searches"));
355 String AXDefinitionListTermText()
357 return String::fromUTF8(_("term"));
360 String AXDefinitionListDefinitionText()
362 return String::fromUTF8(_("definition"));
365 String AXButtonActionVerb()
367 return String::fromUTF8(_("press"));
370 String AXRadioButtonActionVerb()
372 return String::fromUTF8(_("select"));
375 String AXTextFieldActionVerb()
377 return String::fromUTF8(_("activate"));
380 String AXCheckedCheckBoxActionVerb()
382 return String::fromUTF8(_("uncheck"));
385 String AXUncheckedCheckBoxActionVerb()
387 return String::fromUTF8(_("check"));
390 String AXLinkActionVerb()
392 return String::fromUTF8(_("jump"));
395 String AXMenuListPopupActionVerb()
400 String AXMenuListActionVerb()
405 String missingPluginText()
407 return String::fromUTF8(_("Missing Plug-in"));
410 String crashedPluginText()
413 return String::fromUTF8(_("Plug-in Failure"));
416 String multipleFileUploadText(unsigned numberOfFiles)
418 // FIXME: If this file gets localized, this should really be localized as one string with a wildcard for the number.
419 return String::number(numberOfFiles) + String::fromUTF8(_(" files"));
422 String unknownFileSizeText()
424 return String::fromUTF8(_("Unknown"));
427 String imageTitle(const String& filename, const IntSize& size)
429 GOwnPtr<gchar> string(g_strdup_printf(C_("Title string for images", "%s (%dx%d pixels)"),
430 filename.utf8().data(),
431 size.width(), size.height()));
433 return String::fromUTF8(string.get());
439 String mediaElementLoadingStateText()
441 return String::fromUTF8(_("Loading..."));
444 String mediaElementLiveBroadcastStateText()
446 return String::fromUTF8(_("Live Broadcast"));
449 String localizedMediaControlElementString(const String& name)
451 if (name == "AudioElement")
452 return String::fromUTF8(_("audio element controller"));
453 if (name == "VideoElement")
454 return String::fromUTF8(_("video element controller"));
455 if (name == "MuteButton")
456 return String::fromUTF8(_("mute"));
457 if (name == "UnMuteButton")
458 return String::fromUTF8(_("unmute"));
459 if (name == "PlayButton")
460 return String::fromUTF8(_("play"));
461 if (name == "PauseButton")
462 return String::fromUTF8(_("pause"));
463 if (name == "Slider")
464 return String::fromUTF8(_("movie time"));
465 if (name == "SliderThumb")
466 return String::fromUTF8(_("timeline slider thumb"));
467 if (name == "RewindButton")
468 return String::fromUTF8(_("back 30 seconds"));
469 if (name == "ReturnToRealtimeButton")
470 return String::fromUTF8(_("return to realtime"));
471 if (name == "CurrentTimeDisplay")
472 return String::fromUTF8(_("elapsed time"));
473 if (name == "TimeRemainingDisplay")
474 return String::fromUTF8(_("remaining time"));
475 if (name == "StatusDisplay")
476 return String::fromUTF8(_("status"));
477 if (name == "FullscreenButton")
478 return String::fromUTF8(_("fullscreen"));
479 if (name == "SeekForwardButton")
480 return String::fromUTF8(_("fast forward"));
481 if (name == "SeekBackButton")
482 return String::fromUTF8(_("fast reverse"));
483 if (name == "ShowClosedCaptionsButton")
484 return String::fromUTF8(_("show closed captions"));
485 if (name == "HideClosedCaptionsButton")
486 return String::fromUTF8(_("hide closed captions"));
488 ASSERT_NOT_REACHED();
492 String localizedMediaControlElementHelpText(const String& name)
494 if (name == "AudioElement")
495 return String::fromUTF8(_("audio element playback controls and status display"));
496 if (name == "VideoElement")
497 return String::fromUTF8(_("video element playback controls and status display"));
498 if (name == "MuteButton")
499 return String::fromUTF8(_("mute audio tracks"));
500 if (name == "UnMuteButton")
501 return String::fromUTF8(_("unmute audio tracks"));
502 if (name == "PlayButton")
503 return String::fromUTF8(_("begin playback"));
504 if (name == "PauseButton")
505 return String::fromUTF8(_("pause playback"));
506 if (name == "Slider")
507 return String::fromUTF8(_("movie time scrubber"));
508 if (name == "SliderThumb")
509 return String::fromUTF8(_("movie time scrubber thumb"));
510 if (name == "RewindButton")
511 return String::fromUTF8(_("seek movie back 30 seconds"));
512 if (name == "ReturnToRealtimeButton")
513 return String::fromUTF8(_("return streaming movie to real time"));
514 if (name == "CurrentTimeDisplay")
515 return String::fromUTF8(_("current movie time in seconds"));
516 if (name == "TimeRemainingDisplay")
517 return String::fromUTF8(_("number of seconds of movie remaining"));
518 if (name == "StatusDisplay")
519 return String::fromUTF8(_("current movie status"));
520 if (name == "SeekBackButton")
521 return String::fromUTF8(_("seek quickly back"));
522 if (name == "SeekForwardButton")
523 return String::fromUTF8(_("seek quickly forward"));
524 if (name == "FullscreenButton")
525 return String::fromUTF8(_("Play movie in fullscreen mode"));
526 if (name == "ShowClosedCaptionsButton")
527 return String::fromUTF8(_("start displaying closed captions"));
528 if (name == "HideClosedCaptionsButton")
529 return String::fromUTF8(_("stop displaying closed captions"));
531 ASSERT_NOT_REACHED();
535 String localizedMediaTimeDescription(float time)
538 return String::fromUTF8(_("indefinite time"));
540 int seconds = (int)fabsf(time);
541 int days = seconds / (60 * 60 * 24);
542 int hours = seconds / (60 * 60);
543 int minutes = (seconds / 60) % 60;
547 GOwnPtr<gchar> string(g_strdup_printf("%d days %d hours %d minutes %d seconds", days, hours, minutes, seconds));
548 return String::fromUTF8(string.get());
552 GOwnPtr<gchar> string(g_strdup_printf("%d hours %d minutes %d seconds", hours, minutes, seconds));
553 return String::fromUTF8(string.get());
557 GOwnPtr<gchar> string(g_strdup_printf("%d minutes %d seconds", minutes, seconds));
558 return String::fromUTF8(string.get());
561 GOwnPtr<gchar> string(g_strdup_printf("%d seconds", seconds));
562 return String::fromUTF8(string.get());
564 #endif // ENABLE(VIDEO)
566 String validationMessageValueMissingText()
568 return String::fromUTF8(_("value missing"));
571 String validationMessageValueMissingForCheckboxText()
574 return validationMessageValueMissingText();
577 String validationMessageValueMissingForFileText()
580 return validationMessageValueMissingText();
583 String validationMessageValueMissingForMultipleFileText()
586 return validationMessageValueMissingText();
589 String validationMessageValueMissingForRadioText()
592 return validationMessageValueMissingText();
595 String validationMessageValueMissingForSelectText()
598 return validationMessageValueMissingText();
601 String validationMessageTypeMismatchText()
604 return String::fromUTF8(_("type mismatch"));
607 String validationMessageTypeMismatchForEmailText()
610 return validationMessageTypeMismatchText();
613 String validationMessageTypeMismatchForMultipleEmailText()
616 return validationMessageTypeMismatchText();
619 String validationMessageTypeMismatchForURLText()
622 return validationMessageTypeMismatchText();
625 String validationMessagePatternMismatchText()
627 return String::fromUTF8(_("pattern mismatch"));
630 String validationMessageTooLongText(int, int)
632 return String::fromUTF8(_("too long"));
635 String validationMessageRangeUnderflowText(const String&)
637 return String::fromUTF8(_("range underflow"));
640 String validationMessageRangeOverflowText(const String&)
642 return String::fromUTF8(_("range overflow"));
645 String validationMessageStepMismatchText(const String&, const String&)
647 return String::fromUTF8(_("step mismatch"));
650 String localizedString(const char* key)
652 return String::fromUTF8(key, strlen(key));