From 1153eaca5f4424d1d64f728cc032e0f692615e63 Mon Sep 17 00:00:00 2001 From: Siarzhuk Zharski Date: Sun, 20 Feb 2011 18:45:23 +0000 Subject: [PATCH] 1) Devices application localization support reordered to let more translated values be handled. Partialy fixes #7245; 2) Support for localization some still not handled parameters in ProcessController. Pointed out by Diver. Thanks. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40586 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/apps/devices/DeviceACPI.cpp | 17 ++++++++++++++-- src/apps/devices/DeviceACPI.h | 8 ++------ src/apps/devices/DevicePCI.cpp | 15 +++++++++++++- src/apps/devices/DevicePCI.h | 8 +------- src/apps/devices/DevicesApplication.cpp | 2 +- src/apps/devices/Jamfile | 12 ++--------- src/apps/devices/PropertyList.cpp | 5 +++++ src/apps/devices/PropertyList.h | 7 ++----- .../KernelMemoryBarMenuItem.cpp | 20 +++++++++++++------ 9 files changed, 56 insertions(+), 38 deletions(-) diff --git a/src/apps/devices/DeviceACPI.cpp b/src/apps/devices/DeviceACPI.cpp index 0da6df0d7e..9bb8e71a75 100644 --- a/src/apps/devices/DeviceACPI.cpp +++ b/src/apps/devices/DeviceACPI.cpp @@ -7,10 +7,15 @@ */ +#include "DeviceACPI.h" + #include #include -#include "DeviceACPI.h" +#include + +#undef B_TRANSLATE_CONTEXT +#define B_TRANSLATE_CONTEXT "DeviceACPI" DeviceACPI::DeviceACPI(Device* parent) @@ -84,8 +89,16 @@ DeviceACPI::GetBusAttributes() BString DeviceACPI::GetBusStrings() { - BString str("Class Info:\t\t\t\t: %classInfo%"); + BString str(B_TRANSLATE("Class Info:\t\t\t\t: %classInfo%")); str.ReplaceFirst("%classInfo%", fAttributeMap["Class Info"]); return str; } + + +BString +DeviceACPI::GetBusTabName() +{ + return B_TRANSLATE("ACPI Information"); +} + diff --git a/src/apps/devices/DeviceACPI.h b/src/apps/devices/DeviceACPI.h index 2ad1cc48a2..7f101784c6 100644 --- a/src/apps/devices/DeviceACPI.h +++ b/src/apps/devices/DeviceACPI.h @@ -10,10 +10,7 @@ #include "Device.h" -#include -#undef B_TRANSLATE_CONTEXT -#define B_TRANSLATE_CONTEXT "DeviceACPI" class DeviceACPI : public Device { public: @@ -22,9 +19,8 @@ public: virtual Attributes GetBusAttributes(); virtual BString GetBusStrings(); virtual void InitFromAttributes(); - - virtual BString GetBusTabName() - { return B_TRANSLATE("ACPI Information"); } + virtual BString GetBusTabName(); }; #endif /* DEVICEACPI_H */ + diff --git a/src/apps/devices/DevicePCI.cpp b/src/apps/devices/DevicePCI.cpp index 3b1852e7a2..63ce19553b 100644 --- a/src/apps/devices/DevicePCI.cpp +++ b/src/apps/devices/DevicePCI.cpp @@ -7,10 +7,15 @@ */ +#include "DevicePCI.h" + #include #include -#include "DevicePCI.h" +#include + +#undef B_TRANSLATE_CONTEXT +#define B_TRANSLATE_CONTEXT "DevicePCI" extern "C" { #include "dm_wrapper.h" @@ -128,3 +133,11 @@ DevicePCI::GetBusStrings() str.ReplaceFirst("%classInfo%", fAttributeMap["Class Info"]); return str; } + + +BString +DevicePCI::GetBusTabName() +{ + return B_TRANSLATE("PCI Information"); +} + diff --git a/src/apps/devices/DevicePCI.h b/src/apps/devices/DevicePCI.h index 3580f15491..6c55c4d910 100644 --- a/src/apps/devices/DevicePCI.h +++ b/src/apps/devices/DevicePCI.h @@ -10,10 +10,6 @@ #include "Device.h" -#include - -#undef B_TRANSLATE_CONTEXT -#define B_TRANSLATE_CONTEXT "DevicePCI" class DevicePCI : public Device { public: @@ -22,9 +18,7 @@ public: virtual Attributes GetBusAttributes(); virtual BString GetBusStrings(); virtual void InitFromAttributes(); - - virtual BString GetBusTabName() - { return B_TRANSLATE("PCI Information"); } + virtual BString GetBusTabName(); private: uint16 fClassBaseId; diff --git a/src/apps/devices/DevicesApplication.cpp b/src/apps/devices/DevicesApplication.cpp index 839722bafc..5d2ed6a5b9 100644 --- a/src/apps/devices/DevicesApplication.cpp +++ b/src/apps/devices/DevicesApplication.cpp @@ -53,7 +53,7 @@ DevicesApplication::AboutRequested() void DevicesApplication::ShowAbout() { - BAlert* alert = new BAlert("about", B_TRANSLATE("Devices\n" + BAlert* alert = new BAlert(B_TRANSLATE("About"), B_TRANSLATE("Devices\n" "\twritten by Pieter Panman\n" "\n" "\tBased on listdev by Jérôme Duval\n" diff --git a/src/apps/devices/Jamfile b/src/apps/devices/Jamfile index c7621b4427..188950e1b0 100644 --- a/src/apps/devices/Jamfile +++ b/src/apps/devices/Jamfile @@ -84,19 +84,11 @@ DoCatalogs Devices : DevicePCI.cpp PropertyList.cpp PropertyListPlain.cpp + DeviceACPI.cpp + Device.cpp ; Includes [ FGristFiles DevicesInfo.cpp ] : [ FGristFiles isapnpids.h usbdevs.h usbdevs_data.h ] ; Includes [ FGristFiles ConfigurationWindow.cpp ] : [ FGristFiles pcihdr.h ] ; -DoCatalogs Devices : - x-vnd.Haiku-Devices - : - DevicesApplication.cpp - DevicesView.cpp - DevicePCI.h - DeviceACPI.h - Device.cpp - PropertyList.h -; diff --git a/src/apps/devices/PropertyList.cpp b/src/apps/devices/PropertyList.cpp index bcba554317..661b2e82b1 100644 --- a/src/apps/devices/PropertyList.cpp +++ b/src/apps/devices/PropertyList.cpp @@ -8,8 +8,13 @@ #include "PropertyList.h" + +#include #include +#undef B_TRANSLATE_CONTEXT +#define B_TRANSLATE_CONTEXT "PropertyList" + //#include PropertyRow::PropertyRow(const char* name, const char* value) diff --git a/src/apps/devices/PropertyList.h b/src/apps/devices/PropertyList.h index b70df37393..b5b62d6135 100644 --- a/src/apps/devices/PropertyList.h +++ b/src/apps/devices/PropertyList.h @@ -13,10 +13,6 @@ #include #include "Device.h" -#include - -#undef B_TRANSLATE_CONTEXT -#define B_TRANSLATE_CONTEXT "PropertyList" struct Attribute; @@ -43,7 +39,7 @@ private: class PropertyList : public BColumnListView { public: - PropertyList(const char* name = B_TRANSLATE("Properties")); + PropertyList(const char* name); virtual ~PropertyList(); void RemoveAll(); void AddAttributes(const Attributes& attributes); @@ -52,3 +48,4 @@ protected: }; #endif /* PROPERTYLIST_H*/ + diff --git a/src/apps/processcontroller/KernelMemoryBarMenuItem.cpp b/src/apps/processcontroller/KernelMemoryBarMenuItem.cpp index b39f0c576f..b902fe7b8b 100644 --- a/src/apps/processcontroller/KernelMemoryBarMenuItem.cpp +++ b/src/apps/processcontroller/KernelMemoryBarMenuItem.cpp @@ -26,6 +26,11 @@ #include +#include + +#undef B_TRANSLATE_CONTEXT +#define B_TRANSLATE_CONTEXT "ProcessController" + KernelMemoryBarMenuItem::KernelMemoryBarMenuItem(system_info& systemInfo) : BMenuItem("System resources & caches" B_UTF8_ELLIPSIS, NULL) @@ -81,8 +86,10 @@ KernelMemoryBarMenuItem::DrawBar(bool force) cadre.InsetBy(1, 1); BRect r = cadre; - float grenze1 = cadre.left + (cadre.right - cadre.left) * fCachedMemory / fPhysicalMemory; - float grenze2 = cadre.left + (cadre.right - cadre.left) * fCommittedMemory / fPhysicalMemory; + float grenze1 = cadre.left + (cadre.right - cadre.left) + * fCachedMemory / fPhysicalMemory; + float grenze2 = cadre.left + (cadre.right - cadre.left) + * fCommittedMemory / fPhysicalMemory; if (grenze1 > cadre.right) grenze1 = cadre.right; if (grenze2 > cadre.right) @@ -145,11 +152,11 @@ KernelMemoryBarMenuItem::DrawBar(bool force) menu->SetHighColor(kBlack); char infos[128]; - sprintf(infos, "%.1f MB", fCachedMemory / 1024.f); - BPoint loc(cadre.left - kMargin - gMemoryTextWidth / 2 - menu->StringWidth(infos), - cadre.bottom + 1); + sprintf(infos, B_TRANSLATE("%.1f MB"), fCachedMemory / 1024.f); + BPoint loc(cadre.left, cadre.bottom + 1); + loc.x -= kMargin + gMemoryTextWidth / 2 + menu->StringWidth(infos); menu->DrawString(infos, loc); - sprintf(infos, "%.1f MB", fCommittedMemory / 1024.f); + sprintf(infos, B_TRANSLATE("%.1f MB"), fCommittedMemory / 1024.f); loc.x = cadre.left - kMargin - menu->StringWidth(infos); menu->DrawString(infos, loc); fLastSum = sum; @@ -166,3 +173,4 @@ KernelMemoryBarMenuItem::GetContentSize(float* _width, float* _height) *_width += 20 + kBarWidth + kMargin + gMemoryTextWidth; } +