Ticket #7156: bluetooth-preflet-localization-fix.patch

File bluetooth-preflet-localization-fix.patch, 8.9 KB (added by Karvjorm, 13 years ago)

A Bluetooth preflet localization fix.

  • src/preferences/bluetooth/BluetoothMain.cpp

     
    66
    77#include <Alert.h>
    88#include <Catalog.h>
    9 #include <Locale.h>
    109#include <MessageRunner.h>
    1110#include <Roster.h>
    1211
     
    3029    if (!be_roster->IsRunning(BLUETOOTH_SIGNATURE)) {
    3130
    3231        int32 choice = (new BAlert("bluetooth_server not running",
    33             "bluetooth_server has not been found running on the system."
    34             "Should be started, or stay offline", "Work offline",
    35             "Quit", "Start please", B_WIDTH_AS_USUAL, B_WARNING_ALERT))->Go();
     32            B_TRANSLATE("bluetooth_server has not been found running on the system. "
     33            "Should be started, or stay offline"), B_TRANSLATE("Work offline"),
     34            B_TRANSLATE("Quit"), B_TRANSLATE("Start please"), B_WIDTH_AS_USUAL, B_WARNING_ALERT))->Go();
    3635
    3736
    3837        switch (choice) {
  • src/preferences/bluetooth/BluetoothDeviceView.cpp

     
    1212#include <Bitmap.h>
    1313#include <Catalog.h>
    1414#include <GroupLayoutBuilder.h>
    15 #include <Locale.h>
    1615#include <SpaceLayoutItem.h>
    1716#include <StringView.h>
    1817#include <TextView.h>
     
    4039        bdaddrUtils::ToString(bdaddrUtils::NullAddress()));
    4140    fBdaddr->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT, B_ALIGN_MIDDLE));
    4241
     42    BString str1("%1: ");
     43    str1.ReplaceFirst("%1", B_TRANSLATE("Service classes"));
    4344    fClassService = new BStringView("ServiceClass",
    44         B_TRANSLATE("Service classes: "));
     45        str1.String());
    4546    fClassService->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT,
    4647        B_ALIGN_MIDDLE));
    4748
     
    118119        fName->SetText(bDevice->GetFriendlyName().String());
    119120        fBdaddr->SetText(bdaddrUtils::ToString(bDevice->GetBluetoothAddress()));
    120121
    121         BString string(B_TRANSLATE("Service classes: "));
     122        BString string("%1: ");
     123        string.ReplaceFirst("%1", B_TRANSLATE("Service classes"));
    122124        bDevice->GetDeviceClass().GetServiceClass(string);
    123125        fClassService->SetText(string.String());
    124126
     
    134136
    135137        string = "";
    136138        if (bDevice->GetProperty("hci_version", &value) == B_OK)
    137             string << "HCI ver: " << BluetoothHciVersion(value);
     139            string << B_TRANSLATE("HCI ver") << ": " << BluetoothHciVersion(value);
    138140        if (bDevice->GetProperty("hci_revision", &value) == B_OK)
    139             string << " HCI rev: " << value ;
     141            string << B_TRANSLATE(" HCI rev") << ": " << value ;
    140142
    141143        fHCIVersionProperties->SetText(string.String());
    142144
    143145        string = "";
    144146        if (bDevice->GetProperty("lmp_version", &value) == B_OK)
    145             string << "LMP ver: " << BluetoothLmpVersion(value);
     147            string << B_TRANSLATE("LMP ver") << ": " << BluetoothLmpVersion(value);
    146148        if (bDevice->GetProperty("lmp_subversion", &value) == B_OK)
    147             string << " LMP subver: " << value;
     149            string << B_TRANSLATE(" LMP subver") << ": " << value;
    148150        fLMPVersionProperties->SetText(string.String());
    149151
    150152        string = "";
    151153        if (bDevice->GetProperty("manufacturer", &value) == B_OK)
    152             string << "Manufacturer: " << BluetoothManufacturer(value);
     154            string << B_TRANSLATE("Manufacturer") << ": "
     155                << BluetoothManufacturer(value);
    153156        fManufacturerProperties->SetText(string.String());
    154157
    155158        string = "";
    156159        if (bDevice->GetProperty("acl_mtu", &value) == B_OK)
    157             string << "ACL mtu: " << value;
     160            string << B_TRANSLATE("ACL mtu") << ": " << value;
    158161        if (bDevice->GetProperty("acl_max_pkt", &value) == B_OK)
    159             string << " packets: " << value;
     162            string << B_TRANSLATE(" packets") << ": " << value;
    160163        fACLBuffersProperties->SetText(string.String());
    161164
    162165        string = "";
    163166        if (bDevice->GetProperty("sco_mtu", &value) == B_OK)
    164             string << "SCO mtu: " << value;
     167            string << B_TRANSLATE("SCO mtu") << ": " << value;
    165168        if (bDevice->GetProperty("sco_max_pkt", &value) == B_OK)
    166             string << " packets: " << value;
     169            string << B_TRANSLATE(" packets") << ": " << value;
    167170        fSCOBuffersProperties->SetText(string.String());
    168171
    169172    }
  • src/preferences/bluetooth/InquiryPanel.cpp

     
    77#include <Button.h>
    88#include <Catalog.h>
    99#include <GroupLayoutBuilder.h>
    10 #include <Locale.h>
    1110#include <ListView.h>
    1211#include <ListItem.h>
    1312#include <MessageRunner.h>
     
    9493
    9594InquiryPanel::InquiryPanel(BRect frame, LocalDevice* lDevice)
    9695    :
    97     BWindow(frame, "Bluetooth", B_FLOATING_WINDOW,
     96    BWindow(frame, B_TRANSLATE("Bluetooth"), B_FLOATING_WINDOW,
    9897    B_NOT_ZOOMABLE | B_AUTO_UPDATE_SIZE_LIMITS, B_ALL_WORKSPACES ),
    9998    fMessenger(this),
    10099    fScanning(false),
     
    252251        case kMsgSecond:
    253252            if (fScanning && scanningTime < timer) {
    254253                // TODO time formatting could use Locale Kit
    255                 BString elapsedTime = B_TRANSLATE("Remaining ");
    256254
    257255                // TODO should not be needed if SetMaxValue works...
    258256                fScanProgress->SetTo(scanningTime * 100 / timer);
     257                BString elapsedTime = B_TRANSLATE("Remaining %1 seconds");
    259258
    260                 elapsedTime << (int)(timer - scanningTime) <<
    261                     B_TRANSLATE(" seconds");
     259                BString seconds("");
     260                seconds << (int)(timer - scanningTime);
     261
     262                elapsedTime.ReplaceFirst("%1", seconds.String());
    262263                fScanProgress->SetTrailingText(elapsedTime.String());
    263264
    264265                scanningTime = scanningTime + 1;
     
    274275                    if (!labelPlaced) {
    275276
    276277                        labelPlaced = true;
    277                         BString progressText =
    278                             B_TRANSLATE("Retrieving name of ");
    279                         progressText << bdaddrUtils::ToString(fDiscoveryAgent
     278                        BString progressText(B_TRANSLATE("Retrieving name of %1"));
     279                           
     280                        BString namestr("");                       
     281                        namestr << bdaddrUtils::ToString(fDiscoveryAgent
    280282                            ->RetrieveDevices(0).ItemAt(retrievalIndex)
    281283                            ->GetBluetoothAddress());
     284                        progressText.ReplaceFirst("%1", namestr.String());
    282285                        fScanProgress->SetTrailingText(progressText.String());
    283286
    284287                    } else {
  • src/preferences/bluetooth/BluetoothSettingsView.cpp

     
    1111#include <Catalog.h>
    1212#include <GridLayoutBuilder.h>
    1313#include <GroupLayoutBuilder.h>
    14 #include <Locale.h>
    1514#include <MenuField.h>
    1615#include <MenuItem.h>
    1716#include <PopUpMenu.h>
     
    156155        case kMsgSetDeviceClassDesktop:
    157156        {
    158157            devClass.SetRecord(1, 1, 0x72);
    159             ActiveLocalDevice->SetDeviceClass(devClass);
     158            if (ActiveLocalDevice != NULL)
     159                ActiveLocalDevice->SetDeviceClass(devClass);
    160160            break;
    161161        }
    162162
    163163        case kMsgSetDeviceClassServer:
    164164        {
    165165            devClass.SetRecord(1, 2, 0x72);
    166             ActiveLocalDevice->SetDeviceClass(devClass);
     166            if (ActiveLocalDevice != NULL)
     167                ActiveLocalDevice->SetDeviceClass(devClass);
    167168            break;
    168169        }
    169170
    170171        case kMsgSetDeviceClassLaptop:
    171172        {
    172173            devClass.SetRecord(1, 3, 0x72);
    173             ActiveLocalDevice->SetDeviceClass(devClass);
     174            if (ActiveLocalDevice != NULL)
     175                ActiveLocalDevice->SetDeviceClass(devClass);
    174176            break;
    175177        }
    176178
    177179        case kMsgSetDeviceClassHandheld:
    178180        {
    179181            devClass.SetRecord(1, 4, 0x72);
    180             ActiveLocalDevice->SetDeviceClass(devClass);
     182            if (ActiveLocalDevice != NULL)
     183                ActiveLocalDevice->SetDeviceClass(devClass);
    181184            break;
    182185        }
    183186
    184187        case kMsgSetDeviceClassSmartPhone:
    185188        {
    186189            devClass.SetRecord(2, 3, 0x72);
    187             ActiveLocalDevice->SetDeviceClass(devClass);
     190            if (ActiveLocalDevice != NULL)
     191                ActiveLocalDevice->SetDeviceClass(devClass);
    188192            break;
    189193        }
    190194
  • src/preferences/bluetooth/ExtendedLocalDeviceView.cpp

     
    1212#include <Catalog.h>
    1313#include <CheckBox.h>
    1414#include <GroupLayoutBuilder.h>
    15 #include <Locale.h>
    1615#include <SpaceLayoutItem.h>
    1716#include <StringView.h>
    1817
  • src/preferences/bluetooth/RemoteDevicesView.cpp

     
    66
    77#include <Alert.h>
    88#include <Catalog.h>
    9 #include <Locale.h>
    109#include <Messenger.h>
    1110
    1211#include <Directory.h>
  • src/preferences/bluetooth/BluetoothWindow.cpp

     
    88#include <Button.h>
    99#include <Catalog.h>
    1010#include <GroupLayoutBuilder.h>
    11 #include <Locale.h>
    1211#include <Messenger.h>
    1312#include <SpaceLayoutItem.h>
    1413#include <TabView.h>