Ticket #7131: pngtranslator-localization.patch

File pngtranslator-localization.patch, 6.7 KB (added by Karvjorm, 13 years ago)

A PNGTranslator localization patch

  • src/add-ons/translators/png/PNGTranslator.cpp

     
    3535#include <OS.h>
    3636#define PNG_NO_PEDANTIC_WARNINGS
    3737#include <png.h>
     38#include <Catalog.h>
    3839#include "PNGTranslator.h"
    3940#include "PNGView.h"
    4041
     42#undef B_TRANSLATE_CONTEXT
     43#define B_TRANSLATE_CONTEXT "PNGTranslator"
     44
    4145// The input formats that this translator supports.
    4246static const translation_format sInputFormats[] = {
    4347    {
     
    185189// Returns:
    186190// ---------------------------------------------------------------
    187191PNGTranslator::PNGTranslator()
    188     : BaseTranslator("PNG images", "PNG image translator",
     192    : BaseTranslator(B_TRANSLATE("PNG images"),
     193        B_TRANSLATE("PNG image translator"),
    189194        PNG_TRANSLATOR_VERSION,
    190195        sInputFormats, kNumInputFormats,
    191196        sOutputFormats, kNumOutputFormats,
     
    229234        outInfo->quality = PNG_IN_QUALITY;
    230235        outInfo->capability = PNG_IN_CAPABILITY;
    231236        strcpy(outInfo->MIME, "image/png");
    232         strcpy(outInfo->name, "PNG image");
     237        strcpy(outInfo->name, B_TRANSLATE("PNG image"));
    233238    }
    234239
    235240    return B_OK;
     
    975980PNGTranslator::NewConfigView(TranslatorSettings *settings)
    976981{
    977982    return new PNGView(BRect(0, 0, PNG_VIEW_WIDTH, PNG_VIEW_HEIGHT),
    978         "PNGTranslator Settings", B_FOLLOW_ALL, B_WILL_DRAW, settings);
     983        B_TRANSLATE("PNGTranslator Settings"), B_FOLLOW_ALL,
     984        B_WILL_DRAW, settings);
    979985}
    980986
  • src/add-ons/translators/png/PNGView.cpp

     
    1212#include "PNGTranslator.h"
    1313
    1414#include <Alert.h>
     15#include <Catalog.h>
    1516#include <MenuField.h>
    1617#include <MenuItem.h>
    1718#include <PopUpMenu.h>
     
    2223#define PNG_NO_PEDANTIC_WARNINGS
    2324#include <png.h>
    2425
     26#undef B_TRANSLATE_CONTEXT
     27#define B_TRANSLATE_CONTEXT "PNGTranslator"
    2528
    2629PNGView::PNGView(const BRect &frame, const char *name, uint32 resizeMode,
    2730        uint32 flags, TranslatorSettings *settings)
     
    3538    float height = fontHeight.descent + fontHeight.ascent + fontHeight.leading;
    3639
    3740    BRect rect(10, 10, 200, 10 + height);
    38     BStringView *stringView = new BStringView(rect, "title", "PNG image translator");
     41    BStringView *stringView = new BStringView(rect, "title",
     42        B_TRANSLATE("PNG image translator"));
    3943    stringView->SetFont(be_bold_font);
    4044    stringView->ResizeToPreferred();
    4145    AddChild(stringView);
     
    4448
    4549    rect.OffsetBy(0, height + 10);
    4650    char version[256];
    47     snprintf(version, sizeof(version), "Version %d.%d.%d, %s",
     51    snprintf(version, sizeof(version), B_TRANSLATE("Version %d.%d.%d, %s"),
    4852        int(B_TRANSLATION_MAJOR_VERSION(PNG_TRANSLATOR_VERSION)),
    4953        int(B_TRANSLATION_MINOR_VERSION(PNG_TRANSLATOR_VERSION)),
    5054        int(B_TRANSLATION_REVISION_VERSION(PNG_TRANSLATOR_VERSION)),
     
    6064    height = fontHeight.descent + fontHeight.ascent + fontHeight.leading;
    6165
    6266    rect.OffsetBy(0, height + 5);
    63     stringView = new BStringView(rect, "Copyright", B_UTF8_COPYRIGHT "2003-2006 Haiku Inc.");
     67    stringView = new BStringView(rect,
     68        "Copyright", B_UTF8_COPYRIGHT "2003-2006 Haiku Inc.");
    6469    stringView->ResizeToPreferred();
    6570    AddChild(stringView);
    6671
    6772    // setup PNG interlace options
    6873
    69     fInterlaceMenu = new BPopUpMenu("Interlace Option");
    70     BMenuItem* item = new BMenuItem("None", _InterlaceMessage(PNG_INTERLACE_NONE));
     74    fInterlaceMenu = new BPopUpMenu(B_TRANSLATE("Interlace Option"));
     75    BMenuItem* item = new BMenuItem(B_TRANSLATE("None"),
     76        _InterlaceMessage(PNG_INTERLACE_NONE));
    7177    if (fSettings->SetGetInt32(PNG_SETTING_INTERLACE) == PNG_INTERLACE_NONE)
    7278        item->SetMarked(true);
    7379    fInterlaceMenu->AddItem(item);
     
    7884    fInterlaceMenu->AddItem(item);
    7985
    8086    rect.OffsetBy(0, stringView->Frame().Height() + 20.0f);
    81     BMenuField* menuField = new BMenuField(rect, "PNG Interlace Menu",
    82         "Interlacing type:", fInterlaceMenu);
     87    BMenuField* menuField = new BMenuField(rect,
     88        B_TRANSLATE("PNG Interlace Menu"),
     89        B_TRANSLATE("Interlacing type:"), fInterlaceMenu);
    8390    menuField->SetDivider(menuField->StringWidth(menuField->Label()) + 7.0f);
    8491    menuField->ResizeToPreferred();
    8592    AddChild(menuField);
     
    8794    rect.OffsetBy(0, height + 15);
    8895    rect.right = Bounds().right;
    8996    rect.bottom = Bounds().bottom;
    90     fCopyrightView = new BTextView(rect, "PNG copyright", rect.OffsetToCopy(B_ORIGIN),
     97    fCopyrightView = new BTextView(rect, "PNG copyright",
     98        rect.OffsetToCopy(B_ORIGIN),
    9199        B_FOLLOW_ALL, B_WILL_DRAW | B_FRAME_EVENTS);
    92100    fCopyrightView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
    93101    fCopyrightView->SetLowColor(fCopyrightView->ViewColor());
     
    101109
    102110    if (maxWidth + 20 > Bounds().Width())
    103111        ResizeTo(maxWidth + 20, Bounds().Height());
    104     if (Bounds().Height() < rect.top + stringView->Bounds().Height() * 3.0f + 8.0f)
     112    if (Bounds().Height() < rect.top + stringView->Bounds().Height()
     113        * 3.0f + 8.0f)
    105114        ResizeTo(Bounds().Width(), rect.top + height * 3.0f + 8.0f);
    106115
    107116    fCopyrightView->SetTextRect(fCopyrightView->Bounds());
  • src/add-ons/translators/png/Jamfile

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

     
    3333/*****************************************************************************/
    3434
    3535#include <Application.h>
     36#include <Catalog.h>
    3637#include "PNGTranslator.h"
    3738#include "PNGView.h"
    3839#include "TranslatorWindow.h"
    3940
     41#undef B_TRANSLATE_CONTEXT
     42#define B_TRANSLATE_CONTEXT "PNGTranslator"
     43
    4044// ---------------------------------------------------------------
    4145// main
    4246//
     
    5660    BApplication app("application/x-vnd.Haiku-PNGTranslator");
    5761    status_t result;
    5862    result = LaunchTranslatorWindow(new PNGTranslator,
    59         "PNG Settings", BRect(0, 0, PNG_VIEW_WIDTH, PNG_VIEW_HEIGHT));
     63        B_TRANSLATE("PNG Settings"), BRect(0, 0, PNG_VIEW_WIDTH,
     64        PNG_VIEW_HEIGHT));
    6065    if (result == B_OK) {
    6166        app.Run();
    6267        return 0;