From 3440db0ccecb9b882537f8afd926a77d983edc37 Mon Sep 17 00:00:00 2001 From: Siarzhuk Zharski Date: Sat, 19 Feb 2011 13:32:39 +0000 Subject: [PATCH] Yet another localization patch made by Jorma Karvonen. Fixes #7238 Notes on patch: 1) Localization of internal Deskbar item name and kClassName rejected; Additional fixes by S.Zharski: 1) BLocker's internal name localization removed; 2) A bit more safe snprintf used instead of sprintf; 3) Localization of field names in 'PrTh' message removed; 4) Localization of calling "db" debugger removed. The thread debugging command "db %d" replaced with "gdb -pid=%d". git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40558 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/apps/processcontroller/Preferences.cpp | 17 +++++++++-------- src/apps/processcontroller/PriorityMenu.cpp | 4 ++-- .../processcontroller/ProcessController.cpp | 6 +++--- 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/src/apps/processcontroller/Preferences.cpp b/src/apps/processcontroller/Preferences.cpp index b8a3dfc5d7..90cc7e8c92 100644 --- a/src/apps/processcontroller/Preferences.cpp +++ b/src/apps/processcontroller/Preferences.cpp @@ -38,7 +38,7 @@ #define B_TRANSLATE_CONTEXT "ProcessController" Preferences::Preferences(const char* name, const char* signature, bool doSave) - : BMessage('Pref'), BLocker(B_TRANSLATE("Preferences"), true), + : BMessage('Pref'), BLocker("Preferences", true), fSavePreferences(doSave) { fNewPreferences = false; @@ -65,7 +65,7 @@ Preferences::Preferences(const char* name, const char* signature, bool doSave) Preferences::Preferences(const entry_ref &ref, const char* signature, bool doSave) - : BMessage('Pref'), BLocker(B_TRANSLATE("Preferences"), true), + : BMessage('Pref'), BLocker("Preferences", true), fSavePreferences(doSave) { fSettingsFile = new entry_ref(ref); @@ -108,13 +108,14 @@ Preferences::~Preferences() } } else { // implement saving somewhere else! - char error[1024]; - sprintf(error, B_TRANSLATE("Your setting file" - "could not be saved!\n(%s)"), + BString error; + snprintf(error.LockBuffer(256), 256, + B_TRANSLATE("Your setting file could not be saved!\n(%s)"), strerror(file.InitCheck())); - BAlert *alert = new BAlert(B_TRANSLATE("Error saving file"), error, - B_TRANSLATE("Damned!"), NULL, NULL, B_WIDTH_AS_USUAL, - B_STOP_ALERT); + error.UnlockBuffer(); + BAlert *alert = new BAlert(B_TRANSLATE("Error saving file"), + error.String(), B_TRANSLATE("Damned!"), NULL, NULL, + B_WIDTH_AS_USUAL, B_STOP_ALERT); alert->Go(); } } diff --git a/src/apps/processcontroller/PriorityMenu.cpp b/src/apps/processcontroller/PriorityMenu.cpp index 5fcd5db802..34d257eeed 100644 --- a/src/apps/processcontroller/PriorityMenu.cpp +++ b/src/apps/processcontroller/PriorityMenu.cpp @@ -89,8 +89,8 @@ PriorityMenu::BuildMenu() index--; } message = new BMessage('PrTh'); - message->AddInt32(B_TRANSLATE("thread"), fThreadID); - message->AddInt32(B_TRANSLATE("priority"), priority->priority); + message->AddInt32("thread", fThreadID); + message->AddInt32("priority", priority->priority); sprintf(name, B_TRANSLATE("%s priority [%d]"), priority->name, (int)priority->priority); item = new BMenuItem(name, message); item->SetTarget(gPCView); diff --git a/src/apps/processcontroller/ProcessController.cpp b/src/apps/processcontroller/ProcessController.cpp index d43e1af89f..3ffc6e9bbf 100644 --- a/src/apps/processcontroller/ProcessController.cpp +++ b/src/apps/processcontroller/ProcessController.cpp @@ -398,7 +398,7 @@ ProcessController::MessageReceived(BMessage *message) void ProcessController::AboutRequested() { - BAlert *alert = new BAlert(B_TRANSLATE("about"), + BAlert *alert = new BAlert(B_TRANSLATE("About"), B_TRANSLATE("ProcessController\n\n" "Copyright 1997-2001,\n" "Georges-Edouard Berenger.\n\n" @@ -412,7 +412,7 @@ ProcessController::AboutRequested() view->GetFont(&font); font.SetSize(font.Size() * 1.5); font.SetFace(B_BOLD_FACE); - view->SetFontAndColor(0, 17, &font); + view->SetFontAndColor(0, strlen(B_TRANSLATE("ProcessController"))-1, &font); alert->Go(); } @@ -803,7 +803,7 @@ thread_debug_thread(void *arg) thread_info thinfo; get_thread_info(param->thread, &thinfo); char text[4096]; - sprintf(text, B_TRANSLATE("db %d"), int(param->thread)); + sprintf(text, "gdb -pid=%d", int(param->thread)); system(text); if (param->sem >= 0 && thinfo.state == B_THREAD_WAITING && param->sem == thinfo.sem) {