Updated to use B_TRANSLATE* macros. relates to #5408.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36690 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Matt Madia
2010-05-07 00:06:01 +00:00
parent 16a0078818
commit 176fb40f5b
2 changed files with 147 additions and 128 deletions
+22 -14
View File
@@ -68,7 +68,8 @@ SettingsView::SettingsView (bool isVideo)
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
BBox *defaultsBox = new BBox("defaults"); BBox *defaultsBox = new BBox("defaults");
defaultsBox->SetLabel(fIsVideo ? TR("Default nodes") : TR("Defaults")); defaultsBox->SetLabel(fIsVideo ? B_TRANSLATE("Default nodes")
: B_TRANSLATE("Defaults"));
// create the default box // create the default box
BGroupLayout* defaultBoxLayout = new BGroupLayout(B_VERTICAL, 5); BGroupLayout* defaultBoxLayout = new BGroupLayout(B_VERTICAL, 5);
@@ -81,18 +82,20 @@ SettingsView::SettingsView (bool isVideo)
defaultsBox->GetLayout()->AddView(inputField); defaultsBox->GetLayout()->AddView(inputField);
defaultsBox->GetLayout()->AddView(outputField); defaultsBox->GetLayout()->AddView(outputField);
float divider = StringWidth(fIsVideo ? TR("Video output:") float divider = StringWidth(fIsVideo ? B_TRANSLATE("Video output:")
: TR("Audio output:")) + 5; : B_TRANSLATE("Audio output:")) + 5;
fMenu1 = new BPopUpMenu("<none>"); fMenu1 = new BPopUpMenu("<none>");
fMenu1->SetLabelFromMarked(true); fMenu1->SetLabelFromMarked(true);
BMenuField *menuField1 = new BMenuField("menuField1", BMenuField *menuField1 = new BMenuField("menuField1",
fIsVideo ? TR("Video input:") : TR("Audio input:"), fMenu1, NULL); fIsVideo ? B_TRANSLATE("Video input:")
: B_TRANSLATE("Audio input:"), fMenu1, NULL);
menuField1->SetDivider(divider); menuField1->SetDivider(divider);
fMenu2 = new BPopUpMenu("<none>"); fMenu2 = new BPopUpMenu("<none>");
fMenu2->SetLabelFromMarked(true); fMenu2->SetLabelFromMarked(true);
BMenuField *menuField2 = new BMenuField("menuField2", BMenuField *menuField2 = new BMenuField("menuField2",
fIsVideo ? TR("Video output:") : TR("Audio output:"), fMenu2, NULL); fIsVideo ? B_TRANSLATE("Video output:")
: B_TRANSLATE("Audio output:"), fMenu2, NULL);
menuField2->SetDivider(divider); menuField2->SetDivider(divider);
inputField->GroupLayout()->AddView(menuField1); inputField->GroupLayout()->AddView(menuField1);
@@ -103,26 +106,27 @@ SettingsView::SettingsView (bool isVideo)
fMenu3 = new BPopUpMenu("<none>"); fMenu3 = new BPopUpMenu("<none>");
fMenu3->SetLabelFromMarked(true); fMenu3->SetLabelFromMarked(true);
menuField3 = new BMenuField("menuField3", menuField3 = new BMenuField("menuField3",
TR("Channel:"), fMenu3, NULL); B_TRANSLATE("Channel:"), fMenu3, NULL);
outputField->GroupLayout()->AddView(menuField3); outputField->GroupLayout()->AddView(menuField3);
menuField3->SetDivider(StringWidth(TR("Channel:"))+5); menuField3->SetDivider(StringWidth(B_TRANSLATE("Channel:"))+5);
} }
rgb_color red_color = {222, 32, 33}; rgb_color red_color = {222, 32, 33};
fRestartView = new BStringView("restartStringView", fRestartView = new BStringView("restartStringView",
TR("Restart the media server to apply changes.")); B_TRANSLATE("Restart the media server to apply changes."));
fRestartView->SetHighColor(red_color); fRestartView->SetHighColor(red_color);
defaultsBox->AddChild(fRestartView); defaultsBox->AddChild(fRestartView);
fRestartView->Hide(); fRestartView->Hide();
// create the realtime box // create the realtime box
BBox *realtimeBox = new BBox("realtime"); BBox *realtimeBox = new BBox("realtime");
realtimeBox->SetLabel(TR("Real-time")); realtimeBox->SetLabel(B_TRANSLATE("Real-time"));
BMessage *message = new BMessage(ML_ENABLE_REAL_TIME); BMessage *message = new BMessage(ML_ENABLE_REAL_TIME);
message->AddBool("isVideo", fIsVideo); message->AddBool("isVideo", fIsVideo);
fRealtimeCheckBox = new BCheckBox("realtimeCheckBox", fRealtimeCheckBox = new BCheckBox("realtimeCheckBox",
fIsVideo ? TR("Enable real-time video") : TR("Enable real-time audio"), fIsVideo ? B_TRANSLATE("Enable real-time video")
: B_TRANSLATE("Enable real-time audio"),
message); message);
uint32 flags; uint32 flags;
@@ -131,11 +135,13 @@ SettingsView::SettingsView (bool isVideo)
fRealtimeCheckBox->SetValue(B_CONTROL_ON); fRealtimeCheckBox->SetValue(B_CONTROL_ON);
BTextView *textView = new BTextView("stringView"); BTextView *textView = new BTextView("stringView");
textView->Insert(fIsVideo ? TR("Enabling real-time video allows system to " textView->Insert(fIsVideo ? B_TRANSLATE(
"Enabling real-time video allows system to "
"perform video operations as fast and smoothly as possible. It " "perform video operations as fast and smoothly as possible. It "
"achieves optimum performance by using more RAM." "achieves optimum performance by using more RAM."
"\n\nOnly enable this feature if you need the lowest latency possible.") "\n\nOnly enable this feature if you need the lowest latency possible.")
: TR("Enabling real-time audio allows system to record and play audio " : B_TRANSLATE(
"Enabling real-time audio allows system to record and play audio "
"as fast as possible. It achieves this performance by using more CPU and RAM." "as fast as possible. It achieves this performance by using more CPU and RAM."
"\n\nOnly enable this feature if you need the lowest latency possible.")); "\n\nOnly enable this feature if you need the lowest latency possible."));
textView->MakeEditable(false); textView->MakeEditable(false);
@@ -153,11 +159,13 @@ SettingsView::SettingsView (bool isVideo)
// create the bottom line: volumen in deskbar checkbox and restart button // create the bottom line: volumen in deskbar checkbox and restart button
BGroupView* bottomView = new BGroupView(B_HORIZONTAL); BGroupView* bottomView = new BGroupView(B_HORIZONTAL);
BButton *restartButton = new BButton("restartButton", BButton *restartButton = new BButton("restartButton",
TR("Restart media services"), new BMessage(ML_RESTART_MEDIA_SERVER)); B_TRANSLATE("Restart media services"),
new BMessage(ML_RESTART_MEDIA_SERVER));
if (!fIsVideo) { if (!fIsVideo) {
fVolumeCheckBox = new BCheckBox("volumeCheckBox", fVolumeCheckBox = new BCheckBox("volumeCheckBox",
TR("Show volume control on Deskbar"), new BMessage(ML_SHOW_VOLUME_CONTROL)); B_TRANSLATE("Show volume control on Deskbar"),
new BMessage(ML_SHOW_VOLUME_CONTROL));
bottomView->GroupLayout()->AddView(fVolumeCheckBox); bottomView->GroupLayout()->AddView(fVolumeCheckBox);
if (BDeskbar().HasItem("MediaReplicant")) if (BDeskbar().HasItem("MediaReplicant"))
fVolumeCheckBox->SetValue(B_CONTROL_ON); fVolumeCheckBox->SetValue(B_CONTROL_ON);
+30 -19
View File
@@ -40,7 +40,7 @@ const uint32 ML_INIT_MEDIA = 'MlIM';
// MediaWindow - Constructor // MediaWindow - Constructor
MediaWindow::MediaWindow(BRect frame) MediaWindow::MediaWindow(BRect frame)
: BWindow (frame, TR("Media"), B_TITLED_WINDOW, : BWindow (frame, B_TRANSLATE("Media"), B_TITLED_WINDOW,
B_ASYNCHRONOUS_CONTROLS | B_AUTO_UPDATE_SIZE_LIMITS), B_ASYNCHRONOUS_CONTROLS | B_AUTO_UPDATE_SIZE_LIMITS),
fCurrentNode(NULL), fCurrentNode(NULL),
fParamWeb(NULL), fParamWeb(NULL),
@@ -202,7 +202,7 @@ MediaWindow::InitWindow(void)
// StringViews // StringViews
rgb_color titleFontColor = { 0, 0, 0, 0 }; rgb_color titleFontColor = { 0, 0, 0, 0 };
fTitleView = new BStringView("AudioSettings", fTitleView = new BStringView("AudioSettings",
TR("Audio settings"), B_WILL_DRAW); B_TRANSLATE("Audio settings"), B_WILL_DRAW);
fTitleView->SetFont(be_bold_font); fTitleView->SetFont(be_bold_font);
fTitleView->SetHighColor(titleFontColor); fTitleView->SetHighColor(titleFontColor);
@@ -254,15 +254,18 @@ MediaWindow::InitMedia(bool first)
if (first && err != B_OK) { if (first && err != B_OK) {
BAlert *alert = new BAlert("start_media_server", BAlert *alert = new BAlert("start_media_server",
TR("Could not connect to the media server.\n" B_TRANSLATE("Could not connect to the media server.\n"
"Would you like to start it ?"), TR("Quit"), "Would you like to start it ?"),
TR("Start media server"), NULL, B_TRANSLATE("Quit"),
B_TRANSLATE("Start media server"), NULL,
B_WIDTH_AS_USUAL, B_WARNING_ALERT); B_WIDTH_AS_USUAL, B_WARNING_ALERT);
if (alert->Go()==0) if (alert->Go()==0)
return B_ERROR; return B_ERROR;
fAlert = new MediaAlert(BRect(0, 0, 300, 60), fAlert = new MediaAlert(BRect(0, 0, 300, 60),
"restart_alert", TR("Restarting media services\nStarting media server" B_UTF8_ELLIPSIS "\n")); "restart_alert", B_TRANSLATE(
"Restarting media services\nStarting media server"
B_UTF8_ELLIPSIS "\n"));
fAlert->Show(); fAlert->Show();
Show(); Show();
@@ -279,7 +282,8 @@ MediaWindow::InitMedia(bool first)
if ((!first || (first && err) ) && fAlert) { if ((!first || (first && err) ) && fAlert) {
BAutolock locker(fAlert); BAutolock locker(fAlert);
if (locker.IsLocked()) if (locker.IsLocked())
fAlert->TextView()->SetText(TR("Ready for use" B_UTF8_ELLIPSIS)); fAlert->TextView()->SetText(
B_TRANSLATE("Ready for use" B_UTF8_ELLIPSIS));
} }
void *listItem; void *listItem;
@@ -418,7 +422,8 @@ MediaWindow::FrameResized (float width, float height)
void void
ErrorAlert(char* errorMessage) { ErrorAlert(char* errorMessage) {
printf("%s\n", errorMessage); printf("%s\n", errorMessage);
BAlert *alert = new BAlert("BAlert", errorMessage, TR("OK"), NULL, NULL, B_WIDTH_AS_USUAL, B_STOP_ALERT); BAlert *alert = new BAlert("BAlert", errorMessage, B_TRANSLATE("OK"),
NULL, NULL, B_WIDTH_AS_USUAL, B_STOP_ALERT);
alert->Go(); alert->Go();
exit(1); exit(1);
} }
@@ -530,13 +535,15 @@ MediaWindow::MessageReceived (BMessage *message)
status = deskbar.AddItem(&ref, &id); status = deskbar.AddItem(&ref, &id);
if (status != B_OK) { if (status != B_OK) {
fprintf(stderr, TR("Couldn't add volume control in Deskbar: %s\n"), fprintf(stderr, B_TRANSLATE(
"Couldn't add volume control in Deskbar: %s\n"),
strerror(status)); strerror(status));
} }
} else { } else {
status_t status = deskbar.RemoveItem("MediaReplicant"); status_t status = deskbar.RemoveItem("MediaReplicant");
if (status != B_OK) { if (status != B_OK) {
fprintf(stderr, TR("Couldn't remove volume control in Deskbar: %s\n"), fprintf(stderr, B_TRANSLATE(
"Couldn't remove volume control in Deskbar: %s\n"),
strerror(status)); strerror(status));
} }
} }
@@ -614,7 +621,8 @@ MediaWindow::MessageReceived (BMessage *message)
fParamWeb = NULL; fParamWeb = NULL;
BRect bounds = fContentView->Bounds(); BRect bounds = fContentView->Bounds();
BStringView* stringView = new BStringView(bounds, BStringView* stringView = new BStringView(bounds,
"noControls", TR("This hardware has no controls."), B_FOLLOW_V_CENTER | B_FOLLOW_H_CENTER); "noControls", B_TRANSLATE("This hardware has no controls."),
B_FOLLOW_V_CENTER | B_FOLLOW_H_CENTER);
stringView->ResizeToPreferred(); stringView->ResizeToPreferred();
fContentView->AddChild(stringView); fContentView->AddChild(stringView);
stringView->MoveBy((bounds.Width()-stringView->Bounds().Width())/2, stringView->MoveBy((bounds.Width()-stringView->Bounds().Width())/2,
@@ -637,7 +645,8 @@ MediaWindow::MessageReceived (BMessage *message)
&& (strcmp(mimeSig, "application/x-vnd.Be.addon-host")==0 && (strcmp(mimeSig, "application/x-vnd.Be.addon-host")==0
|| strcmp(mimeSig, "application/x-vnd.Be.media-server")==0)) { || strcmp(mimeSig, "application/x-vnd.Be.media-server")==0)) {
fAlert->Lock(); fAlert->Lock();
fAlert->TextView()->SetText(TR("Starting media server" B_UTF8_ELLIPSIS)); fAlert->TextView()->SetText(
B_TRANSLATE("Starting media server" B_UTF8_ELLIPSIS));
fAlert->Unlock(); fAlert->Unlock();
} }
} }
@@ -668,7 +677,8 @@ MediaWindow::RestartMediaServices(void *data)
{ {
MediaWindow *window = (MediaWindow *)data; MediaWindow *window = (MediaWindow *)data;
window->fAlert = new MediaAlert(BRect(0, 0, 300, 60), window->fAlert = new MediaAlert(BRect(0, 0, 300, 60),
"restart_alert", TR("Restarting media services\nShutting down media server\n")); "restart_alert", B_TRANSLATE(
"Restarting media services\nShutting down media server\n"));
window->fAlert->Show(); window->fAlert->Show();
@@ -677,7 +687,8 @@ MediaWindow::RestartMediaServices(void *data)
{ {
BAutolock locker(window->fAlert); BAutolock locker(window->fAlert);
if (locker.IsLocked()) if (locker.IsLocked())
window->fAlert->TextView()->SetText(TR("Starting media server" B_UTF8_ELLIPSIS)); window->fAlert->TextView()->SetText(
B_TRANSLATE("Starting media server" B_UTF8_ELLIPSIS));
} }
launch_media_server(); launch_media_server();
@@ -692,19 +703,19 @@ MediaWindow::UpdateProgress(int stage, const char * message, void * cookie)
const char *string = "Unknown stage"; const char *string = "Unknown stage";
switch (stage) { switch (stage) {
case 10: case 10:
string = TR("Stopping media server" B_UTF8_ELLIPSIS); string = B_TRANSLATE("Stopping media server" B_UTF8_ELLIPSIS);
break; break;
case 20: case 20:
string = TR("Telling media_addon_server to quit."); string = B_TRANSLATE("Telling media_addon_server to quit.");
break; break;
case 40: case 40:
string = TR("Waiting for media_server to quit."); string = B_TRANSLATE("Waiting for media_server to quit.");
break; break;
case 70: case 70:
string = TR("Cleaning up."); string = B_TRANSLATE("Cleaning up.");
break; break;
case 100: case 100:
string = TR("Done shutting down."); string = B_TRANSLATE("Done shutting down.");
break; break;
} }