Ticket #5907: packageinstallerLocalization.2.patch

File packageinstallerLocalization.2.patch, 28.3 KB (added by Karvjorm, 12 years ago)

A localization patch for packageinsteller application.

  • src/apps/packageinstaller/PackageStatus.cpp

     
    1010#include "PackageStatus.h"
    1111
    1212#include <Autolock.h>
    13 
     13#include <Catalog.h>
    1414#include <GroupLayoutBuilder.h>
    1515#include <GroupLayout.h>
     16#include <Locale.h>
    1617
    1718#include <stdio.h>
    1819#include <string.h>
    1920
    20 // Macro reserved for later localization
    21 #define T(x) x
     21#undef TR_CONTEXT
     22#define TR_CONTEXT "PackageStatus"
    2223
    23 
    2424StopButton::StopButton()
    25     :   BButton(BRect(0, 0, 22, 18), "stop", "", new BMessage(P_MSG_STOP))
     25    :   BButton(BRect(0, 0, 22, 18), "stop", TR("Stop"), new BMessage(P_MSG_STOP))
    2626{
    2727}
    2828
     
    100100{
    101101    SetLayout(new BGroupLayout(B_VERTICAL));
    102102
    103     fStatus = new BStatusBar("status_bar", T("Installing package"));
     103    fStatus = new BStatusBar("status_bar", TR("Installing package"));
    104104    fStatus->SetBarHeight(12);
    105105
    106106    fButton = new StopButton();
  • src/apps/packageinstaller/PackageInfo.cpp

     
    1111
    1212#include <Alert.h>
    1313#include <ByteOrder.h>
     14#include <Catalog.h>
    1415#include <FindDirectory.h>
     16#include <Locale.h>
    1517#include <Path.h>
    1618#include <kernel/OS.h>
    1719
    1820
    19 // Macro reserved for later localization
    20 #define T(x) x
     21#undef TR_CONTEXT
     22#define TR_CONTEXT "PackageInfo"
    2123
    2224#define RETURN_AND_SET_STATUS(err) fStatus = err; \
    23     fprintf(stderr, "err at %s():%d: %x\n", __FUNCTION__, __LINE__, err); \
     25    fprintf(stderr, TR("err at %s():%d: %x\n"), __FUNCTION__, __LINE__, err); \
    2426    return fStatus;
    2527
    2628const uint32 kSkipOffset = 33;
     
    4850    :
    4951    fStatus(B_NO_INIT),
    5052    fPackageFile(0),
    51     fDescription(T("No package available.")),
     53    fDescription(TR("No package available.")),
    5254    fProfiles(2),
    5355    fHasImage(false)
    5456{
     
    5961    :
    6062    fStatus(B_NO_INIT),
    6163    fPackageFile(new BFile(ref, B_READ_ONLY)),
    62     fDescription(T("No package selected.")),
     64    fDescription(TR("No package selected.")),
    6365    fProfiles(2),
    6466    fHasImage(false)
    6567{
     
    10271029            parser_debug("PtcI\n");
    10281030            break;
    10291031        } else {
    1030             fprintf(stderr, "Unknown file tag %s\n", buffer);
     1032            fprintf(stderr, TR("Unknown file tag %s\n"), buffer);
    10311033            RETURN_AND_SET_STATUS(B_ERROR);
    10321034        }
    10331035    }
     
    10351037    if (static_cast<uint64>(actualSize) != fileSize) {
    10361038        // Inform the user of a possible error
    10371039        int32 selection;
    1038         BAlert *warning = new BAlert(T("filesize_wrong"),
    1039             T("There seems to be a file size mismatch in the package file. "
     1040        BAlert *warning = new BAlert("filesize_wrong",
     1041            TR("There seems to be a file size mismatch in the package file. "
    10401042                "The package might be corrupted or have been modified after its "
    1041                 "creation. Do you still wish to continue?"), T("Continue"),
    1042                 T("Abort"), NULL,
     1043                "creation. Do you still wish to continue?"), TR("Continue"),
     1044                TR("Abort"), NULL,
    10431045            B_WIDTH_AS_USUAL, B_WARNING_ALERT);
    10441046        selection = warning->Go();
    10451047
  • src/apps/packageinstaller/PackageItem.cpp

     
    1313
    1414#include <Alert.h>
    1515#include <ByteOrder.h>
     16#include <Catalog.h>
    1617#include <Directory.h>
    1718#include <fs_info.h>
     19#include <Locale.h>
    1820#include <NodeInfo.h>
    1921#include <OS.h>
    2022#include <SymLink.h>
     
    2224
    2325#include "zlib.h"
    2426
     27#undef TR_CONTEXT
     28#define TR_CONTEXT "PackageItem"
    2529
    26 // Macro reserved for later localization
    27 #define T(x) x
    28 
    2930enum {
    3031    P_CHUNK_SIZE = 256
    3132};
     
    561562}
    562563
    563564
    564 const char*
     565const uint32
    565566PackageScript::ItemKind()
    566567{
    567     return "script";
     568    return P_KIND_SCRIPT;
    568569}
    569570
    570571
     
    737738}
    738739
    739740
    740 const char*
     741const uint32
    741742PackageDirectory::ItemKind()
    742743{
    743     return "directory";
     744    return P_KIND_DIRECTORY;
    744745}
    745746
    746747
     
    903904}
    904905
    905906
    906 const char*
     907const uint32
    907908PackageFile::ItemKind()
    908909{
    909     return "file";
     910    return P_KIND_FILE;
    910911}
    911912
    912913
     
    10381039}
    10391040
    10401041
    1041 const char*
     1042const uint32
    10421043PackageLink::ItemKind()
    10431044{
    1044     return "symbolic link";
     1045    return P_KIND_SYM_LINK;
    10451046}
     1047
  • src/apps/packageinstaller/PackageItem.h

     
    4242    P_EXISTS_NONE
    4343};
    4444
     45const uint32 P_NO_KIND = 0;
     46const uint32 P_KIND_SCRIPT = 1;
     47const uint32 P_KIND_FILE = 2;
     48const uint32 P_KIND_DIRECTORY = 3;
     49const uint32 P_KIND_SYM_LINK = 4;
     50
    4551extern status_t inflate_data(uint8* in, uint32 inSize, uint8* out,
    4652    uint32 outSize);
    4753
     
    7783    virtual void            SetTo(BFile* parent, const BString& path,
    7884                                uint8 type, uint32 ctime, uint32 mtime,
    7985                                uint64 offset = 0, uint64 size = 0);
    80     virtual const char*     ItemKind() = 0;
     86    virtual const uint32    ItemKind() {return P_NO_KIND;};
    8187
    8288    protected:
    8389            status_t        InitPath(const char* path, BPath* destination);
     
    115121
    116122    virtual status_t        DoInstall(const char* path = NULL,
    117123                                ItemState *state = NULL);
    118     virtual const char*     ItemKind();
     124    virtual const uint32    ItemKind();
    119125};
    120126
    121127
     
    126132
    127133    virtual status_t        DoInstall(const char* path = NULL,
    128134                                ItemState *state = NULL);
    129     virtual const char*     ItemKind();
     135    virtual const uint32    ItemKind();
    130136
    131137            thread_id       GetThreadId() { return fThreadId; }
    132138            void            SetThreadId(thread_id id) { fThreadId = id; }
     
    151157
    152158    virtual status_t        DoInstall(const char* path = NULL,
    153159                                ItemState *state = NULL);
    154     virtual const char*     ItemKind();
     160    virtual const uint32    ItemKind();
    155161
    156162private:
    157163            uint64          fOriginalSize;
     
    172178
    173179    virtual status_t        DoInstall(const char* path = NULL,
    174180                                ItemState *state = NULL);
    175     virtual const char*     ItemKind();
     181    virtual const uint32    ItemKind();
    176182
    177183private:
    178184            uint32          fMode;
  • src/apps/packageinstaller/PackageImageViewer.cpp

     
    1010#include "PackageImageViewer.h"
    1111
    1212#include <BitmapStream.h>
     13#include <Catalog.h>
     14#include <Locale.h>
    1315#include <Message.h>
    1416#include <Screen.h>
    1517#include <TranslatorRoster.h>
    1618
    1719
    18 // Reserved
    19 #define T(x) x
     20#undef TR_CONTEXT
     21#define TR_CONTEXT "PackageImageViewer"
    2022
    21 
    2223enum {
    2324    P_MSG_CLOSE = 'pmic'
    2425};
     
    8182    if (fSuccess)
    8283        DrawBitmapAsync(fImage, Bounds());
    8384    else {
    84         float length = StringWidth(T("Image not loaded correctly"));
    85         DrawString(T("Image not loaded correctly"),
     85        float length = StringWidth(TR("Image not loaded correctly"));
     86        DrawString(TR("Image not loaded correctly"),
    8687            BPoint((Bounds().Width() - length) / 2.0f, 30.0f));
    8788    }
    8889}
  • src/apps/packageinstaller/PackageInstall.cpp

     
    1414#include "PackageView.h"
    1515
    1616#include <Alert.h>
     17#include <Catalog.h>
     18#include <Locale.h>
    1719#include <stdio.h>
    1820
    1921
    20 // Macro reserved for later localization
    21 #define T(x) x
     22#undef TR_CONTEXT
     23#define TR_CONTEXT "PackageInstall"
    2224
    2325static int32 install_function(void *data)
    2426{
     
    106108    PackageStatus *progress = fParent->GetStatusWindow();
    107109    progress->Reset(n + m + 5);
    108110
    109     progress->StageStep(1, T("Preparing package"));
     111    progress->StageStep(1, TR("Preparing package"));
    110112
    111113    InstalledPackageInfo packageInfo(info->GetName(), info->GetVersion());
    112114
     
    114116    if (err == B_OK) {
    115117        // The package is already installed, inform the user
    116118        BAlert *reinstall = new BAlert("reinstall",
    117             T("The given package seems to be already installed on your system. "
     119            TR("The given package seems to be already installed on your system. "
    118120                "Would you like to uninstall the existing one and continue the "
    119                 "installation?"), T("Continue"), T("Abort"));
     121                "installation?"), TR("Continue"), TR("Abort"));
    120122
    121123        if (reinstall->Go() == 0) {
    122124            // Uninstall the package
    123125            err = packageInfo.Uninstall();
    124126            if (err != B_OK) {
    125                 fprintf(stderr, "Error on uninstall\n");
     127                fprintf(stderr, TR("Error on uninstall\n"));
    126128                return P_MSG_I_ERROR;
    127129            }
    128130
    129131            err = packageInfo.SetTo(info->GetName(), info->GetVersion(), true);
    130132            if (err != B_OK) {
    131                 fprintf(stderr, "Error on SetTo\n");
     133                fprintf(stderr, TR("Error on SetTo\n"));
    132134                return P_MSG_I_ERROR;
    133135            }
    134136        } else {
     
    138140    } else if (err == B_ENTRY_NOT_FOUND) {
    139141        err = packageInfo.SetTo(info->GetName(), info->GetVersion(), true);
    140142        if (err != B_OK) {
    141             fprintf(stderr, "Error on SetTo\n");
     143            fprintf(stderr, TR("Error on SetTo\n"));
    142144            return P_MSG_I_ERROR;
    143145        }
    144146    } else if (progress->Stopped()) {
    145147        return P_MSG_I_ABORT;
    146148    } else {
    147         fprintf(stderr, "returning on error\n");
     149        fprintf(stderr, TR("returning on error\n"));
    148150        return P_MSG_I_ERROR;
    149151    }
    150152
    151     progress->StageStep(1, T("Installing files and folders"));
     153    progress->StageStep(1, TR("Installing files and folders"));
    152154
    153155    // Install files and directories
    154156    PackageItem *iter;
     
    189191        }
    190192
    191193        if (err != B_OK) {
    192             fprintf(stderr, "Error while writing path\n");
     194            fprintf(stderr, TR("Error while writing path\n"));
    193195            return P_MSG_I_ERROR;
    194196        }
    195197
     
    202204        packageInfo.AddItem(state.destination.Path());
    203205    }
    204206
    205     progress->StageStep(1, T("Running post-installation scripts"), "");
     207    progress->StageStep(1, TR("Running post-installation scripts"), "");
    206208
    207209    PackageScript *scr;
    208210    status_t status;
     
    214216        fCurrentScript = scr;
    215217
    216218        if (scr->DoInstall() != B_OK) {
    217             fprintf(stderr, "Error while running script\n");
     219            fprintf(stderr, TR("Error while running script\n"));
    218220            return P_MSG_I_ERROR;
    219221        }
    220222        fCurrentScriptLocker.Unlock();
     
    232234        progress->StageStep(1, NULL, label.String());
    233235    }
    234236
    235     progress->StageStep(1, T("Finishing installation"), "");
     237    progress->StageStep(1, TR("Finishing installation"), "");
    236238
    237239    err = packageInfo.Save();
    238240    if (err != B_OK)
    239241        return P_MSG_I_ERROR;
    240242
    241     progress->StageStep(1, T("Done"));
     243    progress->StageStep(1, TR("Done"));
    242244
    243245    // Inform our parent that we finished
    244246    return P_MSG_I_FINISHED;
  • src/apps/packageinstaller/PackageTextViewer.cpp

     
    1010#include "PackageTextViewer.h"
    1111
    1212#include <Button.h>
     13#include <Catalog.h>
     14#include <Locale.h>
    1315#include <ScrollView.h>
    1416
    1517#include <GroupLayout.h>
     
    2123    P_MSG_DECLINE
    2224};
    2325
    24 // Reserved
    25 #define T(x) x
     26#undef TR_CONTEXT
     27#define TR_CONTEXT "PackageTextViewer"
    2628
    2729
    2830PackageTextViewer::PackageTextViewer(const char *text, bool disclaimer)
    29     :   BWindow(BRect(125, 125, 675, 475), T("Disclaimer"), B_MODAL_WINDOW,
     31    :   BWindow(BRect(125, 125, 675, 475), TR("Disclaimer"), B_MODAL_WINDOW,
    3032            B_NOT_ZOOMABLE | B_NOT_RESIZABLE | B_NOT_CLOSABLE),
    3133        fValue(0)
    3234{
     
    115117    BRect bounds;
    116118    BRect rect = Bounds();
    117119    if (disclaimer) {
    118         BButton *button = new BButton(BRect(0, 0, 1, 1), "accept", T("Accept"),
     120        BButton *button = new BButton(BRect(0, 0, 1, 1), "accept", TR("Accept"),
    119121                new BMessage(P_MSG_ACCEPT));
    120122        button->ResizeToPreferred();
    121123
     
    128130        button->MakeDefault(true);
    129131        fBackground->AddChild(button);
    130132
    131         button = new BButton(BRect(0, 0, 1, 1), "decline", T("Decline"),
     133        button = new BButton(BRect(0, 0, 1, 1), "decline", TR("Decline"),
    132134                new BMessage(P_MSG_DECLINE));
    133135        button->ResizeToPreferred();
    134136
     
    138140        fBackground->AddChild(button);
    139141    }
    140142    else {
    141         BButton *button = new BButton(BRect(0, 0, 1, 1), "accept", T("Continue"),
     143        BButton *button = new BButton(BRect(0, 0, 1, 1), "accept", TR("Continue"),
    142144                new BMessage(P_MSG_ACCEPT));
    143145        button->ResizeToPreferred();
    144146
     
    184186            B_FOLLOW_LEFT | B_FOLLOW_TOP, 0, false, true);
    185187
    186188    if (disclaimer) {
    187         BButton *accept = new BButton("accept", T("Accept"),
     189        BButton *accept = new BButton("accept", TR("Accept"),
    188190                new BMessage(P_MSG_ACCEPT));
    189191
    190         BButton *decline = new BButton("decline", T("Decline"),
     192        BButton *decline = new BButton("decline", TR("Decline"),
    191193                new BMessage(P_MSG_DECLINE));
    192194
    193195        fBackground = BGroupLayoutBuilder(B_VERTICAL)
     
    199201            .End();
    200202    }
    201203    else {
    202         BButton *button = new BButton("accept", T("Continue"),
     204        BButton *button = new BButton("accept", TR("Continue"),
    203205                new BMessage(P_MSG_ACCEPT));
    204206
    205207        fBackground = BGroupLayoutBuilder(B_VERTICAL)
  • src/apps/packageinstaller/PackageWindow.cpp

     
    1010#include "PackageWindow.h"
    1111
    1212#include <Application.h>
    13 
     13#include <Catalog.h>
    1414#include <GroupLayout.h>
     15#include <Locale.h>
    1516
    16 // Macro reserved for later localization
    17 #define T(x) x
     17#undef TR_CONTEXT
     18#define TR_CONTEXT "PackageWindow"
    1819
    19 
    2020PackageWindow::PackageWindow(const entry_ref *ref)
    21     :   BWindow(BRect(100, 100, 600, 300), T("PackageInstaller"), B_TITLED_WINDOW,
    22             B_NOT_ZOOMABLE | B_NOT_RESIZABLE)
     21    :   BWindow(BRect(100, 100, 600, 300), TR("PackageInstaller"),
     22        B_TITLED_WINDOW, B_NOT_ZOOMABLE | B_NOT_RESIZABLE)
    2323{
    2424    //SetLayout(new BGroupLayout(B_HORIZONTAL));
    2525
  • src/apps/packageinstaller/main.cpp

     
    99
    1010#include "PackageWindow.h"
    1111
     12#include <Alert.h>
    1213#include <Application.h>
     14#include <Autolock.h>
     15#include <Catalog.h>
     16#include <Entry.h>
    1317#include <FilePanel.h>
    1418#include <List.h>
    15 #include <Alert.h>
     19#include <Locale.h>
    1620#include <TextView.h>
    17 #include <Entry.h>
    18 #include <Autolock.h>
     21
    1922#include <stdio.h>
    2023
     24#undef TR_CONTEXT
     25#define TR_CONTEXT "Packageinstaller main"
    2126
    2227class PackageInstaller : public BApplication {
    2328    public:
     
    3338        void AboutRequested();
    3439
    3540    private:
    36         BFilePanel *fOpen;
    37         uint32 fWindowCount;
     41        BFilePanel  *fOpen;
     42        uint32      fWindowCount;
     43        BCatalog    fAppCatalog;
    3844};
    3945
    4046
    4147PackageInstaller::PackageInstaller()
    4248    :   BApplication("application/x-vnd.Haiku-PackageInstaller"),
    43     fWindowCount(0)
     49    fOpen(NULL),
     50    fWindowCount(0),
     51    fAppCatalog(NULL)
    4452{
    4553    fOpen = new BFilePanel(B_OPEN_PANEL);
     54    be_locale->GetAppCatalog(&fAppCatalog);
    4655}
    4756
    4857
     
    94103   
    95104    for (i = 1; i < argc; i++) {
    96105        if (path.SetTo(argv[i]) != B_OK) {
    97             fprintf(stderr, "Error! \"%s\" is not a valid path.\n", argv[i]);
     106            fprintf(stderr, TR("Error! \"%s\" is not a valid path.\n"), argv[i]);
    98107            continue;
    99108        }
    100109       
    101110        ret = get_ref_for_path(path.Path(), &ref);
    102111        if (ret != B_OK) {
    103             fprintf(stderr, "Error (%s)! Could not open \"%s\".\n", strerror(ret),
     112            fprintf(stderr, TR("Error (%s)! Could not open \"%s\".\n"), strerror(ret),
    104113                    argv[i]);
    105114            continue;
    106115        }
     
    135144PackageInstaller::AboutRequested()
    136145{
    137146    BAlert *about = new BAlert("about",
    138         "PackageInstaller\n"
     147        TR("PackageInstaller\n"
    139148        "BeOS legacy .pkg file installer for Haiku.\n\n"
    140149        "Copyright 2007,\nŁukasz 'Sil2100' Zemczak\n\n"
    141         "Copyright (c) 2007 Haiku, Inc. \n",
    142         "OK");
     150        "Copyright (c) 2007 Haiku, Inc. \n"),
     151        TR("OK"));
    143152
    144153    BTextView *view = about->TextView();
    145154    BFont font;
  • src/apps/packageinstaller/PackageView.cpp

     
    1414
    1515#include <Alert.h>
    1616#include <Button.h>
     17#include <Catalog.h>
    1718#include <Directory.h>
    1819#include <FindDirectory.h>
     20#include <Locale.h>
    1921#include <MenuItem.h>
    2022#include <Path.h>
    2123#include <PopUpMenu.h>
     
    3234#include <fs_info.h>
    3335#include <stdio.h> // For debugging
    3436
    35 // Macro reserved for later localization
    36 #define T(x) x
     37#undef TR_CONTEXT
     38#define TR_CONTEXT "PackageView"
    3739
    3840const float kMaxDescHeight = 125.0f;
    3941const uint32 kSeparatorIndex = 3;
    4042
    4143
    42 
    4344static void
    4445convert_size(uint64 size, char *buffer, uint32 n)
    4546{
    4647    if (size < 1024)
    47         snprintf(buffer, n, "%llu bytes", size);
     48        snprintf(buffer, n, TR("%llu bytes"), size);
    4849    else if (size < 1024 * 1024)
    49         snprintf(buffer, n, "%.1f KiB", size / 1024.0f);
     50        snprintf(buffer, n, TR("%.1f KiB"), size / 1024.0f);
    5051    else if (size < 1024 * 1024 * 1024)
    51         snprintf(buffer, n, "%.1f MiB", size / (1024.0f*1024.0f));
     52        snprintf(buffer, n, TR("%.1f MiB"), size / (1024.0f*1024.0f));
    5253    else
    53         snprintf(buffer, n, "%.1f GiB", size / (1024.0f*1024.0f*1024.0f));
     54        snprintf(buffer, n, TR("%.1f GiB"), size / (1024.0f*1024.0f*1024.0f));
    5455}
    5556
    5657
     
    8889{
    8990    status_t ret = fInfo.InitCheck();
    9091    if (ret != B_OK && ret != B_NO_INIT) {
    91         BAlert *warning = new BAlert(T("parsing_failed"),
    92                 T("The package file is not readable.\nOne of the possible "
     92        BAlert *warning = new BAlert("parsing_failed",
     93                TR("The package file is not readable.\nOne of the possible "
    9394                "reasons for this might be that the requested file is not a valid "
    94                 "BeOS .pkg package."), T("OK"), NULL, NULL, B_WIDTH_AS_USUAL,
     95                "BeOS .pkg package."), TR("OK"), NULL, NULL, B_WIDTH_AS_USUAL,
    9596                B_WARNING_ALERT);
    9697        warning->Go();
    9798
     
    104105    BString title;
    105106    BString name = fInfo.GetName();
    106107    if (name.CountChars() == 0) {
    107         title = T("Package installer");
     108        title = TR("Package installer");
    108109    }
    109110    else {
    110         title = T("Install ");
     111        title = TR("Install ");
    111112        title += name;
    112113    }
    113114    parent->SetTitle(title.String());
     
    122123        // attaching the view to the window
    123124        _GroupChanged(0);
    124125
    125         fStatusWindow = new PackageStatus(T("Installation progress"), NULL, NULL,
     126        fStatusWindow = new PackageStatus(TR("Installation progress"), NULL, NULL,
    126127                this);
    127128
    128129        // Show the splash screen, if present
     
    184185        case P_MSG_I_FINISHED:
    185186        {
    186187            BAlert *notify = new BAlert("installation_success",
    187                 T("The package you requested has been successfully installed "
    188                     "on your system."), T("OK"));
     188                TR("The package you requested has been successfully installed "
     189                    "on your system."), TR("OK"));
    189190
    190191            notify->Go();
    191192            fStatusWindow->Hide();
     
    202203        case P_MSG_I_ABORT:
    203204        {
    204205            BAlert *notify = new BAlert("installation_aborted",
    205                 T("The installation of the package has been aborted."), T("OK"));
     206                TR("The installation of the package has been aborted."),
     207                TR("OK"));
    206208            notify->Go();
    207209            fStatusWindow->Hide();
    208210            fInstall->SetEnabled(true);
     
    214216        case P_MSG_I_ERROR:
    215217        {
    216218            BAlert *notify = new BAlert("installation_failed", // TODO: Review this
    217                 T("The requested package failed to install on your system. This "
    218                     "might be a problem with the target package file. Please consult "
    219                     "this issue with the package distributor."), T("OK"), NULL,
    220                 NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT);
    221             fprintf(stderr, "Error while installing the package\n");
     219                TR("The requested package failed to install on your system. "
     220                "This might be a problem with the target package file. Please "
     221                "consult this issue with the package distributor."),
     222                TR("OK"), NULL, NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT);
     223            fprintf(stderr, TR("Error while installing the package\n"));
    222224            notify->Go();
    223225            fStatusWindow->Hide();
    224226            fInstall->SetEnabled(true);
     
    253255                    break;
    254256
    255257                BString name = path.Path();
    256                 char sizeString[32];
     258                char sizeString[48];
    257259
    258                 convert_size(volume.FreeBytes(), sizeString, 32);
    259                 name << " (" << sizeString << " free)";
     260                convert_size(volume.FreeBytes(), sizeString, 48);
     261                char kbuffer[512];
     262                snprintf(kbuffer, sizeof(kbuffer), "(%s free)", sizeString);
     263                name << kbuffer;
    260264
    261265                item->SetLabel(name.String());
    262266                fCurrentPath.SetTo(path.Path());
     
    300304        case P_EXISTS_ASK:
    301305        case P_EXISTS_NONE:
    302306        {
    303             BString alertString = T("The ");
     307            const char* formatString;
     308            switch (item.ItemKind()){
     309                case P_KIND_SCRIPT:
     310                    formatString = TR("The script named \'%s\' already exits "
     311                        "in the given path.\nReplace the script with the one "
     312                        "from this package or skip it?");   
     313                    break;
     314                case P_KIND_FILE:
     315                    formatString = TR("The file named \'%s\' already exits "
     316                        "in the given path.\nReplace the file with the one "
     317                        "from this package or skip it?");
     318                    break;
     319                case P_KIND_DIRECTORY:
     320                    formatString = TR("The directory named \'%s\' already exits "
     321                        "in the given path.\nReplace the directory with one "
     322                        "from this package or skip it?");
     323                    break;
     324                case P_KIND_SYM_LINK:
     325                    formatString = TR("The symbolic link named \'%s\' already "
     326                        "exists in the give path.\nReplace the link with the "
     327                        "one from this package or skip it?");
     328                    break;
     329                default:
     330                    break;
     331            }
     332            char buffer[512];
     333            snprintf(buffer, sizeof(buffer), formatString, path.Leaf());
     334           
     335            BString alertString = buffer;
     336           
     337            BAlert *alert = new BAlert("file_exists", alertString.String(),
     338                TR("Replace"), TR("Skip"), TR("Abort"));
    304339
    305             alertString << item.ItemKind() << T(" named \'") << path.Leaf() << "\' ";
    306             alertString << T("already exists in the given path.\nReplace the file with "
    307                 "the one from this package or skip it?");
    308 
    309             BAlert *alert = new BAlert(T("file_exists"), alertString.String(),
    310                 T("Replace"), T("Skip"), T("Abort"));
    311 
    312340            choice = alert->Go();
    313341            switch (choice) {
    314342                case 0:
     
    323351
    324352            if (policy == P_EXISTS_NONE) {
    325353                // TODO: Maybe add 'No, but ask again' type of choice as well?
    326                 alertString = T("Do you want to remember this decision for the rest of "
    327                     "this installation?\nAll existing files will be ");
     354                alertString = TR("Do you want to remember this decision for "
     355                    "the rest of this installation?\n");
    328356                alertString << ((choice == P_EXISTS_OVERWRITE)
    329                     ? T("replaced?") : T("skipped?"));
     357                    ? TR("All existing files will be replaced?")
     358                    : TR("All existing files will be skipped?"));
    330359
    331                 alert = new BAlert(T("policy_decision"), alertString.String(),
    332                     T("Yes"), T("No"));
     360                alert = new BAlert("policy_decision", alertString.String(),
     361                    TR("Replace"), TR("Skip"));
    333362
    334363                int32 decision = alert->Go();
    335364                if (decision == 0)
     
    361390    fInstallTypes = new BPopUpMenu("none");
    362391
    363392    BMenuField *installType = new BMenuField("install_type",
    364         T("Installation type:"), fInstallTypes, 0);
     393        TR("Installation type:"), fInstallTypes, 0);
    365394    installType->SetAlignment(B_ALIGN_RIGHT);
    366395    installType->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT, B_ALIGN_MIDDLE));
    367396
     
    370399    fInstallDesc->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
    371400    fInstallDesc->MakeEditable(false);
    372401    fInstallDesc->MakeSelectable(false);
    373     fInstallDesc->SetText(T("No installation type selected"));
     402    fInstallDesc->SetText(TR("No installation type selected"));
    374403    fInstallDesc->TextHeight(0, fInstallDesc->TextLength());
    375404
    376     fInstall = new BButton("install_button", T("Install"),
     405    fInstall = new BButton("install_button", TR("Install"),
    377406            new BMessage(P_MSG_INSTALL));
    378407
    379408    BView *installField = BGroupLayoutBuilder(B_VERTICAL, 5.0f)
     
    436465    fInstallTypes = new BPopUpMenu("none");
    437466
    438467    BMenuField *installType = new BMenuField(BRect(2, 2, 100, 50), "install_type",
    439         T("Installation type:"), fInstallTypes, false);
     468        TR("Installation type:"), fInstallTypes, false);
    440469    installType->SetDivider(installType->StringWidth(installType->Label()) + 8);
    441470    installType->SetAlignment(B_ALIGN_RIGHT);
    442471    installType->ResizeToPreferred();
     
    450479        B_WILL_DRAW);
    451480    fInstallDesc->MakeEditable(false);
    452481    fInstallDesc->MakeSelectable(false);
    453     fInstallDesc->SetText(T("No installation type selected"));
     482    fInstallDesc->SetText(TR("No installation type selected"));
    454483    fInstallDesc->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
    455484
    456485    fInstallDesc->ResizeTo(rect.Width() - B_V_SCROLL_BAR_WIDTH, 60);
     
    469498    rect = installBox->Frame();
    470499    rect.top = rect.bottom + 5;
    471500    rect.bottom += 35;
    472     fDestField = new BMenuField(rect, "install_to", T("Install to:"),
     501    fDestField = new BMenuField(rect, "install_to", TR("Install to:"),
    473502            fDestination, false);
    474503    fDestField->SetDivider(fDestField->StringWidth(fDestField->Label()) + 8);
    475504    fDestField->SetAlignment(B_ALIGN_RIGHT);
     
    477506
    478507    AddChild(fDestField);
    479508
    480     fInstall = new BButton(rect, "install_button", T("Install"),
     509    fInstall = new BButton(rect, "install_button", TR("Install"),
    481510            new BMessage(P_MSG_INSTALL));
    482511    fInstall->ResizeToPreferred();
    483512    AddChild(fInstall);
     
    493522    int i = 0, num = fInfo.GetProfileCount();
    494523    pkg_profile *prof;
    495524    BMenuItem *item = 0;
    496     char sizeString[32];
     525    char sizeString[48];
    497526    BString name = "";
    498527    BMessage *message;
    499528
    500529    if (num > 0) { // Add the default item
    501530        prof = fInfo.GetProfile(0);
    502         convert_size(prof->space_needed, sizeString, 32);
    503         name << prof->name << " (" << sizeString << ")";
     531        convert_size(prof->space_needed, sizeString, 48);
     532        char kbuffer[512];
     533        snprintf(kbuffer, sizeof(kbuffer), "(%s)", sizeString);
     534        name << prof->name << kbuffer;
    504535
    505536        message = new BMessage(P_MSG_GROUP_CHANGED);
    506537        message->AddInt32("index", 0);
     
    514545        prof = fInfo.GetProfile(i);
    515546
    516547        if (prof) {
    517             convert_size(prof->space_needed, sizeString, 32);
     548            convert_size(prof->space_needed, sizeString, 48);
    518549            name = prof->name;
    519             name << " (" << sizeString << ")";
     550            char kbuffer[512];
     551            snprintf(kbuffer, sizeof(kbuffer), "(%s)", sizeString);
     552            name << kbuffer;
    520553
    521554            message = new BMessage(P_MSG_GROUP_CHANGED);
    522555            message->AddInt32("index", i);
     
    554587        BPath path;
    555588        BMessage *temp;
    556589        BVolume volume;
     590        char kbuffer[512];
     591        const char *tmp = TR("(%s free)");
    557592
    558593        if (prof->path_type == P_INSTALL_PATH) {
    559594            dev_t device;
    560595            BString name;
    561             char sizeString[32];
     596            char sizeString[48];
    562597
    563598            if (find_directory(B_BEOS_APPS_DIRECTORY, &path) == B_OK) {
    564599                device = dev_for_path(path.Path());
     
    566601                    temp = new BMessage(P_MSG_PATH_CHANGED);
    567602                    temp->AddString("path", BString(path.Path()));
    568603
    569                     convert_size(volume.FreeBytes(), sizeString, 32);
     604                    convert_size(volume.FreeBytes(), sizeString, 48);
    570605                    name = path.Path();
    571                     name << " (" << sizeString << " free)";
     606                    snprintf(kbuffer, sizeof(kbuffer), tmp, sizeString);
     607                    name << kbuffer;
    572608                    item = new BMenuItem(name.String(), temp);
    573609                    item->SetTarget(this);
    574610                    fDestination->AddItem(item);
     
    580616                    temp = new BMessage(P_MSG_PATH_CHANGED);
    581617                    temp->AddString("path", BString(path.Path()));
    582618
    583                     convert_size(volume.FreeBytes(), sizeString, 32);
     619                    convert_size(volume.FreeBytes(), sizeString, 48);
     620                    char kbuffer[512];
     621                    snprintf(kbuffer, sizeof(kbuffer), tmp, sizeString);
    584622                    name = path.Path();
    585                     name << " (" << sizeString << " free)";
     623                    name << kbuffer;
    586624                    item = new BMenuItem(name.String(), temp);
    587625                    item->SetTarget(this);
    588626                    fDestination->AddItem(item);
     
    595633            }
    596634            fDestination->AddSeparatorItem();
    597635
    598             item = new BMenuItem("Other" B_UTF8_ELLIPSIS, new BMessage(P_MSG_OPEN_PANEL));
     636            item = new BMenuItem(TR("Other" B_UTF8_ELLIPSIS),
     637                new BMessage(P_MSG_OPEN_PANEL));
    599638            item->SetTarget(this);
    600639            fDestination->AddItem(item);
    601640
     
    603642        } else if (prof->path_type == P_USER_PATH) {
    604643            BString name;
    605644            bool defaultPathSet = false;
    606             char sizeString[32], volumeName[B_FILE_NAME_LENGTH];
     645            char sizeString[48], volumeName[B_FILE_NAME_LENGTH];
    607646            BVolumeRoster roster;
    608647            BDirectory mountPoint;
    609648
     
    619658                temp = new BMessage(P_MSG_PATH_CHANGED);
    620659                temp->AddString("path", BString(path.Path()));
    621660
    622                 convert_size(volume.FreeBytes(), sizeString, 32);
     661                convert_size(volume.FreeBytes(), sizeString, 48);
    623662                volume.GetName(volumeName);
    624663                name = volumeName;
    625                 name << " (" << sizeString << " free)";
     664                snprintf(kbuffer, sizeof(kbuffer), tmp, sizeString);
     665                name << kbuffer;
    626666                item = new BMenuItem(name.String(), temp);
    627667                item->SetTarget(this);
    628668                fDestination->AddItem(item);