Ticket #7125: hpgstranslator-localization.patch
File hpgstranslator-localization.patch, 6.0 KB (added by , 14 years ago) |
---|
-
src/add-ons/translators/hpgs/ConfigView.cpp
8 8 #include "ConfigView.h" 9 9 #include "HPGSTranslator.h" 10 10 11 #include <Catalog.h> 11 12 #include <StringView.h> 12 13 #include <CheckBox.h> 13 14 14 15 #include <stdio.h> 15 16 #include <string.h> 16 17 18 #undef B_TRANSLATE_CONTEXT 19 #define B_TRANSLATE_CONTEXT "ConfigView" 17 20 21 18 22 ConfigView::ConfigView(const BRect &frame, uint32 resize, uint32 flags) 19 : BView(frame, "HPGSTranslator Settings", resize, flags)23 : BView(frame, B_TRANSLATE("HPGSTranslator Settings"), resize, flags) 20 24 { 21 25 SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); 22 26 … … 25 29 float height = fontHeight.descent + fontHeight.ascent + fontHeight.leading; 26 30 27 31 BRect rect(10, 10, 200, 10 + height); 28 BStringView *stringView = new BStringView(rect, "title", "HPGS images"); 32 BStringView *stringView = new BStringView(rect, "title", 33 B_TRANSLATE("HPGS images")); 29 34 stringView->SetFont(be_bold_font); 30 35 stringView->ResizeToPreferred(); 31 36 AddChild(stringView); 32 37 33 38 rect.OffsetBy(0, height + 10); 34 39 char version[256]; 35 sprintf(version, "Version %d.%d.%d, %s",40 sprintf(version, B_TRANSLATE("Version %d.%d.%d, %s"), 36 41 int(B_TRANSLATION_MAJOR_VERSION(HPGS_TRANSLATOR_VERSION)), 37 42 int(B_TRANSLATION_MINOR_VERSION(HPGS_TRANSLATOR_VERSION)), 38 43 int(B_TRANSLATION_REVISION_VERSION(HPGS_TRANSLATOR_VERSION)), … … 50 55 AddChild(stringView); 51 56 52 57 rect.OffsetBy(0, height + 10); 53 stringView = new BStringView(rect, "copyright2", "Based on HPGS (http://hpgs.berlios.de)");58 stringView = new BStringView(rect, "copyright2", B_TRANSLATE("Based on HPGS (http://hpgs.berlios.de)")); 54 59 stringView->ResizeToPreferred(); 55 60 AddChild(stringView); 56 61 -
src/add-ons/translators/hpgs/ReadHelper.h
90 90 unsigned char *iptr = (unsigned char *)ptr; 91 91 size_t i = 0; 92 92 for (; i < nmemb; i++) { 93 if (size != stream->buffer->Read(iptr, size))93 if (size != (size_t)stream->buffer->Read(iptr, size)) 94 94 break; 95 95 iptr += size; 96 96 } -
src/add-ons/translators/hpgs/Jamfile
49 49 : true 50 50 ; 51 51 52 DoCatalogs HPGSTranslator : 53 x-vnd.Haiku-HPGSTranslator 54 : 55 ConfigView.cpp 56 HPGSTranslator.cpp 57 ; 58 52 59 SEARCH on [ FGristFiles $(sources) ] = [ FDirName $(SUBDIR) lib ] ; -
src/add-ons/translators/hpgs/HPGSTranslator.cpp
10 10 11 11 #include "hpgsimage.h" 12 12 13 #include <Catalog.h> 13 14 #include <Messenger.h> 14 15 #include <TranslatorRoster.h> 15 16 … … 17 18 #include <stdio.h> 18 19 #include <string.h> 19 20 21 #undef B_TRANSLATE_CONTEXT 22 #define B_TRANSLATE_CONTEXT "HPGSTranslator" 23 24 20 25 typedef struct my_hpgs_png_image_st { 21 26 hpgs_png_image image; 22 27 BPositionIO *target; … … 80 85 81 86 82 87 HPGSTranslator::HPGSTranslator() 83 : BaseTranslator("HPGS images", "HPGS image translator", 88 : BaseTranslator(B_TRANSLATE("HPGS images"), 89 B_TRANSLATE("HPGS image translator"), 84 90 HPGS_TRANSLATOR_VERSION, 85 91 sInputFormats, kNumInputFormats, 86 92 sOutputFormats, kNumOutputFormats, … … 115 121 hpgs_bool multipage = HPGS_FALSE; 116 122 hpgs_bool ignore_ps = HPGS_FALSE; 117 123 hpgs_bool do_linewidth = HPGS_TRUE; 118 hpgs_device *size_dev = (hpgs_device *)hpgs_new_plotsize_device(ignore_ps, do_linewidth); 119 hpgs_reader *reader = hpgs_new_reader(istream, size_dev, multipage, verbosity); 124 hpgs_device *size_dev = (hpgs_device *)hpgs_new_plotsize_device(ignore_ps, 125 do_linewidth); 126 hpgs_reader *reader = hpgs_new_reader(istream, size_dev, multipage, 127 verbosity); 120 128 if (hpgs_read(reader, HPGS_FALSE) == B_OK) { 121 129 info->type = HPGS_IMAGE_FORMAT; 122 130 info->group = B_TRANSLATOR_BITMAP; 123 131 info->quality = HPGS_IN_QUALITY; 124 132 info->capability = HPGS_IN_CAPABILITY; 125 snprintf(info->name, sizeof(info->name), "HPGS image");133 snprintf(info->name, sizeof(info->name), B_TRANSLATE("HPGS image")); 126 134 strcpy(info->MIME, "vector/x-hpgl2"); 127 135 } else 128 136 err = B_NO_TRANSLATOR; … … 175 183 size_dev = (hpgs_device *)hpgs_new_plotsize_device(ignore_ps, do_linewidth); 176 184 hpgs_reader *reader = hpgs_new_reader(istream, size_dev, multipage, verbosity); 177 185 if (hpgs_read(reader, HPGS_FALSE)) { 178 fprintf(stderr, "no hpgs\n");186 fprintf(stderr, B_TRANSLATE("no hpgs\n")); 179 187 err = B_NO_TRANSLATOR; 180 188 goto err1; 181 189 } 182 190 183 191 if (hpgs_getplotsize(size_dev,1,&bbox)<0) { 184 fprintf(stderr, "no hpgs\n");192 fprintf(stderr, B_TRANSLATE("no hpgs\n")); 185 193 err = B_NO_TRANSLATOR; 186 194 goto err1; 187 195 } … … 208 216 209 217 plot_dev = (hpgs_device *)pdv; 210 218 if (hpgs_reader_imbue(reader, plot_dev)) { 211 fprintf(stderr, hpgs_i18n( "Error: Cannot imbue plot device to reader: %s\n"),212 hpgs_get_error());219 fprintf(stderr, hpgs_i18n(B_TRANSLATE("Error: Cannot imbue plot " 220 "device to reader: %s\n")), hpgs_get_error()); 213 221 err = B_NO_TRANSLATOR; 214 222 goto err2; 215 223 } … … 227 235 B_SWAP_HOST_TO_BENDIAN); 228 236 bytesWritten = target->Write(&header, sizeof(TranslatorBitmap)); 229 237 if (bytesWritten < B_OK) { 230 fprintf(stderr, "Write error %s\n", strerror(bytesWritten)); 238 fprintf(stderr, B_TRANSLATE("Write error %s\n"), 239 strerror(bytesWritten)); 231 240 err = bytesWritten; 232 241 goto err2; 233 242 } … … 238 247 } 239 248 240 249 if (err == B_OK && hpgs_read(reader, HPGS_FALSE)) { 241 fprintf(stderr, hpgs_i18n("Error: Cannot process plot data %s\n"), hpgs_get_error()); 250 fprintf(stderr, hpgs_i18n(B_TRANSLATE("Error: Cannot process plot " 251 "data %s\n")), hpgs_get_error()); 242 252 err = B_NO_TRANSLATOR; 243 253 } 244 254