Patch by Dziadek : localize MediaConverter.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40023 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Adrien Destugues
2010-12-29 10:40:46 +00:00
parent d462be1157
commit ae0f70fc69
4 changed files with 136 additions and 171 deletions
+55 -28
View File
@@ -10,7 +10,9 @@
#include <string.h> #include <string.h>
#include <Alert.h> #include <Alert.h>
#include <Catalog.h>
#include <fs_attr.h> #include <fs_attr.h>
#include <Locale.h>
#include <MediaFile.h> #include <MediaFile.h>
#include <MediaTrack.h> #include <MediaTrack.h>
#include <Mime.h> #include <Mime.h>
@@ -21,7 +23,10 @@
#include "MediaConverterWindow.h" #include "MediaConverterWindow.h"
#include "MediaEncoderWindow.h" #include "MediaEncoderWindow.h"
#include "MessageConstants.h" #include "MessageConstants.h"
#include "Strings.h"
#undef B_TRANSLATE_CONTEXT
#define B_TRANSLATE_CONTEXT "MediaConverter"
const char APP_SIGNATURE[] = "application/x-vnd.Haiku-MediaConverter"; const char APP_SIGNATURE[] = "application/x-vnd.Haiku-MediaConverter";
@@ -125,11 +130,25 @@ MediaConverterApp::RefsReceived(BMessage* msg)
if (errors) { if (errors) {
BString alertText; BString alertText;
alertText << errors << " " << ((errors > 1) ? FILES : FILE) if (errors > 1) {
<< NOTRECOGNIZE << "\n"; alertText = B_TRANSLATE(
alertText << errorFiles; "%amountOfFiles files were not recognized"
BAlert* alert = new BAlert(ERROR_LOAD_STRING, alertText.String(), " as supported media files:");
CONTINUE_STRING , NULL, NULL, B_WIDTH_AS_USUAL, B_STOP_ALERT); BString amount;
amount << errors;
alertText.ReplaceAll("%amountOfFiles", amount);
}
else
{
alertText = B_TRANSLATE(
"1 file were not recognized as supported media file:");
}
alertText << "\n" << errorFiles;
BAlert* alert = new BAlert((errors > 1) ?
B_TRANSLATE("Error loading files") :
B_TRANSLATE("Error loading file"),
alertText.String(), B_TRANSLATE("Continue") , NULL, NULL,
B_WIDTH_AS_USUAL, B_STOP_ALERT);
alert->Go(); alert->Go();
} }
} }
@@ -268,14 +287,14 @@ MediaConverterApp::_RunConvert()
outEntry.GetRef(&outRef); outEntry.GetRef(&outRef);
outFile = new BMediaFile(&outRef, fileFormat); outFile = new BMediaFile(&outRef, fileFormat);
name.Prepend(" '"); BString tmp(
name.Prepend(OUTPUT_FILE_STRING1); B_TRANSLATE("Output file '%filename' created"));
name.Append("' "); tmp.ReplaceAll("%filename", name);
name.Append(OUTPUT_FILE_STRING2); name = tmp;
} else { } else {
name.Prepend(" '"); BString tmp(B_TRANSLATE("Error creating '%filename'"));
name.Prepend(OUTPUT_FILE_STRING3); tmp.ReplaceAll("%filename", name);
name.Append("'"); name = tmp;
} }
if (fWin->Lock()) { if (fWin->Lock()) {
@@ -295,8 +314,9 @@ MediaConverterApp::_RunConvert()
fWin->RemoveSourceFile(srcIndex); fWin->RemoveSourceFile(srcIndex);
} else { } else {
srcIndex++; srcIndex++;
BString error(CONVERT_ERROR_STRING); BString error(
error << " '" << inRef.name << "'"; B_TRANSLATE("Error converting '%filename'"));
error.ReplaceAll("%filename", inRef.name);
fWin->SetStatusMessage(error.String()); fWin->SetStatusMessage(error.String());
} }
fWin->Unlock(); fWin->Unlock();
@@ -371,7 +391,8 @@ MediaConverterApp::_ConvertFile(BMediaFile* inFile, BMediaFile* outFile,
if (outAudTrack != NULL) { if (outAudTrack != NULL) {
if (outAudTrack->SetQuality(audioQuality / 100.0f) != B_OK if (outAudTrack->SetQuality(audioQuality / 100.0f) != B_OK
&& fWin->Lock()) { && fWin->Lock()) {
fWin->SetAudioQualityLabel(AUDIO_SUPPORT_STRING); fWin->SetAudioQualityLabel(
B_TRANSLATE("Audio quality not supported"));
fWin->Unlock(); fWin->Unlock();
} }
} }
@@ -435,10 +456,12 @@ MediaConverterApp::_ConvertFile(BMediaFile* inFile, BMediaFile* outFile,
delete encoderView; delete encoderView;
encoderView = NULL; encoderView = NULL;
videoQualitySupport = VIDEO_PARAMFORM_STRING; videoQualitySupport =
B_TRANSLATE("Video using parameters form settings");
} else { } else {
if (outVidTrack->SetQuality(videoQuality / 100.0f) >= B_OK) if (outVidTrack->SetQuality(videoQuality / 100.0f) >= B_OK)
videoQualitySupport = VIDEO_SUPPORT_STRING; videoQualitySupport =
B_TRANSLATE("Video quality not supported");
} }
if (videoQualitySupport && fWin->Lock()) { if (videoQualitySupport && fWin->Lock()) {
fWin->SetVideoQualityLabel(videoQualitySupport); fWin->SetVideoQualityLabel(videoQualitySupport);
@@ -506,7 +529,7 @@ MediaConverterApp::_ConvertFile(BMediaFile* inFile, BMediaFile* outFile,
&mh)) != B_OK) { &mh)) != B_OK) {
fprintf(stderr, "Error reading video frame %Ld: %s\n", i, fprintf(stderr, "Error reading video frame %Ld: %s\n", i,
strerror(ret)); strerror(ret));
status.SetTo(ERROR_READ_VIDEO_STRING); status.SetTo(B_TRANSLATE("Error read video frame "));
status << i; status << i;
SetStatusMessage(status.String()); SetStatusMessage(status.String());
@@ -517,7 +540,7 @@ MediaConverterApp::_ConvertFile(BMediaFile* inFile, BMediaFile* outFile,
mh.u.encoded_video.field_flags)) != B_OK) { mh.u.encoded_video.field_flags)) != B_OK) {
fprintf(stderr, "Error writing video frame %Ld: %s\n", i, fprintf(stderr, "Error writing video frame %Ld: %s\n", i,
strerror(ret)); strerror(ret));
status.SetTo(ERROR_WRITE_VIDEO_STRING); status.SetTo(B_TRANSLATE("Error writing video frame "));
status << i; status << i;
SetStatusMessage(status.String()); SetStatusMessage(status.String());
break; break;
@@ -526,9 +549,11 @@ MediaConverterApp::_ConvertFile(BMediaFile* inFile, BMediaFile* outFile,
currPercent = (int16)floor(completePercent); currPercent = (int16)floor(completePercent);
if (currPercent > lastPercent) { if (currPercent > lastPercent) {
lastPercent = currPercent; lastPercent = currPercent;
status.SetTo(WRITE_VIDEO_STRING); status.SetTo(
status.Append(" "); B_TRANSLATE("Writing video track: %percent complete"));
status << currPercent << "% " << COMPLETE_STRING; BString percent;
percent << currPercent << "%";
status.ReplaceAll("%percent", percent);
SetStatusMessage(status.String()); SetStatusMessage(status.String());
} }
@@ -561,7 +586,7 @@ MediaConverterApp::_ConvertFile(BMediaFile* inFile, BMediaFile* outFile,
if ((ret = inAudTrack->ReadFrames(audioBuffer, &framesRead, if ((ret = inAudTrack->ReadFrames(audioBuffer, &framesRead,
&mh)) != B_OK) { &mh)) != B_OK) {
fprintf(stderr, "Error reading audio frames: %s\n", strerror(ret)); fprintf(stderr, "Error reading audio frames: %s\n", strerror(ret));
status.SetTo(ERROR_READ_AUDIO_STRING); status.SetTo(B_TRANSLATE("Error read audio frame "));
status << i; status << i;
SetStatusMessage(status.String()); SetStatusMessage(status.String());
break; break;
@@ -571,7 +596,7 @@ MediaConverterApp::_ConvertFile(BMediaFile* inFile, BMediaFile* outFile,
framesRead)) != B_OK) { framesRead)) != B_OK) {
fprintf(stderr, "Error writing audio frames: %s\n", fprintf(stderr, "Error writing audio frames: %s\n",
strerror(ret)); strerror(ret));
status.SetTo(ERROR_WRITE_AUDIO_STRING); status.SetTo(B_TRANSLATE("Error writing audio frame "));
status << i; status << i;
SetStatusMessage(status.String()); SetStatusMessage(status.String());
break; break;
@@ -580,9 +605,11 @@ MediaConverterApp::_ConvertFile(BMediaFile* inFile, BMediaFile* outFile,
currPercent = (int16)floor(completePercent); currPercent = (int16)floor(completePercent);
if (currPercent > lastPercent) { if (currPercent > lastPercent) {
lastPercent = currPercent; lastPercent = currPercent;
status.SetTo(WRITE_AUDIO_STRING); status.SetTo(
status.Append(" "); B_TRANSLATE("Writing audio track: %percent complete"));
status << currPercent << "% " << COMPLETE_STRING; BString percent;
percent << currPercent << "%";
status.ReplaceAll("%percent", percent);
SetStatusMessage(status.String()); SetStatusMessage(status.String());
} }
} }
@@ -13,9 +13,11 @@
#include <Application.h> #include <Application.h>
#include <Box.h> #include <Box.h>
#include <Button.h> #include <Button.h>
#include <Catalog.h>
#include <ControlLook.h> #include <ControlLook.h>
#include <FilePanel.h> #include <FilePanel.h>
#include <LayoutBuilder.h> #include <LayoutBuilder.h>
#include <Locale.h>
#include <Menu.h> #include <Menu.h>
#include <MenuBar.h> #include <MenuBar.h>
#include <MenuField.h> #include <MenuField.h>
@@ -32,7 +34,11 @@
#include "MediaFileInfoView.h" #include "MediaFileInfoView.h"
#include "MediaFileListView.h" #include "MediaFileListView.h"
#include "MessageConstants.h" #include "MessageConstants.h"
#include "Strings.h"
#undef B_TRANSLATE_CONTEXT
#define B_TRANSLATE_CONTEXT "MediaConverter"
#define VERSION "1.3.0"
// #pragma mark - DirectoryFilter // #pragma mark - DirectoryFilter
@@ -148,12 +154,15 @@ MediaConverterWindow::MediaConverterWindow(BRect frame)
B_ALIGN_USE_FULL_HEIGHT)); B_ALIGN_USE_FULL_HEIGHT));
fOutputBox->SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED, B_SIZE_UNLIMITED)); fOutputBox->SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED, B_SIZE_UNLIMITED));
fFormatMenu = new BMenuField(NULL, FORMAT_LABEL, new BPopUpMenu("")); fFormatMenu = new BMenuField(NULL, B_TRANSLATE("File format:"),
fAudioMenu = new BMenuField(NULL, AUDIO_LABEL, new BPopUpMenu("")); new BPopUpMenu(""));
fVideoMenu = new BMenuField(NULL, VIDEO_LABEL, new BPopUpMenu("")); fAudioMenu = new BMenuField(NULL, B_TRANSLATE("Audio encoding:"),
new BPopUpMenu(""));
fVideoMenu = new BMenuField(NULL, B_TRANSLATE("Video encoding:"),
new BPopUpMenu(""));
// output folder // output folder
fDestButton = new BButton(OUTPUT_FOLDER_LABEL, fDestButton = new BButton(B_TRANSLATE("Output folder"),
new BMessage(OUTPUT_FOLDER_MESSAGE)); new BMessage(OUTPUT_FOLDER_MESSAGE));
BAlignment labelAlignment(be_control_look->DefaultLabelAlignment()); BAlignment labelAlignment(be_control_look->DefaultLabelAlignment());
fOutputFolder = new BStringView(NULL, defaultDirectory); fOutputFolder = new BStringView(NULL, defaultDirectory);
@@ -191,11 +200,11 @@ MediaConverterWindow::MediaConverterWindow(BRect frame)
.Add(fAudioQualitySlider, 0, 7, 2, 1); .Add(fAudioQualitySlider, 0, 7, 2, 1);
// buttons // buttons
fPreviewButton = new BButton(PREVIEW_BUTTON_LABEL, fPreviewButton = new BButton(B_TRANSLATE("Preview"),
new BMessage(PREVIEW_MESSAGE)); new BMessage(PREVIEW_MESSAGE));
fPreviewButton->SetEnabled(false); fPreviewButton->SetEnabled(false);
fConvertButton = new BButton(CONVERT_LABEL, fConvertButton = new BButton(B_TRANSLATE("Convert"),
new BMessage(CONVERT_BUTTON_MESSAGE)); new BMessage(CONVERT_BUTTON_MESSAGE));
// Status views // Status views
@@ -279,27 +288,27 @@ MediaConverterWindow::MessageReceived(BMessage* msg)
case CONVERT_BUTTON_MESSAGE: case CONVERT_BUTTON_MESSAGE:
if (!fConverting) { if (!fConverting) {
fConvertButton->SetLabel(CANCEL_LABEL); fConvertButton->SetLabel(B_TRANSLATE("Cancel"));
fConverting = true; fConverting = true;
SetStatusMessage(CONVERT_LABEL); SetStatusMessage(B_TRANSLATE("Convert"));
SetEnabled(false, true); SetEnabled(false, true);
BMessenger(be_app).SendMessage(START_CONVERSION_MESSAGE); BMessenger(be_app).SendMessage(START_CONVERSION_MESSAGE);
} else if (!fCancelling) { } else if (!fCancelling) {
fCancelling = true; fCancelling = true;
SetStatusMessage(CANCELLING_LABEL B_UTF8_ELLIPSIS); SetStatusMessage(B_TRANSLATE("Cancelling" B_UTF8_ELLIPSIS));
BMessenger(be_app).SendMessage(CANCEL_CONVERSION_MESSAGE); BMessenger(be_app).SendMessage(CANCEL_CONVERSION_MESSAGE);
} }
break; break;
case CONVERSION_DONE_MESSAGE: case CONVERSION_DONE_MESSAGE:
{ {
SetStatusMessage(fCancelling ? CONV_CANCEL_LABEL SetStatusMessage(fCancelling ? B_TRANSLATE("Conversion cancelled")
: CONV_COMPLETE_LABEL); : B_TRANSLATE("Conversion completed"));
fConverting = false; fConverting = false;
fCancelling = false; fCancelling = false;
bool enable = CountSourceFiles() > 0; bool enable = CountSourceFiles() > 0;
SetEnabled(enable, enable); SetEnabled(enable, enable);
fConvertButton->SetLabel(CONVERT_LABEL); fConvertButton->SetLabel(B_TRANSLATE("Convert"));
break; break;
} }
@@ -311,17 +320,20 @@ MediaConverterWindow::MessageReceived(BMessage* msg)
BMessage message(FOLDER_SELECT_MESSAGE); BMessage message(FOLDER_SELECT_MESSAGE);
fSaveFilePanel = new BFilePanel(B_OPEN_PANEL, NULL, NULL, fSaveFilePanel = new BFilePanel(B_OPEN_PANEL, NULL, NULL,
B_DIRECTORY_NODE, true, &message, NULL, false, true); B_DIRECTORY_NODE, true, &message, NULL, false, true);
fSaveFilePanel->SetButtonLabel(B_DEFAULT_BUTTON, SELECT_LABEL); fSaveFilePanel->SetButtonLabel(B_DEFAULT_BUTTON,
B_TRANSLATE("Select"));
fSaveFilePanel->SetTarget(this); fSaveFilePanel->SetTarget(this);
fSaveFilePanel->Window()->Lock(); fSaveFilePanel->Window()->Lock();
fSaveFilePanel->Window()->SetTitle(SAVE_DIR_LABEL); fSaveFilePanel->Window()->SetTitle(
B_TRANSLATE("MediaConverter+:SaveDirectory"));
BRect buttonRect BRect buttonRect
= fSaveFilePanel->Window()->ChildAt(0)->FindView( = fSaveFilePanel->Window()->ChildAt(0)->FindView(
"cancel button")->Frame(); "cancel button")->Frame();
buttonRect.right = buttonRect.left - 20; buttonRect.right = buttonRect.left - 20;
buttonRect.left = buttonRect.right - 130; buttonRect.left = buttonRect.right - 130;
selectThisDir = new BButton(buttonRect, NULL, SELECT_DIR_LABEL, selectThisDir = new BButton(buttonRect, NULL,
B_TRANSLATE("Select this folder"),
new BMessage(SELECT_THIS_DIR_MESSAGE), new BMessage(SELECT_THIS_DIR_MESSAGE),
B_FOLLOW_BOTTOM | B_FOLLOW_RIGHT); B_FOLLOW_BOTTOM | B_FOLLOW_RIGHT);
selectThisDir->SetTarget(this); selectThisDir->SetTarget(this);
@@ -372,14 +384,15 @@ MediaConverterWindow::MessageReceived(BMessage* msg)
case DISP_ABOUT_MESSAGE: case DISP_ABOUT_MESSAGE:
{ {
(new BAlert(ABOUT_TITLE_LABEL B_UTF8_ELLIPSIS, BString title(B_TRANSLATE("About" B_UTF8_ELLIPSIS));
(new BAlert(title,
"MediaConverter\n" "MediaConverter\n"
VERSION"\n" VERSION"\n"
B_UTF8_COPYRIGHT" 1999, Be Incorporated.\n" B_UTF8_COPYRIGHT" 1999, Be Incorporated.\n"
B_UTF8_COPYRIGHT" 2000-2004 Jun Suzuki\n" B_UTF8_COPYRIGHT" 2000-2004 Jun Suzuki\n"
B_UTF8_COPYRIGHT" 2007 Stephan Aßmus\n" B_UTF8_COPYRIGHT" 2007 Stephan Aßmus\n"
B_UTF8_COPYRIGHT" 2010 Haiku, Inc.", B_UTF8_COPYRIGHT" 2010 Haiku, Inc.",
OK_LABEL))->Go(); B_TRANSLATE("OK")))->Go();
break; break;
} }
@@ -424,8 +437,10 @@ MediaConverterWindow::MessageReceived(BMessage* msg)
if (status != B_OK && status != B_ALREADY_RUNNING) { if (status != B_OK && status != B_ALREADY_RUNNING) {
BString errorString; BString errorString;
errorString << LAUNCH_ERROR << strerror(status); errorString << B_TRANSLATE("Error launching: ") <<
(new BAlert("", errorString.String(), OK_LABEL))->Go(); strerror(status);
(new BAlert("", errorString.String(),
B_TRANSLATE("OK")))->Go();
} }
break; break;
} }
@@ -434,7 +449,8 @@ MediaConverterWindow::MessageReceived(BMessage* msg)
{ {
int32 value; int32 value;
msg->FindInt32("be:value", &value); msg->FindInt32("be:value", &value);
snprintf(buffer, sizeof(buffer), VIDEO_QUALITY_LABEL, (int8)value); snprintf(buffer, sizeof(buffer),
B_TRANSLATE("Video quality: %3d%%"), (int8)value);
fVideoQualitySlider->SetLabel(buffer); fVideoQualitySlider->SetLabel(buffer);
fVideoQuality = value; fVideoQuality = value;
break; break;
@@ -444,7 +460,8 @@ MediaConverterWindow::MessageReceived(BMessage* msg)
{ {
int32 value; int32 value;
msg->FindInt32("be:value", &value); msg->FindInt32("be:value", &value);
snprintf(buffer, sizeof(buffer), AUDIO_QUALITY_LABEL, (int8)value); snprintf(buffer, sizeof(buffer),
B_TRANSLATE("Audio quality: %3d%%"), (int8)value);
fAudioQualitySlider->SetLabel(buffer); fAudioQualitySlider->SetLabel(buffer);
fAudioQuality = value; fAudioQuality = value;
break; break;
@@ -464,7 +481,7 @@ MediaConverterWindow::QuitRequested()
return true; return true;
} else if (!fCancelling) { } else if (!fCancelling) {
fCancelling = true; fCancelling = true;
SetStatusMessage(CANCELLING_LABEL); SetStatusMessage(B_TRANSLATE("Cancelling"));
BMessenger(be_app).SendMessage(CANCEL_CONVERSION_MESSAGE); BMessenger(be_app).SendMessage(CANCEL_CONVERSION_MESSAGE);
} }
return false; return false;
@@ -515,7 +532,8 @@ MediaConverterWindow::BuildAudioVideoMenus()
while (get_next_encoder(&cookie, mf_format, &format, &outfmt, &codec_info) while (get_next_encoder(&cookie, mf_format, &format, &outfmt, &codec_info)
== B_OK) { == B_OK) {
if (separator) { if (separator) {
menu->AddItem(new BMenuItem("No audio", menu->AddItem(new BMenuItem(
B_TRANSLATE_WITH_CONTEXT("No audio", "Audio codecs list"),
new BMessage(AUDIO_CODEC_SELECT_MESSAGE))); new BMessage(AUDIO_CODEC_SELECT_MESSAGE)));
menu->AddSeparatorItem(); menu->AddSeparatorItem();
separator = false; separator = false;
@@ -538,7 +556,9 @@ MediaConverterWindow::BuildAudioVideoMenus()
item->SetMarked(true); item->SetMarked(true);
((BInvoker *)item)->Invoke(); ((BInvoker *)item)->Invoke();
} else { } else {
item = new BMenuItem(NONE_LABEL, NULL); item = new BMenuItem(
B_TRANSLATE_WITH_CONTEXT("None available", "Audio codecs"),
NULL);
menu->AddItem(item); menu->AddItem(item);
item->SetMarked(true); item->SetMarked(true);
fAudioMenu->SetEnabled(false); fAudioMenu->SetEnabled(false);
@@ -568,7 +588,8 @@ MediaConverterWindow::BuildAudioVideoMenus()
cookie = 0; cookie = 0;
while (get_next_encoder(&cookie, mf_format, &format, &outfmt, &codec_info) == B_OK) { while (get_next_encoder(&cookie, mf_format, &format, &outfmt, &codec_info) == B_OK) {
if (separator) { if (separator) {
menu->AddItem(new BMenuItem("No video", menu->AddItem(new BMenuItem(
B_TRANSLATE_WITH_CONTEXT("No video", "Video codecs list"),
new BMessage(VIDEO_CODEC_SELECT_MESSAGE))); new BMessage(VIDEO_CODEC_SELECT_MESSAGE)));
menu->AddSeparatorItem(); menu->AddSeparatorItem();
separator = false; separator = false;
@@ -586,7 +607,9 @@ MediaConverterWindow::BuildAudioVideoMenus()
item->SetMarked(true); item->SetMarked(true);
((BInvoker *)item)->Invoke(); ((BInvoker *)item)->Invoke();
} else { } else {
item = new BMenuItem(NONE_LABEL, NULL); item = new BMenuItem(
B_TRANSLATE_WITH_CONTEXT("None available", "Video codecs"),
NULL);
menu->AddItem(item); menu->AddItem(item);
item->SetMarked(true); item->SetMarked(true);
fVideoMenu->SetEnabled(false); fVideoMenu->SetEnabled(false);
@@ -814,61 +837,61 @@ void
MediaConverterWindow::_UpdateLabels() MediaConverterWindow::_UpdateLabels()
{ {
if (fSourcesBox != NULL) { if (fSourcesBox != NULL) {
fSourcesBox->SetLabel(SOURCE_BOX_LABEL); fSourcesBox->SetLabel(B_TRANSLATE("Source files"));
_UpdateBBoxLayoutInsets(fSourcesBox); _UpdateBBoxLayoutInsets(fSourcesBox);
} }
if (fInfoBox != NULL) if (fInfoBox != NULL)
fInfoBox->SetLabel(INFO_BOX_LABEL); fInfoBox->SetLabel(B_TRANSLATE("File details"));
if (fOutputBox != NULL) { if (fOutputBox != NULL) {
fOutputBox->SetLabel(OUTPUT_BOX_LABEL); fOutputBox->SetLabel(B_TRANSLATE("Output format"));
_UpdateBBoxLayoutInsets(fOutputBox); _UpdateBBoxLayoutInsets(fOutputBox);
} }
if (fConvertButton != NULL) if (fConvertButton != NULL)
fConvertButton->SetLabel(CONVERT_LABEL); fConvertButton->SetLabel(B_TRANSLATE("Convert"));
if (fPreviewButton != NULL) if (fPreviewButton != NULL)
fPreviewButton->SetLabel(PREVIEW_BUTTON_LABEL); fPreviewButton->SetLabel(B_TRANSLATE("Preview"));
if (fDestButton != NULL) if (fDestButton != NULL)
fDestButton->SetLabel(OUTPUT_FOLDER_LABEL); fDestButton->SetLabel(B_TRANSLATE("Output folder"));
if (fVideoQualitySlider != NULL) { if (fVideoQualitySlider != NULL) {
char buffer[40]; char buffer[40];
snprintf(buffer, sizeof(buffer), VIDEO_QUALITY_LABEL, snprintf(buffer, sizeof(buffer), B_TRANSLATE("Video quality: %3d%%"),
(int8)fVideoQuality); (int8)fVideoQuality);
fVideoQualitySlider->SetLabel(buffer); fVideoQualitySlider->SetLabel(buffer);
fVideoQualitySlider->SetLimitLabels(SLIDER_LOW_LABEL, fVideoQualitySlider->SetLimitLabels(B_TRANSLATE("Low"),
SLIDER_HIGH_LABEL); B_TRANSLATE("High"));
} }
if (fAudioQualitySlider != NULL) { if (fAudioQualitySlider != NULL) {
char buffer[40]; char buffer[40];
snprintf(buffer, sizeof(buffer), AUDIO_QUALITY_LABEL, snprintf(buffer, sizeof(buffer), B_TRANSLATE("Audio quality: %3d%%"),
(int8)fAudioQuality); (int8)fAudioQuality);
fAudioQualitySlider->SetLabel(buffer); fAudioQualitySlider->SetLabel(buffer);
fAudioQualitySlider->SetLimitLabels(SLIDER_LOW_LABEL, fAudioQualitySlider->SetLimitLabels(B_TRANSLATE("Low"),
SLIDER_HIGH_LABEL); B_TRANSLATE("High"));
} }
if (fStartDurationTC != NULL) if (fStartDurationTC != NULL)
fStartDurationTC->SetLabel(START_LABEL); fStartDurationTC->SetLabel(B_TRANSLATE("Start [ms]: "));
if (fEndDurationTC != NULL) if (fEndDurationTC != NULL)
fEndDurationTC->SetLabel(END_LABEL); fEndDurationTC->SetLabel(B_TRANSLATE("End   [ms]: "));
if (fFormatMenu != NULL) if (fFormatMenu != NULL)
fFormatMenu->SetLabel(FORMAT_LABEL); fFormatMenu->SetLabel(B_TRANSLATE("File format:"));
if (fAudioMenu != NULL) if (fAudioMenu != NULL)
fAudioMenu->SetLabel(AUDIO_LABEL); fAudioMenu->SetLabel(B_TRANSLATE("Audio encoding:"));
if (fVideoMenu != NULL) if (fVideoMenu != NULL)
fVideoMenu->SetLabel(VIDEO_LABEL); fVideoMenu->SetLabel(B_TRANSLATE("Video encoding:"));
SetFileMessage(DROP_MEDIA_FILE_LABEL); SetFileMessage(B_TRANSLATE("Drop media files onto this window"));
} }
@@ -903,17 +926,20 @@ MediaConverterWindow::_CreateMenu()
BMenuItem* item; BMenuItem* item;
BMenu* menu; BMenu* menu;
menu = new BMenu(FILE_MENU_LABEL); menu = new BMenu(B_TRANSLATE_WITH_CONTEXT("File", "Menu"));
item = new BMenuItem(OPEN_MENU_LABEL B_UTF8_ELLIPSIS, item = new BMenuItem(B_TRANSLATE_WITH_CONTEXT(
"Open" B_UTF8_ELLIPSIS, "Menu"),
new BMessage(OPEN_FILE_MESSAGE), 'O'); new BMessage(OPEN_FILE_MESSAGE), 'O');
menu->AddItem(item); menu->AddItem(item);
menu->AddSeparatorItem(); menu->AddSeparatorItem();
item = new BMenuItem(ABOUT_MENU_LABEL B_UTF8_ELLIPSIS, item = new BMenuItem(B_TRANSLATE_WITH_CONTEXT(
"About MediaConverter" B_UTF8_ELLIPSIS, "Menu"),
new BMessage(DISP_ABOUT_MESSAGE)); new BMessage(DISP_ABOUT_MESSAGE));
menu->AddItem(item); menu->AddItem(item);
menu->AddSeparatorItem(); menu->AddSeparatorItem();
item = new BMenuItem(QUIT_MENU_LABEL, new BMessage(QUIT_MESSAGE), 'Q'); item = new BMenuItem(B_TRANSLATE_WITH_CONTEXT("Quit", "Menu"),
new BMessage(QUIT_MESSAGE), 'Q');
menu->AddItem(item); menu->AddItem(item);
fMenuBar->AddItem(menu); fMenuBar->AddItem(menu);
@@ -6,13 +6,17 @@
#include <stdio.h> #include <stdio.h>
#include <Catalog.h>
#include <Locale.h>
#include <View.h> #include <View.h>
#include "Strings.h"
#undef B_TRANSLATE_CONTEXT
#define B_TRANSLATE_CONTEXT "MediaConverter-EncoderWindow"
MediaEncoderWindow::MediaEncoderWindow(BRect frame, BView* view) MediaEncoderWindow::MediaEncoderWindow(BRect frame, BView* view)
: BWindow(frame, ENCODER_PARAMETERS, B_DOCUMENT_WINDOW_LOOK, : BWindow(frame, B_TRANSLATE("Encoder parameters"), B_DOCUMENT_WINDOW_LOOK,
B_MODAL_APP_WINDOW_FEEL, B_MODAL_APP_WINDOW_FEEL,
B_NOT_RESIZABLE | B_NOT_ZOOMABLE | B_ASYNCHRONOUS_CONTROLS) B_NOT_RESIZABLE | B_NOT_ZOOMABLE | B_ASYNCHRONOUS_CONTROLS)
{ {
-92
View File
@@ -1,92 +0,0 @@
// Copyright 1999, Be Incorporated. All Rights Reserved.
// Copyright 2000-2004, Jun Suzuki. All Rights Reserved.
// Copyright 2007, Stephan Aßmus. All Rights Reserved.
// This file may be used under the terms of the Be Sample Code License.
#ifndef STRINGS_H
#define STRINGS_H
#include <BeBuild.h>
#if B_BEOS_VERSION >= 0x520
typedef const char Char;
#if B_BEOS_VERSION>=0x530 // 0x530 RC3
#include <locale/Locale.h>
#else
#include <Locale.h>
#endif
#else
#define _T(str) str
typedef char Char;
#endif
#define VERSION "1.3.0"
#define SOURCE_BOX_LABEL _T("Source files")
#define INFO_BOX_LABEL _T("File details")
#define OUTPUT_BOX_LABEL _T("Output format")
#define FORMAT_LABEL _T("File format:")
#define VIDEO_LABEL _T("Video encoding:")
#define AUDIO_LABEL _T("Audio encoding:")
//
#define OUTPUT_FOLDER_LABEL _T("Output folder")
#define PREVIEW_BUTTON_LABEL _T("Preview")
#define START_LABEL _T("Start [ms]: ")
#define END_LABEL _T("End [ms]: ")
//
#define FORMAT_MENU_LABEL _T("Format")
#define VIDEO_MENU_LABEL _T("Video")
#define AUDIO_MENU_LABEL _T("Audio")
#define DURATION_LABEL _T("Duration:")
#define VIDEO_INFO_LABEL _T("Video:")
#define AUDIO_INFO_LABEL _T("Audio:")
#define CONVERT_LABEL _T("Convert")
#define CANCEL_LABEL _T("Cancel")
#define VIDEO_QUALITY_LABEL _T("Video quality: %3d%%")
#define AUDIO_QUALITY_LABEL _T("Audio quality: %3d%%")
#define SLIDER_LOW_LABEL _T("Low")
#define SLIDER_HIGH_LABEL _T("High")
#define NONE_LABEL _T("None available")
#define DROP_MEDIA_FILE_LABEL _T("Drop media files onto this window")
#define CANCELLING_LABEL _T("Cancelling")
#define ABOUT_TITLE_LABEL _T("About")
#define OK_LABEL _T("OK")
#define CONV_COMPLETE_LABEL _T("Conversion completed")
#define CONV_CANCEL_LABEL _T("Conversion cancelled")
#define SELECT_DIR_LABEL _T("Select this folder")
#define SELECT_LABEL _T("Select")
#define SAVE_DIR_LABEL _T("MediaConverter+:SaveDirectory")
#define NO_FILE_LABEL _T("No file selected")
//
#define FILE_MENU_LABEL _T("File")
#define OPEN_MENU_LABEL _T("Open")
#define ABOUT_MENU_LABEL _T("About MediaConverter")
#define QUIT_MENU_LABEL _T("Quit")
#define WRITE_AUDIO_STRING _T("Writing audio track:")
#define WRITE_VIDEO_STRING _T("Writing video track:")
#define COMPLETE_STRING _T("complete")
#define OUTPUT_FILE_STRING1 _T("Output file")
#define OUTPUT_FILE_STRING2 _T("created")
#define AUDIO_SUPPORT_STRING _T("Audio quality not supported")
#define VIDEO_SUPPORT_STRING _T("Video quality not supported")
#define VIDEO_PARAMFORM_STRING _T("Video using parameters form settings")
#define CONTINUE_STRING _T("Continue")
#define FILES _T("files")
#define FILE _T("file")
#define NOTRECOGNIZE _T(" were not recognized as supported media files:")
//
#define LAUNCH_ERROR _T("Error launching: ")
#define OUTPUT_FILE_STRING3 _T("Error creating")
#define CONVERT_ERROR_STRING _T("Error converting")
#define ERROR_WRITE_VIDEO_STRING _T("Error writing video frame ")
#define ERROR_WRITE_AUDIO_STRING _T("Error writing audio frame ")
#define ERROR_READ_VIDEO_STRING _T("Error read video frame ")
#define ERROR_READ_AUDIO_STRING _T("Error read audio frame ")
#define ERROR_LOAD_STRING _T("Error loading file")
#define ENCODER_PARAMETERS _T("Encoder parameters")
#endif // STRINGS_H