Ticket #6058: filepanelLocalization.patch

File filepanelLocalization.patch, 8.3 KB (added by Karvjorm, 14 years ago)

An updated filepanelLocalization.patch

  • src/bin/Jamfile

     
    201201# standard commands that need libbe.so, libtracker.so
    202202StdBinCommands
    203203    checkitout.cpp
     204    : be tracker $(TARGET_LIBSUPC++) : $(haiku-utils_rsrc) ;
     205   
     206#standard commands that need libbe.so, libtracker.so, liblocale.so
     207StdBinCommands
    204208    filepanel.cpp
    205     : be tracker $(TARGET_LIBSUPC++) : $(haiku-utils_rsrc) ;
     209    : be tracker $(TARGET_LIBSUPC++) $(HAIKU_LOCALE_LIBS) : $(haiku-utils_rsrc) ;
    206210
    207211# standard commands that need libncurses.a
    208212StdBinCommands
  • src/bin/filepanel.cpp

     
    1717#include <stdlib.h>
    1818#include <strings.h>
    1919#include <Application.h>
     20#include <Catalog.h>
     21#include <Locale.h>
    2022#include <Messenger.h>
    2123#include <Window.h>
    2224#include <storage/Entry.h>
     
    2527
    2628#define APP_SIG "application/x-vnd.mmu_man.filepanel"
    2729
     30#undef B_TRANSLATE_CONTEXT
     31#define B_TRANSLATE_CONTEXT "FilePanelApp"
     32
     33
    2834volatile int return_code = 0;
    2935
    3036class FilePanelApp : public BApplication
     
    3642    virtual void RefsReceived(BMessage *message);
    3743};
    3844
     45
    3946FilePanelApp::FilePanelApp()
    4047    :BApplication(APP_SIG)
    4148{
    4249}
    4350
     51
    4452void
    4553FilePanelApp::MessageReceived(BMessage *message)
    4654{
     
    6876    }
    6977}
    7078
     79
    7180void
    7281FilePanelApp::RefsReceived(BMessage *message)
    7382{
     
    8493    be_app_messenger.SendMessage(B_QUIT_REQUESTED);
    8594}
    8695
     96
    8797int
    8898usage(char *pname, int error)
    8999{
    90     fprintf(stderr, "display a load/save file panel\n");
    91     fprintf(stderr, "usage: %s [--help] [--directory folder] [--load|--save] [--title ttl] [--single] [--modal] [--allow pattern] [--forbid pattern]\n", pname);
    92     fprintf(stderr, "usage: %s [-h]     [-d folder]              [-l|-s]     [-t ttl]      [-1]       [-m]      [-a pattern]      [-f pattern]\n", pname);
    93     fprintf(stderr, "options:\n");
    94     fprintf(stderr, "short\tlong\tdescription\n");
    95     fprintf(stderr, "-h\t--help\tdisplay usage\n");
    96     fprintf(stderr, "-d\t--directory\topen at <folder>\n");
    97     fprintf(stderr, "-l\t--load\tuse a load FilePanel (default)\n");
    98     fprintf(stderr, "-s\t--save\tuse a save FilePanel\n");
    99     fprintf(stderr, "-n\t--name\tset the default name for saving\n");
    100     fprintf(stderr, "-k\t--kind\tkind of entries that can be opened (flavour): any combination of f, d, s (file (default), directory, symlink)\n");
    101     fprintf(stderr, "-t\t--title\tset the FilePanel window title\n");
    102     fprintf(stderr, "-1\t--single\tallow only 1 file to be selected\n");
    103     fprintf(stderr, "-m\t--modal\tmakes the FilePanel modal\n");
     100    fprintf(stderr, B_TRANSLATE("display a load/save file panel\n"));
     101    fprintf(stderr, B_TRANSLATE("usage: %s [--help] [--directory folder] "
     102        "[--load|--save] [--title ttl] [--single] [--modal] [--allow pattern] "
     103        "[--forbid pattern]\n"), pname);
     104    fprintf(stderr, B_TRANSLATE("usage: %s [-h]     [-d folder]              "
     105        "[-l|-s]     [-t ttl]      [-1]       [-m]      [-a pattern]      "
     106        "[-f pattern]\n"), pname);
     107    fprintf(stderr, B_TRANSLATE("options:\n"));
     108    fprintf(stderr, B_TRANSLATE("short\tlong\tdescription\n"));
     109    fprintf(stderr, B_TRANSLATE("-h\t--help\tdisplay usage\n"));
     110    fprintf(stderr, B_TRANSLATE("-d\t--directory\topen at <folder>\n"));
     111    fprintf(stderr, B_TRANSLATE("-l\t--load\tuse a load FilePanel "
     112        "(default)\n"));
     113    fprintf(stderr, B_TRANSLATE("-s\t--save\tuse a save FilePanel\n"));
     114    fprintf(stderr, B_TRANSLATE("-n\t--name\tset the default name for "
     115        "saving\n"));
     116    fprintf(stderr, B_TRANSLATE("-k\t--kind\tkind of entries that can be "
     117        "opened (flavour): any combination of f, d, s (file (default), "
     118        "directory, symlink)\n"));
     119    fprintf(stderr, B_TRANSLATE("-t\t--title\tset the FilePanel window "
     120        "title\n"));
     121    fprintf(stderr, B_TRANSLATE("-1\t--single\tallow only 1 file to be "
     122        "selected\n"));
     123    fprintf(stderr, B_TRANSLATE("-m\t--modal\tmakes the FilePanel modal\n"));
    104124#ifndef USE_FNMATCH
    105     fprintf(stderr, "-a\t--allow\tunimplemented\n");
    106     fprintf(stderr, "-f\t--forbid\tunimplemented\n");
     125    fprintf(stderr, B_TRANSLATE("-a\t--allow\tunimplemented\n"));
     126    fprintf(stderr, B_TRANSLATE("-f\t--forbid\tunimplemented\n"));
    107127#else
    108     fprintf(stderr, "-a\t--allow\tunimplemented\n");
    109     fprintf(stderr, "-f\t--forbid\tunimplemented\n");
     128    fprintf(stderr, B_TRANSLATE("-a\t--allow\tunimplemented\n"));
     129    fprintf(stderr, B_TRANSLATE("-f\t--forbid\tunimplemented\n"));
    110130#endif
    111131    return error;
    112132}
    113133
     134
    114135int
    115136main(int argc, char **argv)
    116137{
     
    124145    const char *defaultName = NULL;
    125146
    126147    for (i = 1; i < argc; i++) {
    127         if (strncmp(argv[i], "--", 2) && ((*(argv[i]) == '-' && strlen(argv[i]) != 2) || *(argv[i]) != '-')) {
    128             fprintf(stderr, "%s not a valid option\n", argv[i]);
     148        if (strncmp(argv[i], "--", 2) && ((*(argv[i]) == '-' &&
     149            strlen(argv[i]) != 2) || *(argv[i]) != '-')) {
     150            fprintf(stderr, B_TRANSLATE("%s not a valid option\n"), argv[i]);
    129151            return usage(argv[0], 2);
    130152        }
    131153        if (!strcmp(argv[i], "--help") || !strcmp(argv[i], "-h")) {
    132154            return usage(argv[0], 0);
    133155        } else if (!strcmp(argv[i], "--directory") || !strcmp(argv[i], "-d")) {
    134156            if (++i >= argc) {
    135                 fprintf(stderr, "%s: this option requires a parameter\n", argv[i-1]);
     157                fprintf(stderr, B_TRANSLATE("%s: this option requires a "
     158                    "parameter\n"), argv[i-1]);
    136159                return usage(argv[0], 2);
    137160            }
    138161            openAt = argv[i];
     
    142165            fpMode = B_SAVE_PANEL;
    143166        } else if (!strcmp(argv[i], "--name") || !strcmp(argv[i], "-n")) {
    144167            if (++i >= argc) {
    145                 fprintf(stderr, "%s: this option requires a parameter\n", argv[i-1]);
     168                fprintf(stderr, B_TRANSLATE("%s: this option requires a "
     169                    "parameter\n"), argv[i-1]);
    146170                return usage(argv[0], 2);
    147171            }
    148172            defaultName = (const char *)argv[i];
    149173        } else if (!strcmp(argv[i], "--kind") || !strcmp(argv[i], "-k")) {
    150174            if (++i >= argc) {
    151                 fprintf(stderr, "%s: this option requires a parameter\n", argv[i-1]);
     175                fprintf(stderr, B_TRANSLATE("%s: this option requires a "
     176                    "parameter\n"), argv[i-1]);
    152177                return usage(argv[0], 2);
    153178            }
    154179            if (strchr(argv[i], 'f')) nodeFlavour |= B_FILE_NODE;
     
    156181            if (strchr(argv[i], 's')) nodeFlavour |= B_SYMLINK_NODE;
    157182        } else if (!strcmp(argv[i], "--title") || !strcmp(argv[i], "-t")) {
    158183            if (++i >= argc) {
    159                 fprintf(stderr, "%s: this option requires a parameter\n", argv[i-1]);
     184                fprintf(stderr, B_TRANSLATE("%s: this option requires a "
     185                    "parameter\n"), argv[i-1]);
    160186                return usage(argv[0], 2);
    161187            }
    162188            windowTitle = argv[i];
     
    166192            makeModal = true;
    167193        } else if (!strcmp(argv[i], "--allow") || !strcmp(argv[i], "-a")) {
    168194            if (++i >= argc) {
    169                 fprintf(stderr, "%s: this option requires a parameter\n", argv[i-1]);
     195                fprintf(stderr, B_TRANSLATE("%s: this option requires a "
     196                    "parameter\n"), argv[i-1]);
    170197                return usage(argv[0], 2);
    171198            }
    172             fprintf(stderr, "%s: UNIMPLEMENTED\n", argv[i-1]);
     199            fprintf(stderr, B_TRANSLATE("%s: UNIMPLEMENTED\n"), argv[i-1]);
    173200        } else if (!strcmp(argv[i], "--forbid") || !strcmp(argv[i], "-f")) {
    174201            if (++i >= argc) {
    175                 fprintf(stderr, "%s: this option requires a parameter\n", argv[i-1]);
     202                fprintf(stderr, B_TRANSLATE("%s: this option requires a "
     203                    "parameter\n"), argv[i-1]);
    176204                return usage(argv[0], 2);
    177205            }
    178             fprintf(stderr, "%s: UNIMPLEMENTED\n", argv[i-1]);
     206            fprintf(stderr, B_TRANSLATE("%s: UNIMPLEMENTED\n"), argv[i-1]);
    179207        } else {
    180             fprintf(stderr, "%s not a valid option\n", argv[i]);
     208            fprintf(stderr, B_TRANSLATE("%s not a valid option\n"), argv[i]);
    181209            return usage(argv[0], 2);
    182210        }
    183211    }
    184212    new FilePanelApp;
    185213    entry_ref panelDir;
    186 // THIS LINE makes main() return always 0 no matter which value on return of exit() ???
    187     BFilePanel *fPanel = new BFilePanel(fpMode, NULL, NULL, nodeFlavour, allowMultiSelect, NULL, NULL, makeModal);
     214// THIS LINE makes main() return always 0 no matter which value on return of
     215// exit() ???
     216    BFilePanel *fPanel = new BFilePanel(fpMode, NULL, NULL, nodeFlavour,
     217        allowMultiSelect, NULL, NULL, makeModal);
    188218/**/
    189219    if (openAt)
    190220        fPanel->SetPanelDirectory(openAt);