Ticket #7164: bmpinfo-localization.patch
File bmpinfo-localization.patch, 8.1 KB (added by , 13 years ago) |
---|
-
src/tools/translation/bmpinfo/Jamfile
1 1 SubDir HAIKU_TOP src tools translation bmpinfo ; 2 2 3 BinCommand bmpinfo : bmpinfo.cpp : be ;3 BinCommand bmpinfo : bmpinfo.cpp : be libbe.so $(HAIKU_LOCALE_LIBS) translation $(TARGET_LIBSTDC++) $(TARGET_LIBSUPC++) ; 4 4 5 AddResources bmpinfo : bmpinfo.rdef ; 6 7 DoCatalogs bmpinfo : 8 x-vnd.Haiku-bmpsinfo 9 : 10 bmpinfo.cpp 11 ; -
src/tools/translation/bmpinfo/bmpinfo.rdef
1 /* 2 * bmpinfo.rdef 3 */ 4 5 resource app_signature "application/x-vnd.Haiku-bmpinfo"; 6 7 resource app_version { 8 major = 1, 9 middle = 0, 10 minor = 0, 11 variety = 0, 12 internal = 0, 13 short_info = "bmpinfo displays text information about BMP images.", 14 long_info = "Haiku bmpinfo is a command line tool for displaying text information about BMP 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/bmpinfo/bmpinfo.cpp
36 36 #include <stdlib.h> 37 37 #include <string.h> 38 38 #include <ByteOrder.h> 39 #include <Catalog.h> 39 40 #include <File.h> 40 41 #include <TranslatorFormats.h> 41 42 #include <StorageDefs.h> 42 43 44 #undef B_TRANSLATE_CONTEXT 45 #define B_TRANSLATE_CONTEXT "bmpinfo" 46 43 47 #define BMP_NO_COMPRESS 0 44 48 #define BMP_RLE8_COMPRESS 1 45 49 #define BMP_RLE4_COMPRESS 2 … … 82 86 83 87 ssize_t size = 14; 84 88 if (file.Read(buf, size) != size) { 85 printf( "Error: unable to read BMP file header\n");89 printf(B_TRANSLATE("Error: unable to read BMP file header\n")); 86 90 return; 87 91 } 88 92 … … 96 100 swap_data(B_UINT32_TYPE, (reinterpret_cast<uint8 *> (&fh)) + 2, 97 101 12, B_SWAP_LENDIAN_TO_HOST); 98 102 99 printf("\nFile Header:\n"); 100 printf(" magic: 0x%.4x (should be: 0x424d)\n", fh.magic); 101 printf(" file size: 0x%.8lx (%lu)\n", fh.fileSize, fh.fileSize); 102 printf(" reserved: 0x%.8lx (should be: 0x%.8x)\n", fh.reserved, 0); 103 printf("data offset: 0x%.8lx (%lu) (should be: >= 54 for MS format " 104 "and >= 26 for OS/2 format)\n", fh.dataOffset, fh.dataOffset); 103 printf(B_TRANSLATE("\nFile Header:\n")); 104 printf(B_TRANSLATE(" magic: 0x%.4x (should be: 0x424d)\n"), fh.magic); 105 printf(B_TRANSLATE(" file size: 0x%.8lx (%lu)\n"), fh.fileSize, 106 fh.fileSize); 107 printf(B_TRANSLATE(" reserved: 0x%.8lx (should be: 0x%.8x)\n"), 108 fh.reserved, 0); 109 printf(B_TRANSLATE("data offset: 0x%.8lx (%lu) (should be: >= 54 for MS " 110 "format and >= 26 for OS/2 format)\n"), fh.dataOffset, fh.dataOffset); 105 111 106 112 uint32 headersize = 0; 107 113 if (file.Read(&headersize, 4) != 4) { 108 printf( "Error: unable to read info header size\n");114 printf(B_TRANSLATE("Error: unable to read info header size\n")); 109 115 return; 110 116 } 111 117 swap_data(B_UINT32_TYPE, &headersize, 4, B_SWAP_LENDIAN_TO_HOST); … … 115 121 MSInfoHeader msh; 116 122 msh.size = headersize; 117 123 if (file.Read(reinterpret_cast<uint8 *> (&msh) + 4, 36) != 36) { 118 printf( "Error: unable to read entire MS info header\n");124 printf(B_TRANSLATE("Error: unable to read entire MS info header\n")); 119 125 return; 120 126 } 121 127 … … 123 129 swap_data(B_UINT32_TYPE, reinterpret_cast<uint8 *> (&msh) + 4, 36, 124 130 B_SWAP_LENDIAN_TO_HOST); 125 131 126 printf("\nMS Info Header:\n"); 127 printf(" header size: 0x%.8lx (%lu) (should be: 40)\n", msh.size, msh.size); 128 printf(" width: %lu\n", msh.width); 129 printf(" height: %lu\n", msh.height); 130 printf(" planes: %u (should be: 1)\n", msh.planes); 131 printf(" bits per pixel: %u (should be: 1,4,8,16,24 or 32)\n", msh.bitsperpixel); 132 printf(" compression: %s (%lu)\n", 133 ((msh.compression == BMP_NO_COMPRESS) ? ("none") : 134 ((msh.compression == BMP_RLE8_COMPRESS) ? ("RLE 8") : 135 ((msh.compression == BMP_RLE4_COMPRESS) ? ("RLE 4") : 136 ("unknown")))), msh.compression); 137 printf(" image size: 0x%.8lx (%lu)\n", msh.imagesize, msh.imagesize); 138 printf(" x pixels/meter: %lu\n", msh.xpixperm); 139 printf(" y pixels/meter: %lu\n", msh.ypixperm); 140 printf(" colors used: %lu\n", msh.colorsused); 141 printf("colors important: %lu\n", msh.colorsimportant); 132 printf(B_TRANSLATE("\nMS Info Header:\n")); 133 printf(B_TRANSLATE(" header size: 0x%.8lx (%lu) (should be: " 134 "40)\n"), msh.size, msh.size); 135 printf(B_TRANSLATE(" width: %lu\n"), msh.width); 136 printf(B_TRANSLATE(" height: %lu\n"), msh.height); 137 printf(B_TRANSLATE(" planes: %u (should be: 1)\n"), 138 msh.planes); 139 printf(B_TRANSLATE(" bits per pixel: %u (should be: 1,4,8,16,24 or " 140 "32)\n"), msh.bitsperpixel); 141 if (msh.compression == BMP_NO_COMPRESS) 142 printf(B_TRANSLATE(" compression: none (%lu)\n"), 143 msh.compression); 144 else if (msh.compression == BMP_RLE8_COMPRESS) 145 printf(B_TRANSLATE(" compression: RLE8 (%lu)\n"), 146 msh.compression); 147 else if (msh.compression == BMP_RLE4_COMPRESS) 148 printf(B_TRANSLATE(" compression: RLE4 (%lu)\n"), 149 msh.compression); 150 else 151 printf(B_TRANSLATE(" compression: unknown (%lu)\n"), 152 msh.compression); 153 printf(B_TRANSLATE(" image size: 0x%.8lx (%lu)\n"), msh.imagesize, 154 msh.imagesize); 155 printf(B_TRANSLATE(" x pixels/meter: %lu\n"), msh.xpixperm); 156 printf(B_TRANSLATE(" y pixels/meter: %lu\n"), msh.ypixperm); 157 printf(B_TRANSLATE(" colors used: %lu\n"), msh.colorsused); 158 printf(B_TRANSLATE("colors important: %lu\n"), msh.colorsimportant); 142 159 143 160 } else if (headersize == sizeof(OS2InfoHeader)) { 144 161 // OS/2 format … … 146 163 OS2InfoHeader os2; 147 164 os2.size = headersize; 148 165 if (file.Read(reinterpret_cast<uint8 *> (&os2) + 4, 8) != 8) { 149 printf("Error: unable to read entire OS/2 info header\n"); 166 printf(B_TRANSLATE("Error: unable to read entire OS/2 info " 167 "header\n")); 150 168 return; 151 169 } 152 170 … … 154 172 swap_data(B_UINT32_TYPE, reinterpret_cast<uint8 *> (&os2) + 4, 8, 155 173 B_SWAP_LENDIAN_TO_HOST); 156 174 157 printf("\nOS/2 Info Header:\n"); 158 printf(" header size: 0x%.8lx (%lu) (should be: 12)\n", os2.size, os2.size); 159 printf(" width: %u\n", os2.width); 160 printf(" height: %u\n", os2.height); 161 printf(" planes: %u (should be: 1)\n", os2.planes); 162 printf("bits per pixel: %u (should be: 1,4,8 or 24)\n", 175 printf(B_TRANSLATE("\nOS/2 Info Header:\n")); 176 printf(B_TRANSLATE(" header size: 0x%.8lx (%lu) (should be: 12)\n"), 177 os2.size, os2.size); 178 printf(B_TRANSLATE(" width: %u\n"), os2.width); 179 printf(B_TRANSLATE(" height: %u\n"), os2.height); 180 printf(B_TRANSLATE(" planes: %u (should be: 1)\n"), os2.planes); 181 printf(B_TRANSLATE("bits per pixel: %u (should be: 1,4,8 or 24)\n"), 163 182 os2.bitsperpixel); 164 183 165 184 } else 166 printf( "Error: info header size (%lu) does not match MS or OS/2"167 " info header size\n", headersize);185 printf(B_TRANSLATE("Error: info header size (%lu) does not match MS " 186 "or OS/2 info header size\n"), headersize); 168 187 } 169 188 170 189 int … … 173 192 printf("\n"); 174 193 175 194 if (argc == 1) { 176 printf("bmpinfo - reports information about a BMP image file\n"); 177 printf("\nUsage:\n"); 178 printf("bmpinfo filename.bmp\n"); 195 printf(B_TRANSLATE("bmpinfo - reports information about a BMP image " 196 "file\n")); 197 printf(B_TRANSLATE("\nUsage:\n")); 198 printf(B_TRANSLATE("bmpinfo filename.bmp\n")); 179 199 } 180 200 else { 181 201 BFile file; 182 202 183 203 for (int32 i = 1; i < argc; i++) { 184 204 if (file.SetTo(argv[i], B_READ_ONLY) != B_OK) 185 printf( "\nError opening %s\n", argv[i]);205 printf(B_TRANSLATE("\nError opening %s\n"), argv[i]); 186 206 else { 187 printf("\nBMP image information for: %s\n", argv[i]); 207 printf(B_TRANSLATE("\nBMP image information for: %s\n"), 208 argv[i]); 188 209 print_bmp_info(file); 189 210 } 190 211 }