Ticket #7147: tifftranslator-localization.patch

File tifftranslator-localization.patch, 7.5 KB (added by Karvjorm, 11 years ago)

A TIFFTranslator localization patch

  • src/add-ons/translators/tiff/TIFFTranslator.cpp

     
    1313
    1414#include "tiffio.h"
    1515
     16#include <Catalog.h>
    1617#include <stdio.h>
    1718#include <string.h>
    1819
     20#undef B_TRANSLATE_CONTEXT
     21#define B_TRANSLATE_CONTEXT "TIFFTranslator"
    1922
    2023/*!
    2124    How this works:
     
    202205
    203206        if (documentIndex < 1 || documentIndex > documentCount) {
    204207            // document index is invalid
    205             fprintf(stderr, "identify_tiff_header: invalid document index\n");
     208            fprintf(stderr, B_TRANSLATE("identify_tiff_header: invalid "
     209                "document index\n"));
    206210            return B_NO_TRANSLATOR;
    207211        }
    208212    }
     
    210214    // identify the document the user specified or the first document
    211215    // if the user did not specify which document they wanted to identify
    212216    if (!TIFFSetDirectory(tif, documentIndex - 1)) {
    213         fprintf(stderr, "identify_tiff_header: couldn't set directory\n");
     217        fprintf(stderr, B_TRANSLATE("identify_tiff_header: couldn't set "
     218            "directory\n"));
    214219        return B_NO_TRANSLATOR;
    215220    }
    216221
     
    226231        outInfo->quality = TIFF_IN_QUALITY;
    227232        outInfo->capability = TIFF_IN_CAPABILITY;
    228233        strcpy(outInfo->MIME, "image/tiff");
    229         sprintf(outInfo->name, "TIFF image");
     234        sprintf(outInfo->name, B_TRANSLATE("TIFF image"));
    230235    }
    231236
    232237    if (!poutTIFF) {
     
    337342// convert_buffers_bgrX_rgb
    338343inline void
    339344convert_buffers_bgrX_rgb(uint8* inBuffer, uint8* outBuffer,
    340                          uint32 rows, uint32 width, uint32 bytesPerRow, uint32 samplesPerPixel)
     345                         uint32 rows, uint32 width, uint32 bytesPerRow,
     346                         uint32 samplesPerPixel)
    341347{
    342348    for (uint32 y = 0; y < rows; y++) {
    343349        uint8* inHandle = inBuffer;
     
    360366// convert_buffers_rgbX_rgb
    361367inline void
    362368convert_buffers_rgbX_rgb(uint8* inBuffer, uint8* outBuffer,
    363                          uint32 rows, uint32 width, uint32 bytesPerRow, uint32 samplesPerPixel)
     369                         uint32 rows, uint32 width, uint32 bytesPerRow,
     370                         uint32 samplesPerPixel)
    364371{
    365372    for (uint32 y = 0; y < rows; y++) {
    366373        uint8* inHandle = inBuffer;
     
    596603
    597604
    598605TIFFTranslator::TIFFTranslator()
    599     : BaseTranslator("TIFF images", "TIFF image translator",
     606    : BaseTranslator(B_TRANSLATE("TIFF images"),
     607        B_TRANSLATE("TIFF image translator"),
    600608        TIFF_TRANSLATOR_VERSION,
    601609        sInputFormats, kNumInputFormats,
    602610        sOutputFormats, kNumOutputFormats,
     
    950958BView *
    951959TIFFTranslator::NewConfigView(TranslatorSettings *settings)
    952960{
    953     return new TIFFView("TIFFTranslator Settings", B_WILL_DRAW, settings);
     961    return new TIFFView(B_TRANSLATE("TIFFTranslator Settings"),
     962        B_WILL_DRAW, settings);
    954963}
  • src/add-ons/translators/tiff/TIFFView.cpp

     
    3333#include <stdio.h>
    3434#include <string.h>
    3535
     36#include <Catalog.h>
    3637#include <GridLayoutBuilder.h>
    3738#include <GroupLayout.h>
    3839#include <GroupLayoutBuilder.h>
     
    4950
    5051#include "TIFFView.h"
    5152
     53#undef B_TRANSLATE_CONTEXT
     54#define B_TRANSLATE_CONTEXT "TIFFView"
     55
    5256// add_menu_item
    5357void
    5458add_menu_item(BMenu* menu,
     
    7781//
    7882// Returns:
    7983// ---------------------------------------------------------------
    80 TIFFView::TIFFView(const char *name, uint32 flags, TranslatorSettings *settings)
     84TIFFView::TIFFView(const char *name, uint32 flags,
     85    TranslatorSettings *settings)
    8186    :   BView(name, flags)
    8287{
    8388    fSettings = settings;
     
    8590    SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
    8691    SetLowColor(ViewColor());
    8792
    88     fTitle = new BStringView("title", "TIFF Image Translator");
     93    fTitle = new BStringView("title", B_TRANSLATE("TIFF Image Translator"));
    8994    fTitle->SetFont(be_bold_font);
    9095
    9196    char detail[100];
    92     sprintf(detail, "Version %d.%d.%d %s",
     97    sprintf(detail, B_TRANSLATE("Version %d.%d.%d %s"),
    9398        static_cast<int>(B_TRANSLATION_MAJOR_VERSION(TIFF_TRANSLATOR_VERSION)),
    9499        static_cast<int>(B_TRANSLATION_MINOR_VERSION(TIFF_TRANSLATOR_VERSION)),
    95         static_cast<int>(B_TRANSLATION_REVISION_VERSION(TIFF_TRANSLATOR_VERSION)),
    96         __DATE__);
     100        static_cast<int>(B_TRANSLATION_REVISION_VERSION(
     101            TIFF_TRANSLATOR_VERSION)), __DATE__);
    97102    fDetail = new BStringView("detail", detail);
    98103
    99104    int16 i = 1;
    100     fLibTIFF[0] = new BStringView(NULL, "TIFF Library:");
     105    fLibTIFF[0] = new BStringView(NULL, B_TRANSLATE("TIFF Library:"));
    101106    char libtiff[] = TIFFLIB_VERSION_STR;
    102107    char *tok = strtok(libtiff, "\n");
    103108    while (i < 5 && tok) {
     
    110115
    111116    uint32 currentCompression = fSettings->SetGetInt32(TIFF_SETTING_COMPRESSION);
    112117    // create the menu items with the various compression methods
    113     add_menu_item(menu, COMPRESSION_NONE, "None", currentCompression);
     118    add_menu_item(menu, COMPRESSION_NONE, B_TRANSLATE("None"),
     119        currentCompression);
    114120    menu->AddSeparatorItem();
    115     add_menu_item(menu, COMPRESSION_PACKBITS, "RLE (Packbits)", currentCompression);
    116     add_menu_item(menu, COMPRESSION_DEFLATE, "ZIP (Deflate)", currentCompression);
    117     add_menu_item(menu, COMPRESSION_LZW, "LZW", currentCompression);
     121    add_menu_item(menu, COMPRESSION_PACKBITS, B_TRANSLATE("RLE (Packbits)"),
     122        currentCompression);
     123    add_menu_item(menu, COMPRESSION_DEFLATE, B_TRANSLATE("ZIP (Deflate)"),
     124        currentCompression);
     125    add_menu_item(menu, COMPRESSION_LZW, B_TRANSLATE("LZW"),
     126        currentCompression);
    118127
    119128// TODO: the disabled compression modes are not configured in libTIFF
    120129//  menu->AddSeparatorItem();
     
    122131// TODO ? - strip encoding is not implemented in libTIFF for this compression
    123132//  add_menu_item(menu, COMPRESSION_JP2000, "JPEG2000", currentCompression);
    124133
    125     fCompressionMF = new BMenuField("Use Compression:", menu, NULL);
     134    fCompressionMF = new BMenuField(B_TRANSLATE("Use Compression:"),
     135        menu, NULL);
    126136 
    127137    // Build the layout
    128138    SetLayout(new BGroupLayout(B_VERTICAL));
  • src/add-ons/translators/tiff/Jamfile

     
    1414    TIFFTranslator.cpp
    1515    TIFFView.cpp
    1616
    17     : be libtiff.so translation libtranslatorsutils.a $(TARGET_LIBSUPC++)
    18     $(HAIKU_LOCALE_LIBS)
     17    : be libtiff.so translation libtranslatorsutils.a $(TARGET_LIBSUPC++) $(HAIKU_LOCALE_LIBS)
    1918    : true
    2019;
    2120
     21DoCatalogs TIFFTranslator :
     22    x-vnd.Haiku-TIFFTranslator
     23    :
     24    TIFFMain.cpp
     25    TIFFTranslator.cpp
     26    TIFFView.cpp
     27;
     28
    2229Package haiku-translationkit-cvs :
    2330    TIFFTranslator :
    2431    boot home config add-ons Translators ;
  • src/add-ons/translators/tiff/TIFFMain.cpp

     
    3333/*****************************************************************************/
    3434
    3535#include <Application.h>
     36#include <Catalog.h>
    3637#include "TIFFTranslator.h"
    3738#include "TranslatorWindow.h"
    3839
     40#undef B_TRANSLATE_CONTEXT
     41#define B_TRANSLATE_CONTEXT "TIFFMain"
     42
    3943// ---------------------------------------------------------------
    4044// main
    4145//
     
    5458{
    5559    BApplication app("application/x-vnd.Haiku-TIFFTranslator");
    5660    status_t result;
    57     result = LaunchTranslatorWindow(new TIFFTranslator, "TIFF Settings");
     61    result = LaunchTranslatorWindow(new TIFFTranslator,
     62        B_TRANSLATE("TIFF Settings"));
    5863    if (result == B_OK) {
    5964        app.Run();
    6065        return 0;