Ticket #5907: packageinstallerLocalization.2.patch
File packageinstallerLocalization.2.patch, 28.3 KB (added by , 15 years ago) |
---|
-
src/apps/packageinstaller/PackageStatus.cpp
10 10 #include "PackageStatus.h" 11 11 12 12 #include <Autolock.h> 13 13 #include <Catalog.h> 14 14 #include <GroupLayoutBuilder.h> 15 15 #include <GroupLayout.h> 16 #include <Locale.h> 16 17 17 18 #include <stdio.h> 18 19 #include <string.h> 19 20 20 // Macro reserved for later localization 21 #define T (x) x21 #undef TR_CONTEXT 22 #define TR_CONTEXT "PackageStatus" 22 23 23 24 24 StopButton::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)) 26 26 { 27 27 } 28 28 … … 100 100 { 101 101 SetLayout(new BGroupLayout(B_VERTICAL)); 102 102 103 fStatus = new BStatusBar("status_bar", T ("Installing package"));103 fStatus = new BStatusBar("status_bar", TR("Installing package")); 104 104 fStatus->SetBarHeight(12); 105 105 106 106 fButton = new StopButton(); -
src/apps/packageinstaller/PackageInfo.cpp
11 11 12 12 #include <Alert.h> 13 13 #include <ByteOrder.h> 14 #include <Catalog.h> 14 15 #include <FindDirectory.h> 16 #include <Locale.h> 15 17 #include <Path.h> 16 18 #include <kernel/OS.h> 17 19 18 20 19 // Macro reserved for later localization 20 #define T (x) x21 #undef TR_CONTEXT 22 #define TR_CONTEXT "PackageInfo" 21 23 22 24 #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); \ 24 26 return fStatus; 25 27 26 28 const uint32 kSkipOffset = 33; … … 48 50 : 49 51 fStatus(B_NO_INIT), 50 52 fPackageFile(0), 51 fDescription(T ("No package available.")),53 fDescription(TR("No package available.")), 52 54 fProfiles(2), 53 55 fHasImage(false) 54 56 { … … 59 61 : 60 62 fStatus(B_NO_INIT), 61 63 fPackageFile(new BFile(ref, B_READ_ONLY)), 62 fDescription(T ("No package selected.")),64 fDescription(TR("No package selected.")), 63 65 fProfiles(2), 64 66 fHasImage(false) 65 67 { … … 1027 1029 parser_debug("PtcI\n"); 1028 1030 break; 1029 1031 } else { 1030 fprintf(stderr, "Unknown file tag %s\n", buffer);1032 fprintf(stderr, TR("Unknown file tag %s\n"), buffer); 1031 1033 RETURN_AND_SET_STATUS(B_ERROR); 1032 1034 } 1033 1035 } … … 1035 1037 if (static_cast<uint64>(actualSize) != fileSize) { 1036 1038 // Inform the user of a possible error 1037 1039 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. " 1040 1042 "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, 1043 1045 B_WIDTH_AS_USUAL, B_WARNING_ALERT); 1044 1046 selection = warning->Go(); 1045 1047 -
src/apps/packageinstaller/PackageItem.cpp
13 13 14 14 #include <Alert.h> 15 15 #include <ByteOrder.h> 16 #include <Catalog.h> 16 17 #include <Directory.h> 17 18 #include <fs_info.h> 19 #include <Locale.h> 18 20 #include <NodeInfo.h> 19 21 #include <OS.h> 20 22 #include <SymLink.h> … … 22 24 23 25 #include "zlib.h" 24 26 27 #undef TR_CONTEXT 28 #define TR_CONTEXT "PackageItem" 25 29 26 // Macro reserved for later localization27 #define T(x) x28 29 30 enum { 30 31 P_CHUNK_SIZE = 256 31 32 }; … … 561 562 } 562 563 563 564 564 const char*565 const uint32 565 566 PackageScript::ItemKind() 566 567 { 567 return "script";568 return P_KIND_SCRIPT; 568 569 } 569 570 570 571 … … 737 738 } 738 739 739 740 740 const char*741 const uint32 741 742 PackageDirectory::ItemKind() 742 743 { 743 return "directory";744 return P_KIND_DIRECTORY; 744 745 } 745 746 746 747 … … 903 904 } 904 905 905 906 906 const char*907 const uint32 907 908 PackageFile::ItemKind() 908 909 { 909 return "file";910 return P_KIND_FILE; 910 911 } 911 912 912 913 … … 1038 1039 } 1039 1040 1040 1041 1041 const char*1042 const uint32 1042 1043 PackageLink::ItemKind() 1043 1044 { 1044 return "symbolic link";1045 return P_KIND_SYM_LINK; 1045 1046 } 1047 -
src/apps/packageinstaller/PackageItem.h
42 42 P_EXISTS_NONE 43 43 }; 44 44 45 const uint32 P_NO_KIND = 0; 46 const uint32 P_KIND_SCRIPT = 1; 47 const uint32 P_KIND_FILE = 2; 48 const uint32 P_KIND_DIRECTORY = 3; 49 const uint32 P_KIND_SYM_LINK = 4; 50 45 51 extern status_t inflate_data(uint8* in, uint32 inSize, uint8* out, 46 52 uint32 outSize); 47 53 … … 77 83 virtual void SetTo(BFile* parent, const BString& path, 78 84 uint8 type, uint32 ctime, uint32 mtime, 79 85 uint64 offset = 0, uint64 size = 0); 80 virtual const char* ItemKind() = 0;86 virtual const uint32 ItemKind() {return P_NO_KIND;}; 81 87 82 88 protected: 83 89 status_t InitPath(const char* path, BPath* destination); … … 115 121 116 122 virtual status_t DoInstall(const char* path = NULL, 117 123 ItemState *state = NULL); 118 virtual const char*ItemKind();124 virtual const uint32 ItemKind(); 119 125 }; 120 126 121 127 … … 126 132 127 133 virtual status_t DoInstall(const char* path = NULL, 128 134 ItemState *state = NULL); 129 virtual const char*ItemKind();135 virtual const uint32 ItemKind(); 130 136 131 137 thread_id GetThreadId() { return fThreadId; } 132 138 void SetThreadId(thread_id id) { fThreadId = id; } … … 151 157 152 158 virtual status_t DoInstall(const char* path = NULL, 153 159 ItemState *state = NULL); 154 virtual const char*ItemKind();160 virtual const uint32 ItemKind(); 155 161 156 162 private: 157 163 uint64 fOriginalSize; … … 172 178 173 179 virtual status_t DoInstall(const char* path = NULL, 174 180 ItemState *state = NULL); 175 virtual const char*ItemKind();181 virtual const uint32 ItemKind(); 176 182 177 183 private: 178 184 uint32 fMode; -
src/apps/packageinstaller/PackageImageViewer.cpp
10 10 #include "PackageImageViewer.h" 11 11 12 12 #include <BitmapStream.h> 13 #include <Catalog.h> 14 #include <Locale.h> 13 15 #include <Message.h> 14 16 #include <Screen.h> 15 17 #include <TranslatorRoster.h> 16 18 17 19 18 // Reserved 19 #define T (x) x20 #undef TR_CONTEXT 21 #define TR_CONTEXT "PackageImageViewer" 20 22 21 22 23 enum { 23 24 P_MSG_CLOSE = 'pmic' 24 25 }; … … 81 82 if (fSuccess) 82 83 DrawBitmapAsync(fImage, Bounds()); 83 84 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"), 86 87 BPoint((Bounds().Width() - length) / 2.0f, 30.0f)); 87 88 } 88 89 } -
src/apps/packageinstaller/PackageInstall.cpp
14 14 #include "PackageView.h" 15 15 16 16 #include <Alert.h> 17 #include <Catalog.h> 18 #include <Locale.h> 17 19 #include <stdio.h> 18 20 19 21 20 // Macro reserved for later localization 21 #define T (x) x22 #undef TR_CONTEXT 23 #define TR_CONTEXT "PackageInstall" 22 24 23 25 static int32 install_function(void *data) 24 26 { … … 106 108 PackageStatus *progress = fParent->GetStatusWindow(); 107 109 progress->Reset(n + m + 5); 108 110 109 progress->StageStep(1, T ("Preparing package"));111 progress->StageStep(1, TR("Preparing package")); 110 112 111 113 InstalledPackageInfo packageInfo(info->GetName(), info->GetVersion()); 112 114 … … 114 116 if (err == B_OK) { 115 117 // The package is already installed, inform the user 116 118 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. " 118 120 "Would you like to uninstall the existing one and continue the " 119 "installation?"), T ("Continue"), T("Abort"));121 "installation?"), TR("Continue"), TR("Abort")); 120 122 121 123 if (reinstall->Go() == 0) { 122 124 // Uninstall the package 123 125 err = packageInfo.Uninstall(); 124 126 if (err != B_OK) { 125 fprintf(stderr, "Error on uninstall\n");127 fprintf(stderr, TR("Error on uninstall\n")); 126 128 return P_MSG_I_ERROR; 127 129 } 128 130 129 131 err = packageInfo.SetTo(info->GetName(), info->GetVersion(), true); 130 132 if (err != B_OK) { 131 fprintf(stderr, "Error on SetTo\n");133 fprintf(stderr, TR("Error on SetTo\n")); 132 134 return P_MSG_I_ERROR; 133 135 } 134 136 } else { … … 138 140 } else if (err == B_ENTRY_NOT_FOUND) { 139 141 err = packageInfo.SetTo(info->GetName(), info->GetVersion(), true); 140 142 if (err != B_OK) { 141 fprintf(stderr, "Error on SetTo\n");143 fprintf(stderr, TR("Error on SetTo\n")); 142 144 return P_MSG_I_ERROR; 143 145 } 144 146 } else if (progress->Stopped()) { 145 147 return P_MSG_I_ABORT; 146 148 } else { 147 fprintf(stderr, "returning on error\n");149 fprintf(stderr, TR("returning on error\n")); 148 150 return P_MSG_I_ERROR; 149 151 } 150 152 151 progress->StageStep(1, T ("Installing files and folders"));153 progress->StageStep(1, TR("Installing files and folders")); 152 154 153 155 // Install files and directories 154 156 PackageItem *iter; … … 189 191 } 190 192 191 193 if (err != B_OK) { 192 fprintf(stderr, "Error while writing path\n");194 fprintf(stderr, TR("Error while writing path\n")); 193 195 return P_MSG_I_ERROR; 194 196 } 195 197 … … 202 204 packageInfo.AddItem(state.destination.Path()); 203 205 } 204 206 205 progress->StageStep(1, T ("Running post-installation scripts"), "");207 progress->StageStep(1, TR("Running post-installation scripts"), ""); 206 208 207 209 PackageScript *scr; 208 210 status_t status; … … 214 216 fCurrentScript = scr; 215 217 216 218 if (scr->DoInstall() != B_OK) { 217 fprintf(stderr, "Error while running script\n");219 fprintf(stderr, TR("Error while running script\n")); 218 220 return P_MSG_I_ERROR; 219 221 } 220 222 fCurrentScriptLocker.Unlock(); … … 232 234 progress->StageStep(1, NULL, label.String()); 233 235 } 234 236 235 progress->StageStep(1, T ("Finishing installation"), "");237 progress->StageStep(1, TR("Finishing installation"), ""); 236 238 237 239 err = packageInfo.Save(); 238 240 if (err != B_OK) 239 241 return P_MSG_I_ERROR; 240 242 241 progress->StageStep(1, T ("Done"));243 progress->StageStep(1, TR("Done")); 242 244 243 245 // Inform our parent that we finished 244 246 return P_MSG_I_FINISHED; -
src/apps/packageinstaller/PackageTextViewer.cpp
10 10 #include "PackageTextViewer.h" 11 11 12 12 #include <Button.h> 13 #include <Catalog.h> 14 #include <Locale.h> 13 15 #include <ScrollView.h> 14 16 15 17 #include <GroupLayout.h> … … 21 23 P_MSG_DECLINE 22 24 }; 23 25 24 // Reserved 25 #define T (x) x26 #undef TR_CONTEXT 27 #define TR_CONTEXT "PackageTextViewer" 26 28 27 29 28 30 PackageTextViewer::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, 30 32 B_NOT_ZOOMABLE | B_NOT_RESIZABLE | B_NOT_CLOSABLE), 31 33 fValue(0) 32 34 { … … 115 117 BRect bounds; 116 118 BRect rect = Bounds(); 117 119 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"), 119 121 new BMessage(P_MSG_ACCEPT)); 120 122 button->ResizeToPreferred(); 121 123 … … 128 130 button->MakeDefault(true); 129 131 fBackground->AddChild(button); 130 132 131 button = new BButton(BRect(0, 0, 1, 1), "decline", T ("Decline"),133 button = new BButton(BRect(0, 0, 1, 1), "decline", TR("Decline"), 132 134 new BMessage(P_MSG_DECLINE)); 133 135 button->ResizeToPreferred(); 134 136 … … 138 140 fBackground->AddChild(button); 139 141 } 140 142 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"), 142 144 new BMessage(P_MSG_ACCEPT)); 143 145 button->ResizeToPreferred(); 144 146 … … 184 186 B_FOLLOW_LEFT | B_FOLLOW_TOP, 0, false, true); 185 187 186 188 if (disclaimer) { 187 BButton *accept = new BButton("accept", T ("Accept"),189 BButton *accept = new BButton("accept", TR("Accept"), 188 190 new BMessage(P_MSG_ACCEPT)); 189 191 190 BButton *decline = new BButton("decline", T ("Decline"),192 BButton *decline = new BButton("decline", TR("Decline"), 191 193 new BMessage(P_MSG_DECLINE)); 192 194 193 195 fBackground = BGroupLayoutBuilder(B_VERTICAL) … … 199 201 .End(); 200 202 } 201 203 else { 202 BButton *button = new BButton("accept", T ("Continue"),204 BButton *button = new BButton("accept", TR("Continue"), 203 205 new BMessage(P_MSG_ACCEPT)); 204 206 205 207 fBackground = BGroupLayoutBuilder(B_VERTICAL) -
src/apps/packageinstaller/PackageWindow.cpp
10 10 #include "PackageWindow.h" 11 11 12 12 #include <Application.h> 13 13 #include <Catalog.h> 14 14 #include <GroupLayout.h> 15 #include <Locale.h> 15 16 16 // Macro reserved for later localization 17 #define T (x) x17 #undef TR_CONTEXT 18 #define TR_CONTEXT "PackageWindow" 18 19 19 20 20 PackageWindow::PackageWindow(const entry_ref *ref) 21 : BWindow(BRect(100, 100, 600, 300), T ("PackageInstaller"), B_TITLED_WINDOW,22 21 : BWindow(BRect(100, 100, 600, 300), TR("PackageInstaller"), 22 B_TITLED_WINDOW, B_NOT_ZOOMABLE | B_NOT_RESIZABLE) 23 23 { 24 24 //SetLayout(new BGroupLayout(B_HORIZONTAL)); 25 25 -
src/apps/packageinstaller/main.cpp
9 9 10 10 #include "PackageWindow.h" 11 11 12 #include <Alert.h> 12 13 #include <Application.h> 14 #include <Autolock.h> 15 #include <Catalog.h> 16 #include <Entry.h> 13 17 #include <FilePanel.h> 14 18 #include <List.h> 15 #include < Alert.h>19 #include <Locale.h> 16 20 #include <TextView.h> 17 #include <Entry.h> 18 #include <Autolock.h> 21 19 22 #include <stdio.h> 20 23 24 #undef TR_CONTEXT 25 #define TR_CONTEXT "Packageinstaller main" 21 26 22 27 class PackageInstaller : public BApplication { 23 28 public: … … 33 38 void AboutRequested(); 34 39 35 40 private: 36 BFilePanel *fOpen; 37 uint32 fWindowCount; 41 BFilePanel *fOpen; 42 uint32 fWindowCount; 43 BCatalog fAppCatalog; 38 44 }; 39 45 40 46 41 47 PackageInstaller::PackageInstaller() 42 48 : BApplication("application/x-vnd.Haiku-PackageInstaller"), 43 fWindowCount(0) 49 fOpen(NULL), 50 fWindowCount(0), 51 fAppCatalog(NULL) 44 52 { 45 53 fOpen = new BFilePanel(B_OPEN_PANEL); 54 be_locale->GetAppCatalog(&fAppCatalog); 46 55 } 47 56 48 57 … … 94 103 95 104 for (i = 1; i < argc; i++) { 96 105 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]); 98 107 continue; 99 108 } 100 109 101 110 ret = get_ref_for_path(path.Path(), &ref); 102 111 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), 104 113 argv[i]); 105 114 continue; 106 115 } … … 135 144 PackageInstaller::AboutRequested() 136 145 { 137 146 BAlert *about = new BAlert("about", 138 "PackageInstaller\n"147 TR("PackageInstaller\n" 139 148 "BeOS legacy .pkg file installer for Haiku.\n\n" 140 149 "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")); 143 152 144 153 BTextView *view = about->TextView(); 145 154 BFont font; -
src/apps/packageinstaller/PackageView.cpp
14 14 15 15 #include <Alert.h> 16 16 #include <Button.h> 17 #include <Catalog.h> 17 18 #include <Directory.h> 18 19 #include <FindDirectory.h> 20 #include <Locale.h> 19 21 #include <MenuItem.h> 20 22 #include <Path.h> 21 23 #include <PopUpMenu.h> … … 32 34 #include <fs_info.h> 33 35 #include <stdio.h> // For debugging 34 36 35 // Macro reserved for later localization 36 #define T (x) x37 #undef TR_CONTEXT 38 #define TR_CONTEXT "PackageView" 37 39 38 40 const float kMaxDescHeight = 125.0f; 39 41 const uint32 kSeparatorIndex = 3; 40 42 41 43 42 43 44 static void 44 45 convert_size(uint64 size, char *buffer, uint32 n) 45 46 { 46 47 if (size < 1024) 47 snprintf(buffer, n, "%llu bytes", size);48 snprintf(buffer, n, TR("%llu bytes"), size); 48 49 else if (size < 1024 * 1024) 49 snprintf(buffer, n, "%.1f KiB", size / 1024.0f);50 snprintf(buffer, n, TR("%.1f KiB"), size / 1024.0f); 50 51 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)); 52 53 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)); 54 55 } 55 56 56 57 … … 88 89 { 89 90 status_t ret = fInfo.InitCheck(); 90 91 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 " 93 94 "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, 95 96 B_WARNING_ALERT); 96 97 warning->Go(); 97 98 … … 104 105 BString title; 105 106 BString name = fInfo.GetName(); 106 107 if (name.CountChars() == 0) { 107 title = T ("Package installer");108 title = TR("Package installer"); 108 109 } 109 110 else { 110 title = T ("Install ");111 title = TR("Install "); 111 112 title += name; 112 113 } 113 114 parent->SetTitle(title.String()); … … 122 123 // attaching the view to the window 123 124 _GroupChanged(0); 124 125 125 fStatusWindow = new PackageStatus(T ("Installation progress"), NULL, NULL,126 fStatusWindow = new PackageStatus(TR("Installation progress"), NULL, NULL, 126 127 this); 127 128 128 129 // Show the splash screen, if present … … 184 185 case P_MSG_I_FINISHED: 185 186 { 186 187 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")); 189 190 190 191 notify->Go(); 191 192 fStatusWindow->Hide(); … … 202 203 case P_MSG_I_ABORT: 203 204 { 204 205 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")); 206 208 notify->Go(); 207 209 fStatusWindow->Hide(); 208 210 fInstall->SetEnabled(true); … … 214 216 case P_MSG_I_ERROR: 215 217 { 216 218 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")); 222 224 notify->Go(); 223 225 fStatusWindow->Hide(); 224 226 fInstall->SetEnabled(true); … … 253 255 break; 254 256 255 257 BString name = path.Path(); 256 char sizeString[ 32];258 char sizeString[48]; 257 259 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; 260 264 261 265 item->SetLabel(name.String()); 262 266 fCurrentPath.SetTo(path.Path()); … … 300 304 case P_EXISTS_ASK: 301 305 case P_EXISTS_NONE: 302 306 { 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")); 304 339 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 312 340 choice = alert->Go(); 313 341 switch (choice) { 314 342 case 0: … … 323 351 324 352 if (policy == P_EXISTS_NONE) { 325 353 // 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 "th is installation?\nAll existing files will be");354 alertString = TR("Do you want to remember this decision for " 355 "the rest of this installation?\n"); 328 356 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?")); 330 359 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")); 333 362 334 363 int32 decision = alert->Go(); 335 364 if (decision == 0) … … 361 390 fInstallTypes = new BPopUpMenu("none"); 362 391 363 392 BMenuField *installType = new BMenuField("install_type", 364 T ("Installation type:"), fInstallTypes, 0);393 TR("Installation type:"), fInstallTypes, 0); 365 394 installType->SetAlignment(B_ALIGN_RIGHT); 366 395 installType->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT, B_ALIGN_MIDDLE)); 367 396 … … 370 399 fInstallDesc->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); 371 400 fInstallDesc->MakeEditable(false); 372 401 fInstallDesc->MakeSelectable(false); 373 fInstallDesc->SetText(T ("No installation type selected"));402 fInstallDesc->SetText(TR("No installation type selected")); 374 403 fInstallDesc->TextHeight(0, fInstallDesc->TextLength()); 375 404 376 fInstall = new BButton("install_button", T ("Install"),405 fInstall = new BButton("install_button", TR("Install"), 377 406 new BMessage(P_MSG_INSTALL)); 378 407 379 408 BView *installField = BGroupLayoutBuilder(B_VERTICAL, 5.0f) … … 436 465 fInstallTypes = new BPopUpMenu("none"); 437 466 438 467 BMenuField *installType = new BMenuField(BRect(2, 2, 100, 50), "install_type", 439 T ("Installation type:"), fInstallTypes, false);468 TR("Installation type:"), fInstallTypes, false); 440 469 installType->SetDivider(installType->StringWidth(installType->Label()) + 8); 441 470 installType->SetAlignment(B_ALIGN_RIGHT); 442 471 installType->ResizeToPreferred(); … … 450 479 B_WILL_DRAW); 451 480 fInstallDesc->MakeEditable(false); 452 481 fInstallDesc->MakeSelectable(false); 453 fInstallDesc->SetText(T ("No installation type selected"));482 fInstallDesc->SetText(TR("No installation type selected")); 454 483 fInstallDesc->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); 455 484 456 485 fInstallDesc->ResizeTo(rect.Width() - B_V_SCROLL_BAR_WIDTH, 60); … … 469 498 rect = installBox->Frame(); 470 499 rect.top = rect.bottom + 5; 471 500 rect.bottom += 35; 472 fDestField = new BMenuField(rect, "install_to", T ("Install to:"),501 fDestField = new BMenuField(rect, "install_to", TR("Install to:"), 473 502 fDestination, false); 474 503 fDestField->SetDivider(fDestField->StringWidth(fDestField->Label()) + 8); 475 504 fDestField->SetAlignment(B_ALIGN_RIGHT); … … 477 506 478 507 AddChild(fDestField); 479 508 480 fInstall = new BButton(rect, "install_button", T ("Install"),509 fInstall = new BButton(rect, "install_button", TR("Install"), 481 510 new BMessage(P_MSG_INSTALL)); 482 511 fInstall->ResizeToPreferred(); 483 512 AddChild(fInstall); … … 493 522 int i = 0, num = fInfo.GetProfileCount(); 494 523 pkg_profile *prof; 495 524 BMenuItem *item = 0; 496 char sizeString[ 32];525 char sizeString[48]; 497 526 BString name = ""; 498 527 BMessage *message; 499 528 500 529 if (num > 0) { // Add the default item 501 530 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; 504 535 505 536 message = new BMessage(P_MSG_GROUP_CHANGED); 506 537 message->AddInt32("index", 0); … … 514 545 prof = fInfo.GetProfile(i); 515 546 516 547 if (prof) { 517 convert_size(prof->space_needed, sizeString, 32);548 convert_size(prof->space_needed, sizeString, 48); 518 549 name = prof->name; 519 name << " (" << sizeString << ")"; 550 char kbuffer[512]; 551 snprintf(kbuffer, sizeof(kbuffer), "(%s)", sizeString); 552 name << kbuffer; 520 553 521 554 message = new BMessage(P_MSG_GROUP_CHANGED); 522 555 message->AddInt32("index", i); … … 554 587 BPath path; 555 588 BMessage *temp; 556 589 BVolume volume; 590 char kbuffer[512]; 591 const char *tmp = TR("(%s free)"); 557 592 558 593 if (prof->path_type == P_INSTALL_PATH) { 559 594 dev_t device; 560 595 BString name; 561 char sizeString[ 32];596 char sizeString[48]; 562 597 563 598 if (find_directory(B_BEOS_APPS_DIRECTORY, &path) == B_OK) { 564 599 device = dev_for_path(path.Path()); … … 566 601 temp = new BMessage(P_MSG_PATH_CHANGED); 567 602 temp->AddString("path", BString(path.Path())); 568 603 569 convert_size(volume.FreeBytes(), sizeString, 32);604 convert_size(volume.FreeBytes(), sizeString, 48); 570 605 name = path.Path(); 571 name << " (" << sizeString << " free)"; 606 snprintf(kbuffer, sizeof(kbuffer), tmp, sizeString); 607 name << kbuffer; 572 608 item = new BMenuItem(name.String(), temp); 573 609 item->SetTarget(this); 574 610 fDestination->AddItem(item); … … 580 616 temp = new BMessage(P_MSG_PATH_CHANGED); 581 617 temp->AddString("path", BString(path.Path())); 582 618 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); 584 622 name = path.Path(); 585 name << " (" << sizeString << " free)";623 name << kbuffer; 586 624 item = new BMenuItem(name.String(), temp); 587 625 item->SetTarget(this); 588 626 fDestination->AddItem(item); … … 595 633 } 596 634 fDestination->AddSeparatorItem(); 597 635 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)); 599 638 item->SetTarget(this); 600 639 fDestination->AddItem(item); 601 640 … … 603 642 } else if (prof->path_type == P_USER_PATH) { 604 643 BString name; 605 644 bool defaultPathSet = false; 606 char sizeString[ 32], volumeName[B_FILE_NAME_LENGTH];645 char sizeString[48], volumeName[B_FILE_NAME_LENGTH]; 607 646 BVolumeRoster roster; 608 647 BDirectory mountPoint; 609 648 … … 619 658 temp = new BMessage(P_MSG_PATH_CHANGED); 620 659 temp->AddString("path", BString(path.Path())); 621 660 622 convert_size(volume.FreeBytes(), sizeString, 32);661 convert_size(volume.FreeBytes(), sizeString, 48); 623 662 volume.GetName(volumeName); 624 663 name = volumeName; 625 name << " (" << sizeString << " free)"; 664 snprintf(kbuffer, sizeof(kbuffer), tmp, sizeString); 665 name << kbuffer; 626 666 item = new BMenuItem(name.String(), temp); 627 667 item->SetTarget(this); 628 668 fDestination->AddItem(item);