Ticket #7347: pulse-localization-fix.patch

File pulse-localization-fix.patch, 8.4 KB (added by Karvjorm, 13 years ago)

A clean up and localization fix for the Pulse application

  • src/apps/pulse/ConfigView.cpp

     
    1616
    1717#include <Catalog.h>
    1818#include <CheckBox.h>
    19 #include <Locale.h>
    2019#include <RadioButton.h>
    2120#include <TextControl.h>
    2221
  • src/apps/pulse/MiniPulseView.cpp

     
    1111#include "MiniPulseView.h"
    1212#include "Common.h"
    1313#include <Catalog.h>
    14 #include <Locale.h>
    1514#include <interface/Window.h>
    1615
    1716#undef B_TRANSLATE_CONTEXT
  • src/apps/pulse/PrefsWindow.cpp

     
    1616
    1717#include <Catalog.h>
    1818#include <Button.h>
    19 #include <Locale.h>
    2019#include <TabView.h>
    2120#include <TextControl.h>
    2221
  • src/apps/pulse/DeskbarPulseView.cpp

     
    1515#include <Catalog.h>
    1616#include <interface/Deskbar.h>
    1717#include <interface/Alert.h>
    18 #include <Locale.h>
    1918#include <Roster.h>
    2019#include <stdlib.h>
    2120#include <string.h>
    2221#include <stdio.h>
     22#include <TextView.h>
    2323
    2424#undef B_TRANSLATE_CONTEXT
    2525#define B_TRANSLATE_CONTEXT "DeskbarPulseView"
     
    124124            prefswindow->Show();
    125125            break;
    126126        case PV_ABOUT: {
     127            BString msgStr = B_TRANSLATE("Pulse\n\nBy David Ramsey and Arve Hjønnevåg\n"
     128                "Revised by Daniel Switkin");
     129            msgStr << "\n";
    127130            BAlert *alert = new BAlert(B_TRANSLATE("Info"),
    128                 B_TRANSLATE("Pulse\n\nBy David Ramsey and Arve Hjønnevåg\n"
    129                 "Revised by Daniel Switkin"), B_TRANSLATE("OK"));
     131                msgStr.String(), B_TRANSLATE("OK"));
     132            BTextView* view = alert->TextView();
     133            BFont font;
     134                       
     135            view->SetStylable(true);           
     136            view->GetFont(&font);
     137           
     138            font.SetSize(18);
     139            font.SetFace(B_BOLD_FACE);
     140            view->SetFontAndColor(0, strlen(B_TRANSLATE("Pulse")), &font);
     141            alert->SetShortcut(0, B_ESCAPE);
    130142            alert->Go(NULL);
    131143            break;
    132144        }
     
    179191        sprintf(temp, B_TRANSLATE("Remove(): %s"), strerror(err));
    180192        BAlert *alert = new BAlert(B_TRANSLATE("Info"), temp,
    181193            B_TRANSLATE("OK"));
     194        alert->SetShortcut(0, B_ESCAPE);
    182195        alert->Go(NULL);
    183196    }
    184197    delete deskbar;
  • src/apps/pulse/PulseWindow.cpp

     
    1717#include <Alert.h>
    1818#include <Catalog.h>
    1919#include <Deskbar.h>
    20 #include <Locale.h>
    2120#include <Screen.h>
     21#include <TextView.h>
    2222
    2323#include <stdlib.h>
    2424#include <string.h>
     
    2828
    2929
    3030PulseWindow::PulseWindow(BRect rect) :
    31     BWindow(rect, "Pulse", B_TITLED_WINDOW, B_NOT_RESIZABLE | B_NOT_ZOOMABLE)
     31    BWindow(rect, B_TRANSLATE("Pulse"), B_TITLED_WINDOW, B_NOT_RESIZABLE | B_NOT_ZOOMABLE)
    3232{
    3333    SetPulseRate(200000);
    34 
    35     SetTitle(B_TRANSLATE("Pulse"));
    3634   
    3735    PulseApp *pulseapp = (PulseApp *)be_app;
    3836    BRect bounds = Bounds();
     
    103101            break;
    104102        }
    105103        case PV_ABOUT: {
     104            BString msgStr = B_TRANSLATE("Pulse\n\nBy David Ramsey and Arve "
     105                "Hjønnevåg\nRevised by Daniel Switkin");
     106            msgStr << "\n";
    106107            BAlert *alert = new BAlert(B_TRANSLATE("Info"),
    107                 B_TRANSLATE("Pulse\n\nBy David Ramsey and Arve Hjønnevåg\n"
    108                 "Revised by Daniel Switkin"), B_TRANSLATE("OK"));
     108                msgStr.String(), B_TRANSLATE("OK"));
     109            BTextView* view = alert->TextView();
     110            BFont font;
     111           
     112            view->SetStylable(true);
     113           
     114            view->GetFont(&font);
     115            font.SetSize(18);
     116            font.SetFace(B_BOLD_FACE);
     117            view->SetFontAndColor(0, strlen(B_TRANSLATE("Pulse")), &font);
     118            alert->SetShortcut(0, B_ESCAPE);
    109119            // Use the asynchronous version so we don't block the window's thread
    110120            alert->Go(NULL);
    111121            break;
  • src/apps/pulse/CPUButton.cpp

     
    1616#include <Alert.h>
    1717#include <Catalog.h>
    1818#include <Dragger.h>
    19 #include <Locale.h>
    2019#include <PopUpMenu.h>
    21 
     20#include <TextView.h>
    2221#include <ViewPrivate.h>
    2322
    2423#include <syscalls.h>
     
    241240    if (!LastEnabledCPU(fCPU)) {
    242241        _kern_set_cpu_enabled(fCPU, Value());
    243242    } else {
    244         BAlert *alert = new BAlert(NULL, B_TRANSLATE("You can't disable the "
    245             "last active CPU."), B_TRANSLATE("OK"));
     243        BString msgStr = B_TRANSLATE("You can't disable the last active CPU.");
     244        msgStr << "\n";
     245        BAlert *alert = new BAlert(B_TRANSLATE("Error"),
     246            msgStr.String(), B_TRANSLATE("OK"));
     247        alert->SetShortcut(0, B_ESCAPE);
    246248        alert->Go(NULL);
    247249        SetValue(!Value());
    248250    }
     
    276278{
    277279    switch (message->what) {
    278280        case B_ABOUT_REQUESTED: {
     281            BString msgStr = B_TRANSLATE("Pulse\n\nBy David Ramsey and Arve "
     282                "Hjønnevåg\nRevised by Daniel Switkin");
     283            msgStr << "\n";
    279284            BAlert *alert = new BAlert(B_TRANSLATE("Info"),
    280                 B_TRANSLATE("Pulse\n\nBy David Ramsey and Arve Hjønnevåg\n"
    281                 "Revised by Daniel Switkin"), B_TRANSLATE("OK"));
     285                msgStr.String(), B_TRANSLATE("OK"));
     286            BTextView* view = alert->TextView();
     287            BFont font;
     288           
     289            view->SetStylable(true);
     290           
     291            view->GetFont(&font);
     292            font.SetSize(18);
     293            font.SetFace(B_BOLD_FACE);
     294            view->SetFontAndColor(0, strlen(B_TRANSLATE("Pulse")), &font);
     295            alert->SetShortcut(0, B_ESCAPE);
     296
    282297            // Use the asynchronous version so we don't block the window's thread
    283298            alert->Go(NULL);
    284299            break;
  • src/apps/pulse/PulseView.cpp

     
    1616
    1717#include <Alert.h>
    1818#include <Catalog.h>
    19 #include <Locale.h>
    2019
    2120#include <syscalls.h>
    2221
     
    128127    if (!LastEnabledCPU(which)) {
    129128        _kern_set_cpu_enabled(which, (int)!cpu_menu_items[which]->IsMarked());
    130129    } else {
    131         BAlert *alert = new BAlert(NULL, B_TRANSLATE("You can't disable the "
    132             "last active CPU."), B_TRANSLATE("OK"));
     130        BString msgStr = B_TRANSLATE("You can't disable the last active CPU.");
     131        msgStr << "\n";
     132        BAlert *alert = new BAlert(B_TRANSLATE("Error"),
     133            msgStr.String(), B_TRANSLATE("OK"));
     134        alert->SetShortcut(0, B_ESCAPE);
    133135        alert->Go(NULL);
    134136    }
    135137}
  • src/apps/pulse/Jamfile

     
    4040    PrefsWindow.cpp
    4141    PulseWindow.cpp
    4242;
     43
     44AddCatalogEntryAttribute Pulse
     45    :
     46    x-vnd.Haiku-Pulse:PulseWindow:Pulse
     47;
     48
  • src/apps/pulse/PulseApp.cpp

     
    2121#include <Alert.h>
    2222#include <Catalog.h>
    2323#include <Deskbar.h>
    24 #include <Locale.h>
    2524#include <Rect.h>
    2625
    2726#include <syscalls.h>
     
    234233    delete replicant;
    235234    delete deskbar;
    236235    if (err != B_OK) {
    237         BAlert *alert = new BAlert(NULL, strerror(err), B_TRANSLATE("OK"));
     236        BAlert *alert = new BAlert(B_TRANSLATE("Error"), strerror(err), B_TRANSLATE("OK"));
     237        alert->SetShortcut(0, B_ESCAPE);
    238238        alert->Go(NULL);
    239239        return false;
    240240    }
  • src/apps/pulse/NormalPulseView.cpp

     
    1616#include <Catalog.h>
    1717#include <Bitmap.h>
    1818#include <Dragger.h>
    19 #include <Locale.h>
    2019#include <Window.h>
    2120
    2221#include <stdlib.h>
     
    203202    char buffer[64];
    204203    int32 cpuSpeed = get_rounded_cpu_speed();
    205204    if (cpuSpeed > 1000 && (cpuSpeed % 10) == 0)
    206         snprintf(buffer, sizeof(buffer), "%.2f GHz", cpuSpeed / 1000.0f);
     205        snprintf(buffer, sizeof(buffer), B_TRANSLATE("%.2f GHz"), cpuSpeed / 1000.0f);
    207206    else
    208         snprintf(buffer, sizeof(buffer), "%ld MHz", cpuSpeed);
     207        snprintf(buffer, sizeof(buffer), B_TRANSLATE("%ld MHz"), cpuSpeed);
    209208   
    210209    // We can't assume anymore that a CPU clock speed is always static.
    211210    // Let's compute the best font size for the CPU speed string each time...