[haiku-commits] r40021 - in haiku/trunk/src/apps/mediaplayer: . interface playlist settings

  • From: pulkomandy@xxxxxxxxxxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Wed, 29 Dec 2010 11:38:59 +0100 (CET)

Author: pulkomandy
Date: 2010-12-29 11:38:58 +0100 (Wed, 29 Dec 2010)
New Revision: 40021
Changeset: http://dev.haiku-os.org/changeset/40021

Modified:
   haiku/trunk/src/apps/mediaplayer/Jamfile
   haiku/trunk/src/apps/mediaplayer/MainApp.cpp
   haiku/trunk/src/apps/mediaplayer/MainWin.cpp
   haiku/trunk/src/apps/mediaplayer/interface/PeakView.cpp
   haiku/trunk/src/apps/mediaplayer/playlist/CopyPLItemsCommand.cpp
   haiku/trunk/src/apps/mediaplayer/playlist/ImportPLItemsCommand.cpp
   haiku/trunk/src/apps/mediaplayer/playlist/MovePLItemsCommand.cpp
   haiku/trunk/src/apps/mediaplayer/playlist/PlaylistItem.cpp
   haiku/trunk/src/apps/mediaplayer/playlist/PlaylistWindow.cpp
   haiku/trunk/src/apps/mediaplayer/playlist/RandomizePLItemsCommand.cpp
   haiku/trunk/src/apps/mediaplayer/playlist/RemovePLItemsCommand.cpp
   haiku/trunk/src/apps/mediaplayer/settings/SettingsWindow.cpp
Log:
Patch by Dziadek as part of GCI : localize MediaPlayer.


Modified: haiku/trunk/src/apps/mediaplayer/Jamfile
===================================================================
--- haiku/trunk/src/apps/mediaplayer/Jamfile    2010-12-29 08:30:25 UTC (rev 
40020)
+++ haiku/trunk/src/apps/mediaplayer/Jamfile    2010-12-29 10:38:58 UTC (rev 
40021)
@@ -113,8 +113,23 @@
        MainWin.cpp
        VideoView.cpp
 
-       : be game locale media tracker translation textencoding 
$(TARGET_LIBSTDC++)
-               libshared.a
+       : be game locale media tracker translation textencoding 
$(TARGET_LIBSTDC++) 
+               $(HAIKU_LOCALE_LIBS) libshared.a
        : MediaPlayer.rdef
 ;
 
+DoCatalogs MediaPlayer : 
+       x-vnd.Haiku-MediaPlayer
+       : 
+       PeakView.cpp
+       CopyPLItemsCommand.cpp
+       ImportPLItemsCommand.cpp
+       MovePLItemsCommand.cpp
+       PlaylistItem.cpp
+       PlaylistWindow.cpp
+       RandomizePLItemsCommand.cpp
+       RemovePLItemsCommand.cpp
+       SettingsWindow.cpp
+       MainApp.cpp
+       MainWin.cpp
+;

Modified: haiku/trunk/src/apps/mediaplayer/MainApp.cpp
===================================================================
--- haiku/trunk/src/apps/mediaplayer/MainApp.cpp        2010-12-29 08:30:25 UTC 
(rev 40020)
+++ haiku/trunk/src/apps/mediaplayer/MainApp.cpp        2010-12-29 10:38:58 UTC 
(rev 40021)
@@ -24,8 +24,10 @@
 
 #include <Alert.h>
 #include <Autolock.h>
+#include <Catalog.h>
 #include <Entry.h>
 #include <FilePanel.h>
+#include <Locale.h>
 #include <MediaDefs.h>
 #include <MediaRoster.h>
 #include <MimeType.h>
@@ -43,9 +45,13 @@
 #include "SettingsWindow.h"
 
 
+#undef B_TRANSLATE_CONTEXT
+#define B_TRANSLATE_CONTEXT "MediaPlayer-Main"
 
-static const char* kCurrentPlaylistFilename = "MediaPlayer Current Playlist";
 
+static const char* kCurrentPlaylistFilename = 
+       B_TRANSLATE("MediaPlayer Current Playlist");
+
 const char* kAppSig = "application/x-vnd.Haiku-MediaPlayer";
 
 MainApp* gMainApp;
@@ -85,8 +91,9 @@
 
        if (!fMediaServerRunning || !fMediaAddOnServerRunning) {
                BAlert* alert = new BAlert("start_media_server",
-                       "It appears the media server is not running.\n"
-                       "Would you like to start it ?", "Quit", "Start media 
server", NULL,
+                       B_TRANSLATE("It appears the media server is not 
running.\n"
+                       "Would you like to start it ?"), B_TRANSLATE("Quit"), 
+                       B_TRANSLATE("Start media server"), NULL,
                        B_WIDTH_AS_USUAL, B_WARNING_ALERT);
                if (alert->Go() == 0) {
                        PostMessage(B_QUIT_REQUESTED);
@@ -404,8 +411,10 @@
 void
 MainApp::AboutRequested()
 {
-       BAlert* alert = new BAlert("about", NAME"\n\nWritten by Marcus 
Overhagen, "
-               "Stephan Aßmus and Frederik Modéen", "Thanks");
+       BAlert* alert = new BAlert("about", B_TRANSLATE(
+               NAME"\n\nWritten by Marcus Overhagen, "
+               "Stephan Aßmus and Frederik Modéen"), 
+               B_TRANSLATE("Thanks"));
        alert->SetFeel(B_FLOATING_ALL_WINDOW_FEEL);
                // Make sure it is on top of any player windows that may have 
the
                // floating all window feel.
@@ -462,7 +471,7 @@
        }
 
        _ShowFilePanel(fOpenFilePanel, M_OPEN_PANEL_RESULT, message,
-               "Open", "Open");
+               B_TRANSLATE("Open"), B_TRANSLATE("Open"));
 }
 
 
@@ -475,7 +484,7 @@
        }
 
        _ShowFilePanel(fSaveFilePanel, M_SAVE_PANEL_RESULT, message,
-               "Save", "Save");
+               B_TRANSLATE("Save"), B_TRANSLATE("Save"));
 }
 
 

Modified: haiku/trunk/src/apps/mediaplayer/MainWin.cpp
===================================================================
--- haiku/trunk/src/apps/mediaplayer/MainWin.cpp        2010-12-29 08:30:25 UTC 
(rev 40020)
+++ haiku/trunk/src/apps/mediaplayer/MainWin.cpp        2010-12-29 10:38:58 UTC 
(rev 40021)
@@ -30,9 +30,11 @@
 #include <Alert.h>
 #include <Application.h>
 #include <Autolock.h>
+#include <Catalog.h>
 #include <Debug.h>
 #include <fs_attr.h>
 #include <Language.h>
+#include <Locale.h>
 #include <Menu.h>
 #include <MenuBar.h>
 #include <MenuItem.h>
@@ -59,6 +61,8 @@
 #include "Settings.h"
 
 
+#undef B_TRANSLATE_CONTEXT
+#define B_TRANSLATE_CONTEXT "MediaPlayer-Main"
 #define MIN_WIDTH 250
 
 
@@ -116,34 +120,43 @@
 
 
 static property_info sPropertyInfo[] = {
-       { "Next", { B_EXECUTE_PROPERTY },
-               { B_DIRECT_SPECIFIER, 0 }, "Skip to the next track.", 0
+       { B_TRANSLATE("Next"), { B_EXECUTE_PROPERTY },
+               { B_DIRECT_SPECIFIER, 0 }, 
+               B_TRANSLATE("Skip to the next track."), 0
        },
-       { "Prev", { B_EXECUTE_PROPERTY },
-               { B_DIRECT_SPECIFIER, 0 }, "Skip to the previous track.", 0
+       { B_TRANSLATE("Prev"), { B_EXECUTE_PROPERTY },
+               { B_DIRECT_SPECIFIER, 0 }, 
+               B_TRANSLATE("Skip to the previous track."), 0
        },
-       { "Play", { B_EXECUTE_PROPERTY },
-               { B_DIRECT_SPECIFIER, 0 }, "Start playing.", 0
+       { B_TRANSLATE("Play"), { B_EXECUTE_PROPERTY },
+               { B_DIRECT_SPECIFIER, 0 },
+               B_TRANSLATE("Start playing."), 0
        },
-       { "Stop", { B_EXECUTE_PROPERTY },
-               { B_DIRECT_SPECIFIER, 0 }, "Stop playing.", 0
+       { B_TRANSLATE("Stop"), { B_EXECUTE_PROPERTY },
+               { B_DIRECT_SPECIFIER, 0 }, 
+               B_TRANSLATE("Stop playing."), 0
        },
-       { "Pause", { B_EXECUTE_PROPERTY },
-               { B_DIRECT_SPECIFIER, 0 }, "Pause playback.", 0
+       { B_TRANSLATE("Pause"), { B_EXECUTE_PROPERTY },
+               { B_DIRECT_SPECIFIER, 0 },
+               B_TRANSLATE("Pause playback."), 0
        },
-       { "TogglePlaying", { B_EXECUTE_PROPERTY },
-               { B_DIRECT_SPECIFIER, 0 }, "Toggle pause/play.", 0
+       { B_TRANSLATE("TogglePlaying"), { B_EXECUTE_PROPERTY },
+               { B_DIRECT_SPECIFIER, 0 }, 
+               B_TRANSLATE("Toggle pause/play."), 0
        },
-       { "Mute", { B_EXECUTE_PROPERTY },
-               { B_DIRECT_SPECIFIER, 0 }, "Toggle mute.", 0
+       { B_TRANSLATE("Mute"), { B_EXECUTE_PROPERTY },
+               { B_DIRECT_SPECIFIER, 0 }, 
+               B_TRANSLATE("Toggle mute."), 0
        },
-       { "Volume", { B_GET_PROPERTY, B_SET_PROPERTY, 0 },
-               { B_DIRECT_SPECIFIER, 0 }, "Gets/sets the volume (0.0-2.0).", 0,
+       { B_TRANSLATE("Volume"), { B_GET_PROPERTY, B_SET_PROPERTY, 0 },
+               { B_DIRECT_SPECIFIER, 0 }, 
+               B_TRANSLATE("Gets/sets the volume (0.0-2.0)."), 0,
                { B_FLOAT_TYPE }
        },
-       { "URI", { B_GET_PROPERTY, 0 },
+       { B_TRANSLATE("URI"), { B_GET_PROPERTY, 0 },
                { B_DIRECT_SPECIFIER, 0 },
-               "Gets the URI of the currently playing item.", 0, { 
B_STRING_TYPE }
+               B_TRANSLATE("Gets the URI of the currently playing item."), 0, 
+               { B_STRING_TYPE }
        },
        { 0, { 0 }, { 0 }, 0, 0 }
 };
@@ -151,7 +164,7 @@
 
 static const char* kRatingAttrName = "Media:Rating";
 
-static const char* kDisabledSeekMessage = "Drop files to play";
+static const char* kDisabledSeekMessage = B_TRANSLATE("Drop files to play");
 
 
 //#define printf(a...)
@@ -609,8 +622,9 @@
                }
                case MSG_PLAYLIST_IMPORT_FAILED:
                {
-                       BAlert* alert = new BAlert("Nothing to Play", "None of 
the files "
-                               "you wanted to play appear to be media files.", 
"OK");
+                       BAlert* alert = new BAlert(B_TRANSLATE("Nothing to 
Play"), 
+                               B_TRANSLATE("None of the files you wanted to 
play appear "
+                               "to be media files."), B_TRANSLATE("OK"));
                        alert->Go();
                        fControls->SetDisabledString(kDisabledSeekMessage);
                        break;
@@ -741,8 +755,8 @@
                        BMessage appMessage(M_SHOW_OPEN_PANEL);
                        appMessage.AddMessenger("target", target);
                        appMessage.AddMessage("message", &result);
-                       appMessage.AddString("title", "Open Clips");
-                       appMessage.AddString("label", "Open");
+                       appMessage.AddString("title", B_TRANSLATE("Open 
Clips"));
+                       appMessage.AddString("label", B_TRANSLATE("Open"));
                        be_app->PostMessage(&appMessage);
                        break;
                }
@@ -1068,8 +1082,9 @@
        if (ret != B_OK) {
                fprintf(stderr, "MainWin::OpenPlaylistItem() - Failed to send 
message "
                        "to Controller.\n");
-               (new BAlert("error", NAME" encountered an internal error. "
-                       "The file could not be opened.", "OK"))->Go();
+               (new BAlert(B_TRANSLATE("error"), 
+                       B_TRANSLATE(NAME" encountered an internal error. "
+                       "The file could not be opened."), 
B_TRANSLATE("OK")))->Go();
                _PlaylistItemOpened(item, ret);
        } else {
                BString string;
@@ -1307,21 +1322,21 @@
 
                if (allItemsFailed) {
                        // Display error if all files failed to play.
-                       BString message;
-                       message << "The file '";
-                       message << item->Name();
-                       message << "' could not be opened.\n\n";
+                       BString message(B_TRANSLATE(
+                               "The file'%filename' could not be 
opened.\n\n"));;
+                       message.ReplaceAll("%filename", item->Name());
 
                        if (result == B_MEDIA_NO_HANDLER) {
                                // give a more detailed message for the most 
likely of all
                                // errors
-                               message << "There is no decoder installed to 
handle the "
+                               message << B_TRANSLATE(
+                                       "There is no decoder installed to 
handle the "
                                        "file format, or the decoder has 
trouble with the "
-                                       "specific version of the format.";
+                                       "specific version of the format.");
                        } else {
-                               message << "Error: " << strerror(result);
+                               message << B_TRANSLATE("Error: ") << 
strerror(result);
                        }
-                       (new BAlert("error", message.String(), "OK"))->Go();
+                       (new BAlert("error", message.String(), 
B_TRANSLATE("OK")))->Go();
                        fControls->SetDisabledString(kDisabledSeekMessage);
                } else {
                        // Just go to the next file and don't bother user (yet)
@@ -1404,21 +1419,23 @@
 MainWin::_CreateMenu()
 {
        fFileMenu = new BMenu(NAME);
-       fPlaylistMenu = new BMenu("Playlist"B_UTF8_ELLIPSIS);
-       fAudioMenu = new BMenu("Audio");
-       fVideoMenu = new BMenu("Video");
-       fVideoAspectMenu = new BMenu("Aspect ratio");
-       fAudioTrackMenu = new BMenu("Track");
-       fVideoTrackMenu = new BMenu("Track");
-       fSubTitleTrackMenu = new BMenu("Subtitles");
-       fAttributesMenu = new BMenu("Attributes");
+       fPlaylistMenu = new BMenu(B_TRANSLATE("Playlist"B_UTF8_ELLIPSIS));
+       fAudioMenu = new BMenu(B_TRANSLATE("Audio"));
+       fVideoMenu = new BMenu(B_TRANSLATE("Video"));
+       fVideoAspectMenu = new BMenu(B_TRANSLATE("Aspect ratio"));
+       fAudioTrackMenu = new BMenu(B_TRANSLATE_WITH_CONTEXT("Track", 
+               "Audio Track Menu"));
+       fVideoTrackMenu = new BMenu(B_TRANSLATE_WITH_CONTEXT("Track", 
+               "Video Track Menu"));
+       fSubTitleTrackMenu = new BMenu(B_TRANSLATE("Subtitles"));
+       fAttributesMenu = new BMenu(B_TRANSLATE("Attributes"));
 
        fMenuBar->AddItem(fFileMenu);
        fMenuBar->AddItem(fAudioMenu);
        fMenuBar->AddItem(fVideoMenu);
        fMenuBar->AddItem(fAttributesMenu);
 
-       BMenuItem* item = new BMenuItem("New player"B_UTF8_ELLIPSIS,
+       BMenuItem* item = new BMenuItem(B_TRANSLATE("New 
player"B_UTF8_ELLIPSIS),
                new BMessage(M_NEW_PLAYER), 'N');
        fFileMenu->AddItem(item);
        item->SetTarget(be_app);
@@ -1426,14 +1443,14 @@
        // Add recent files to "Open File" entry as sub-menu.
        BRecentFilesList recentFiles(10, false, NULL, kAppSig);
        item = new BMenuItem(recentFiles.NewFileListMenu(
-               "Open file"B_UTF8_ELLIPSIS, NULL, NULL, this, 10, true, NULL, 
kAppSig),
-               new BMessage(M_FILE_OPEN));
+               B_TRANSLATE("Open file"B_UTF8_ELLIPSIS), NULL, NULL, this, 10, 
true,
+               NULL, kAppSig), new BMessage(M_FILE_OPEN));
        item->SetShortcut('O', 0);
        fFileMenu->AddItem(item);
 
        fFileMenu->AddSeparatorItem();
 
-       fFileMenu->AddItem(new BMenuItem("File info"B_UTF8_ELLIPSIS,
+       fFileMenu->AddItem(new BMenuItem(B_TRANSLATE("File 
info"B_UTF8_ELLIPSIS),
                new BMessage(M_FILE_INFO), 'I'));
        fFileMenu->AddItem(fPlaylistMenu);
        fPlaylistMenu->Superitem()->SetShortcut('P', B_COMMAND_KEY);
@@ -1441,28 +1458,30 @@
 
        fFileMenu->AddSeparatorItem();
 
-       fNoInterfaceMenuItem = new BMenuItem("Hide interface",
+       fNoInterfaceMenuItem = new BMenuItem(B_TRANSLATE("Hide interface"),
                new BMessage(M_TOGGLE_NO_INTERFACE), 'H');
        fFileMenu->AddItem(fNoInterfaceMenuItem);
-       fFileMenu->AddItem(new BMenuItem("Always on top",
+       fFileMenu->AddItem(new BMenuItem(B_TRANSLATE("Always on top"),
                new BMessage(M_TOGGLE_ALWAYS_ON_TOP), 'A'));
 
-       item = new BMenuItem("Settings"B_UTF8_ELLIPSIS,
+       item = new BMenuItem(B_TRANSLATE("Settings"B_UTF8_ELLIPSIS),
                new BMessage(M_SETTINGS), 'S');
        fFileMenu->AddItem(item);
        item->SetTarget(be_app);
 
        fFileMenu->AddSeparatorItem();
 
-       item = new BMenuItem("About " NAME B_UTF8_ELLIPSIS,
+       item = new BMenuItem(B_TRANSLATE("About " NAME B_UTF8_ELLIPSIS),
                new BMessage(B_ABOUT_REQUESTED));
        fFileMenu->AddItem(item);
        item->SetTarget(be_app);
 
        fFileMenu->AddSeparatorItem();
 
-       fFileMenu->AddItem(new BMenuItem("Close", new BMessage(M_FILE_CLOSE), 
'W'));
-       fFileMenu->AddItem(new BMenuItem("Quit", new BMessage(M_FILE_QUIT), 
'Q'));
+       fFileMenu->AddItem(new BMenuItem(B_TRANSLATE("Close"), 
+               new BMessage(M_FILE_CLOSE), 'W'));
+       fFileMenu->AddItem(new BMenuItem(B_TRANSLATE("Quit"), 
+               new BMessage(M_FILE_QUIT), 'Q'));
 
        fPlaylistMenu->SetRadioMode(true);
 
@@ -1473,27 +1492,32 @@
        fVideoMenu->AddSeparatorItem();
        BMessage* resizeMessage = new BMessage(M_VIEW_SIZE);
        resizeMessage->AddInt32("size", 50);
-       fVideoMenu->AddItem(new BMenuItem("50% scale", resizeMessage, '0'));
+       fVideoMenu->AddItem(new BMenuItem(
+               B_TRANSLATE("50% scale"), resizeMessage, '0'));
 
        resizeMessage = new BMessage(M_VIEW_SIZE);
        resizeMessage->AddInt32("size", 100);
-       fVideoMenu->AddItem(new BMenuItem("100% scale", resizeMessage, '1'));
+       fVideoMenu->AddItem(new BMenuItem(
+               B_TRANSLATE("100% scale"), resizeMessage, '1'));
 
        resizeMessage = new BMessage(M_VIEW_SIZE);
        resizeMessage->AddInt32("size", 200);
-       fVideoMenu->AddItem(new BMenuItem("200% scale", resizeMessage, '2'));
+       fVideoMenu->AddItem(new BMenuItem(
+               B_TRANSLATE("200% scale"), resizeMessage, '2'));
 
        resizeMessage = new BMessage(M_VIEW_SIZE);
        resizeMessage->AddInt32("size", 300);
-       fVideoMenu->AddItem(new BMenuItem("300% scale", resizeMessage, '3'));
+       fVideoMenu->AddItem(new BMenuItem(
+               B_TRANSLATE("300% scale"), resizeMessage, '3'));
 
        resizeMessage = new BMessage(M_VIEW_SIZE);
        resizeMessage->AddInt32("size", 400);
-       fVideoMenu->AddItem(new BMenuItem("400% scale", resizeMessage, '4'));
+       fVideoMenu->AddItem(new BMenuItem(
+               B_TRANSLATE("400% scale"), resizeMessage, '4'));
 
        fVideoMenu->AddSeparatorItem();
 
-       fVideoMenu->AddItem(new BMenuItem("Full screen",
+       fVideoMenu->AddItem(new BMenuItem(B_TRANSLATE("Full screen"),
                new BMessage(M_TOGGLE_FULLSCREEN), 'F'));
 
        fVideoMenu->AddSeparatorItem();
@@ -1501,7 +1525,7 @@
        _SetupVideoAspectItems(fVideoAspectMenu);
        fVideoMenu->AddItem(fVideoAspectMenu);
 
-       fRatingMenu = new BMenu("Rating");
+       fRatingMenu = new BMenu(B_TRANSLATE("Rating"));
        fAttributesMenu->AddItem(fRatingMenu);
        for (int32 i = 1; i <= 10; i++) {
                char label[16];
@@ -1532,12 +1556,12 @@
        // "Stream Settings" and "16 : 9" if the stream settings happen to
        // be "16 : 9".
 
-       menu->AddItem(item = new BMenuItem("Stream settings",
+       menu->AddItem(item = new BMenuItem(B_TRANSLATE("Stream settings"),
                new BMessage(M_ASPECT_SAME_AS_SOURCE)));
        item->SetMarked(widthAspect == fWidthAspect
                && heightAspect == fHeightAspect);
 
-       menu->AddItem(item = new BMenuItem("No aspect correction",
+       menu->AddItem(item = new BMenuItem(B_TRANSLATE("No aspect correction"),
                new BMessage(M_ASPECT_NO_DISTORTION)));
        item->SetMarked(width == fWidthAspect && height == fHeightAspect);
 
@@ -1558,10 +1582,10 @@
        menu->AddItem(item = new BMenuItem("1.75 : 1",
                new BMessage(M_ASPECT_7_4)));
        item->SetMarked(fWidthAspect == 7 && fHeightAspect == 4);
-       menu->AddItem(item = new BMenuItem("1.85 : 1 (American)",
+       menu->AddItem(item = new BMenuItem(B_TRANSLATE("1.85 : 1 (American)"),
                new BMessage(M_ASPECT_37_20)));
        item->SetMarked(fWidthAspect == 37 && fHeightAspect == 20);
-       menu->AddItem(item = new BMenuItem("2.35 : 1 (Cinemascope)",
+       menu->AddItem(item = new BMenuItem(B_TRANSLATE("2.35 : 1 
(Cinemascope)"),
                new BMessage(M_ASPECT_47_20)));
        item->SetMarked(fWidthAspect == 47 && fHeightAspect == 20);
 }
@@ -1591,14 +1615,15 @@
                                languageString = languageName.String();
                        snprintf(s, sizeof(s), "%s", languageString);
                } else
-                       snprintf(s, sizeof(s), "Track %d", i + 1);
+                       snprintf(s, sizeof(s), B_TRANSLATE("Track %d"), i + 1);
                BMenuItem* item = new BMenuItem(s,
                        new BMessage(M_SELECT_AUDIO_TRACK + i));
                item->SetMarked(i == current);
                audioTrackMenu->AddItem(item);
        }
        if (count == 0) {
-               audioTrackMenu->AddItem(new BMenuItem("none", new 
BMessage(M_DUMMY)));
+               audioTrackMenu->AddItem(new 
BMenuItem(B_TRANSLATE_WITH_CONTEXT("none",
+                       "Audio track menu"), new BMessage(M_DUMMY)));
                audioTrackMenu->ItemAt(0)->SetMarked(true);
        }
 
@@ -1606,7 +1631,7 @@
        count = fController->VideoTrackCount();
        current = fController->CurrentVideoTrack();
        for (int i = 0; i < count; i++) {
-               snprintf(s, sizeof(s), "Track %d", i + 1);
+               snprintf(s, sizeof(s), B_TRANSLATE("Track %d"), i + 1);
                BMenuItem* item = new BMenuItem(s,
                        new BMessage(M_SELECT_VIDEO_TRACK + i));
                item->SetMarked(i == current);
@@ -1620,7 +1645,8 @@
        count = fController->SubTitleTrackCount();
        if (count > 0) {
                current = fController->CurrentSubTitleTrack();
-               BMenuItem* item = new BMenuItem("Off",
+               BMenuItem* item = new BMenuItem(
+                       B_TRANSLATE_WITH_CONTEXT("Off", "Subtitles menu"),
                        new BMessage(M_SELECT_SUB_TITLE_TRACK - 1));
                subTitleTrackMenu->AddItem(item);
                item->SetMarked(current == -1);
@@ -1632,14 +1658,15 @@
                        if (name != NULL)
                                snprintf(s, sizeof(s), "%s", name);
                        else
-                               snprintf(s, sizeof(s), "Track %d", i + 1);
+                               snprintf(s, sizeof(s), B_TRANSLATE("Track %d"), 
i + 1);
                        item = new BMenuItem(s,
                                new BMessage(M_SELECT_SUB_TITLE_TRACK + i));
                        item->SetMarked(i == current);
                        subTitleTrackMenu->AddItem(item);
                }
        } else {
-               subTitleTrackMenu->AddItem(new BMenuItem("none",
+               subTitleTrackMenu->AddItem(new BMenuItem(
+                       B_TRANSLATE_WITH_CONTEXT("none", "Subtitles menu"),
                        new BMessage(M_DUMMY)));
                subTitleTrackMenu->ItemAt(0)->SetMarked(true);
        }
@@ -1978,18 +2005,18 @@
        printf("Show context menu\n");
        BPopUpMenu* menu = new BPopUpMenu("context menu", false, false);
        BMenuItem* item;
-       menu->AddItem(item = new BMenuItem("Full screen",
+       menu->AddItem(item = new BMenuItem(B_TRANSLATE("Full screen"),
                new BMessage(M_TOGGLE_FULLSCREEN), 'F'));
        item->SetMarked(fIsFullscreen);
        item->SetEnabled(fHasVideo);
 
-       BMenu* aspectSubMenu = new BMenu("Aspect ratio");
+       BMenu* aspectSubMenu = new BMenu(B_TRANSLATE("Aspect ratio"));
        _SetupVideoAspectItems(aspectSubMenu);
        aspectSubMenu->SetTargetForItems(this);
        menu->AddItem(item = new BMenuItem(aspectSubMenu));
        item->SetEnabled(fHasVideo);
 
-       menu->AddItem(item = new BMenuItem("Hide interface",
+       menu->AddItem(item = new BMenuItem(B_TRANSLATE("Hide interface"),
                new BMessage(M_TOGGLE_NO_INTERFACE), 'H'));
        item->SetMarked(fNoInterface);
        item->SetEnabled(fHasVideo);
@@ -1997,9 +2024,9 @@
        menu->AddSeparatorItem();
 
        // Add track selector menus
-       BMenu* audioTrackMenu = new BMenu("Audio track");
-       BMenu* videoTrackMenu = new BMenu("Video track");
-       BMenu* subTitleTrackMenu = new BMenu("Subtitles");
+       BMenu* audioTrackMenu = new BMenu(B_TRANSLATE("Audio track"));
+       BMenu* videoTrackMenu = new BMenu(B_TRANSLATE("Video track"));
+       BMenu* subTitleTrackMenu = new BMenu(B_TRANSLATE("Subtitles"));
        _SetupTrackMenus(audioTrackMenu, videoTrackMenu, subTitleTrackMenu);
 
        audioTrackMenu->SetTargetForItems(this);
@@ -2016,7 +2043,7 @@
        item->SetEnabled(fHasVideo);
 
        menu->AddSeparatorItem();
-       menu->AddItem(new BMenuItem("Quit", new BMessage(M_FILE_QUIT), 'Q'));
+       menu->AddItem(new BMenuItem(B_TRANSLATE("Quit"), new 
BMessage(M_FILE_QUIT), 'Q'));
 
        menu->SetTargetForItems(this);
        BRect rect(screenPoint.x - 5, screenPoint.y - 5, screenPoint.x + 5,

Modified: haiku/trunk/src/apps/mediaplayer/interface/PeakView.cpp
===================================================================
--- haiku/trunk/src/apps/mediaplayer/interface/PeakView.cpp     2010-12-29 
08:30:25 UTC (rev 40020)
+++ haiku/trunk/src/apps/mediaplayer/interface/PeakView.cpp     2010-12-29 
10:38:58 UTC (rev 40021)
@@ -14,7 +14,9 @@
 #include <string.h>
 
 #include <Bitmap.h>
+#include <Catalog.h>
 #include <ControlLook.h>
+#include <Locale.h>
 #include <MenuItem.h>
 #include <Message.h>
 #include <MessageRunner.h>
@@ -22,6 +24,11 @@
 #include <PopUpMenu.h>
 #include <Window.h>
 
+
+#undef B_TRANSLATE_CONTEXT
+#define B_TRANSLATE_CONTEXT "MediaPlayer-PeakView"
+
+
 using std::nothrow;
 
 
@@ -133,7 +140,7 @@
        } else {
                // Display context menu
                BPopUpMenu* menu = new BPopUpMenu("peak context menu");
-               BMenuItem* item = new BMenuItem("Lock Peaks",
+               BMenuItem* item = new BMenuItem(B_TRANSLATE("Lock Peaks"),
                        new BMessage(MSG_LOCK_PEAKS));
                item->SetMarked(fPeakLocked);
                menu->AddItem(item);

Modified: haiku/trunk/src/apps/mediaplayer/playlist/CopyPLItemsCommand.cpp
===================================================================
--- haiku/trunk/src/apps/mediaplayer/playlist/CopyPLItemsCommand.cpp    
2010-12-29 08:30:25 UTC (rev 40020)
+++ haiku/trunk/src/apps/mediaplayer/playlist/CopyPLItemsCommand.cpp    
2010-12-29 10:38:58 UTC (rev 40021)
@@ -8,10 +8,16 @@
 #include <stdio.h>
 
 #include <Autolock.h>
+#include <Catalog.h>
+#include <Locale.h>
 
 #include "Playlist.h"
 
 
+#undef B_TRANSLATE_CONTEXT
+#define B_TRANSLATE_CONTEXT "MediaPlayer-CopyPLItemsCmd"
+
+
 using std::nothrow;
 
 
@@ -111,7 +117,7 @@
 CopyPLItemsCommand::GetName(BString& name)
 {
        if (fCount > 1)
-               name << "Copy Entries";
+               name << B_TRANSLATE("Copy Entries");
        else
-               name << "Copy Entry";
+               name << B_TRANSLATE("Copy Entry");
 }

Modified: haiku/trunk/src/apps/mediaplayer/playlist/ImportPLItemsCommand.cpp
===================================================================
--- haiku/trunk/src/apps/mediaplayer/playlist/ImportPLItemsCommand.cpp  
2010-12-29 08:30:25 UTC (rev 40020)
+++ haiku/trunk/src/apps/mediaplayer/playlist/ImportPLItemsCommand.cpp  
2010-12-29 10:38:58 UTC (rev 40021)
@@ -10,11 +10,17 @@
 #include <stdio.h>
 
 #include <Autolock.h>
+#include <Catalog.h>
+#include <Locale.h>
 
 #include "Playlist.h"
 #include "PlaylistItem.h"
 
 
+#undef B_TRANSLATE_CONTEXT
+#define B_TRANSLATE_CONTEXT "MediaPlayer-ImportPLItemsCmd"
+
+
 using std::nothrow;
 
 
@@ -166,8 +172,8 @@
 ImportPLItemsCommand::GetName(BString& name)
 {
        if (fNewCount > 1)
-               name << "Import Entries";
+               name << B_TRANSLATE("Import Entries");
        else
-               name << "Import Entry";
+               name << B_TRANSLATE("Import Entry");
 }
 

Modified: haiku/trunk/src/apps/mediaplayer/playlist/MovePLItemsCommand.cpp
===================================================================
--- haiku/trunk/src/apps/mediaplayer/playlist/MovePLItemsCommand.cpp    
2010-12-29 08:30:25 UTC (rev 40020)
+++ haiku/trunk/src/apps/mediaplayer/playlist/MovePLItemsCommand.cpp    
2010-12-29 10:38:58 UTC (rev 40021)
@@ -9,10 +9,16 @@
 #include <stdio.h>
 
 #include <Autolock.h>
+#include <Catalog.h>
+#include <Locale.h>
 
 #include "Playlist.h"
 
 
+#undef B_TRANSLATE_CONTEXT
+#define B_TRANSLATE_CONTEXT "MediaPlayer-MovePLItemsCmd"
+
+
 using std::nothrow;
 
 
@@ -172,7 +178,7 @@
 MovePLItemsCommand::GetName(BString& name)
 {
        if (fCount > 1)
-               name << "Move Entries";
+               name << B_TRANSLATE("Move Entries");
        else
-               name << "Move Entry";
+               name << B_TRANSLATE("Move Entry");
 }

Modified: haiku/trunk/src/apps/mediaplayer/playlist/PlaylistItem.cpp
===================================================================
--- haiku/trunk/src/apps/mediaplayer/playlist/PlaylistItem.cpp  2010-12-29 
08:30:25 UTC (rev 40020)
+++ haiku/trunk/src/apps/mediaplayer/playlist/PlaylistItem.cpp  2010-12-29 
10:38:58 UTC (rev 40021)
@@ -7,7 +7,14 @@
 
 #include <stdio.h>
 
+#include <Catalog.h>
+#include <Locale.h>
 
+
+#undef B_TRANSLATE_CONTEXT
+#define B_TRANSLATE_CONTEXT "MediaPlayer-PlaylistItem"
+
+
 PlaylistItem::Listener::Listener()
 {
 }
@@ -55,7 +62,7 @@
 {
        BString name;
        if (GetAttribute(ATTR_STRING_NAME, name) != B_OK)
-               name = "<unnamed>";
+               name = B_TRANSLATE_WITH_CONTEXT("<unnamed>", 
"PlaylistItem-name");
        return name;
 }
 
@@ -65,7 +72,7 @@
 {
        BString author;
        if (GetAttribute(ATTR_STRING_AUTHOR, author) != B_OK)
-               author = "<unknown>";
+               author = B_TRANSLATE_WITH_CONTEXT("<unknown>", 
"PlaylistItem-author");
        return author;
 }
 
@@ -75,7 +82,7 @@
 {
        BString album;
        if (GetAttribute(ATTR_STRING_ALBUM, album) != B_OK)
-               album = "<unknown>";
+               album = B_TRANSLATE_WITH_CONTEXT("<unknown>", 
"PlaylistItem-album");
        return album;
 }
 
@@ -85,7 +92,7 @@
 {
        BString title;
        if (GetAttribute(ATTR_STRING_TITLE, title) != B_OK)
-               title = "<untitled>";
+               title = B_TRANSLATE_WITH_CONTEXT("<untitled>", 
"PlaylistItem-title");
        return title;
 }
 

Modified: haiku/trunk/src/apps/mediaplayer/playlist/PlaylistWindow.cpp
===================================================================
--- haiku/trunk/src/apps/mediaplayer/playlist/PlaylistWindow.cpp        
2010-12-29 08:30:25 UTC (rev 40020)
+++ haiku/trunk/src/apps/mediaplayer/playlist/PlaylistWindow.cpp        
2010-12-29 10:38:58 UTC (rev 40021)
@@ -15,20 +15,22 @@
 #include <Alert.h>
 #include <Application.h>
 #include <Autolock.h>
+#include <Box.h>
+#include <Button.h>
+#include <Catalog.h>
 #include <Entry.h>
 #include <File.h>
-#include <Roster.h>
-#include <Path.h>
+#include <FilePanel.h>
+#include <Locale.h>
 #include <Menu.h>
 #include <MenuBar.h>
 #include <MenuItem.h>
 #include <NodeInfo.h>
+#include <Path.h>
+#include <Roster.h>
 #include <ScrollBar.h>
 #include <ScrollView.h>
 #include <String.h>
-#include <Box.h>
-#include <Button.h>
-#include <FilePanel.h>
 
 #include "CommandStack.h"
 #include "MainApp.h"
@@ -36,6 +38,10 @@
 #include "RWLocker.h"
 
 
+#undef B_TRANSLATE_CONTEXT
+#define B_TRANSLATE_CONTEXT "MediaPlayer-PlaylistWindow"
+
+
 // TODO:
 // Maintaining a playlist file on disk is a bit tricky. The playlist ref should
 // be discarded when the user
@@ -64,8 +70,8 @@
 static void
 display_save_alert(const char* message)
 {
-       BAlert* alert = new BAlert("Save error", message, "OK", NULL, NULL,
-               B_WIDTH_AS_USUAL, B_STOP_ALERT);
+       BAlert* alert = new BAlert(B_TRANSLATE("Save error"), message, 
+               B_TRANSLATE("OK"), NULL, NULL, B_WIDTH_AS_USUAL, B_STOP_ALERT);
        alert->Go(NULL);
 }
 
@@ -73,7 +79,7 @@
 static void
 display_save_alert(status_t error)
 {
-       BString errorMessage("Saving the playlist failed.\n\nError: ");
+       BString errorMessage(B_TRANSLATE("Saving the playlist failed.\n\nError: 
"));
        errorMessage << strerror(error);
        display_save_alert(errorMessage.String());
 }
@@ -85,8 +91,8 @@
 PlaylistWindow::PlaylistWindow(BRect frame, Playlist* playlist,
                Controller* controller)
        :
-       BWindow(frame, "Playlist", B_DOCUMENT_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL,
-               B_ASYNCHRONOUS_CONTROLS),
+       BWindow(frame, B_TRANSLATE("Playlist"), B_DOCUMENT_WINDOW_LOOK,
+               B_NORMAL_WINDOW_FEEL, B_ASYNCHRONOUS_CONTROLS),
        fPlaylist(playlist),
        fLocker(new RWLocker("command stack lock")),
        fCommandStack(new CommandStack(fLocker)),
@@ -188,8 +194,8 @@
                        BMessage appMessage(M_SHOW_OPEN_PANEL);
                        appMessage.AddMessenger("target", target);
                        appMessage.AddMessage("message", &result);
-                       appMessage.AddString("title", "Open Playlist");
-                       appMessage.AddString("label", "Open");
+                       appMessage.AddString("title", B_TRANSLATE("Open 
Playlist"));
+                       appMessage.AddString("label", B_TRANSLATE("Open"));
                        be_app->PostMessage(&appMessage);
                        break;
                }
@@ -207,8 +213,8 @@
                        BMessage appMessage(M_SHOW_SAVE_PANEL);
                        appMessage.AddMessenger("target", target);
                        appMessage.AddMessage("message", &result);
-                       appMessage.AddString("title", "Save Playlist");
-                       appMessage.AddString("label", "Save");
+                       appMessage.AddString("title", B_TRANSLATE("Save 
Playlist"));
+                       appMessage.AddString("label", B_TRANSLATE("Save"));
                        be_app->PostMessage(&appMessage);
                        break;
                }
@@ -250,34 +256,35 @@
 {
        frame.bottom = 15;
        BMenuBar* menuBar = new BMenuBar(frame, "main menu");
-       BMenu* fileMenu = new BMenu("Playlist");
+       BMenu* fileMenu = new BMenu(B_TRANSLATE("Playlist"));
        menuBar->AddItem(fileMenu);
-       fileMenu->AddItem(new BMenuItem("Open"B_UTF8_ELLIPSIS,
+       fileMenu->AddItem(new BMenuItem(B_TRANSLATE("Open"B_UTF8_ELLIPSIS),
                new BMessage(M_PLAYLIST_OPEN), 'O'));
-       fileMenu->AddItem(new BMenuItem("Save as"B_UTF8_ELLIPSIS,
+       fileMenu->AddItem(new BMenuItem(B_TRANSLATE("Save as"B_UTF8_ELLIPSIS),
                new BMessage(M_PLAYLIST_SAVE_AS), 'S', B_SHIFT_KEY));
 //     fileMenu->AddItem(new BMenuItem("Save",
 //             new BMessage(M_PLAYLIST_SAVE), 'S'));
 
        fileMenu->AddSeparatorItem();
 
-       fileMenu->AddItem(new BMenuItem("Close",
+       fileMenu->AddItem(new BMenuItem(B_TRANSLATE("Close"),
                new BMessage(B_QUIT_REQUESTED), 'W'));
 
-       BMenu* editMenu = new BMenu("Edit");
-       fUndoMI = new BMenuItem("Undo", new BMessage(B_UNDO), 'Z');
+       BMenu* editMenu = new BMenu(B_TRANSLATE("Edit"));
+       fUndoMI = new BMenuItem(B_TRANSLATE("Undo"), new BMessage(B_UNDO), 'Z');
        editMenu->AddItem(fUndoMI);
-       fRedoMI = new BMenuItem("Redo", new BMessage(B_REDO), 'Z', B_SHIFT_KEY);
+       fRedoMI = new BMenuItem(B_TRANSLATE("Redo"), new BMessage(B_REDO), 'Z', 
+               B_SHIFT_KEY);
        editMenu->AddItem(fRedoMI);
        editMenu->AddSeparatorItem();
-       editMenu->AddItem(new BMenuItem("Randomize",
+       editMenu->AddItem(new BMenuItem(B_TRANSLATE("Randomize"),
                new BMessage(M_PLAYLIST_RANDOMIZE), 'R'));
        editMenu->AddSeparatorItem();
-       editMenu->AddItem(new BMenuItem("Remove (Del)",
+       editMenu->AddItem(new BMenuItem(B_TRANSLATE("Remove (Del)"),
                new BMessage(M_PLAYLIST_REMOVE)/*, B_DELETE, 0*/));
-       editMenu->AddItem(new BMenuItem("Remove and put into Trash",
+       editMenu->AddItem(new BMenuItem(B_TRANSLATE("Remove and put into 
Trash"),
                new BMessage(M_PLAYLIST_REMOVE_AND_PUT_INTO_TRASH), 'T'));
-       editMenu->AddItem(new BMenuItem("Remove all",
+       editMenu->AddItem(new BMenuItem(B_TRANSLATE("Remove all"),
                new BMessage(M_PLAYLIST_EMPTY), 'N'));
 
        menuBar->AddItem(editMenu);
@@ -297,20 +304,20 @@
 {
        if (object == fCommandStack) {
                // relable Undo item and update enabled status
-               BString label("Undo");
+               BString label(B_TRANSLATE("Undo"));
                fUndoMI->SetEnabled(fCommandStack->GetUndoName(label));
                if (fUndoMI->IsEnabled())
                        fUndoMI->SetLabel(label.String());
                else
-                       fUndoMI->SetLabel("<nothing to undo>");
+                       fUndoMI->SetLabel(B_TRANSLATE("<nothing to undo>"));
 
                // relable Redo item and update enabled status
-               label.SetTo("Redo");
+               label.SetTo(B_TRANSLATE("Redo"));
                fRedoMI->SetEnabled(fCommandStack->GetRedoName(label));
                if (fRedoMI->IsEnabled())
                        fRedoMI->SetLabel(label.String());
                else
-                       fRedoMI->SetLabel("<nothing to redo>");
+                       fRedoMI->SetLabel(B_TRANSLATE("<nothing to redo>"));
        }
 }
 
@@ -322,8 +329,8 @@
        const char* name;
        if (message->FindRef("directory", &ref) != B_OK
                || message->FindString("name", &name) != B_OK) {
-               display_save_alert("Internal error (malformed message). "
-                       "Saving the playlist failed.");
+               display_save_alert(B_TRANSLATE("Internal error (malformed 
message). "
+                       "Saving the playlist failed."));
                return;
        }
 
@@ -335,16 +342,16 @@
        if (origPath.InitCheck() != B_OK || tempPath.InitCheck() != B_OK
                || origPath.Append(name) != B_OK
                || tempPath.Append(tempName.String()) != B_OK) {
-               display_save_alert("Internal error (out of memory). "
-                       "Saving the playlist failed.");
+               display_save_alert(B_TRANSLATE("Internal error (out of memory). 
"
+                       "Saving the playlist failed."));
                return;
        }
 
        BEntry origEntry(origPath.Path());
        BEntry tempEntry(tempPath.Path());
        if (origEntry.InitCheck() != B_OK || tempEntry.InitCheck() != B_OK) {
-               display_save_alert("Internal error (out of memory). "
-                       "Saving the playlist failed.");
+               display_save_alert(B_TRANSLATE("Internal error (out of memory). 
"
+                       "Saving the playlist failed."));
                return;
        }
 
@@ -392,7 +399,8 @@
 
        BFile file(&tempEntry, B_CREATE_FILE | B_ERASE_FILE | B_WRITE_ONLY);
        if (file.InitCheck() != B_OK) {
-               BString errorMessage("Saving the playlist failed:\n\nError: ");
+               BString errorMessage(B_TRANSLATE(
+                       "Saving the playlist failed:\n\nError: "));
                errorMessage << strerror(file.InitCheck());
                display_save_alert(errorMessage.String());
                return;
@@ -400,8 +408,8 @@
 
        AutoLocker<Playlist> lock(fPlaylist);
        if (!lock.IsLocked()) {
-               display_save_alert("Internal error (locking failed). "
-                       "Saving the playlist failed.");
+               display_save_alert(B_TRANSLATE("Internal error (locking 
failed). "
+                       "Saving the playlist failed."));
                return;
        }
 

Modified: haiku/trunk/src/apps/mediaplayer/playlist/RandomizePLItemsCommand.cpp
===================================================================
--- haiku/trunk/src/apps/mediaplayer/playlist/RandomizePLItemsCommand.cpp       
2010-12-29 08:30:25 UTC (rev 40020)
+++ haiku/trunk/src/apps/mediaplayer/playlist/RandomizePLItemsCommand.cpp       
2010-12-29 10:38:58 UTC (rev 40021)
@@ -10,10 +10,16 @@
 #include <stdlib.h>
 
 #include <Autolock.h>
+#include <Catalog.h>
+#include <Locale.h>
 
 #include "Playlist.h"
 
 
+#undef B_TRANSLATE_CONTEXT
+#define B_TRANSLATE_CONTEXT "MediaPlayer-RandomizePLItemsCmd"
+
+
 using std::nothrow;
 
 
@@ -93,7 +99,7 @@
 void
 RandomizePLItemsCommand::GetName(BString& name)
 {
-       name << "Randomize Entries";
+       name << B_TRANSLATE("Randomize Entries");
 }
 
 

Modified: haiku/trunk/src/apps/mediaplayer/playlist/RemovePLItemsCommand.cpp
===================================================================
--- haiku/trunk/src/apps/mediaplayer/playlist/RemovePLItemsCommand.cpp  
2010-12-29 08:30:25 UTC (rev 40020)
+++ haiku/trunk/src/apps/mediaplayer/playlist/RemovePLItemsCommand.cpp  
2010-12-29 10:38:58 UTC (rev 40021)
@@ -10,10 +10,16 @@
 
 #include <Alert.h>
 #include <Autolock.h>
+#include <Catalog.h>
+#include <Locale.h>
 
 #include "Playlist.h"
 
 
+#undef B_TRANSLATE_CONTEXT
+#define B_TRANSLATE_CONTEXT "MediaPlayer-RemovePLItemsCmd"
+
+
 using std::nothrow;
 
 
@@ -106,13 +112,14 @@
                        fMoveErrorShown = true;
                        BString message;
                        if (errorOnAllFiles)
-                               message << "All ";
+                               message << 

[... truncated: 180 lines follow ...]

Other related posts:

  • » [haiku-commits] r40021 - in haiku/trunk/src/apps/mediaplayer: . interface playlist settings - pulkomandy