* Patch by Jorma Karvonnen updated by me : localize NetworkStatus

* Fix a small bug in LocaleRoster : a / was left out in the mimesignature. Didn't cause any harm, but it's cleaner this way.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37337 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Adrien Destugues
2010-07-02 13:03:33 +00:00
parent be8fa2fb30
commit 757e70593c
5 changed files with 84 additions and 28 deletions
+10 -1
View File
@@ -14,6 +14,15 @@ Application NetworkStatus :
NetworkStatusWindow.cpp NetworkStatusWindow.cpp
NetworkStatusView.cpp NetworkStatusView.cpp
NetworkStatus.cpp NetworkStatus.cpp
: be $(icon_libs) $(TARGET_NETWORK_LIBS) $(TARGET_LIBSUPC++) : be $(HAIKU_LOCALE_LIBS) $(icon_libs) $(TARGET_NETWORK_LIBS)
$(TARGET_LIBSUPC++)
: NetworkStatus.rdef NetworkStatusIcons.rdef : NetworkStatus.rdef NetworkStatusIcons.rdef
; ;
DoCatalogs NetworkStatus :
x-vnd.Haiku-NetworkStatus
:
NetworkStatus.cpp
NetworkStatusWindow.cpp
NetworkStatusView
;
+13 -6
View File
@@ -13,14 +13,20 @@
#include <Alert.h> #include <Alert.h>
#include <Application.h> #include <Application.h>
#include <Catalog.h>
#include <Deskbar.h> #include <Deskbar.h>
#include <Entry.h> #include <Entry.h>
#include <Locale.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#undef B_TRANSLATE_CONTEXT
#define B_TRANSLATE_CONTEXT "NetworkStatus"
class NetworkStatus : public BApplication { class NetworkStatus : public BApplication {
public: public:
NetworkStatus(); NetworkStatus();
@@ -80,9 +86,10 @@ NetworkStatus::ArgvReceived(int32 argc, char** argv)
if (strcmp(argv[1], "--help") == 0 if (strcmp(argv[1], "--help") == 0
|| strcmp(argv[1], "-h") == 0) { || strcmp(argv[1], "-h") == 0) {
printf("NetworkStatus options:\n"); const char* str = B_TRANSLATE("NetworkStatus options:\n"
printf(" --deskbar automatically add replicant to Deskbar\n"); "\t--deskbar\tautomatically add replicant to Deskbar\n"
printf(" --help print this info and exit\n"); "\t--help\t\tprint this info and exit\n");
printf(str);
fQuitImmediately = true; fQuitImmediately = true;
return; return;
} }
@@ -144,9 +151,9 @@ NetworkStatus::ReadyToRun()
} }
if (isDeskbarRunning && !isInstalled) { if (isDeskbarRunning && !isInstalled) {
BAlert* alert = new BAlert("", "Do you want NetworkStatus to live in " BAlert* alert = new BAlert("", B_TRANSLATE("Do you want NetworkStatus "
"the Deskbar?", "Don't", "Install", NULL, B_WIDTH_AS_USUAL, "to live in the Deskbar?"), B_TRANSLATE("Don't"),
B_WARNING_ALERT); B_TRANSLATE("Install"), NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT);
alert->SetShortcut(0, B_ESCAPE); alert->SetShortcut(0, B_ESCAPE);
if (alert->Go() == 1) { if (alert->Go() == 1) {
+53 -19
View File
@@ -22,11 +22,13 @@
#include <Alert.h> #include <Alert.h>
#include <Application.h> #include <Application.h>
#include <Catalog.h>
#include <Bitmap.h> #include <Bitmap.h>
#include <Deskbar.h> #include <Deskbar.h>
#include <Dragger.h> #include <Dragger.h>
#include <Drivers.h> #include <Drivers.h>
#include <IconUtils.h> #include <IconUtils.h>
#include <Locale.h>
#include <MenuItem.h> #include <MenuItem.h>
#include <MessageRunner.h> #include <MessageRunner.h>
#include <PopUpMenu.h> #include <PopUpMenu.h>
@@ -41,12 +43,16 @@
#include "NetworkStatusIcons.h" #include "NetworkStatusIcons.h"
#undef B_TRANSLATE_CONTEXT
#define B_TRANSLATE_CONTEXT "NetworkStatusView"
static const char *kStatusDescriptions[] = { static const char *kStatusDescriptions[] = {
"Unknown", B_TRANSLATE_MARK("Unknown"),
"No link", B_TRANSLATE_MARK("No link"),
"No stateful configuration", B_TRANSLATE_MARK("No stateful configuration"),
"Configuring", B_TRANSLATE_MARK("Configuring"),
"Ready" B_TRANSLATE_MARK("Ready")
}; };
extern "C" _EXPORT BView *instantiate_deskbar_item(void); extern "C" _EXPORT BView *instantiate_deskbar_item(void);
@@ -314,8 +320,16 @@ NetworkStatusView::_ShowConfiguration(BMessage* message)
if (!_PrepareRequest(request, name)) if (!_PrepareRequest(request, name))
return; return;
BString text = name; BString text = NULL;
text += " information:\n"; if (strncmp("Address", name, strlen(name)) == 0)
text = B_TRANSLATE("Address information:\n");
if (strncmp("Broadcast", name, strlen(name)) == 0)
text = B_TRANSLATE("Broadcast information:\n");
if (strncmp("Netmask", name, strlen(name)) == 0)
text = B_TRANSLATE("Netmask information:\n");
size_t boldLength = text.Length(); size_t boldLength = text.Length();
for (int i = 0; kInformationEntries[i].label; i++) { for (int i = 0; kInformationEntries[i].label; i++) {
@@ -341,12 +355,24 @@ NetworkStatusView::_ShowConfiguration(BMessage* message)
} }
text += "\n"; text += "\n";
text += kInformationEntries[i].label;
if (strncmp("Address", kInformationEntries[i].label,
strlen(kInformationEntries[i].label)) == 0)
text += B_TRANSLATE("Address");
if (strncmp("Broadcast", kInformationEntries[i].label,
strlen(kInformationEntries[i].label)) == 0)
text += B_TRANSLATE("Broadcast");
if (strncmp("Netmask", kInformationEntries[i].label,
strlen(kInformationEntries[i].label)) == 0)
text += B_TRANSLATE("Netmask");
text += ": "; text += ": ";
text += address; text += address;
} }
BAlert* alert = new BAlert(name, text.String(), "OK"); BAlert* alert = new BAlert(name, text.String(), B_TRANSLATE("OK"));
BTextView* view = alert->TextView(); BTextView* view = alert->TextView();
BFont font; BFont font;
@@ -380,13 +406,16 @@ NetworkStatusView::MouseDown(BPoint point)
} }
menu->AddSeparatorItem(); menu->AddSeparatorItem();
//menu->AddItem(new BMenuItem("About NetworkStatus" B_UTF8_ELLIPSIS, //menu->AddItem(new BMenuItem(B_TRANSLATE(
// new BMessage(B_ABOUT_REQUESTED))); // "About NetworkStatus" B_UTF8_ELLIPSIS),
menu->AddItem(new BMenuItem("Open network preferences" B_UTF8_ELLIPSIS, // new BMessage(B_ABOUT_REQUESTED)));
menu->AddItem(new BMenuItem(B_TRANSLATE(
"Open network preferences" B_UTF8_ELLIPSIS),
new BMessage(kMsgOpenNetworkPreferences))); new BMessage(kMsgOpenNetworkPreferences)));
if (fInDeskbar) if (fInDeskbar)
menu->AddItem(new BMenuItem("Quit", new BMessage(B_QUIT_REQUESTED))); menu->AddItem(new BMenuItem(B_TRANSLATE("Quit"),
new BMessage(B_QUIT_REQUESTED)));
menu->SetTargetForItems(this); menu->SetTargetForItems(this);
ConvertToScreen(&point); ConvertToScreen(&point);
@@ -397,9 +426,14 @@ NetworkStatusView::MouseDown(BPoint point)
void void
NetworkStatusView::_AboutRequested() NetworkStatusView::_AboutRequested()
{ {
BAlert* alert = new BAlert("about", "NetworkStatus\n" BString _about = B_TRANSLATE(
"\twritten by Axel Dörfler and Hugo Santos\n" "NetworkStatus\n\twritten by %1 and Hugo Santos\n\t%2, Haiku, Inc.\n"
"\tCopyright 2007, Haiku, Inc.\n", "OK"); );
_about.ReplaceFirst("%1", "Axel Dörfler");
// Append a new developer here
_about.ReplaceFirst("%2", "Copyright 2007-2010");
// Append a new year here
BAlert* alert = new BAlert("about", _about, B_TRANSLATE("OK"));
BTextView *view = alert->TextView(); BTextView *view = alert->TextView();
BFont font; BFont font;
@@ -512,11 +546,11 @@ NetworkStatusView::_OpenNetworksPreferences()
{ {
status_t status = be_roster->Launch("application/x-vnd.Haiku-Network"); status_t status = be_roster->Launch("application/x-vnd.Haiku-Network");
if (status != B_OK && status != B_ALREADY_RUNNING) { if (status != B_OK && status != B_ALREADY_RUNNING) {
BString errorMessage("Launching the network preflet failed.\n\n" BString errorMessage(B_TRANSLATE("Launching the network preflet "
"Error: "); "failed.\n\nError: "));
errorMessage << strerror(status); errorMessage << strerror(status);
BAlert* alert = new BAlert("launch error", errorMessage.String(), BAlert* alert = new BAlert("launch error", errorMessage.String(),
"OK"); B_TRANSLATE("OK"));
// asynchronous alert in order to not block replicant host application // asynchronous alert in order to not block replicant host application
alert->Go(NULL); alert->Go(NULL);
@@ -11,11 +11,16 @@
#include "NetworkStatusView.h" #include "NetworkStatusView.h"
#include <Application.h> #include <Application.h>
#include <Catalog.h>
#include <Locale.h>
#undef B_TRANSLATE_CONTEXT
#define B_TRANSLATE_CONTEXT "NetworkStatusWindow"
NetworkStatusWindow::NetworkStatusWindow() NetworkStatusWindow::NetworkStatusWindow()
: BWindow(BRect(150, 150, 249, 249), "NetworkStatus", B_TITLED_WINDOW, : BWindow(BRect(150, 150, 249, 249), B_TRANSLATE("NetworkStatus"),
B_NOT_ZOOMABLE | B_ASYNCHRONOUS_CONTROLS) B_TITLED_WINDOW, B_NOT_ZOOMABLE | B_ASYNCHRONOUS_CONTROLS)
{ {
BView* topView = new BView(Bounds(), NULL, B_FOLLOW_ALL, B_WILL_DRAW); BView* topView = new BView(Bounds(), NULL, B_FOLLOW_ALL, B_WILL_DRAW);
topView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); topView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
+1
View File
@@ -461,6 +461,7 @@ BLocaleRoster::GetCatalog(BCatalog* catalog, vint32* catalogInitStatus)
char* stripSignature = objectSignature; char* stripSignature = objectSignature;
while(*stripSignature != '/') while(*stripSignature != '/')
stripSignature ++; stripSignature ++;
stripSignature ++;
log_team(LOG_DEBUG, log_team(LOG_DEBUG,
"Image %s (address %x) requested catalog with mimetype %s", "Image %s (address %x) requested catalog with mimetype %s",