Ticket #7234: Login-localization.patch

File Login-localization.patch, 8.0 KB (added by Karvjorm, 13 years ago)

A Login application localization patch

  • src/apps/login/LoginWindow.cpp

     
    44 */
    55
    66
     7#include <Catalog.h>
     8
    79#include "LoginWindow.h"
    810#include "LoginView.h"
    911
     12#undef B_TRANSLATE_CONTEXT
     13#define B_TRANSLATE_CONTEXT "Login Window"
     14
    1015#define WINDOW_FEEL B_NORMAL_WINDOW_FEEL
    1116//#define WINDOW_FEEL B_FLOATING_ALL_WINDOW_FEEL
    1217
    1318LoginWindow::LoginWindow(BRect frame)
    14     : BWindow(frame, "Welcome to Haiku", B_TITLED_WINDOW_LOOK,
     19    : BWindow(frame, B_TRANSLATE("Welcome to Haiku"), B_TITLED_WINDOW_LOOK,
    1520        WINDOW_FEEL,
    1621        B_NOT_MOVABLE | B_NOT_CLOSABLE | B_NOT_ZOOMABLE |
    1722        B_NOT_MINIMIZABLE | B_NOT_RESIZABLE |
  • src/apps/login/DesktopWindow.cpp

     
    77#include <string.h>
    88#include <stdio.h>
    99
     10#include <Catalog.h>
    1011#include <Directory.h>
    1112#include <Entry.h>
    1213#include <FindDirectory.h>
     
    1718#include "LoginApp.h"
    1819#include "DesktopWindow.h"
    1920
     21#undef B_TRANSLATE_CONTEXT
     22#define B_TRANSLATE_CONTEXT "Desktop Window"
     23
    2024const window_feel kPrivateDesktopWindowFeel = window_feel(1024);
    2125const window_look kPrivateDesktopWindowLook = window_look(4);
    2226    // this is a mirror of an app server private values
    2327
    2428
    2529DesktopWindow::DesktopWindow(BRect frame, bool editMode)
    26     : BWindow(frame, "Desktop",
     30    : BWindow(frame, B_TRANSLATE("Desktop"),
    2731        kPrivateDesktopWindowLook,
    2832        kPrivateDesktopWindowFeel,
    2933        B_NOT_MOVABLE | B_NOT_CLOSABLE | B_NOT_ZOOMABLE
     
    7175{
    7276    status_t err;
    7377    err = fDesktopShelf->Save();
    74     printf("error %s\n", strerror(err));
     78    printf(B_TRANSLATE_COMMENT("error %s\n",
     79        "A return message from fDesktopShelf->Save(). It can be \"B_OK\""),
     80        strerror(err));
    7581    return BWindow::QuitRequested();
    7682}
    7783
  • src/apps/login/LoginView.cpp

     
    22 * Copyright 2008, François Revol, <revol@free.fr>. All rights reserved.
    33 * Distributed under the terms of the MIT License.
    44 */
     5#include <Catalog.h>
    56#include <ScrollView.h>
    67#include <String.h>
    78#include <Window.h>
     
    1415#include "LoginApp.h"
    1516#include "LoginView.h"
    1617
     18#undef B_TRANSLATE_CONTEXT
     19#define B_TRANSLATE_CONTEXT "Login View"
     20
    1721#define LW 120
    1822#define CSEP 15
    1923#define BH 20
     
    5761
    5862    r.Set(LW + 30, Bounds().top + CSEP,
    5963        Bounds().right - CSEP, Bounds().top + CSEP + CSEP);
    60     fLoginControl = new BTextControl(r, "login", "Login:", "",
     64    fLoginControl = new BTextControl(r, "login", B_TRANSLATE("Login:"), "",
    6165        new BMessage(kLoginEdited));
    6266    AddChild(fLoginControl);
    6367
    6468    r.OffsetBySelf(0, CSEP + CSEP);
    65     fPasswordControl = new BTextControl(r, "password", "Password:", "",
    66         new BMessage(kPasswordEdited));
     69    fPasswordControl = new BTextControl(r, "password",
     70        B_TRANSLATE("Password:"), "", new BMessage(kPasswordEdited));
    6771    fPasswordControl->TextView()->HideTyping(true);
    6872    AddChild(fPasswordControl);
    6973
    7074    r.OffsetBySelf(0, CSEP + CSEP);
    71     fHidePasswordCheckBox = new BCheckBox(r, "hidepw", "Hide password",
    72         new BMessage(kHidePassword));
     75    fHidePasswordCheckBox = new BCheckBox(r, "hidepw",
     76        B_TRANSLATE("Hide password"), new BMessage(kHidePassword));
    7377    fHidePasswordCheckBox->SetValue(1);
    7478    AddChild(fHidePasswordCheckBox);
    7579
     
    7983        buttonWidth, Bounds().bottom);
    8084    buttonRect.OffsetBySelf(CSEP, -CSEP);
    8185
    82     fHaltButton = new BButton(buttonRect, "halt", "Halt",
     86    fHaltButton = new BButton(buttonRect, "halt", B_TRANSLATE("Halt"),
    8387        new BMessage(kHaltAction));
    8488    AddChild(fHaltButton);
    8589
    8690    buttonRect.OffsetBySelf(CSEP + buttonWidth, 0);
    87     fRebootButton = new BButton(buttonRect, "reboot", "Reboot",
     91    fRebootButton = new BButton(buttonRect, "reboot", B_TRANSLATE("Reboot"),
    8892        new BMessage(kRebootAction));
    8993    AddChild(fRebootButton);
    9094
     
    9397
    9498    buttonRect.OffsetToSelf(Bounds().Width() - CSEP - buttonWidth,
    9599        Bounds().Height() - CSEP - BH);
    96     fLoginButton = new BButton(buttonRect, "ok", "OK",
     100    fLoginButton = new BButton(buttonRect, "ok", B_TRANSLATE("OK"),
    97101        new BMessage(kAttemptLogin));
    98102    AddChild(fLoginButton);
    99103
     
    175179        case kLoginBad:
    176180            fPasswordControl->SetText("");
    177181            EnableControls(false);
    178             fInfoView->SetText("Invalid login!");
     182            fInfoView->SetText(B_TRANSLATE("Invalid login!"));
    179183            if (Window()) {
    180184                BPoint savedPos = Window()->Frame().LeftTop();
    181185                for (int i = 0; i < 10; i++) {
  • src/apps/login/Jamfile

     
    1919    LoginWindow.cpp
    2020    LoginView.cpp
    2121    main.cpp
    22     : be tracker $(mu_libs) $(TARGET_LIBSTDC++)
     22    : be tracker $(mu_libs) $(TARGET_LIBSTDC++) $(HAIKU_LOCALE_LIBS)
    2323    : Login.rdef
    2424;
    2525
     26DoCatalogs Login :
     27    x-vnd.Haiku-Login
     28    :
     29    LoginApp.cpp
     30    DesktopWindow.cpp
     31    LoginView.cpp
     32    LoginWindow.cpp
     33;
  • src/apps/login/LoginApp.cpp

     
    55
    66
    77#include <Alert.h>
     8#include <Catalog.h>
    89#include <Screen.h>
    910#include <String.h>
    1011#include <View.h>
     
    2526#include "multiuser_utils.h"
    2627#endif
    2728
     29#undef B_TRANSLATE_CONTEXT
     30#define B_TRANSLATE_CONTEXT "Login App"
    2831
    2932const char *kLoginAppSig = "application/x-vnd.Haiku-Login";
    3033
     
    4851    BScreen screen;
    4952
    5053    if (fEditShelfMode) {
    51         (new BAlert("Info", "You can customize the desktop shown "
    52             "behind the Login application by dropping replicants onto it.\n"
     54        (new BAlert(B_TRANSLATE("Info"), B_TRANSLATE("You can customize the "
     55            "desktop shown behind the Login application by dropping replicants"
     56            " onto it.\n"
    5357            "\n"
    54             "When you are finished just quit the application (Alt-Q).",
    55             "OK"))->Go(NULL);
     58            "When you are finished just quit the application (Alt-Q)."),
     59            B_TRANSLATE("OK")))->Go(NULL);
    5660    } else {
    5761        BRect frame(0, 0, 400, 150);
    5862        frame.OffsetBySelf(screen.Frame().Width()/2 - frame.Width()/2,
     
    8892            BRoster::Private rosterPrivate(roster);
    8993            status_t error = rosterPrivate.ShutDown(reboot, false, false);
    9094            if (error < B_OK) {
    91                 BString msg("Error: ");
    92                 msg << strerror(error);
    93                 (new BAlert("Error", msg.String(), "OK"))->Go();
     95                BString msg(B_TRANSLATE("Error: %1"));
     96                msg.ReplaceFirst("%1", strerror(error));
     97                (new BAlert(("Error"), msg.String(), B_TRANSLATE("OK")))->Go();
    9498            }
    9599            break;
    96100        }
    97101        case kSuspendAction:
    98             (new BAlert("Error", "Unimplemented", "OK"))->Go();
     102            (new BAlert(B_TRANSLATE("Error"), B_TRANSLATE("Unimplemented"),
     103                B_TRANSLATE("OK")))->Go();
    99104            break;
    100105#endif
    101106    default:
     
    115120        else if (arg == "--nonmodal")
    116121            fModalMode = false;
    117122        else /*if (arg == "--help")*/ {
    118             printf("Login application for Haiku\nUsage:\n");
     123            printf(B_TRANSLATE("Login application for Haiku\nUsage:\n"));
    119124            printf("%s [--nonmodal] [--edit]\n", argv[0]);
    120             printf("--nonmodal  Do not make the window modal\n");
    121             printf("--edit  Launch in shelf editting mode to "
    122                 "allow customizing the desktop.\n");
     125            printf(B_TRANSLATE("--nonmodal  Do not make the window modal\n"));
     126            printf(B_TRANSLATE("--edit  Launch in shelf editting mode to "
     127                "allow customizing the desktop.\n"));
    123128            // just return to the shell
    124129            exit((arg == "--help") ? 0 : 1);
    125130            return;
     
    139144        if (message->FindString("password", &password) < B_OK)
    140145            password = NULL;
    141146        err = ValidateLogin(login, password);
    142         printf("ValidateLogin: %s\n", strerror(err));
     147        printf(B_TRANSLATE_COMMENT("ValidateLogin: %s\n",
     148            "A message returned from the ValidateLogin function. "
     149            "It can be \"B_OK\"."), strerror(err));
    143150        if (err == B_OK) {
    144151            reply.what = kLoginOk;
    145152            message->SendReply(&reply);
     
    224231
    225232    return fd;
    226233}
    227 
    228 
    229