Ticket #5912: devicesLocalization.patch
File devicesLocalization.patch, 17.0 KB (added by , 14 years ago) |
---|
-
src/apps/devices/Device.cpp
9 9 10 10 #include "Device.h" 11 11 12 #include <Catalog.h> 13 #include <Locale.h> 12 14 #include <iostream> 13 15 16 #undef B_TRANSLATE_CONTEXT 17 #define B_TRANSLATE_CONTEXT "Device" 14 18 15 19 // This list comes from the pciid list, except for the last one 16 20 const char* kCategoryString[] = { 17 "Unclassified device",// 0x0018 "Mass storage controller",// 0x0119 "Network controller", // 0x0220 "Display controller",// 0x0321 "Multimedia controller",// 0x0422 "Memory controller",// 0x0523 "Bridge",// 0x0624 "Communication controller",// 0x0725 "Generic system peripheral",// 0x0826 "Input device controller",// 0x0927 "Docking station",// 0x0a28 "Processor",// 0x0b29 "Serial bus controller",// 0x0c30 "Wireless controller",// 0x0d31 "Intelligent controller",// 0x0e32 "Satellite communications controller",// 0x0f33 "Encryption controller",// 0x1034 "Signal processing controller",// 0x1135 "Computer" // 0x12 (added later)21 B_TRANSLATE_MARK("Unclassified device"), // 0x00 22 B_TRANSLATE_MARK("Mass storage controller"), // 0x01 23 B_TRANSLATE_MARK("Network controller"), // 0x02 24 B_TRANSLATE_MARK("Display controller"), // 0x03 25 B_TRANSLATE_MARK("Multimedia controller"), // 0x04 26 B_TRANSLATE_MARK("Memory controller"), // 0x05 27 B_TRANSLATE_MARK("Bridge"), // 0x06 28 B_TRANSLATE_MARK("Communication controller"), // 0x07 29 B_TRANSLATE_MARK("Generic system peripheral"), // 0x08 30 B_TRANSLATE_MARK("Input device controller"), // 0x09 31 B_TRANSLATE_MARK("Docking station"), // 0x0a 32 B_TRANSLATE_MARK("Processor"), // 0x0b 33 B_TRANSLATE_MARK("Serial bus controller"), // 0x0c 34 B_TRANSLATE_MARK("Wireless controller"), // 0x0d 35 B_TRANSLATE_MARK("Intelligent controller"), // 0x0e 36 B_TRANSLATE_MARK("Satellite communications controller"),// 0x0f 37 B_TRANSLATE_MARK("Encryption controller"), // 0x10 38 B_TRANSLATE_MARK("Signal processing controller"), // 0x11 39 B_TRANSLATE_MARK("Computer") // 0x12 (added later) 36 40 }; 37 41 38 42 … … 71 75 Device::GetBasicAttributes() 72 76 { 73 77 Attributes attributes; 74 attributes.push_back(Attribute("Device name:", GetName())); 75 attributes.push_back(Attribute("Manufacturer:", GetManufacturer())); 78 BString _unknown = B_TRANSLATE("unknown"); 79 if (GetName() == "unknown") 80 attributes.push_back(Attribute("Device name:", _unknown)); 81 else 82 attributes.push_back(Attribute("Device name:", GetName())); 83 if (GetManufacturer() == "unknown") 84 attributes.push_back(Attribute("Manufacturer:", _unknown)); 85 else 86 attributes.push_back(Attribute("Manufacturer:", GetManufacturer())); 76 87 return attributes; 77 88 } 78 89 … … 101 112 BString 102 113 Device::GetBasicStrings() 103 114 { 104 BString str; 105 str << "Device Name\t\t\t\t: " << GetName() << "\n"; 106 str << "Manufacturer\t\t\t: " << GetManufacturer() << "\n"; 107 str << "Driver used\t\t\t\t: " << GetDriverUsed() << "\n"; 108 str << "Device paths\t: " << GetDevPathsPublished(); 115 BString _unknown = B_TRANSLATE("unknown"); 116 BString str = B_TRANSLATE("Device Name\t\t\t\t: %1\n" 117 "Manufacturer\t\t\t: %2\n" 118 "Driver used\t\t\t\t: %3\n" 119 "Device paths\t: %4\n"); 120 if (GetName() == "unknown") 121 str.ReplaceFirst("%1", _unknown); 122 else 123 str.ReplaceFirst("%1", GetName()); 124 if (GetManufacturer() == "unknown") 125 str.ReplaceFirst("%2", _unknown); 126 else 127 str.ReplaceFirst("%2", GetManufacturer()); 128 if (GetDriverUsed() == "unknown") 129 str.ReplaceFirst("%3", _unknown); 130 else 131 str.ReplaceFirst("%3", GetDriverUsed()); 132 if (GetDevPathsPublished() == "unknown") 133 str.ReplaceFirst("%4", _unknown); 134 else 135 str.ReplaceFirst("%4", GetDevPathsPublished()); 109 136 return str; 110 137 } 111 138 112 139 BString 113 140 Device::GetBusStrings() 114 141 { 115 return "None";142 return B_TRANSLATE("None"); 116 143 } 117 144 118 145 … … 126 153 } 127 154 return str; 128 155 } 156 157 158 BString 159 Device::GetBusTabName() 160 { 161 return B_TRANSLATE("Bus Information"); 162 } -
src/apps/devices/DevicePCI.h
20 20 virtual BString GetBusStrings(); 21 21 virtual void InitFromAttributes(); 22 22 23 virtual BString GetBusTabName() 24 { return "PCI Information"; } 23 virtual BString GetBusTabName(); 25 24 26 25 private: 27 26 uint16 fClassBaseId; -
src/apps/devices/PropertyListPlain.cpp
9 9 10 10 #include "PropertyListPlain.h" 11 11 12 #include <Catalog.h> 12 13 #include <GridLayout.h> 13 14 #include <GridLayoutBuilder.h> 14 15 #include <GroupLayout.h> 15 16 #include <GroupLayoutBuilder.h> 17 #include <Locale.h> 16 18 #include <Message.h> 17 19 #include <SpaceLayoutItem.h> 18 20 #include <String.h> … … 20 22 21 23 #include "Device.h" 22 24 25 #undef B_TRANSLATE_CONTEXT 26 #define B_TRANSLATE_CONTEXT "PropertyListPlain" 23 27 24 28 PropertyListPlain::PropertyListPlain(const char* name) 25 29 : … … 48 52 49 53 BString tempViewName(name); 50 54 BStringView *nameView = new BStringView(tempViewName.String(), name); 51 tempViewName.Append( "Value");55 tempViewName.Append(B_TRANSLATE("Value")); 52 56 BStringView *valueView = new BStringView(tempViewName.String(), value); 53 57 54 58 nameView->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT, -
src/apps/devices/Device.h
86 86 virtual BString GetBusStrings(); 87 87 virtual BString GetAllStrings(); 88 88 89 virtual BString GetBusTabName() 90 { return "Bus Information"; } 89 virtual BString GetBusTabName(); 91 90 92 91 virtual Attribute GetAttribute(const BString& name) 93 92 { return Attribute(name.String(), -
src/apps/devices/DevicesApplication.cpp
8 8 9 9 #include <Alert.h> 10 10 #include <Application.h> 11 #include <Catalog.h> 12 #include <Locale.h> 11 13 #include <TextView.h> 12 14 13 15 #include "DevicesView.h" 14 16 17 #undef B_TRANSLATE_CONTEXT 18 #define B_TRANSLATE_CONTEXT "DevicesApplication" 15 19 16 20 class DevicesApplication : public BApplication { 17 21 public: … … 50 54 void 51 55 DevicesApplication::ShowAbout() 52 56 { 53 BAlert* alert = new BAlert("about", "Devices\n" 54 "\twritten by Pieter Panman\n" 55 "\n" 56 "\tBased on listdev by Jérôme Duval\n" 57 BString str1 = B_TRANSLATE("Devices\n" 58 "\twritten by %1\n\n" 59 "\tBased on listdev by %2\n" 57 60 "\tand the previous Devices preference\n" 58 "\tby Jérôme Duval and Sikosis\n" 59 "\tCopyright 2009, Haiku, Inc.\n", "OK"); 61 "\tby %3 and %4\n" 62 "\tCopyright %5, Haiku, Inc.\n"); 63 str1.ReplaceFirst("%1", "Pieter Panman"); 64 str1.ReplaceFirst("%2", "Jérôme Duval"); 65 str1.ReplaceFirst("%3", "Jérôme Duval"); 66 str1.ReplaceFirst("%4", "Sikosis"); 67 str1.ReplaceFirst("%5", "2009"); 68 BAlert* alert = new BAlert("about", str1, B_TRANSLATE("OK")); 60 69 BTextView* view = alert->TextView(); 61 70 BFont font; 62 71 … … 73 82 74 83 DevicesWindow::DevicesWindow() 75 84 : 76 BWindow(BRect(50, 50, 750, 550), "Devices", B_TITLED_WINDOW,85 BWindow(BRect(50, 50, 750, 550), B_TRANSLATE("Devices"), B_TITLED_WINDOW, 77 86 B_ASYNCHRONOUS_CONTROLS | B_AUTO_UPDATE_SIZE_LIMITS 78 87 | B_QUIT_ON_WINDOW_CLOSE) 79 88 { -
src/apps/devices/DevicesView.cpp
8 8 9 9 10 10 #include <Application.h> 11 #include <Catalog.h> 12 #include <Locale.h> 11 13 #include <MenuBar.h> 12 14 13 15 #include <iostream> 14 16 15 17 #include "DevicesView.h" 16 18 19 #undef B_TRANSLATE_CONTEXT 20 #define B_TRANSLATE_CONTEXT "DevicesView" 17 21 18 22 DevicesView::DevicesView(const BRect& rect) 19 23 : BView(rect, "DevicesView", B_FOLLOW_ALL, B_WILL_DRAW | B_FRAME_EVENTS) … … 30 34 SetLayout(new BGroupLayout(B_VERTICAL)); 31 35 32 36 BMenuBar* menuBar = new BMenuBar("menu"); 33 BMenu* menu = new BMenu( "Devices");37 BMenu* menu = new BMenu(B_TRANSLATE("Devices")); 34 38 BMenuItem* item; 35 menu->AddItem(new BMenuItem("Refresh devices", new BMessage(kMsgRefresh), 'R')); 36 menu->AddItem(item = new BMenuItem("Report compatibility", 39 menu->AddItem(new BMenuItem(B_TRANSLATE("Refresh devices"), 40 new BMessage(kMsgRefresh), 'R')); 41 menu->AddItem(item = new BMenuItem(B_TRANSLATE("Report compatibility"), 37 42 new BMessage(kMsgReportCompatibility))); 38 43 item->SetEnabled(false); 39 menu->AddItem(item = new BMenuItem("Generate system information", 44 menu->AddItem(item = new BMenuItem( 45 B_TRANSLATE("Generate system information"), 40 46 new BMessage(kMsgGenerateSysInfo))); 41 47 item->SetEnabled(false); 42 48 menu->AddSeparatorItem(); 43 menu->AddItem(item = new BMenuItem("About Devices" B_UTF8_ELLIPSIS, 49 menu->AddItem(item = new BMenuItem( 50 B_TRANSLATE("About Devices" B_UTF8_ELLIPSIS), 44 51 new BMessage(B_ABOUT_REQUESTED))); 45 52 menu->AddSeparatorItem(); 46 menu->AddItem(new BMenuItem("Quit", new BMessage(B_QUIT_REQUESTED), 'Q')); 53 menu->AddItem(new BMenuItem(B_TRANSLATE("Quit"), 54 new BMessage(B_QUIT_REQUESTED), 'Q')); 47 55 menu->SetTargetForItems(this); 48 56 item->SetTarget(be_app); 49 57 menuBar->AddItem(menu); … … 60 68 // why? Bug? In scrollview or in outlinelistview? 61 69 62 70 BPopUpMenu* orderByPopupMenu = new BPopUpMenu("orderByMenu"); 63 BMenuItem* byCategory = new BMenuItem( "Category",71 BMenuItem* byCategory = new BMenuItem(B_TRANSLATE("Category"), 64 72 new BMessage(kMsgOrderCategory)); 65 BMenuItem* byConnection = new BMenuItem( "Connection",73 BMenuItem* byConnection = new BMenuItem(B_TRANSLATE("Connection"), 66 74 new BMessage(kMsgOrderConnection)); 67 75 byCategory->SetMarked(true); 68 76 fOrderBy = byCategory->IsMarked() ? ORDER_BY_CATEGORY : 69 77 ORDER_BY_CONNECTION; 70 78 orderByPopupMenu->AddItem(byCategory); 71 79 orderByPopupMenu->AddItem(byConnection); 72 fOrderByMenu = new BMenuField( "Order by:", orderByPopupMenu);80 fOrderByMenu = new BMenuField(B_TRANSLATE("Order by:"), orderByPopupMenu); 73 81 74 82 fTabView = new BTabView("fTabView", B_WIDTH_FROM_LABEL); 75 83 76 84 fBasicTab = new BTab(); 77 85 fBasicView = new PropertyListPlain("basicView"); 78 86 fTabView->AddTab(fBasicView, fBasicTab); 79 fBasicTab->SetLabel( "Basic information");87 fBasicTab->SetLabel(B_TRANSLATE("Basic information")); 80 88 81 89 fDeviceTypeTab = new BTab(); 82 90 fBusView = new PropertyListPlain("busView"); 83 91 fTabView->AddTab(fBusView, fDeviceTypeTab); 84 fDeviceTypeTab->SetLabel( "Bus");92 fDeviceTypeTab->SetLabel(B_TRANSLATE("Bus")); 85 93 86 94 fDetailedTab = new BTab(); 87 95 fAttributesView = new PropertyList("attributesView"); 88 96 fTabView->AddTab(fAttributesView, fDetailedTab); 89 fDetailedTab->SetLabel( "Detailed");97 fDetailedTab->SetLabel(B_TRANSLATE("Detailed")); 90 98 91 99 AddChild(BGroupLayoutBuilder(B_VERTICAL,0) 92 100 .Add(menuBar) … … 269 277 attrString << attr.value.ui64; 270 278 break; 271 279 default: 272 attrString << "Raw data";280 attrString << B_TRANSLATE("Raw data"); 273 281 } 274 282 attributes.push_back(Attribute(attr.name, attrString)); 275 283 } … … 279 287 // Devices Root 280 288 if (attributes[i].fName == "device/pretty name" 281 289 && attributes[i].fValue == "Devices Root") { 282 newDevice = new Device(parent, BUS_NONE, CAT_COMPUTER, "Computer"); 290 newDevice = new Device(parent, BUS_NONE, CAT_COMPUTER, 291 B_TRANSLATE("Computer")); 283 292 break; 284 293 } 285 294 286 295 // PCI bus 287 296 if (attributes[i].fName == "device/pretty name" 288 297 && attributes[i].fValue == "PCI") { 289 newDevice = new Device(parent, BUS_PCI, CAT_BUS, "PCI bus"); 298 newDevice = new Device(parent, BUS_PCI, CAT_BUS, 299 B_TRANSLATE("PCI bus")); 290 300 break; 291 301 } 292 302 293 303 // ISA bus 294 304 if (attributes[i].fName == "device/bus" 295 305 && attributes[i].fValue == "isa") { 296 newDevice = new Device(parent, BUS_ISA, CAT_BUS, "ISA bus"); 306 newDevice = new Device(parent, BUS_ISA, CAT_BUS, 307 B_TRANSLATE("ISA bus")); 297 308 break; 298 309 } 299 310 … … 306 317 } 307 318 308 319 if (newDevice == NULL) { 309 newDevice = new Device(parent, BUS_NONE, CAT_NONE, "Unknown device"); 320 newDevice = new Device(parent, BUS_NONE, CAT_NONE, 321 B_TRANSLATE("Unknown device")); 310 322 } 311 323 312 324 // Add its attributes to the device, initialize it and add to the list. -
src/apps/devices/PropertyList.cpp
9 9 10 10 #include "PropertyList.h" 11 11 12 #include <Catalog.h> 12 13 #include <ColumnTypes.h> 14 #include <Locale.h> 13 15 14 16 //#include <stdio.h> 15 17 18 #undef B_TRANSLATE_CONTEXT 19 #define B_TRANSLATE_CONTEXT "PropertyList" 16 20 17 21 PropertyRow::PropertyRow(const char* name, const char* value) 18 22 : BRow(), … … 49 53 B_NO_BORDER, true) 50 54 { 51 55 BStringColumn* nameColumn; 52 AddColumn(nameColumn = new BStringColumn("Name", 150, 50, 500, 53 B_TRUNCATE_MIDDLE), 54 kNameColumn); 55 AddColumn(new BStringColumn("Value", 150, 50, 500, B_TRUNCATE_END), 56 kValueColumn); 56 57 SetName(B_TRANSLATE("Properties")); 58 59 AddColumn(nameColumn = new BStringColumn(B_TRANSLATE("Name"), 150, 50, 500, 60 B_TRUNCATE_MIDDLE), kNameColumn); 61 AddColumn(new BStringColumn(B_TRANSLATE("Value"), 150, 50, 500, 62 B_TRUNCATE_END), kValueColumn); 57 63 SetSortColumn(nameColumn, false, true); 58 64 } 59 65 -
src/apps/devices/Jamfile
68 68 Device.cpp 69 69 PropertyList.cpp 70 70 PropertyListPlain.cpp 71 : be libcolumnlistview.a tracker $(TARGET_LIBSUPC++) $(TARGET_LIBSTDC++) 71 : be libcolumnlistview.a tracker $(TARGET_LIBSUPC++) $(TARGET_LIBSTDC++) $(HAIKU_LOCALE_LIBS) 72 72 : Devices.rdef 73 73 ; 74 74 75 DoCatalogs Devices : 76 x-vnd.Haiku-Devices 77 : 78 DevicesApplication.cpp 79 DevicesView.cpp 80 DevicePCI.cpp 81 PropertyList.cpp 82 PropertyListPlain.cpp 83 ; 84 75 85 Includes [ FGristFiles DevicesInfo.cpp ] : [ FGristFiles isapnpids.h usbdevs.h 76 86 usbdevs_data.h ] ; 77 87 Includes [ FGristFiles ConfigurationWindow.cpp ] : [ FGristFiles pcihdr.h ] ; -
src/apps/devices/DevicePCI.cpp
10 10 #include <sstream> 11 11 #include <stdlib.h> 12 12 13 #include <Catalog.h> 14 #include <Locale.h> 13 15 #include "DevicePCI.h" 14 16 15 17 extern "C" { … … 18 20 #include "pci-utils.h" 19 21 } 20 22 23 #undef B_TRANSLATE_CONTEXT 24 #define B_TRANSLATE_CONTEXT "DevicePCI" 21 25 22 26 DevicePCI::DevicePCI(Device* parent) 23 27 : … … 66 70 67 71 // Fetch ClassInfo 68 72 char classInfo[64]; 69 get_class_info(fClassBaseId, fClassSubId, fClassApiId, classInfo, sizeof(classInfo)); 73 get_class_info(fClassBaseId, fClassSubId, fClassApiId, classInfo, 74 sizeof(classInfo)); 70 75 71 76 // Fetch ManufacturerName 72 77 BString ManufacturerName; … … 74 79 const char *venFull; 75 80 get_vendor_info(fVendorId, &venShort, &venFull); 76 81 if (!venShort && !venFull) { 77 ManufacturerName << "Unknown";82 ManufacturerName << B_TRANSLATE("Unknown"); 78 83 } else if (venShort && venFull) { 79 84 ManufacturerName << venFull << "(" << venShort << ")"; 80 85 } else { … … 85 90 BString DeviceName; 86 91 const char *devShort; 87 92 const char *devFull; 88 get_device_info(fVendorId, fDeviceId, fSubsystemVendorId, fSubSystemId, &devShort, &devFull); 93 get_device_info(fVendorId, fDeviceId, fSubsystemVendorId, fSubSystemId, 94 &devShort, &devFull); 89 95 if (!devShort && !devFull) { 90 DeviceName << "Unknown";96 DeviceName << B_TRANSLATE("Unknown"); 91 97 } else if (devShort && devFull) { 92 98 DeviceName << devFull << "(" << devShort << ")"; 93 99 } else { … … 96 102 97 103 SetAttribute("Device name", DeviceName); 98 104 SetAttribute("Manufacturer", ManufacturerName); 99 SetAttribute("Driver used", "Not implemented");100 SetAttribute("Device paths", "Not implemented");105 SetAttribute("Driver used", B_TRANSLATE("Not implemented")); 106 SetAttribute("Device paths", B_TRANSLATE("Not implemented")); 101 107 SetAttribute("Class info", classInfo); 102 108 fCategory = (Category)fClassBaseId; 103 109 BString outlineName; … … 123 129 DevicePCI::GetBusStrings() 124 130 { 125 131 BString str; 126 str << "Class Info:\t\t\t\t: " << fAttributeMap["Class Info"]; 132 str << B_TRANSLATE("Class Info:"); 133 str << "\t\t\t\t: " << fAttributeMap["Class Info"]; 127 134 return str; 128 135 } 136 137 138 BString 139 DevicePCI::GetBusTabName() 140 { 141 return B_TRANSLATE("PCI Information"); 142 }