From 398bd39a3d2fddb99930e01e57a59277a8eecb95 Mon Sep 17 00:00:00 2001 From: Matt Madia Date: Thu, 6 May 2010 23:44:45 +0000 Subject: [PATCH] Updated to use B_TRANSLATE* macros. relates to #5408. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36686 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/preferences/keyboard/Keyboard.cpp | 12 +++++--- src/preferences/keyboard/KeyboardView.cpp | 22 ++++++------- src/preferences/keyboard/KeyboardWindow.cpp | 34 ++++++++++----------- 3 files changed, 35 insertions(+), 33 deletions(-) diff --git a/src/preferences/keyboard/Keyboard.cpp b/src/preferences/keyboard/Keyboard.cpp index 70b188287c..18149448e9 100644 --- a/src/preferences/keyboard/Keyboard.cpp +++ b/src/preferences/keyboard/Keyboard.cpp @@ -32,12 +32,13 @@ KeyboardApplication::MessageReceived(BMessage* message) switch (message->what) { case ERROR_DETECTED: { - BAlert* errorAlert = new BAlert("Error", TR("Something has gone wrong!"), - TR("OK"), NULL, NULL, B_WIDTH_AS_USUAL, B_OFFSET_SPACING, - B_WARNING_ALERT); + BAlert* errorAlert = new BAlert("Error", + B_TRANSLATE("Something has gone wrong!"), + B_TRANSLATE("OK"), NULL, NULL, + B_WIDTH_AS_USUAL, B_OFFSET_SPACING, B_WARNING_ALERT); errorAlert->Go(); be_app->PostMessage(B_QUIT_REQUESTED); - break; + break; } default: BApplication::MessageReceived(message); @@ -49,7 +50,8 @@ KeyboardApplication::MessageReceived(BMessage* message) void KeyboardApplication::AboutRequested() { - (new BAlert("about", TR("Written by Andrew Edward McCall"), TR("OK")))->Go(); + (new BAlert("about", B_TRANSLATE("Written by Andrew Edward McCall"), + B_TRANSLATE("OK")))->Go(); } diff --git a/src/preferences/keyboard/KeyboardView.cpp b/src/preferences/keyboard/KeyboardView.cpp index 20575d8629..439777b977 100644 --- a/src/preferences/keyboard/KeyboardView.cpp +++ b/src/preferences/keyboard/KeyboardView.cpp @@ -28,37 +28,37 @@ KeyboardView::KeyboardView() : BGroupView() -{ +{ fIconBitmap = BTranslationUtils::GetBitmap("key_bmap"); fClockBitmap = BTranslationUtils::GetBitmap("clock_bmap"); // Create the "Key repeat rate" slider... fRepeatSlider = new BSlider("key_repeat_rate", - TR("Key repeat rate"), + B_TRANSLATE("Key repeat rate"), new BMessage(SLIDER_REPEAT_RATE), 20, 300, B_HORIZONTAL); fRepeatSlider->SetHashMarks(B_HASH_MARKS_BOTTOM); fRepeatSlider->SetHashMarkCount(5); - fRepeatSlider->SetLimitLabels(TR("Slow"),TR("Fast")); - - + fRepeatSlider->SetLimitLabels(B_TRANSLATE("Slow"),B_TRANSLATE("Fast")); + + // Create the "Delay until key repeat" slider... fDelaySlider = new BSlider("delay_until_key_repeat", - TR("Delay until key repeat"), + B_TRANSLATE("Delay until key repeat"), new BMessage(SLIDER_DELAY_RATE), 250000, 1000000, B_HORIZONTAL); fDelaySlider->SetHashMarks(B_HASH_MARKS_BOTTOM); fDelaySlider->SetHashMarkCount(4); - fDelaySlider->SetLimitLabels(TR("Short"),TR("Long")); - + fDelaySlider->SetLimitLabels(B_TRANSLATE("Short"),B_TRANSLATE("Long")); + // Create the "Typing test area" text box... BTextControl* textcontrol = new BTextControl(NULL, - TR("Typing test area"), + B_TRANSLATE("Typing test area"), new BMessage('TTEA')); textcontrol->SetAlignment(B_ALIGN_LEFT, B_ALIGN_CENTER); textcontrol->SetExplicitMinSize(BSize( - textcontrol->StringWidth(TR("Typing test area")), B_SIZE_UNSET)); - + textcontrol->StringWidth(B_TRANSLATE("Typing test area")), B_SIZE_UNSET)); + // Build the layout SetLayout(new BGroupLayout(B_HORIZONTAL)); diff --git a/src/preferences/keyboard/KeyboardWindow.cpp b/src/preferences/keyboard/KeyboardWindow.cpp index ee9dda7956..68aa73d47f 100644 --- a/src/preferences/keyboard/KeyboardWindow.cpp +++ b/src/preferences/keyboard/KeyboardWindow.cpp @@ -28,7 +28,7 @@ #define TR_CONTEXT "KeyboardWindow" KeyboardWindow::KeyboardWindow() - : BWindow(BRect(0, 0, 200, 200), TR("Keyboard"), B_TITLED_WINDOW, + : BWindow(BRect(0, 0, 200, 200), B_TRANSLATE("Keyboard"), B_TITLED_WINDOW, B_NOT_RESIZABLE | B_NOT_ZOOMABLE | B_ASYNCHRONOUS_CONTROLS | B_AUTO_UPDATE_SIZE_LIMITS) { @@ -38,17 +38,17 @@ KeyboardWindow::KeyboardWindow() fSettingsView = new KeyboardView(); BBox* fSettingsBox = new BBox("keyboard_box"); fSettingsBox->AddChild(fSettingsView); - - // Add the "Default" button.. - fDefaultsButton = new BButton(TR("Defaults"), new BMessage(BUTTON_DEFAULTS)); - + + // Add the "Default" button.. + fDefaultsButton = new BButton(B_TRANSLATE("Defaults"), new BMessage(BUTTON_DEFAULTS)); + // Add the "Revert" button... - fRevertButton = new BButton(TR("Revert"), new BMessage(BUTTON_REVERT)); + fRevertButton = new BButton(B_TRANSLATE("Revert"), new BMessage(BUTTON_REVERT)); fRevertButton->SetEnabled(false); - + // Build the layout SetLayout(new BGroupLayout(B_VERTICAL)); - + AddChild(BGroupLayoutBuilder(B_VERTICAL, 10) .Add(fSettingsBox) .AddGroup(B_HORIZONTAL, 7) @@ -60,11 +60,11 @@ KeyboardWindow::KeyboardWindow() ); BSlider* slider = (BSlider* )FindView("key_repeat_rate"); - if (slider !=NULL) + if (slider !=NULL) slider->SetValue(fSettings.KeyboardRepeatRate()); slider = (BSlider* )FindView("delay_until_key_repeat"); - if (slider !=NULL) + if (slider !=NULL) slider->SetValue(fSettings.KeyboardRepeatDelay()); fDefaultsButton->SetEnabled(fSettings.IsDefaultable()); @@ -73,7 +73,7 @@ KeyboardWindow::KeyboardWindow() BScreen screen; if (screen.Frame().right < Frame().right || screen.Frame().bottom < Frame().bottom) { - CenterOnScreen(); + CenterOnScreen(); } #ifdef DEBUG @@ -109,11 +109,11 @@ KeyboardWindow::MessageReceived(BMessage* message) fSettings.Defaults(); slider = (BSlider* )FindView("key_repeat_rate"); - if (slider !=NULL) + if (slider !=NULL) slider->SetValue(fSettings.KeyboardRepeatRate()); slider = (BSlider* )FindView("delay_until_key_repeat"); - if (slider !=NULL) + if (slider !=NULL) slider->SetValue(fSettings.KeyboardRepeatDelay()); fDefaultsButton->SetEnabled(false); @@ -124,13 +124,13 @@ KeyboardWindow::MessageReceived(BMessage* message) case BUTTON_REVERT: { fSettings.Revert(); - + slider = (BSlider* )FindView("key_repeat_rate"); - if (slider !=NULL) + if (slider !=NULL) slider->SetValue(fSettings.KeyboardRepeatRate()); slider = (BSlider* )FindView("delay_until_key_repeat"); - if (slider !=NULL) + if (slider !=NULL) slider->SetValue(fSettings.KeyboardRepeatDelay()); fDefaultsButton->SetEnabled(fSettings.IsDefaultable()); @@ -171,7 +171,7 @@ KeyboardWindow::MessageReceived(BMessage* message) fSettings.SetKeyboardRepeatDelay(delay); slider = (BSlider* )FindView("delay_until_key_repeat"); - if (slider != NULL) + if (slider != NULL) slider->SetValue(delay); fDefaultsButton->SetEnabled(fSettings.IsDefaultable());