[haiku-commits] r36675 - haiku/trunk/src/apps/terminal

  • From: mattmadia@xxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Fri, 7 May 2010 00:21:26 +0200 (CEST)

Author: mmadia
Date: 2010-05-07 00:21:26 +0200 (Fri, 07 May 2010)
New Revision: 36675
Changeset: http://dev.haiku-os.org/changeset/36675/haiku
Ticket: http://dev.haiku-os.org/ticket/5408

Modified:
   haiku/trunk/src/apps/terminal/AppearPrefView.cpp
   haiku/trunk/src/apps/terminal/Arguments.cpp
   haiku/trunk/src/apps/terminal/FindWindow.cpp
   haiku/trunk/src/apps/terminal/PrefHandler.cpp
   haiku/trunk/src/apps/terminal/PrefWindow.cpp
   haiku/trunk/src/apps/terminal/Shell.cpp
   haiku/trunk/src/apps/terminal/SmartTabView.cpp
   haiku/trunk/src/apps/terminal/TermApp.cpp
   haiku/trunk/src/apps/terminal/TermParse.cpp
   haiku/trunk/src/apps/terminal/TermView.cpp
   haiku/trunk/src/apps/terminal/TermWindow.cpp
Log:
 Updated to use B_TRANSLATE* macros. relates to #5408.

Modified: haiku/trunk/src/apps/terminal/AppearPrefView.cpp
===================================================================
--- haiku/trunk/src/apps/terminal/AppearPrefView.cpp    2010-05-06 22:12:03 UTC 
(rev 36674)
+++ haiku/trunk/src/apps/terminal/AppearPrefView.cpp    2010-05-06 22:21:26 UTC 
(rev 36675)
@@ -62,17 +62,17 @@
        };
 
        SetLayout(new BGroupLayout(B_HORIZONTAL));
-       
+
        BMenu* fontMenu = _MakeFontMenu(MSG_HALF_FONT_CHANGED,
                PrefHandler::Default()->getString(PREF_HALF_FONT_FAMILY),
                PrefHandler::Default()->getString(PREF_HALF_FONT_STYLE));
-       
+
        BMenu* sizeMenu = _MakeSizeMenu(MSG_HALF_SIZE_CHANGED,
                PrefHandler::Default()->getInt32(PREF_HALF_FONT_SIZE));
-       
-       fFont = new BMenuField(TR("Font:"), fontMenu);
-       fFontSize = new BMenuField(TR("Size:"), sizeMenu);
-       fColorField = new BMenuField(TR("Color:"),
+
+       fFont = new BMenuField(B_TRANSLATE("Font:"), fontMenu);
+       fFontSize = new BMenuField(B_TRANSLATE("Size:"), sizeMenu);
+       fColorField = new BMenuField(B_TRANSLATE("Color:"),
                _MakeMenu(MSG_COLOR_FIELD_CHANGED, kColorTable,
                kColorTable[0]));
 
@@ -93,9 +93,9 @@
                                        B_CELLS_32x8, 8.0, "", new 
BMessage(MSG_COLOR_CHANGED)))
                        .End()
                .End();
-       
+
        AddChild(layoutView);
-       
+
        fFont->SetAlignment(B_ALIGN_RIGHT);
        fFontSize->SetAlignment(B_ALIGN_RIGHT);
        fColorField->SetAlignment(B_ALIGN_RIGHT);
@@ -105,7 +105,7 @@
        BTextControl* redInput = (BTextControl*)fColorControl->ChildAt(0);
        BTextControl* greenInput = (BTextControl*)fColorControl->ChildAt(1);
        BTextControl* blueInput = (BTextControl*)fColorControl->ChildAt(2);
-       
+
        redInput->SetAlignment(B_ALIGN_RIGHT, B_ALIGN_LEFT);
        greenInput->SetAlignment(B_ALIGN_RIGHT, B_ALIGN_LEFT);
        blueInput->SetAlignment(B_ALIGN_RIGHT, B_ALIGN_LEFT);
@@ -160,16 +160,16 @@
                        const char* style = NULL;
                        msg->FindString("font_family", &family);
                        msg->FindString("font_style", &style);
-                       
+
                        PrefHandler* pref = PrefHandler::Default();
-                       const char* currentFamily 
+                       const char* currentFamily
                                = pref->getString(PREF_HALF_FONT_FAMILY);
                        const char* currentStyle
                                = pref->getString(PREF_HALF_FONT_STYLE);
                        if (currentFamily == NULL || strcmp(currentFamily, 
family)
                                || currentStyle == NULL || strcmp(currentStyle, 
style)) {
                                pref->setString(PREF_HALF_FONT_FAMILY, family);
-                               pref->setString(PREF_HALF_FONT_STYLE, style);   
        
+                               pref->setString(PREF_HALF_FONT_STYLE, style);
                                modified = true;
                        }
                        break;
@@ -177,7 +177,7 @@
                case MSG_HALF_SIZE_CHANGED:
                        if 
(strcmp(PrefHandler::Default()->getString(PREF_HALF_FONT_SIZE),
                                        
fFontSize->Menu()->FindMarked()->Label())) {
-       
+
                                
PrefHandler::Default()->setString(PREF_HALF_FONT_SIZE,
                                        
fFontSize->Menu()->FindMarked()->Label());
                                modified = true;
@@ -224,23 +224,23 @@
 
        if (font.IsFixed())
                return true;
-       
+
        // manually check if all applicable chars are the same width
        char buffer[2] = { ' ', 0 };
        int firstWidth = (int)ceilf(font.StringWidth(buffer));
-       
+
        // TODO: Workaround for broken fonts/font_subsystem
        if (firstWidth <= 0)
                return false;
-               
+
        for (int c = ' '+1; c <= 0x7e; c++) {
                buffer[0] = c;
                int width = (int)ceilf(font.StringWidth(buffer));
-               
+
                if (width != firstWidth)
                        return false;
        }
-       
+
        return true;
 }
 
@@ -253,7 +253,7 @@
        BPopUpMenu* menu = new BPopUpMenu("");
        int32 numFamilies = count_font_families();
        uint32 flags;
-       
+
        for (int32 i = 0; i < numFamilies; i++) {
                font_family family;
                if (get_font_family(i, &family, &flags) == B_OK) {
@@ -281,7 +281,7 @@
                        }
                }
        }
-       
+
        if (menu->FindMarked() == NULL)
                menu->ItemAt(0)->SetMarked(true);
 

Modified: haiku/trunk/src/apps/terminal/Arguments.cpp
===================================================================
--- haiku/trunk/src/apps/terminal/Arguments.cpp 2010-05-06 22:12:03 UTC (rev 
36674)
+++ haiku/trunk/src/apps/terminal/Arguments.cpp 2010-05-06 22:21:26 UTC (rev 
36675)
@@ -46,7 +46,7 @@
                if (*arg == '-') {
                        if (strcmp(arg, "-h") == 0 || strcmp(arg, "--help") == 
0) {
                                fUsageRequested = true;
-                       
+
                        /*} else if (strcmp(arg, "-l") == 0) {
                                // location
                                float x, y;
@@ -78,11 +78,12 @@
                                        fTitle = argv[argi++];
 
                        } else if (strcmp(arg, "-f") == 0 || strcmp(arg, 
"--fullscreen") == 0) {
-                               fFullScreen = true;                             
-                               argi++;                 
+                               fFullScreen = true;
+                               argi++;
                        } else {
                                // illegal option
-                               fprintf(stderr, TR("Unrecognized option 
\"%s\"\n"), arg);
+                               fprintf(stderr, B_TRANSLATE("Unrecognized 
option \"%s\"\n"),
+                                       arg);
                                fUsageRequested = true;
                        }
 

Modified: haiku/trunk/src/apps/terminal/FindWindow.cpp
===================================================================
--- haiku/trunk/src/apps/terminal/FindWindow.cpp        2010-05-06 22:12:03 UTC 
(rev 36674)
+++ haiku/trunk/src/apps/terminal/FindWindow.cpp        2010-05-06 22:21:26 UTC 
(rev 36675)
@@ -32,7 +32,7 @@
 FindWindow::FindWindow(BMessenger messenger, const BString& str,
                bool findSelection, bool matchWord, bool matchCase, bool 
forwardSearch)
        :
-       BWindow(kWindowFrame, TR("Find"), B_FLOATING_WINDOW,
+       BWindow(kWindowFrame, B_TRANSLATE("Find"), B_FLOATING_WINDOW,
                B_NOT_RESIZABLE | B_NOT_ZOOMABLE | B_CLOSE_ON_ESCAPE
                | B_AUTO_UPDATE_SIZE_LIMITS),
        fFindDlgMessenger(messenger)
@@ -48,16 +48,16 @@
        BView* layoutView = BGroupLayoutBuilder(B_VERTICAL, 5.0)
                .SetInsets(spacing, spacing, spacing, spacing)
                .Add(BGridLayoutBuilder()
-                       .Add(fTextRadio = new BRadioButton(TR("Use text:"),
+                       .Add(fTextRadio = new BRadioButton(B_TRANSLATE("Use 
text:"),
                                new BMessage(TOGGLE_FIND_CONTROL)), 0, 0)
                        .Add(fFindLabel = new BTextControl(NULL, NULL, NULL), 
1, 0)
-                       .Add(useSelection = new BRadioButton(TR("Use 
selection"),
+                       .Add(useSelection = new BRadioButton(B_TRANSLATE("Use 
selection"),
                                new BMessage(TOGGLE_FIND_CONTROL)), 0, 1))
                .Add(separator)
-               .Add(fForwardSearchBox = new BCheckBox(TR("Search forward")))
-               .Add(fMatchCaseBox = new BCheckBox(TR("Match case")))
-               .Add(fMatchWordBox = new BCheckBox(TR("Match word")))
-               .Add(fFindButton = new BButton(TR("Find"), new 
BMessage(MSG_FIND)))
+               .Add(fForwardSearchBox = new BCheckBox(B_TRANSLATE("Search 
forward")))
+               .Add(fMatchCaseBox = new BCheckBox(B_TRANSLATE("Match case")))
+               .Add(fMatchWordBox = new BCheckBox(B_TRANSLATE("Match word")))
+               .Add(fFindButton = new BButton(B_TRANSLATE("Find"), new 
BMessage(MSG_FIND)))
                .End();
        AddChild(layoutView);
 

Modified: haiku/trunk/src/apps/terminal/PrefHandler.cpp
===================================================================
--- haiku/trunk/src/apps/terminal/PrefHandler.cpp       2010-05-06 22:12:03 UTC 
(rev 36674)
+++ haiku/trunk/src/apps/terminal/PrefHandler.cpp       2010-05-06 22:21:26 UTC 
(rev 36675)
@@ -2,7 +2,7 @@
  * Copyright 2003-2007, Haiku, Inc. All Rights Reserved.
  * Copyright (c) 2004 Daniel Furrer <assimil8or@xxxxxxxxxxxxxxxxxxxxx>
  * Copyright (c) 2003-4 Kian Duffy <myob@xxxxxxxxxxxxxxxxxxxxx>
- * Copyright (c) 1998,99 Kazuho Okui and Takashi Murai. 
+ * Copyright (c) 1998,99 Kazuho Okui and Takashi Murai.
  *
  * Distributed unter the terms of the MIT License.
  */
@@ -130,13 +130,13 @@
        status = path.Append("Terminal");
        if (status != B_OK)
                return status;
-       
+
        // Just create the directory. Harmless if already there
        status = create_directory(path.Path(), 0755);
        if (status != B_OK)
                return status;
-               
-#ifdef HAIKU_TARGET_PLATFORM_HAIKU     
+
+#ifdef HAIKU_TARGET_PLATFORM_HAIKU
        status = path.Append("Default");
 #else
        status = path.Append("HaikuTerminal_settings");
@@ -220,7 +220,7 @@
 }
 
 
-int32 
+int32
 PrefHandler::getInt32(const char *key)
 {
        const char *value = fContainer.FindString(key);
@@ -231,7 +231,7 @@
 }
 
 
-float 
+float
 PrefHandler::getFloat(const char *key)
 {
        const char *value = fContainer.FindString(key);
@@ -244,12 +244,12 @@
 #undef TR_CONTEXT
 #define TR_CONTEXT "Terminal getString"
 
-const char* 
+const char*
 PrefHandler::getString(const char *key)
 {
        const char *buffer;
        if (fContainer.FindString(key, &buffer) != B_OK)
-               buffer = TR("Error!");
+               buffer = B_TRANSLATE("Error!");
 
        //printf("%x GET %s: %s\n", this, key, buf);
        return buffer;
@@ -281,7 +281,8 @@
        if (const char *s = fContainer.FindString(key)) {
                sscanf(s, "%d, %d, %d", &r, &g, &b);
        } else {
-               fprintf(stderr, TR("PrefHandler::getRGB(%s) - key not 
found\n"), key);
+               fprintf(stderr,
+                       B_TRANSLATE("PrefHandler::getRGB(%s) - key not 
found\n"), key);
                r = g = b = 0;
        }
 

Modified: haiku/trunk/src/apps/terminal/PrefWindow.cpp
===================================================================
--- haiku/trunk/src/apps/terminal/PrefWindow.cpp        2010-05-06 22:12:03 UTC 
(rev 36674)
+++ haiku/trunk/src/apps/terminal/PrefWindow.cpp        2010-05-06 22:21:26 UTC 
(rev 36675)
@@ -1,7 +1,7 @@
 /*
  * Copyright 2007-2009, Haiku, Inc. All rights reserved.
  * Copyright 2003-2004 Kian Duffy, myob@xxxxxxxxxxxxxxxxxxxxx
- * Parts Copyright 1998-1999 Kazuho Okui and Takashi Murai. 
+ * Parts Copyright 1998-1999 Kazuho Okui and Takashi Murai.
  * All rights reserved. Distributed under the terms of the MIT license.
  */
 
@@ -27,7 +27,7 @@
 #define TR_CONTEXT "Terminal PrefWindow"
 
 PrefWindow::PrefWindow(const BMessenger &messenger)
-       : BWindow(BRect(0, 0, 375, 185), TR("Terminal settings"),
+       : BWindow(BRect(0, 0, 375, 185), B_TRANSLATE("Terminal settings"),
                B_TITLED_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL,
                B_NOT_RESIZABLE|B_NOT_ZOOMABLE|B_AUTO_UPDATE_SIZE_LIMITS),
        fPreviousPref(new PrefHandler(PrefHandler::Default())),
@@ -38,22 +38,23 @@
        BLayoutBuilder::Group<>(this, B_VERTICAL)
                .AddGroup(B_VERTICAL)
                .SetInsets(10, 10, 10, 10)
-                       .Add(new AppearancePrefView(TR("Appearance"), 
fTerminalMessenger))
+                       .Add(new AppearancePrefView(B_TRANSLATE("Appearance"),
+                               fTerminalMessenger))
                        .AddGroup(B_HORIZONTAL)
                                .Add(fSaveAsFileButton = new 
BButton("savebutton",
-                                       TR("Save to file" B_UTF8_ELLIPSIS),
+                                       B_TRANSLATE("Save to file" 
B_UTF8_ELLIPSIS),
                                        new BMessage(MSG_SAVEAS_PRESSED), 
B_WILL_DRAW))
                                .AddGlue()
                                .Add(fRevertButton = new BButton("revertbutton",
-                                       TR("Cancel"), new 
BMessage(MSG_REVERT_PRESSED),
+                                       B_TRANSLATE("Cancel"), new 
BMessage(MSG_REVERT_PRESSED),
                                        B_WILL_DRAW))
-                               .Add(fSaveButton = new BButton("okbutton", 
TR("OK"),
+                               .Add(fSaveButton = new BButton("okbutton", 
B_TRANSLATE("OK"),
                                        new BMessage(MSG_SAVE_PRESSED), 
B_WILL_DRAW))
                        .End()
                .End();
-                       
+
        fSaveButton->MakeDefault(true);
-       
+
        AddShortcut('Q', B_COMMAND_KEY, new BMessage(B_QUIT_REQUESTED));
        AddShortcut('W', B_COMMAND_KEY, new BMessage(B_QUIT_REQUESTED));
 
@@ -83,13 +84,14 @@
        if (!fDirty)
                return true;
 
-       BAlert *alert = new BAlert("", TR("Save changes to this settings 
panel?"),
-               TR("Cancel"), TR("Don't save"), TR("Save"),
+       BAlert *alert = new BAlert("",
+               B_TRANSLATE("Save changes to this settings panel?"),
+               B_TRANSLATE("Cancel"), B_TRANSLATE("Don't save"), 
B_TRANSLATE("Save"),
                B_WIDTH_AS_USUAL, B_OFFSET_SPACING,
-               B_WARNING_ALERT); 
-       alert->SetShortcut(0, B_ESCAPE); 
-       alert->SetShortcut(1, 'd'); 
-       alert->SetShortcut(2, 's'); 
+               B_WARNING_ALERT);
+       alert->SetShortcut(0, B_ESCAPE);
+       alert->SetShortcut(1, 'd');
+       alert->SetShortcut(2, 's');
 
        int32 index = alert->Go();
        if (index == 0)
@@ -111,7 +113,7 @@
                BMessenger messenger(this);
                fSavePanel = new BFilePanel(B_SAVE_PANEL, &messenger);
        }
-       
+
        fSavePanel->Show();
 }
 

Modified: haiku/trunk/src/apps/terminal/Shell.cpp
===================================================================
--- haiku/trunk/src/apps/terminal/Shell.cpp     2010-05-06 22:12:03 UTC (rev 
36674)
+++ haiku/trunk/src/apps/terminal/Shell.cpp     2010-05-06 22:21:26 UTC (rev 
36675)
@@ -364,7 +364,8 @@
                        } else {
                                // B_BUSY is a normal case
                                if (errno != B_BUSY)
-                                       fprintf(stderr, TR("could not open %s: 
%s\n"), ptyName, strerror(errno));
+                                       fprintf(stderr, B_TRANSLATE("could not 
open %s: %s\n"),
+                                               ptyName, strerror(errno));
                        }
                }
                closedir(dir);
@@ -372,7 +373,7 @@
 #endif /* __HAIKU__ */
 
        if (master < 0) {
-       fprintf(stderr, TR("Didn't find any available pseudo ttys."));
+       fprintf(stderr, B_TRANSLATE("Didn't find any available pseudo ttys."));
        return errno;
        }
 
@@ -380,7 +381,7 @@
        if (grantpt(master) != 0 || unlockpt(master) != 0
                || (ttyName = ptsname(master)) == NULL) {
                close(master);
-       fprintf(stderr, TR("Failed to init pseudo tty."));
+       fprintf(stderr, B_TRANSLATE("Failed to init pseudo tty."));
                return errno;
        }
 #endif /* __HAIKU__ */
@@ -415,7 +416,7 @@
                if (setsid() < 0) {
                        handshake.status = PTY_NG;
                        snprintf(handshake.msg, sizeof(handshake.msg),
-                               TR("could not set session leader."));
+                               B_TRANSLATE("could not set session leader."));
                        send_handshake_message(terminalThread, handshake);
                        exit(1);
                }
@@ -425,7 +426,7 @@
                if ((slave = open(ttyName, O_RDWR)) < 0) {
                        handshake.status = PTY_NG;
                        snprintf(handshake.msg, sizeof(handshake.msg),
-                               TR("can't open tty (%s)."), ttyName);
+                               B_TRANSLATE("can't open tty (%s)."), ttyName);
                        send_handshake_message(terminalThread, handshake);
                        exit(1);
                }
@@ -464,7 +465,7 @@
                if (tcsetattr(0, TCSANOW, &tio) == -1) {
                        handshake.status = PTY_NG;
                        snprintf(handshake.msg, sizeof(handshake.msg),
-                               TR("failed set terminal interface (TERMIOS)."));
+                               B_TRANSLATE("failed set terminal interface 
(TERMIOS)."));
                        send_handshake_message(terminalThread, handshake);
                        exit(1);
                }
@@ -480,7 +481,7 @@
                if (handshake.status != PTY_WS) {
                        handshake.status = PTY_NG;
                        snprintf(handshake.msg, sizeof(handshake.msg),
-                               TR("mismatch handshake."));
+                               B_TRANSLATE("mismatch handshake."));
                        send_handshake_message(terminalThread, handshake);
                        exit(1);
                }
@@ -517,8 +518,8 @@
 
                sleep(1);
                BString knonLocalizedPart = "alert --stop ";
-               const char *kLocalizedPart = 
-                       TR("'Cannot execute \"%s\":\n\t%s' 'Use default shell' 
'Abort'");
+               const char *kLocalizedPart =
+                       B_TRANSLATE("'Cannot execute \"%s\":\n\t%s' 'Use 
default shell' 'Abort'");
                const char *spawnAlertMessage = knonLocalizedPart << 
kLocalizedPart;
                char errorMessage[256];
                snprintf(errorMessage, sizeof(errorMessage), spawnAlertMessage, 
argv[0], strerror(errno));

Modified: haiku/trunk/src/apps/terminal/SmartTabView.cpp
===================================================================
--- haiku/trunk/src/apps/terminal/SmartTabView.cpp      2010-05-06 22:12:03 UTC 
(rev 36674)
+++ haiku/trunk/src/apps/terminal/SmartTabView.cpp      2010-05-06 22:21:26 UTC 
(rev 36675)
@@ -80,7 +80,8 @@
                                message->AddInt32("index", tabIndex);
 
                                BPopUpMenu* popUpMenu = new BPopUpMenu("tab 
menu");
-                               popUpMenu->AddItem(new BMenuItem(TR("Close 
tab"), message));
+                               popUpMenu->AddItem(new 
BMenuItem(B_TRANSLATE("Close tab"),
+                                       message));
                                popUpMenu->SetAsyncAutoDestruct(true);
                                popUpMenu->SetTargetForItems(BMessenger(this));
                                popUpMenu->Go(ConvertToScreen(point), true, 
true, true);

Modified: haiku/trunk/src/apps/terminal/TermApp.cpp
===================================================================
--- haiku/trunk/src/apps/terminal/TermApp.cpp   2010-05-06 22:12:03 UTC (rev 
36674)
+++ haiku/trunk/src/apps/terminal/TermApp.cpp   2010-05-06 22:21:26 UTC (rev 
36675)
@@ -1,7 +1,7 @@
 /*
  * Copyright 2001-2009, Haiku, Inc. All rights reserved.
  * Copyright (c) 2003-2004 Kian Duffy <myob@xxxxxxxxxxxxxxxxxxxxx>
- * Copyright (C) 1998,99 Kazuho Okui and Takashi Murai. 
+ * Copyright (C) 1998,99 Kazuho Okui and Takashi Murai.
  *
  * Distributed unter the terms of the MIT license.
  */
@@ -67,7 +67,7 @@
        const char *defaultArgs[2];
        defaultArgs[0] = kDefaultShell;
        defaultArgs[1] = "--login";
-       
+
        struct passwd passwdStruct;
        struct passwd *passwdResult;
        char stringBuffer[256];
@@ -75,12 +75,12 @@
                        sizeof(stringBuffer), &passwdResult)) {
                defaultArgs[0] = passwdStruct.pw_shell;
        }
-       
+
        be_locale->GetAppCatalog(&fAppCatalog);
-       
+
        fArgs = new Arguments(2, defaultArgs);
-       
-       fWindowTitle = TR("Terminal");
+
+       fWindowTitle = B_TRANSLATE("Terminal");
        _RegisterTerminal();
 
        if (fWindowNumber > 0)
@@ -122,7 +122,8 @@
 #endif
        action.sa_userdata = this;
        if (sigaction(SIGCHLD, &action, NULL) < 0) {
-               fprintf(stderr, TR("sigaction() failed: %s\n"), 
strerror(errno));
+               fprintf(stderr, B_TRANSLATE("sigaction() failed: %s\n"),
+                       strerror(errno));
                // continue anyway
        }
 
@@ -134,8 +135,9 @@
        // failed spawn, print stdout and open alert panel
        // TODO: This alert does never show up.
        if (status < B_OK) {
-               (new BAlert("alert", TR("Terminal couldn't start the shell. 
Sorry."),
-                       TR("OK"), NULL, NULL, B_WIDTH_FROM_LABEL,
+               (new BAlert("alert",
+                       B_TRANSLATE("Terminal couldn't start the shell. 
Sorry."),
+                       B_TRANSLATE("OK"), NULL, NULL, B_WIDTH_FROM_LABEL,
                        B_INFO_ALERT))->Go(NULL);
                PostMessage(B_QUIT_REQUESTED);
                return;
@@ -200,14 +202,14 @@
 TermApp::ArgvReceived(int32 argc, char **argv)
 {
        fArgs->Parse(argc, argv);
-       
+
        if (fArgs->UsageRequested()) {
                _Usage(argv[0]);
                sUsageRequested = true;
                PostMessage(B_QUIT_REQUESTED);
-               return; 
+               return;
        }
-       
+
        if (fArgs->Title() != NULL)
                fWindowTitle = fArgs->Title();
 
@@ -216,17 +218,17 @@
 
 
 void
-TermApp::RefsReceived(BMessage* message) 
-{ 
+TermApp::RefsReceived(BMessage* message)
+{
        // Works Only Launced by Double-Click file, or Drags file to App.
        if (!IsLaunching())
                return;
 
-       entry_ref ref; 
+       entry_ref ref;
        if (message->FindRef("refs", 0, &ref) != B_OK)
                return;
 
-       BFile file; 
+       BFile file;
        if (file.SetTo(&ref, B_READ_WRITE) != B_OK)
                return;
 
@@ -236,7 +238,7 @@
 
        // if App opened by Pref file
        if (!strcmp(mimetype, PREFFILE_MIMETYPE)) {
-       
+
                BEntry ent(&ref);
                BPath path(&ent);
                PrefHandler::Default()->OpenText(path.Path());
@@ -249,7 +251,7 @@
                //    beep();
                return;
        }
-}  
+}
 
 
 status_t
@@ -258,13 +260,13 @@
        try {
                fTermWindow = new TermWindow(frame, fWindowTitle.String(), 
fArgs);
        } catch (int error) {
-               return (status_t)error; 
+               return (status_t)error;
        } catch (...) {
                return B_ERROR;
        }
 
        fTermWindow->Show();
-       
+
        return B_OK;
 }
 
@@ -285,7 +287,7 @@
 {
        team_id myId = be_app->Team();
        BList teams;
-       be_roster->GetAppList(TERM_SIGNATURE, &teams); 
+       be_roster->GetAppList(TERM_SIGNATURE, &teams);
 
        int32 numTerms = teams.CountItems();
        if (numTerms <= 1)
@@ -504,7 +506,7 @@
 
 
 //#ifndef B_NETPOSITIVE_APP_SIGNATURE
-//#define B_NETPOSITIVE_APP_SIGNATURE "application/x-vnd.Be-NPOS" 
+//#define B_NETPOSITIVE_APP_SIGNATURE "application/x-vnd.Be-NPOS"
 //#endif
 //
 //void
@@ -518,7 +520,7 @@
 //  message.AddString("be:url", url);
 
 //  be_roster->Launch(B_NETPOSITIVE_APP_SIGNATURE, &message);
-//  while(!(be_roster->IsRunning(B_NETPOSITIVE_APP_SIGNATURE)))  
+//  while(!(be_roster->IsRunning(B_NETPOSITIVE_APP_SIGNATURE)))
 //    snooze(10000);
 //
 //  // Activate net+
@@ -562,17 +564,17 @@
 void
 TermApp::_Usage(char *name)
 {
-       fprintf(stderr, TR("Haiku Terminal\n"
+       fprintf(stderr, B_TRANSLATE("Haiku Terminal\n"
                "Copyright 2001-2009 Haiku, Inc.\n"
                "Copyright(C) 1999 Kazuho Okui and Takashi Murai.\n"
                "\n"
                "Usage: %s [OPTION] [SHELL]\n"), name);
 
        fprintf(stderr,
-               TR("  -h,     --help               print this help\n"    
+               B_TRANSLATE("  -h,     --help               print this help\n"
                //"  -p,     --preference         load preference file\n"
                "  -t,     --title              set window title\n"
-               "  -f,     --fullscreen         start fullscreen\n")            
+               "  -f,     --fullscreen         start fullscreen\n")
                //"  -geom,  --geometry           set window geometry\n"
                //"                               An example of geometry is 
\"80x25+100+100\"\n"
                );

Modified: haiku/trunk/src/apps/terminal/TermParse.cpp
===================================================================
--- haiku/trunk/src/apps/terminal/TermParse.cpp 2010-05-06 22:12:03 UTC (rev 
36674)
+++ haiku/trunk/src/apps/terminal/TermParse.cpp 2010-05-06 22:21:26 UTC (rev 
36675)
@@ -96,7 +96,7 @@
 
        fQuitting = false;
        fBuffer = buffer;
-       
+
        status_t status = _InitPtyReader();
        if (status < B_OK) {
                fBuffer = NULL;
@@ -143,7 +143,7 @@
 
        if (fParseThread < 0)
                return fParseThread;
-               
+
        resume_thread(fParseThread);
 
        return B_OK;
@@ -291,17 +291,17 @@
        { NULL, NULL }
        };
        int i;
-       fprintf(stderr, TR("groundtable: "));
+       fprintf(stderr, B_TRANSLATE("groundtable: "));
        for (i = 0; tables[i].p; i++) {
                if (tables[i].p == groundtable)
                        fprintf(stderr, "%s\t", tables[i].name);
        }
-       fprintf(stderr, TR("parsestate: "));
+       fprintf(stderr, B_TRANSLATE("parsestate: "));
        for (i = 0; tables[i].p; i++) {
                if (tables[i].p == parsestate)
                        fprintf(stderr, "%s\t", tables[i].name);
        }
-       fprintf(stderr, TR("char: 0x%02x (%d)\n"), c, c);
+       fprintf(stderr, B_TRANSLATE("char: 0x%02x (%d)\n"), c, c);
 }
 
 
@@ -332,7 +332,7 @@
        int32 srcLen;
        int32 dstLen;
        long dummyState = 0;
-                                       
+
        int width = 1;
        BAutolock locker(fBuffer);
 
@@ -1026,7 +1026,7 @@
                                        default:
                                                break;
                                }
-               } catch (...) { 
+               } catch (...) {
                        break;
                }
        }

Modified: haiku/trunk/src/apps/terminal/TermView.cpp
===================================================================
--- haiku/trunk/src/apps/terminal/TermView.cpp  2010-05-06 22:12:03 UTC (rev 
36674)
+++ haiku/trunk/src/apps/terminal/TermView.cpp  2010-05-06 22:21:26 UTC (rev 
36675)
@@ -1431,7 +1431,8 @@
        bool hasResizeView = fResizeRunner != NULL;
        if (!hasResizeView) {
                // show the current size in a view
-               fResizeView = new BStringView(BRect(100, 100, 300, 140), 
TR("size"), "");
+               fResizeView = new BStringView(BRect(100, 100, 300, 140),
+                       B_TRANSLATE("size"), "");
                fResizeView->SetAlignment(B_ALIGN_CENTER);
                fResizeView->SetFont(be_bold_font);
 
@@ -1825,12 +1826,15 @@
        cpMessage->what = kSecondaryMouseDropAction;
        cpMessage->AddInt8("action", kCopyFiles);
 
-       BMenuItem* insertItem = new BMenuItem(TR("Insert path"), insertMessage);
-       BMenuItem* cdItem = new BMenuItem(TR("Change directory"), cdMessage);
-       BMenuItem* lnItem = new BMenuItem(TR("Create link here"), lnMessage);
-       BMenuItem* mvItem = new BMenuItem(TR("Move here"), mvMessage);
-       BMenuItem* cpItem = new BMenuItem(TR("Copy here"), cpMessage);
-       BMenuItem* chItem = new BMenuItem(TR("Cancel"), NULL);
+       BMenuItem* insertItem = new BMenuItem(
+               B_TRANSLATE("Insert path"), insertMessage);
+       BMenuItem* cdItem = new BMenuItem(
+               B_TRANSLATE("Change directory"), cdMessage);
+       BMenuItem* lnItem = new BMenuItem(
+               B_TRANSLATE("Create link here"), lnMessage);
+       BMenuItem* mvItem = new BMenuItem(B_TRANSLATE("Move here"), mvMessage);
+       BMenuItem* cpItem = new BMenuItem(B_TRANSLATE("Copy here"), cpMessage);
+       BMenuItem* chItem = new BMenuItem(B_TRANSLATE("Cancel"), NULL);
 
        // if the refs point to different directorys disable the cd menu item
        bool differentDirs = false;
@@ -1858,7 +1862,8 @@
        if (differentDirs)
                cdItem->SetEnabled(false);
 
-       BPopUpMenu *menu = new BPopUpMenu(TR("Secondary mouse button drop 
menu"));
+       BPopUpMenu *menu = new BPopUpMenu(
+               B_TRANSLATE("Secondary mouse button drop menu"));
        menu->SetAsyncAutoDestruct(true);
        menu->AddItem(insertItem);
        menu->AddSeparatorItem();
@@ -2768,10 +2773,11 @@
 TermView::AboutRequested()
 {
        BAlert *alert = new (std::nothrow) BAlert("about",
-               TR("Terminal\n\n"
-               "written by Kazuho Okui and Takashi Murai\n"
-               "updated by Kian Duffy and others\n\n"
-               "Copyright " B_UTF8_COPYRIGHT "2003-2009, Haiku.\n"), TR("OK"));
+               B_TRANSLATE("Terminal\n\n"
+                       "written by Kazuho Okui and Takashi Murai\n"
+                       "updated by Kian Duffy and others\n\n"
+                       "Copyright " B_UTF8_COPYRIGHT "2003-2009, Haiku.\n"),
+               B_TRANSLATE("OK"));
        if (alert != NULL)
                alert->Go();
 }

Modified: haiku/trunk/src/apps/terminal/TermWindow.cpp
===================================================================
--- haiku/trunk/src/apps/terminal/TermWindow.cpp        2010-05-06 22:12:03 UTC 
(rev 36674)
+++ haiku/trunk/src/apps/terminal/TermWindow.cpp        2010-05-06 22:21:26 UTC 
(rev 36675)
@@ -257,7 +257,7 @@
 BMenu *
 TermWindow::_MakeEncodingMenu()
 {
-       BMenu *menu = new (std::nothrow) BMenu(TR("Text encoding"));
+       BMenu *menu = new (std::nothrow) BMenu(B_TRANSLATE("Text encoding"));
        if (menu == NULL)
                return NULL;
 
@@ -286,44 +286,49 @@
        fMenubar = new BMenuBar(Bounds(), "mbar");
 
        // Make File Menu.
-       fFilemenu = new BMenu(TR("Terminal"));
-       fFilemenu->AddItem(new BMenuItem(TR("Switch Terminals"),
+       fFilemenu = new BMenu(B_TRANSLATE("Terminal"));
+       fFilemenu->AddItem(new BMenuItem(B_TRANSLATE("Switch Terminals"),
                new BMessage(MENU_SWITCH_TERM), B_TAB));
-       fFilemenu->AddItem(new BMenuItem(TR("New Terminal"),
+       fFilemenu->AddItem(new BMenuItem(B_TRANSLATE("New Terminal"),
                new BMessage(MENU_NEW_TERM), 'N'));
-       fFilemenu->AddItem(new BMenuItem(TR("New tab"), new BMessage(kNewTab), 
'T'));
+       fFilemenu->AddItem(new BMenuItem(B_TRANSLATE("New tab"),
+               new BMessage(kNewTab), 'T'));
 
        fFilemenu->AddSeparatorItem();
-       fFilemenu->AddItem(new BMenuItem(TR("Page setup" B_UTF8_ELLIPSIS),
+       fFilemenu->AddItem(new BMenuItem(B_TRANSLATE("Page setup" 
B_UTF8_ELLIPSIS),
                new BMessage(MENU_PAGE_SETUP)));
-       fFilemenu->AddItem(new BMenuItem(TR("Print"), new 
BMessage(MENU_PRINT),'P'));
+       fFilemenu->AddItem(new BMenuItem(B_TRANSLATE("Print"),
+               new BMessage(MENU_PRINT),'P'));
        fFilemenu->AddSeparatorItem();
-       fFilemenu->AddItem(new BMenuItem(TR("About Terminal" B_UTF8_ELLIPSIS),
+       fFilemenu->AddItem(new BMenuItem(
+               B_TRANSLATE("About Terminal" B_UTF8_ELLIPSIS),
                new BMessage(B_ABOUT_REQUESTED)));
        fFilemenu->AddSeparatorItem();
-       fFilemenu->AddItem(new BMenuItem(TR("Close active tab"),
+       fFilemenu->AddItem(new BMenuItem(B_TRANSLATE("Close active tab"),
                new BMessage(kCloseView), 'W', B_SHIFT_KEY));
-       fFilemenu->AddItem(new BMenuItem(TR("Quit"),
+       fFilemenu->AddItem(new BMenuItem(B_TRANSLATE("Quit"),
                new BMessage(B_QUIT_REQUESTED), 'Q'));
        fMenubar->AddItem(fFilemenu);
 
        // Make Edit Menu.
        fEditmenu = new BMenu("Edit");
-       fEditmenu->AddItem(new BMenuItem(TR("Copy"), new BMessage(B_COPY),'C'));
-       fEditmenu->AddItem(new BMenuItem(TR("Paste"), new 
BMessage(B_PASTE),'V'));
+       fEditmenu->AddItem(new BMenuItem(B_TRANSLATE("Copy"),
+               new BMessage(B_COPY),'C'));
+       fEditmenu->AddItem(new BMenuItem(B_TRANSLATE("Paste"),
+               new BMessage(B_PASTE),'V'));
        fEditmenu->AddSeparatorItem();
-       fEditmenu->AddItem(new BMenuItem(TR("Select all"),
+       fEditmenu->AddItem(new BMenuItem(B_TRANSLATE("Select all"),
                new BMessage(B_SELECT_ALL), 'A'));
-       fEditmenu->AddItem(new BMenuItem(TR("Clear all"),
+       fEditmenu->AddItem(new BMenuItem(B_TRANSLATE("Clear all"),
                new BMessage(MENU_CLEAR_ALL), 'L'));
        fEditmenu->AddSeparatorItem();
-       fEditmenu->AddItem(new BMenuItem(TR("Find" B_UTF8_ELLIPSIS),
+       fEditmenu->AddItem(new BMenuItem(B_TRANSLATE("Find" B_UTF8_ELLIPSIS),
                new BMessage(MENU_FIND_STRING),'F'));
-       fFindPreviousMenuItem = new BMenuItem(TR("Find previous"),
+       fFindPreviousMenuItem = new BMenuItem(B_TRANSLATE("Find previous"),
                new BMessage(MENU_FIND_PREVIOUS), 'G', B_SHIFT_KEY);
        fEditmenu->AddItem(fFindPreviousMenuItem);
        fFindPreviousMenuItem->SetEnabled(false);
-       fFindNextMenuItem = new BMenuItem(TR("Find next"),
+       fFindNextMenuItem = new BMenuItem(B_TRANSLATE("Find next"),
                new BMessage(MENU_FIND_NEXT), 'G');
        fEditmenu->AddItem(fFindNextMenuItem);
        fFindNextMenuItem->SetEnabled(false);
@@ -331,17 +336,17 @@
        fMenubar->AddItem(fEditmenu);
 
        // Make Help Menu.
-       fHelpmenu = new BMenu(TR("Settings"));
+       fHelpmenu = new BMenu(B_TRANSLATE("Settings"));
        fWindowSizeMenu = _MakeWindowSizeMenu();
 
        fEncodingmenu = _MakeEncodingMenu();
 
-       fSizeMenu = new BMenu(TR("Text size"));
+       fSizeMenu = new BMenu(B_TRANSLATE("Text size"));
 
-       fIncreaseFontSizeMenuItem = new BMenuItem(TR("Increase"),
+       fIncreaseFontSizeMenuItem = new BMenuItem(B_TRANSLATE("Increase"),
                new BMessage(kIncreaseFontSize), '+', B_COMMAND_KEY);
 
-       fDecreaseFontSizeMenuItem = new BMenuItem(TR("Decrease"),
+       fDecreaseFontSizeMenuItem = new BMenuItem(B_TRANSLATE("Decrease"),
                new BMessage(kDecreaseFontSize), '-', B_COMMAND_KEY);
 
        fSizeMenu->AddItem(fIncreaseFontSizeMenuItem);
@@ -351,10 +356,10 @@
        fHelpmenu->AddItem(fEncodingmenu);
        fHelpmenu->AddItem(fSizeMenu);
        fHelpmenu->AddSeparatorItem();
-       fHelpmenu->AddItem(new BMenuItem(TR("Settings" B_UTF8_ELLIPSIS),
+       fHelpmenu->AddItem(new BMenuItem(B_TRANSLATE("Settings" 
B_UTF8_ELLIPSIS),
                new BMessage(MENU_PREF_OPEN)));
        fHelpmenu->AddSeparatorItem();
-       fHelpmenu->AddItem(new BMenuItem(TR("Save as default"),
+       fHelpmenu->AddItem(new BMenuItem(B_TRANSLATE("Save as default"),
                new BMessage(SAVE_AS_DEFAULT)));
        fMenubar->AddItem(fHelpmenu);
 
@@ -455,9 +460,11 @@
 
                        if (fFindString.Length() == 0) {
                                const char* errorMsg = !fFindSelection
-                                       ? TR("No search string was entered.") : 
TR("Nothing is selected.");
-                               BAlert* alert = new BAlert(TR("Find failed"), 
errorMsg, TR("OK"), NULL,
-                                       NULL, B_WIDTH_AS_USUAL, 
B_WARNING_ALERT);
+                                       ? B_TRANSLATE("No search string was 
entered.")
+                                       : B_TRANSLATE("Nothing is selected.");
+                               BAlert* alert = new BAlert(B_TRANSLATE("Find 
failed"),
+                                       errorMsg, B_TRANSLATE("OK"), NULL, NULL,
+                                       B_WIDTH_AS_USUAL, B_WARNING_ALERT);
 
                                alert->Go();
                                fFindPreviousMenuItem->SetEnabled(false);
@@ -471,8 +478,10 @@
                        findresult = _ActiveTermView()->Find(fFindString, 
fForwardSearch, fMatchCase, fMatchWord);
 
                        if (!findresult) {
-                               BAlert *alert = new BAlert(TR("Find failed"), 
TR("Text not found."), TR("OK"), NULL,
-                                       NULL, B_WIDTH_AS_USUAL, 
B_WARNING_ALERT);
+                               BAlert *alert = new BAlert(B_TRANSLATE("Find 
failed"),
+                                       B_TRANSLATE("Text not found."),
+                                       B_TRANSLATE("OK"), NULL, NULL,
+                                       B_WIDTH_AS_USUAL, B_WARNING_ALERT);
                                alert->SetShortcut(0, B_ESCAPE);
                                alert->Go();
                                fFindPreviousMenuItem->SetEnabled(false);
@@ -492,7 +501,8 @@
                                (message->what == MENU_FIND_NEXT) == 
fForwardSearch,
                                fMatchCase, fMatchWord);
                        if (!findresult) {
-                               BAlert *alert = new BAlert(TR("Find failed"), 
TR("Not found."), TR("OK"),
+                               BAlert *alert = new BAlert(B_TRANSLATE("Find 
failed"),
+                                       B_TRANSLATE("Not found."), 
B_TRANSLATE("OK"),
                                        NULL, NULL, B_WIDTH_AS_USUAL, 
B_WARNING_ALERT);
                                alert->SetShortcut(0, B_ESCAPE);
                                alert->Go();
@@ -723,7 +733,8 @@
 TermWindow::_DoPrint()
 {
        if (!fPrintSettings || (_DoPageSetup() != B_OK)) {
-               (new BAlert(TR("Cancel"), TR("Print cancelled."), 
TR("OK")))->Go();
+               (new BAlert(B_TRANSLATE("Cancel"), B_TRANSLATE("Print 
cancelled."),
+                       B_TRANSLATE("OK")))->Go();
                return;
        }
 
@@ -982,7 +993,7 @@
 BMenu*
 TermWindow::_MakeWindowSizeMenu()
 {
-       BMenu *menu = new (std::nothrow) BMenu(TR("Window size"));
+       BMenu *menu = new (std::nothrow) BMenu(B_TRANSLATE("Window size"));
        if (menu == NULL)
                return NULL;
 
@@ -1006,8 +1017,8 @@
        }
 
        menu->AddSeparatorItem();
-       menu->AddItem(new BMenuItem(TR("Full screen"), new BMessage(FULLSCREEN),
-               B_ENTER));
+       menu->AddItem(new BMenuItem(B_TRANSLATE("Full screen"),
+               new BMessage(FULLSCREEN), B_ENTER));
 
        return menu;
 }


Other related posts:

  • » [haiku-commits] r36675 - haiku/trunk/src/apps/terminal - mattmadia