Ticket #6092: NetworkStatusLocalization.patch

File NetworkStatusLocalization.patch, 7.7 KB (added by Karvjorm, 14 years ago)

An updated localization patch for NetworkStatus

  • src/apps/networkstatus/NetworkStatusWindow.cpp

     
    1111#include "NetworkStatusView.h"
    1212
    1313#include <Application.h>
     14#include <Catalog.h>
     15#include <Locale.h>
    1416
     17#undef B_TRANSLATE_CONTEXT
     18#define B_TRANSLATE_CONTEXT "NetworkStatusWindow"
    1519
     20
    1621NetworkStatusWindow::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)
    1924{
    2025    BView* topView = new BView(Bounds(), NULL, B_FOLLOW_ALL, B_WILL_DRAW);
    2126    topView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
  • src/apps/networkstatus/Jamfile

     
    1414    NetworkStatusWindow.cpp
    1515    NetworkStatusView.cpp
    1616    NetworkStatus.cpp
    17     : be $(icon_libs) $(TARGET_NETWORK_LIBS) $(TARGET_LIBSUPC++)
     17    : be locale $(icon_libs) $(TARGET_NETWORK_LIBS) $(TARGET_LIBSUPC++)
    1818    : NetworkStatus.rdef NetworkStatusIcons.rdef
    1919    ;
     20
     21DoCatalogs NetworkStatus :
     22    x-vnd.Haiku-NetworkStatus
     23    :
     24    NetworkStatus.cpp
     25    NetworkStatusWindow.cpp
     26    NetworkStatusView
     27;
  • src/apps/networkstatus/NetworkStatusView.cpp

     
    2222
    2323#include <Alert.h>
    2424#include <Application.h>
     25#include <Catalog.h>
    2526#include <Bitmap.h>
    2627#include <Deskbar.h>
    2728#include <Dragger.h>
    2829#include <Drivers.h>
    2930#include <IconUtils.h>
     31#include <Locale.h>
    3032#include <MenuItem.h>
    3133#include <MessageRunner.h>
    3234#include <PopUpMenu.h>
     
    4143#include "NetworkStatusIcons.h"
    4244
    4345
     46#undef B_TRANSLATE_CONTEXT
     47#define B_TRANSLATE_CONTEXT "NetworkStatusView"
     48
     49
    4450static 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")
    5056};
    5157
    5258extern "C" _EXPORT BView *instantiate_deskbar_item(void);
     
    314320    if (!_PrepareRequest(request, name))
    315321        return;
    316322
    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
    319333    size_t boldLength = text.Length();
    320334
    321335    for (int i = 0; kInformationEntries[i].label; i++) {
     
    341355        }
    342356
    343357        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
    345371        text += ": ";
    346372        text += address;
    347373    }
    348374
    349     BAlert* alert = new BAlert(name, text.String(), "OK");
     375    BAlert* alert = new BAlert(name, text.String(), B_TRANSLATE("OK"));
    350376    BTextView* view = alert->TextView();
    351377    BFont font;
    352378
     
    380406    }
    381407
    382408    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),
    386414        new BMessage(kMsgOpenNetworkPreferences)));
    387415
    388416    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)));
    390419    menu->SetTargetForItems(this);
    391420
    392421    ConvertToScreen(&point);
     
    397426void
    398427NetworkStatusView::_AboutRequested()
    399428{
    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"));
    403437    BTextView *view = alert->TextView();
    404438    BFont font;
    405439
     
    512546{
    513547    status_t status = be_roster->Launch("application/x-vnd.Haiku-Network");
    514548    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: "));
    517551        errorMessage << strerror(status);
    518552        BAlert* alert = new BAlert("launch error", errorMessage.String(),
    519             "OK");
     553            B_TRANSLATE("OK"));
    520554
    521555        // asynchronous alert in order to not block replicant host application
    522556        alert->Go(NULL);
  • src/apps/networkstatus/NetworkStatus.cpp

     
    1313
    1414#include <Alert.h>
    1515#include <Application.h>
     16#include <Catalog.h>
    1617#include <Deskbar.h>
    1718#include <Entry.h>
     19#include <Locale.h>
    1820
    1921#include <stdio.h>
    2022#include <stdlib.h>
    2123#include <string.h>
    2224
    2325
     26#undef B_TRANSLATE_CONTEXT
     27#define B_TRANSLATE_CONTEXT "NetworkStatus"
     28
     29
    2430class NetworkStatus : public BApplication {
    2531    public:
    2632        NetworkStatus();
     
    3440
    3541                bool    fAutoInstallInDeskbar;
    3642                bool    fQuitImmediately;
     43        BCatalog        fAppCatalog;
    3744};
    3845
    3946
     
    6471      fAutoInstallInDeskbar(false),
    6572      fQuitImmediately(false)
    6673{
     74    be_locale->GetAppCatalog(&fAppCatalog);
    6775}
    6876
    6977
     
    8088
    8189    if (strcmp(argv[1], "--help") == 0
    8290        || 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);
    8695        fQuitImmediately = true;
    8796        return;
    8897    }
     
    144153    }
    145154
    146155    if (isDeskbarRunning && !isInstalled) {
    147         BAlert* alert = new BAlert("", "Do you want NetworkStatus to live in "
    148             "the 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);
    150159        alert->SetShortcut(0, B_ESCAPE);
    151160
    152161        if (alert->Go() == 1) {