Applying revized localization patch prepared by Jorma Karvonen.

Fixes #7347. Thanks.

Additionally: single function for About alert added - replaces the triplication of 
the same text in original code.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40910 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Siarzhuk Zharski
2011-03-10 22:32:12 +00:00
parent 80cdaa81fd
commit 55f0b964a3
11 changed files with 87 additions and 42 deletions
+6 -9
View File
@@ -16,9 +16,8 @@
#include <Alert.h>
#include <Catalog.h>
#include <Dragger.h>
#include <Locale.h>
#include <PopUpMenu.h>
#include <TextView.h>
#include <ViewPrivate.h>
#include <syscalls.h>
@@ -241,8 +240,10 @@ CPUButton::Invoke(BMessage *message)
if (!LastEnabledCPU(fCPU)) {
_kern_set_cpu_enabled(fCPU, Value());
} else {
BAlert *alert = new BAlert(NULL, B_TRANSLATE("You can't disable the "
"last active CPU."), B_TRANSLATE("OK"));
BAlert *alert = new BAlert(B_TRANSLATE("Info"),
B_TRANSLATE("You can't disable the last active CPU."),
B_TRANSLATE("OK"));
alert->SetShortcut(0, B_ESCAPE);
alert->Go(NULL);
SetValue(!Value());
}
@@ -276,11 +277,7 @@ CPUButton::MessageReceived(BMessage *message)
{
switch (message->what) {
case B_ABOUT_REQUESTED: {
BAlert *alert = new BAlert(B_TRANSLATE("Info"),
B_TRANSLATE("Pulse\n\nBy David Ramsey and Arve Hjønnevåg\n"
"Revised by Daniel Switkin"), B_TRANSLATE("OK"));
// Use the asynchronous version so we don't block the window's thread
alert->Go(NULL);
PulseApp::ShowAbout();
break;
}
case PV_REPLICANT_PULSE: {
-1
View File
@@ -16,7 +16,6 @@
#include <Catalog.h>
#include <CheckBox.h>
#include <Locale.h>
#include <RadioButton.h>
#include <TextControl.h>
+20 -16
View File
@@ -8,18 +8,22 @@
//
//****************************************************************************************
#include "DeskbarPulseView.h"
#include "Common.h"
#include "Prefs.h"
#include <app/Application.h>
#include <Catalog.h>
#include <interface/Deskbar.h>
#include <interface/Alert.h>
#include <Locale.h>
#include <Roster.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <Alert.h>
#include <Application.h>
#include <Catalog.h>
#include <Deskbar.h>
#include <Roster.h>
#include "Common.h"
#include "Prefs.h"
#include "PulseApp.h"
#undef B_TRANSLATE_CONTEXT
#define B_TRANSLATE_CONTEXT "DeskbarPulseView"
@@ -124,10 +128,7 @@ void DeskbarPulseView::MessageReceived(BMessage *message) {
prefswindow->Show();
break;
case PV_ABOUT: {
BAlert *alert = new BAlert(B_TRANSLATE("Info"),
B_TRANSLATE("Pulse\n\nBy David Ramsey and Arve Hjønnevåg\n"
"Revised by Daniel Switkin"), B_TRANSLATE("OK"));
alert->Go(NULL);
PulseApp::ShowAbout();
break;
}
case PV_QUIT:
@@ -175,10 +176,13 @@ void DeskbarPulseView::Remove() {
BDeskbar *deskbar = new BDeskbar();
status_t err = deskbar->RemoveItem("DeskbarPulseView");
if (err != B_OK) {
char temp[255];
sprintf(temp, B_TRANSLATE("Remove(): %s"), strerror(err));
BAlert *alert = new BAlert(B_TRANSLATE("Info"), temp,
BString str;
snprintf(str.LockBuffer(512), 512,
B_TRANSLATE("Removing from Deskbar failed.\n%s"), strerror(err));
str.UnlockBuffer();
BAlert *alert = new BAlert(B_TRANSLATE("Info"), str.String(),
B_TRANSLATE("OK"));
alert->SetShortcut(0, B_ESCAPE);
alert->Go(NULL);
}
delete deskbar;
+6
View File
@@ -40,3 +40,9 @@ DoCatalogs Pulse :
PrefsWindow.cpp
PulseWindow.cpp
;
AddCatalogEntryAttribute Pulse
:
x-vnd.Haiku-Pulse:PulseWindow:Pulse
;
-1
View File
@@ -11,7 +11,6 @@
#include "MiniPulseView.h"
#include "Common.h"
#include <Catalog.h>
#include <Locale.h>
#include <interface/Window.h>
#undef B_TRANSLATE_CONTEXT
+2 -3
View File
@@ -16,7 +16,6 @@
#include <Catalog.h>
#include <Bitmap.h>
#include <Dragger.h>
#include <Locale.h>
#include <Window.h>
#include <stdlib.h>
@@ -203,9 +202,9 @@ NormalPulseView::Draw(BRect rect)
char buffer[64];
int32 cpuSpeed = get_rounded_cpu_speed();
if (cpuSpeed > 1000 && (cpuSpeed % 10) == 0)
snprintf(buffer, sizeof(buffer), "%.2f GHz", cpuSpeed / 1000.0f);
snprintf(buffer, sizeof(buffer), B_TRANSLATE("%.2f GHz"), cpuSpeed / 1000.0f);
else
snprintf(buffer, sizeof(buffer), "%ld MHz", cpuSpeed);
snprintf(buffer, sizeof(buffer), B_TRANSLATE("%ld MHz"), cpuSpeed);
// We can't assume anymore that a CPU clock speed is always static.
// Let's compute the best font size for the CPU speed string each time...
-1
View File
@@ -16,7 +16,6 @@
#include <Catalog.h>
#include <Button.h>
#include <Locale.h>
#include <TabView.h>
#include <TextControl.h>
+43 -2
View File
@@ -21,8 +21,8 @@
#include <Alert.h>
#include <Catalog.h>
#include <Deskbar.h>
#include <Locale.h>
#include <Rect.h>
#include <TextView.h>
#include <syscalls.h>
@@ -160,6 +160,41 @@ PulseApp::~PulseApp()
}
void
PulseApp::AboutRequested()
{
PulseApp::ShowAbout();
}
void
PulseApp::ShowAbout()
{
// static version to be used in replicant mode
BString name(B_TRANSLATE("Pulse"));
BString message;
snprintf(message.LockBuffer(512), 512,
B_TRANSLATE("%s\n\nBy David Ramsey and Arve Hjønnevåg\n"
"Revised by Daniel Switkin\n"), name.String());
message.UnlockBuffer();
BAlert *alert = new BAlert(B_TRANSLATE("Info"),
message.String(), B_TRANSLATE("OK"));
BTextView* view = alert->TextView();
BFont font;
view->SetStylable(true);
view->GetFont(&font);
font.SetSize(18);
font.SetFace(B_BOLD_FACE);
view->SetFontAndColor(0, name.Length(), &font);
alert->SetShortcut(0, B_ESCAPE);
// Use the asynchronous version so we don't block the window's thread
alert->Go(NULL);
}
// #pragma mark -
@@ -234,7 +269,13 @@ LoadInDeskbar()
delete replicant;
delete deskbar;
if (err != B_OK) {
BAlert *alert = new BAlert(NULL, strerror(err), B_TRANSLATE("OK"));
BString message;
snprintf(message.LockBuffer(512), 512,
B_TRANSLATE("Installing in Deskbar failed\n%s"), strerror(err));
message.UnlockBuffer();
BAlert *alert = new BAlert(B_TRANSLATE("Error"),
message.String(), B_TRANSLATE("OK"));
alert->SetShortcut(0, B_ESCAPE);
alert->Go(NULL);
return false;
}
+3
View File
@@ -23,6 +23,9 @@ public:
PulseApp(int argc, char **argv);
~PulseApp();
virtual void AboutRequested();
static void ShowAbout();
Prefs* prefs;
private:
+5 -3
View File
@@ -16,7 +16,6 @@
#include <Alert.h>
#include <Catalog.h>
#include <Locale.h>
#include <syscalls.h>
@@ -128,8 +127,10 @@ void PulseView::ChangeCPUState(BMessage *message) {
if (!LastEnabledCPU(which)) {
_kern_set_cpu_enabled(which, (int)!cpu_menu_items[which]->IsMarked());
} else {
BAlert *alert = new BAlert(NULL, B_TRANSLATE("You can't disable the "
"last active CPU."), B_TRANSLATE("OK"));
BAlert *alert = new BAlert(B_TRANSLATE("Info"),
B_TRANSLATE("You can't disable the last active CPU."),
B_TRANSLATE("OK"));
alert->SetShortcut(0, B_ESCAPE);
alert->Go(NULL);
}
}
@@ -138,3 +139,4 @@ PulseView::~PulseView() {
if (popupmenu != NULL) delete popupmenu;
if (cpu_menu_items != NULL) delete cpu_menu_items;
}
+2 -6
View File
@@ -17,8 +17,8 @@
#include <Alert.h>
#include <Catalog.h>
#include <Deskbar.h>
#include <Locale.h>
#include <Screen.h>
#include <TextView.h>
#include <stdlib.h>
#include <string.h>
@@ -103,11 +103,7 @@ PulseWindow::MessageReceived(BMessage *message)
break;
}
case PV_ABOUT: {
BAlert *alert = new BAlert(B_TRANSLATE("Info"),
B_TRANSLATE("Pulse\n\nBy David Ramsey and Arve Hjønnevåg\n"
"Revised by Daniel Switkin"), B_TRANSLATE("OK"));
// Use the asynchronous version so we don't block the window's thread
alert->Go(NULL);
PulseApp::ShowAbout();
break;
}
case PV_QUIT: