Ticket #6092: NetworkStatusLocalization.patch
File NetworkStatusLocalization.patch, 7.7 KB (added by , 14 years ago) |
---|
-
src/apps/networkstatus/NetworkStatusWindow.cpp
11 11 #include "NetworkStatusView.h" 12 12 13 13 #include <Application.h> 14 #include <Catalog.h> 15 #include <Locale.h> 14 16 17 #undef B_TRANSLATE_CONTEXT 18 #define B_TRANSLATE_CONTEXT "NetworkStatusWindow" 15 19 20 16 21 NetworkStatusWindow::NetworkStatusWindow() 17 : BWindow(BRect(150, 150, 249, 249), "NetworkStatus", B_TITLED_WINDOW,18 B_ NOT_ZOOMABLE | B_ASYNCHRONOUS_CONTROLS)22 : BWindow(BRect(150, 150, 249, 249), B_TRANSLATE("NetworkStatus"), 23 B_TITLED_WINDOW, B_NOT_ZOOMABLE | B_ASYNCHRONOUS_CONTROLS) 19 24 { 20 25 BView* topView = new BView(Bounds(), NULL, B_FOLLOW_ALL, B_WILL_DRAW); 21 26 topView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); -
src/apps/networkstatus/Jamfile
14 14 NetworkStatusWindow.cpp 15 15 NetworkStatusView.cpp 16 16 NetworkStatus.cpp 17 : be $(icon_libs) $(TARGET_NETWORK_LIBS) $(TARGET_LIBSUPC++)17 : be locale $(icon_libs) $(TARGET_NETWORK_LIBS) $(TARGET_LIBSUPC++) 18 18 : NetworkStatus.rdef NetworkStatusIcons.rdef 19 19 ; 20 21 DoCatalogs NetworkStatus : 22 x-vnd.Haiku-NetworkStatus 23 : 24 NetworkStatus.cpp 25 NetworkStatusWindow.cpp 26 NetworkStatusView 27 ; -
src/apps/networkstatus/NetworkStatusView.cpp
22 22 23 23 #include <Alert.h> 24 24 #include <Application.h> 25 #include <Catalog.h> 25 26 #include <Bitmap.h> 26 27 #include <Deskbar.h> 27 28 #include <Dragger.h> 28 29 #include <Drivers.h> 29 30 #include <IconUtils.h> 31 #include <Locale.h> 30 32 #include <MenuItem.h> 31 33 #include <MessageRunner.h> 32 34 #include <PopUpMenu.h> … … 41 43 #include "NetworkStatusIcons.h" 42 44 43 45 46 #undef B_TRANSLATE_CONTEXT 47 #define B_TRANSLATE_CONTEXT "NetworkStatusView" 48 49 44 50 static const char *kStatusDescriptions[] = { 45 "Unknown",46 "No link",47 "No stateful configuration",48 "Configuring",49 "Ready"51 B_TRANSLATE_MARK("Unknown"), 52 B_TRANSLATE_MARK("No link"), 53 B_TRANSLATE_MARK("No stateful configuration"), 54 B_TRANSLATE_MARK("Configuring"), 55 B_TRANSLATE_MARK("Ready") 50 56 }; 51 57 52 58 extern "C" _EXPORT BView *instantiate_deskbar_item(void); … … 314 320 if (!_PrepareRequest(request, name)) 315 321 return; 316 322 317 BString text = name; 318 text += " information:\n"; 323 BString text = NULL; 324 if (strncmp("Address", name, strlen(name)) == 0) 325 text = B_TRANSLATE("Address information:\n"); 326 327 if (strncmp("Broadcast", name, strlen(name)) == 0) 328 text = B_TRANSLATE("Broadcast information:\n"); 329 330 if (strncmp("Netmask", name, strlen(name)) == 0) 331 text = B_TRANSLATE("Netmask information:\n"); 332 319 333 size_t boldLength = text.Length(); 320 334 321 335 for (int i = 0; kInformationEntries[i].label; i++) { … … 341 355 } 342 356 343 357 text += "\n"; 344 text += kInformationEntries[i].label; 358 359 if (strncmp("Address", kInformationEntries[i].label, 360 strlen(kInformationEntries[i].label)) == 0) 361 text += B_TRANSLATE("Address"); 362 363 if (strncmp("Broadcast", kInformationEntries[i].label, 364 strlen(kInformationEntries[i].label)) == 0) 365 text += B_TRANSLATE("Broadcast"); 366 367 if (strncmp("Netmask", kInformationEntries[i].label, 368 strlen(kInformationEntries[i].label)) == 0) 369 text += B_TRANSLATE("Netmask"); 370 345 371 text += ": "; 346 372 text += address; 347 373 } 348 374 349 BAlert* alert = new BAlert(name, text.String(), "OK");375 BAlert* alert = new BAlert(name, text.String(), B_TRANSLATE("OK")); 350 376 BTextView* view = alert->TextView(); 351 377 BFont font; 352 378 … … 380 406 } 381 407 382 408 menu->AddSeparatorItem(); 383 //menu->AddItem(new BMenuItem("About NetworkStatus" B_UTF8_ELLIPSIS, 384 // new BMessage(B_ABOUT_REQUESTED))); 385 menu->AddItem(new BMenuItem("Open network preferences" B_UTF8_ELLIPSIS, 409 //menu->AddItem(new BMenuItem(B_TRANSLATE( 410 // "About NetworkStatus" B_UTF8_ELLIPSIS), 411 // new BMessage(B_ABOUT_REQUESTED))); 412 menu->AddItem(new BMenuItem(B_TRANSLATE( 413 "Open network preferences" B_UTF8_ELLIPSIS), 386 414 new BMessage(kMsgOpenNetworkPreferences))); 387 415 388 416 if (fInDeskbar) 389 menu->AddItem(new BMenuItem("Quit", new BMessage(B_QUIT_REQUESTED))); 417 menu->AddItem(new BMenuItem(B_TRANSLATE("Quit"), 418 new BMessage(B_QUIT_REQUESTED))); 390 419 menu->SetTargetForItems(this); 391 420 392 421 ConvertToScreen(&point); … … 397 426 void 398 427 NetworkStatusView::_AboutRequested() 399 428 { 400 BAlert* alert = new BAlert("about", "NetworkStatus\n" 401 "\twritten by Axel Dörfler and Hugo Santos\n" 402 "\tCopyright 2007, Haiku, Inc.\n", "OK"); 429 BString _about = B_TRANSLATE( 430 "NetworkStatus\n\twritten by %1 and Hugo Santos\n\t%2, Haiku, Inc.\n" 431 ); 432 _about.ReplaceFirst("%1", "Axel Dörfler"); 433 // Append a new developer here 434 _about.ReplaceFirst("%2", "Copyright 2007-2010"); 435 // Append a new year here 436 BAlert* alert = new BAlert("about", _about, B_TRANSLATE("OK")); 403 437 BTextView *view = alert->TextView(); 404 438 BFont font; 405 439 … … 512 546 { 513 547 status_t status = be_roster->Launch("application/x-vnd.Haiku-Network"); 514 548 if (status != B_OK && status != B_ALREADY_RUNNING) { 515 BString errorMessage( "Launching the network preflet failed.\n\n"516 " Error: ");549 BString errorMessage(B_TRANSLATE("Launching the network preflet " 550 "failed.\n\nError: ")); 517 551 errorMessage << strerror(status); 518 552 BAlert* alert = new BAlert("launch error", errorMessage.String(), 519 "OK");553 B_TRANSLATE("OK")); 520 554 521 555 // asynchronous alert in order to not block replicant host application 522 556 alert->Go(NULL); -
src/apps/networkstatus/NetworkStatus.cpp
13 13 14 14 #include <Alert.h> 15 15 #include <Application.h> 16 #include <Catalog.h> 16 17 #include <Deskbar.h> 17 18 #include <Entry.h> 19 #include <Locale.h> 18 20 19 21 #include <stdio.h> 20 22 #include <stdlib.h> 21 23 #include <string.h> 22 24 23 25 26 #undef B_TRANSLATE_CONTEXT 27 #define B_TRANSLATE_CONTEXT "NetworkStatus" 28 29 24 30 class NetworkStatus : public BApplication { 25 31 public: 26 32 NetworkStatus(); … … 34 40 35 41 bool fAutoInstallInDeskbar; 36 42 bool fQuitImmediately; 43 BCatalog fAppCatalog; 37 44 }; 38 45 39 46 … … 64 71 fAutoInstallInDeskbar(false), 65 72 fQuitImmediately(false) 66 73 { 74 be_locale->GetAppCatalog(&fAppCatalog); 67 75 } 68 76 69 77 … … 80 88 81 89 if (strcmp(argv[1], "--help") == 0 82 90 || strcmp(argv[1], "-h") == 0) { 83 printf("NetworkStatus options:\n"); 84 printf(" --deskbar automatically add replicant to Deskbar\n"); 85 printf(" --help print this info and exit\n"); 91 const char* str = B_TRANSLATE("NetworkStatus options:\n" 92 "\t--deskbar\tautomatically add replicant to Deskbar\n" 93 "\t--help\t\tprint this info and exit\n"); 94 printf(str); 86 95 fQuitImmediately = true; 87 96 return; 88 97 } … … 144 153 } 145 154 146 155 if (isDeskbarRunning && !isInstalled) { 147 BAlert* alert = new BAlert("", "Do you want NetworkStatus to live in"148 "t he Deskbar?", "Don't", "Install", NULL, B_WIDTH_AS_USUAL,149 B_ WARNING_ALERT);156 BAlert* alert = new BAlert("", B_TRANSLATE("Do you want NetworkStatus " 157 "to live in the Deskbar?"), B_TRANSLATE("Don't"), 158 B_TRANSLATE("Install"), NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT); 150 159 alert->SetShortcut(0, B_ESCAPE); 151 160 152 161 if (alert->Go() == 1) {