Ticket #6926: activitymonitor.patch

File activitymonitor.patch, 11.1 KB (added by Karvjorm, 10 years ago)

Activity localization patch

  • src/apps/activitymonitor/ActivityMonitor.cpp

     
    1414
    1515#include "ActivityWindow.h"
    1616
     17#include <Catalog.h>
     18#include <Language.h>
     19#include <Locale.h>
     20#include <LocaleRoster.h>
    1721
    1822const char* kSignature = "application/x-vnd.Haiku-ActivityMonitor";
    1923
     
    6165/*static*/ void
    6266ActivityMonitor::ShowAbout()
    6367{
    64     BAlert *alert = new BAlert("about", "ActivityMonitor\n"
     68    BAlert *alert = new BAlert("about", B_TRANSLATE("ActivityMonitor\n"
    6569        "\twritten by Axel Dörfler\n"
    66         "\tCopyright 2008, Haiku Inc.\n", "OK");
     70        "\tCopyright 2008, Haiku Inc.\n"), B_TRANSLATE("OK"));
    6771    BTextView *view = alert->TextView();
    6872    BFont font;
    6973
  • src/apps/activitymonitor/ActivityWindow.cpp

     
    2525#include "DataSource.h"
    2626#include "SettingsWindow.h"
    2727
     28#include <Catalog.h>
     29#include <Language.h>
     30#include <Locale.h>
     31#include <LocaleRoster.h>
    2832
    2933static const uint32 kMsgAddView = 'advw';
    3034static const uint32 kMsgShowSettings = 'shst';
    3135
    3236
    3337ActivityWindow::ActivityWindow()
    34     : BWindow(BRect(100, 100, 500, 350), "ActivityMonitor", B_TITLED_WINDOW,
    35         B_ASYNCHRONOUS_CONTROLS | B_QUIT_ON_WINDOW_CLOSE)
     38    : BWindow(BRect(100, 100, 500, 350), B_TRANSLATE("ActivityMonitor"),
     39        B_TITLED_WINDOW, B_ASYNCHRONOUS_CONTROLS | B_QUIT_ON_WINDOW_CLOSE)
    3640{
    3741    BMessage settings;
    3842    _LoadSettings(settings);
     
    113117    // add menu
    114118
    115119    // "File" menu
    116     BMenu* menu = new BMenu("File");
     120    BMenu* menu = new BMenu(B_TRANSLATE("File"));
    117121    BMenuItem* item;
    118122
    119     menu->AddItem(new BMenuItem("Add graph", new BMessage(kMsgAddView)));
     123    menu->AddItem(new BMenuItem(B_TRANSLATE("Add graph"),
     124        new BMessage(kMsgAddView)));
    120125    menu->AddSeparatorItem();
    121126
    122     menu->AddItem(item = new BMenuItem("About ActivityMonitor" B_UTF8_ELLIPSIS,
     127    menu->AddItem(item = new BMenuItem(
     128        B_TRANSLATE("About ActivityMonitor" B_UTF8_ELLIPSIS),
    123129        new BMessage(B_ABOUT_REQUESTED)));
    124130    menu->AddSeparatorItem();
    125131
    126     menu->AddItem(new BMenuItem("Quit", new BMessage(B_QUIT_REQUESTED), 'Q'));
     132    menu->AddItem(new BMenuItem(B_TRANSLATE("Quit"),
     133        new BMessage(B_QUIT_REQUESTED), 'Q'));
    127134    menu->SetTargetForItems(this);
    128135    item->SetTarget(be_app);
    129136    menuBar->AddItem(menu);
    130137
    131138    // "Settings" menu
    132     menu = new BMenu("Settings");
    133     menu->AddItem(new BMenuItem("Settings" B_UTF8_ELLIPSIS,
     139    menu = new BMenu(B_TRANSLATE("Settings"));
     140    menu->AddItem(new BMenuItem(B_TRANSLATE("Settings" B_UTF8_ELLIPSIS),
    134141        new BMessage(kMsgShowSettings)));
    135142    menu->SetTargetForItems(this);
    136143    menuBar->AddItem(menu);
  • src/apps/activitymonitor/ActivityView.cpp

     
    3333#include "SystemInfo.h"
    3434#include "SystemInfoHandler.h"
    3535
     36#include <Catalog.h>
     37#include <Language.h>
     38#include <Locale.h>
     39#include <LocaleRoster.h>
    3640
    3741template<typename ObjectType>
    3842class ListAddDeleter {
     
    991995    BPopUpMenu *menu = new BPopUpMenu(B_EMPTY_STRING, false, false);
    992996    menu->SetFont(be_plain_font);
    993997
    994     BMenu* additionalMenu = new BMenu("Additional items");
     998    BMenu* additionalMenu = new BMenu(B_TRANSLATE("Additional items"));
    995999    additionalMenu->SetFont(be_plain_font);
    9961000
    9971001    SystemInfo info;
     
    10181022
    10191023    menu->AddItem(new BMenuItem(additionalMenu));
    10201024    menu->AddSeparatorItem();
    1021     menu->AddItem(new BMenuItem(fShowLegend ? "Hide legend" : "Show legend",
     1025    menu->AddItem(new BMenuItem(fShowLegend ? B_TRANSLATE("Hide legend")
     1026        : B_TRANSLATE("Show legend"),
    10221027        new BMessage(kMsgToggleLegend)));
    10231028
    10241029    menu->SetTargetForItems(this);
     
    10291034        menu->AddSeparatorItem();
    10301035        BMessage* message = new BMessage(kMsgRemoveView);
    10311036        message->AddPointer("view", this);
    1032         menu->AddItem(item = new BMenuItem("Remove graph", message));
     1037        menu->AddItem(item = new BMenuItem(B_TRANSLATE("Remove graph"),
     1038            message));
    10331039        item->SetTarget(window);
    10341040    }
    10351041
  • src/apps/activitymonitor/SettingsWindow.cpp

     
    1414#include <Slider.h>
    1515#include <String.h>
    1616
     17#include <Catalog.h>
     18#include <Language.h>
     19#include <Locale.h>
     20#include <LocaleRoster.h>
    1721
    1822static const uint32 kMsgUpdateTimeInterval = 'upti';
    1923
     
    7074
    7175        bigtime_t interval = kUpdateIntervals[level];
    7276        if ((interval % 1000) == 0)
    73             snprintf(fText, sizeof(fText), "%lld sec.", interval / 1000);
     77            snprintf(fText, sizeof(fText), B_TRANSLATE("%lld sec."), interval / 1000);
    7478        else
    75             snprintf(fText, sizeof(fText), "%lld ms", interval);
     79            snprintf(fText, sizeof(fText), B_TRANSLATE("%lld ms"), interval);
    7680
    7781        return fText;
    7882    }
     
    8589
    8690
    8791SettingsWindow::SettingsWindow(ActivityWindow* target)
    88     : BWindow(_RelativeTo(target), "Settings", B_FLOATING_WINDOW,
     92    : BWindow(_RelativeTo(target), B_TRANSLATE("Settings"), B_FLOATING_WINDOW,
    8993        B_ASYNCHRONOUS_CONTROLS | B_NOT_ZOOMABLE | B_AUTO_UPDATE_SIZE_LIMITS),
    9094    fTarget(target)
    9195{
    9296    SetLayout(new BGroupLayout(B_VERTICAL));
    9397
    94     fIntervalSlider = new IntervalSlider("Update time interval:",
     98    fIntervalSlider = new IntervalSlider(B_TRANSLATE("Update time interval:"),
    9599        new BMessage(kMsgUpdateTimeInterval), kNumUpdateIntervals);
    96100    fIntervalSlider->SetInterval(target->RefreshInterval());
    97101
  • src/apps/activitymonitor/DataSource.cpp

     
    1414
    1515#include "SystemInfo.h"
    1616
     17#include <Catalog.h>
     18#include <Language.h>
     19#include <Locale.h>
     20#include <LocaleRoster.h>
    1721
    1822const DataSource* kSources[] = {
    1923    new UsedMemoryDataSource(),
     
    286290MemoryDataSource::Print(BString& text, int64 value) const
    287291{
    288292    char buffer[32];
    289     snprintf(buffer, sizeof(buffer), "%.1f MB", value / 1048576.0);
     293    snprintf(buffer, sizeof(buffer), B_TRANSLATE("%.1f MB"),
     294        value / 1048576.0);
    290295
    291296    text = buffer;
    292297}
     
    295300const char*
    296301MemoryDataSource::Unit() const
    297302{
    298     return "MB";
     303    return B_TRANSLATE("MB");
    299304}
    300305
    301306
     
    329334const char*
    330335UsedMemoryDataSource::Label() const
    331336{
    332     return "Used memory";
     337    return B_TRANSLATE("Used memory");
    333338}
    334339
    335340
    336341const char*
    337342UsedMemoryDataSource::ShortLabel() const
    338343{
    339     return "Memory";
     344    return B_TRANSLATE("Memory");
    340345}
    341346
    342347
     
    378383const char*
    379384CachedMemoryDataSource::Label() const
    380385{
    381     return "Cached memory";
     386    return B_TRANSLATE("Cached memory");
    382387}
    383388
    384389
    385390const char*
    386391CachedMemoryDataSource::ShortLabel() const
    387392{
    388     return "Cache";
     393    return B_TRANSLATE("Cache");
    389394}
    390395
    391396
     
    430435const char*
    431436SwapSpaceDataSource::Label() const
    432437{
    433     return "Swap space";
     438    return B_TRANSLATE("Swap space");
    434439}
    435440
    436441
    437442const char*
    438443SwapSpaceDataSource::ShortLabel() const
    439444{
    440     return "Swap";
     445    return B_TRANSLATE("Swap");
    441446}
    442447
    443448
     
    485490const char*
    486491BlockCacheDataSource::Label() const
    487492{
    488     return "Block cache memory";
     493    return B_TRANSLATE("Block cache memory");
    489494}
    490495
    491496
    492497const char*
    493498BlockCacheDataSource::ShortLabel() const
    494499{
    495     return "Block cache";
     500    return B_TRANSLATE("Block cache");
    496501}
    497502
    498503
     
    532537const char*
    533538SemaphoresDataSource::Label() const
    534539{
    535     return "Semaphores";
     540    return B_TRANSLATE("Semaphores");
    536541}
    537542
    538543
    539544const char*
    540545SemaphoresDataSource::ShortLabel() const
    541546{
    542     return "Sems";
     547    return B_TRANSLATE("Sems");
    543548}
    544549
    545550
     
    586591const char*
    587592PortsDataSource::Label() const
    588593{
    589     return "Ports";
     594    return B_TRANSLATE("Ports");
    590595}
    591596
    592597
     
    633638const char*
    634639ThreadsDataSource::Label() const
    635640{
    636     return "Threads";
     641    return B_TRANSLATE("Threads");
    637642}
    638643
    639644
     
    680685const char*
    681686TeamsDataSource::Label() const
    682687{
    683     return "Teams";
     688    return B_TRANSLATE("Teams");
    684689}
    685690
    686691
     
    727732const char*
    728733RunningAppsDataSource::Label() const
    729734{
    730     return "Running applications";
     735    return B_TRANSLATE("Running applications");
    731736}
    732737
    733738
    734739const char*
    735740RunningAppsDataSource::ShortLabel() const
    736741{
    737     return "Apps";
     742    return B_TRANSLATE("Apps");
    738743}
    739744
    740745
     
    839844const char*
    840845CPUUsageDataSource::Name() const
    841846{
    842     return "CPU usage";
     847    return B_TRANSLATE("CPU usage");
    843848}
    844849
    845850
     
    868873CPUUsageDataSource::_SetCPU(int32 cpu)
    869874{
    870875    fCPU = cpu;
    871     fLabel = "CPU";
     876    fLabel = B_TRANSLATE("CPU");
    872877    if (SystemInfo().CPUCount() > 1)
    873878        fLabel << " " << cpu + 1;
    874879
    875880    fShortLabel = fLabel;
    876     fLabel << " usage";
     881    fLabel << B_TRANSLATE(" usage");
    877882
    878883    const rgb_color kColors[B_MAX_CPU_COUNT] = {
    879884        // TODO: find some better defaults...
     
    967972const char*
    968973CPUCombinedUsageDataSource::Label() const
    969974{
    970     return "CPU usage";
     975    return B_TRANSLATE("CPU usage");
    971976}
    972977
    973978
    974979const char*
    975980CPUCombinedUsageDataSource::ShortLabel() const
    976981{
    977     return "CPU";
     982    return B_TRANSLATE("CPU");
    978983}
    979984
    980985
    981986const char*
    982987CPUCombinedUsageDataSource::Name() const
    983988{
    984     return "CPU usage (combined)";
     989    return B_TRANSLATE("CPU usage (combined)");
    985990}
    986991
    987992
     
    10411046PageFaultsDataSource::Print(BString& text, int64 value) const
    10421047{
    10431048    char buffer[32];
    1044     snprintf(buffer, sizeof(buffer), "%.1f faults/s", value / 1024.0);
     1049    snprintf(buffer, sizeof(buffer), B_TRANSLATE("%.1f faults/s"), value / 1024.0);
    10451050
    10461051    text = buffer;
    10471052}
     
    10651070const char*
    10661071PageFaultsDataSource::Label() const
    10671072{
    1068     return "Page faults";
     1073    return B_TRANSLATE("Page faults");
    10691074}
    10701075
    10711076
    10721077const char*
    10731078PageFaultsDataSource::ShortLabel() const
    10741079{
    1075     return "P-faults";
     1080    return B_TRANSLATE("P-faults");
    10761081}
    10771082
    10781083
    10791084const char*
    10801085PageFaultsDataSource::Name() const
    10811086{
    1082     return "Page faults";
     1087    return B_TRANSLATE("Page faults");
    10831088}
    10841089
    10851090
     
    11421147NetworkUsageDataSource::Print(BString& text, int64 value) const
    11431148{
    11441149    char buffer[32];
    1145     snprintf(buffer, sizeof(buffer), "%.1f KB/s", value / 1024.0);
     1150    snprintf(buffer, sizeof(buffer), B_TRANSLATE("%.1f KB/s"), value / 1024.0);
    11461151
    11471152    text = buffer;
    11481153}
     
    11661171const char*
    11671172NetworkUsageDataSource::Label() const
    11681173{
    1169     return fIn ? "Receiving" : "Sending";
     1174    return fIn ? B_TRANSLATE("Receiving") : B_TRANSLATE("Sending");
    11701175}
    11711176
    11721177
     
    11801185const char*
    11811186NetworkUsageDataSource::Name() const
    11821187{
    1183     return fIn ? "Network receive" : "Network send";
     1188    return fIn ? B_TRANSLATE("Network receive") : B_TRANSLATE("Network send");
    11841189}
    11851190
    11861191
     
    12501255const char*
    12511256ClipboardSizeDataSource::Label() const
    12521257{
    1253     return fText ? "Text clipboard size" : "Raw clipboard size";
     1258    return fText ? B_TRANSLATE("Text clipboard size")
     1259        : B_TRANSLATE("Raw clipboard size");
    12541260}
    12551261
    12561262
    12571263const char*
    12581264ClipboardSizeDataSource::Unit() const
    12591265{
    1260     return "bytes"/*"KB"*/;
     1266    return B_TRANSLATE("bytes")/*"KB"*/;
    12611267}
    12621268
    12631269
     
    13041310const char*
    13051311MediaNodesDataSource::Label() const
    13061312{
    1307     return "Media nodes";
     1313    return B_TRANSLATE("Media nodes");
    13081314}
    13091315
    13101316