Ticket #6058: filepanelLocalization.patch
File filepanelLocalization.patch, 8.3 KB (added by , 14 years ago) |
---|
-
src/bin/Jamfile
201 201 # standard commands that need libbe.so, libtracker.so 202 202 StdBinCommands 203 203 checkitout.cpp 204 : be tracker $(TARGET_LIBSUPC++) : $(haiku-utils_rsrc) ; 205 206 #standard commands that need libbe.so, libtracker.so, liblocale.so 207 StdBinCommands 204 208 filepanel.cpp 205 : be tracker $(TARGET_LIBSUPC++) : $(haiku-utils_rsrc) ;209 : be tracker $(TARGET_LIBSUPC++) $(HAIKU_LOCALE_LIBS) : $(haiku-utils_rsrc) ; 206 210 207 211 # standard commands that need libncurses.a 208 212 StdBinCommands -
src/bin/filepanel.cpp
17 17 #include <stdlib.h> 18 18 #include <strings.h> 19 19 #include <Application.h> 20 #include <Catalog.h> 21 #include <Locale.h> 20 22 #include <Messenger.h> 21 23 #include <Window.h> 22 24 #include <storage/Entry.h> … … 25 27 26 28 #define APP_SIG "application/x-vnd.mmu_man.filepanel" 27 29 30 #undef B_TRANSLATE_CONTEXT 31 #define B_TRANSLATE_CONTEXT "FilePanelApp" 32 33 28 34 volatile int return_code = 0; 29 35 30 36 class FilePanelApp : public BApplication … … 36 42 virtual void RefsReceived(BMessage *message); 37 43 }; 38 44 45 39 46 FilePanelApp::FilePanelApp() 40 47 :BApplication(APP_SIG) 41 48 { 42 49 } 43 50 51 44 52 void 45 53 FilePanelApp::MessageReceived(BMessage *message) 46 54 { … … 68 76 } 69 77 } 70 78 79 71 80 void 72 81 FilePanelApp::RefsReceived(BMessage *message) 73 82 { … … 84 93 be_app_messenger.SendMessage(B_QUIT_REQUESTED); 85 94 } 86 95 96 87 97 int 88 98 usage(char *pname, int error) 89 99 { 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")); 104 124 #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")); 107 127 #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")); 110 130 #endif 111 131 return error; 112 132 } 113 133 134 114 135 int 115 136 main(int argc, char **argv) 116 137 { … … 124 145 const char *defaultName = NULL; 125 146 126 147 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]); 129 151 return usage(argv[0], 2); 130 152 } 131 153 if (!strcmp(argv[i], "--help") || !strcmp(argv[i], "-h")) { 132 154 return usage(argv[0], 0); 133 155 } else if (!strcmp(argv[i], "--directory") || !strcmp(argv[i], "-d")) { 134 156 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]); 136 159 return usage(argv[0], 2); 137 160 } 138 161 openAt = argv[i]; … … 142 165 fpMode = B_SAVE_PANEL; 143 166 } else if (!strcmp(argv[i], "--name") || !strcmp(argv[i], "-n")) { 144 167 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]); 146 170 return usage(argv[0], 2); 147 171 } 148 172 defaultName = (const char *)argv[i]; 149 173 } else if (!strcmp(argv[i], "--kind") || !strcmp(argv[i], "-k")) { 150 174 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]); 152 177 return usage(argv[0], 2); 153 178 } 154 179 if (strchr(argv[i], 'f')) nodeFlavour |= B_FILE_NODE; … … 156 181 if (strchr(argv[i], 's')) nodeFlavour |= B_SYMLINK_NODE; 157 182 } else if (!strcmp(argv[i], "--title") || !strcmp(argv[i], "-t")) { 158 183 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]); 160 186 return usage(argv[0], 2); 161 187 } 162 188 windowTitle = argv[i]; … … 166 192 makeModal = true; 167 193 } else if (!strcmp(argv[i], "--allow") || !strcmp(argv[i], "-a")) { 168 194 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]); 170 197 return usage(argv[0], 2); 171 198 } 172 fprintf(stderr, "%s: UNIMPLEMENTED\n", argv[i-1]);199 fprintf(stderr, B_TRANSLATE("%s: UNIMPLEMENTED\n"), argv[i-1]); 173 200 } else if (!strcmp(argv[i], "--forbid") || !strcmp(argv[i], "-f")) { 174 201 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]); 176 204 return usage(argv[0], 2); 177 205 } 178 fprintf(stderr, "%s: UNIMPLEMENTED\n", argv[i-1]);206 fprintf(stderr, B_TRANSLATE("%s: UNIMPLEMENTED\n"), argv[i-1]); 179 207 } 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]); 181 209 return usage(argv[0], 2); 182 210 } 183 211 } 184 212 new FilePanelApp; 185 213 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); 188 218 /**/ 189 219 if (openAt) 190 220 fPanel->SetPanelDirectory(openAt);