Ticket #7125: hpgstranslator-localization.patch

File hpgstranslator-localization.patch, 6.0 KB (added by Karvjorm, 14 years ago)

An HPGSTranslator localization patch

  • src/add-ons/translators/hpgs/ConfigView.cpp

     
    88#include "ConfigView.h"
    99#include "HPGSTranslator.h"
    1010
     11#include <Catalog.h>
    1112#include <StringView.h>
    1213#include <CheckBox.h>
    1314
    1415#include <stdio.h>
    1516#include <string.h>
    1617
     18#undef B_TRANSLATE_CONTEXT
     19#define B_TRANSLATE_CONTEXT "ConfigView"
    1720
     21
    1822ConfigView::ConfigView(const BRect &frame, uint32 resize, uint32 flags)
    19     : BView(frame, "HPGSTranslator Settings", resize, flags)
     23    : BView(frame, B_TRANSLATE("HPGSTranslator Settings"), resize, flags)
    2024{
    2125    SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
    2226
     
    2529    float height = fontHeight.descent + fontHeight.ascent + fontHeight.leading;
    2630
    2731    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"));
    2934    stringView->SetFont(be_bold_font);
    3035    stringView->ResizeToPreferred();
    3136    AddChild(stringView);
    3237
    3338    rect.OffsetBy(0, height + 10);
    3439    char version[256];
    35     sprintf(version, "Version %d.%d.%d, %s",
     40    sprintf(version, B_TRANSLATE("Version %d.%d.%d, %s"),
    3641        int(B_TRANSLATION_MAJOR_VERSION(HPGS_TRANSLATOR_VERSION)),
    3742        int(B_TRANSLATION_MINOR_VERSION(HPGS_TRANSLATOR_VERSION)),
    3843        int(B_TRANSLATION_REVISION_VERSION(HPGS_TRANSLATOR_VERSION)),
     
    5055    AddChild(stringView);
    5156
    5257    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)"));
    5459    stringView->ResizeToPreferred();
    5560    AddChild(stringView);
    5661
  • src/add-ons/translators/hpgs/ReadHelper.h

     
    9090    unsigned char *iptr = (unsigned char *)ptr;
    9191    size_t i = 0;
    9292    for (; i < nmemb; i++) {
    93         if (size != stream->buffer->Read(iptr, size))
     93        if (size != (size_t)stream->buffer->Read(iptr, size))
    9494            break;
    9595        iptr += size;
    9696    }
  • src/add-ons/translators/hpgs/Jamfile

     
    4949    : true
    5050;
    5151
     52DoCatalogs HPGSTranslator :
     53    x-vnd.Haiku-HPGSTranslator
     54    :
     55    ConfigView.cpp
     56    HPGSTranslator.cpp
     57;
     58
    5259SEARCH on [ FGristFiles $(sources) ] = [ FDirName $(SUBDIR) lib ] ;
  • src/add-ons/translators/hpgs/HPGSTranslator.cpp

     
    1010
    1111#include "hpgsimage.h"
    1212
     13#include <Catalog.h>
    1314#include <Messenger.h>
    1415#include <TranslatorRoster.h>
    1516
     
    1718#include <stdio.h>
    1819#include <string.h>
    1920
     21#undef B_TRANSLATE_CONTEXT
     22#define B_TRANSLATE_CONTEXT "HPGSTranslator"
     23
     24
    2025typedef struct my_hpgs_png_image_st {
    2126    hpgs_png_image image;
    2227    BPositionIO *target;
     
    8085
    8186
    8287HPGSTranslator::HPGSTranslator()
    83     : BaseTranslator("HPGS images", "HPGS image translator",
     88    : BaseTranslator(B_TRANSLATE("HPGS images"),
     89        B_TRANSLATE("HPGS image translator"),
    8490        HPGS_TRANSLATOR_VERSION,
    8591        sInputFormats, kNumInputFormats,
    8692        sOutputFormats, kNumOutputFormats,
     
    115121    hpgs_bool multipage = HPGS_FALSE;
    116122    hpgs_bool ignore_ps = HPGS_FALSE;
    117123    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);
    120128    if (hpgs_read(reader, HPGS_FALSE) == B_OK) {
    121129        info->type = HPGS_IMAGE_FORMAT;
    122130        info->group = B_TRANSLATOR_BITMAP;
    123131        info->quality = HPGS_IN_QUALITY;
    124132        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"));
    126134        strcpy(info->MIME, "vector/x-hpgl2");
    127135    } else
    128136        err = B_NO_TRANSLATOR;
     
    175183    size_dev = (hpgs_device *)hpgs_new_plotsize_device(ignore_ps, do_linewidth);
    176184    hpgs_reader *reader = hpgs_new_reader(istream, size_dev, multipage, verbosity);
    177185    if (hpgs_read(reader, HPGS_FALSE)) {
    178         fprintf(stderr, "no hpgs\n");
     186        fprintf(stderr, B_TRANSLATE("no hpgs\n"));
    179187        err = B_NO_TRANSLATOR;
    180188        goto err1;
    181189    }
    182190
    183191    if (hpgs_getplotsize(size_dev,1,&bbox)<0) {
    184         fprintf(stderr, "no hpgs\n");
     192        fprintf(stderr, B_TRANSLATE("no hpgs\n"));
    185193        err = B_NO_TRANSLATOR;
    186194        goto err1;
    187195    }
     
    208216
    209217    plot_dev = (hpgs_device *)pdv;
    210218    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());
    213221        err = B_NO_TRANSLATOR;
    214222        goto err2;
    215223    }
     
    227235        B_SWAP_HOST_TO_BENDIAN);
    228236    bytesWritten = target->Write(&header, sizeof(TranslatorBitmap));
    229237    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));
    231240        err = bytesWritten;
    232241        goto err2;
    233242    }
     
    238247    }
    239248
    240249    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());
    242252        err = B_NO_TRANSLATOR;
    243253    }
    244254