Ticket #7162: bitsinfo-localization.patch
File bitsinfo-localization.patch, 5.9 KB (added by , 13 years ago) |
---|
-
src/tools/translation/bitsinfo/Jamfile
1 1 SubDir HAIKU_TOP src tools translation bitsinfo ; 2 2 3 BinCommand bitsinfo : bitsinfo.cpp : be $(TARGET_LIBSUPC++);3 SetSubDirSupportedPlatformsBeOSCompatible ; 4 4 5 BinCommand bitsinfo : 6 bitsinfo.cpp 7 : be libbe.so $(HAIKU_LOCALE_LIBS) translation $(TARGET_LIBSTDC++) $(TARGET_LIBSUPC++) ; 8 9 AddResources bitsinfo : bitsinfo.rdef ; 10 11 DoCatalogs bitsinfo : 12 x-vnd.Haiku-bitsinfo 13 : 14 bitsinfo.cpp 15 ; -
src/tools/translation/bitsinfo/bitsinfo.rdef
1 /* 2 * bitsinfo.rdef 3 */ 4 5 resource app_signature "application/x-vnd.Haiku-bitsinfo"; 6 7 resource app_version { 8 major = 1, 9 middle = 0, 10 minor = 0, 11 variety = 0, 12 internal = 0, 13 short_info = "bitsinfo displays text information about Be bitmap format ("bits") images.", 14 long_info = "Haiku bitsinfo is a command line tool for displaying text information about Be bitmap format ("bits") images. Written by Michael Wilber, OBOS Translation Kit Team, Copyright © 2003 OpenBeOS Project." 15 }; 16 17 resource app_flags B_SINGLE_LAUNCH; -
src/tools/translation/bitsinfo/bitsinfo.cpp
38 38 #include <stdlib.h> 39 39 #include <string.h> 40 40 #include <ByteOrder.h> 41 #include <Catalog.h> 41 42 #include <File.h> 42 43 #include <TranslatorFormats.h> 43 44 #include <StorageDefs.h> 44 45 46 #undef B_TRANSLATE_CONTEXT 47 #define B_TRANSLATE_CONTEXT "bitsinfo" 48 45 49 struct ColorSpaceName { 46 50 color_space id; 47 51 const char *name; … … 62 66 // read in the rest of the header 63 67 ssize_t size = sizeof(TranslatorBitmap); 64 68 if (file.Read(reinterpret_cast<uint8 *> (&header), size) != size) { 65 printf("\nError: Unable to read the Be bitmap header.\n"); 69 printf(B_TRANSLATE("\nError: Unable to read the Be bitmap " 70 "header.\n")); 66 71 return; 67 72 } 68 73 if (!bdumppixels) … … 72 77 // convert to host byte order 73 78 if (swap_data(B_UINT32_TYPE, &header, sizeof(TranslatorBitmap), 74 79 B_SWAP_BENDIAN_TO_HOST) != B_OK) { 75 printf( "\nError: Unable to swap byte order\n");80 printf(B_TRANSLATE("\nError: Unable to swap byte order\n")); 76 81 return; 77 82 } 78 83 79 printf("\nBe bitmap (\"bits\") header for: %s\n\n", filepath); 84 printf(B_TRANSLATE("\nBe bitmap (\"bits\") header for: %s\n\n"), 85 filepath); 80 86 81 87 const uint32 kbitsmagic = 0x62697473UL; 82 88 // in ASCII, this number looks like "bits" 83 printf("magic number: 0x%.8lx ", header.magic);84 89 if (header.magic == kbitsmagic) 85 printf("(valid)\n"); 90 printf(B_TRANSLATE("magic number: 0x%.8lx (valid)\n"), 91 header.magic); 86 92 else 87 printf( "(INVALID, should be: 0x%.8lx)\n",88 kbitsmagic);89 printf( "bounds: (%f, %f, %f, %f)\n",93 printf(B_TRANSLATE("magic number: 0x%.8lx (INVALID, should be: " 94 "0x%.8lx)\n"), header.magic, kbitsmagic); 95 printf(B_TRANSLATE("bounds: (%f, %f, %f, %f)\n"), 90 96 header.bounds.left, header.bounds.top, 91 97 header.bounds.right, header.bounds.bottom); 92 printf( "dimensions: %d x %d\n",98 printf(B_TRANSLATE("dimensions: %d x %d\n"), 93 99 static_cast<int>(header.bounds.Width() + 1), 94 100 static_cast<int>(header.bounds.Height() + 1)); 95 101 96 printf( "bytes per row: %u\n",102 printf(B_TRANSLATE("bytes per row: %u\n"), 97 103 static_cast<unsigned int>(header.rowBytes)); 98 104 99 105 // print out colorspace if it matches an item in the list … … 149 155 int32 i; 150 156 for (i = 0; i < kncolorspaces; i++) { 151 157 if (header.colors == colorspaces[i].id) { 152 printf( "color space: %s\n", colorspaces[i].name);158 printf(B_TRANSLATE("color space: %s\n"), colorspaces[i].name); 153 159 break; 154 160 } 155 161 } 156 162 if (i == kncolorspaces) 157 printf( "color space: Unknown (0x%.8lx)\n",163 printf(B_TRANSLATE("color space: Unknown (0x%.8lx)\n"), 158 164 static_cast<unsigned long>(header.colors)); 159 165 160 printf( "data size: %u\n",166 printf(B_TRANSLATE("data size: %u\n"), 161 167 static_cast<unsigned int>(header.dataSize)); 162 168 163 169 if (bdumppixels) { … … 178 184 break; 179 185 180 186 default: 181 printf( "Sorry, %s isn't supported yet"182 " for this color space\n" , kpixels);187 printf(B_TRANSLATE("Sorry, %s isn't supported yet" 188 " for this color space\n"), kpixels); 183 189 return; 184 190 } 185 191 uint8 *prow = new uint8[header.rowBytes]; 186 192 if (!prow) { 187 printf("Error: Not enough memory for row buffer\n"); 193 printf(B_TRANSLATE("Error: Not enough memory for row " 194 "buffer\n")); 188 195 return; 189 196 } 190 197 ssize_t ret, n; 191 198 uint32 totalbytes = 0; 192 printf( "pixel data (%s):\n", components);199 printf(B_TRANSLATE("pixel data (%s):\n"), components); 193 200 while ((ret = file.Read(prow, header.rowBytes)) > 0) { 194 201 n = 0; 195 202 while (n < ret) { … … 205 212 } 206 213 207 214 } else 208 printf("Error opening %s\n", filepath); 215 printf(B_TRANSLATE_COMMENT("Error opening %s\n", 216 "file path is opening"), filepath); 209 217 } 210 218 211 219 int 212 220 main(int argc, char **argv) 213 221 { 214 222 if (argc == 1) { 215 printf("\nbitsinfo - reports information about a Be bitmap (\"bits\") image\n"); 216 printf("\nUsage:\n"); 217 printf("bitsinfo [options] filename.bits\n\n"); 218 printf("Options:\n\n"); 219 printf("\t%s \t print RGB color for each pixel\n", kpixels); 223 printf(B_TRANSLATE("\nbitsinfo - reports information about a Be " 224 "bitmap (\"bits\") image\n")); 225 printf(B_TRANSLATE("\nUsage:\n")); 226 printf(B_TRANSLATE("bitsinfo [options] filename.bits\n\n")); 227 printf(B_TRANSLATE("Options:\n\n")); 228 printf(B_TRANSLATE("\t%s \t print RGB color for each pixel\n"), 229 kpixels); 220 230 } 221 231 else { 222 232 int32 first = 1;