From 8dca2efd6296ed54786215e31123d77bce2d177a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Duval?= Date: Fri, 21 Jan 2011 22:42:52 +0000 Subject: [PATCH] Applied patchs from Karvjorm (tickets #7125, #7131, #7126, #7129): Localizations for PNG PCX HVIF and HPGS translators. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40262 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/translators/hpgs/ConfigView.cpp | 22 +++++++++----- .../translators/hpgs/HPGSTranslator.cpp | 30 ++++++++++++------- src/add-ons/translators/hpgs/Jamfile | 7 +++++ src/add-ons/translators/hpgs/ReadHelper.h | 2 +- src/add-ons/translators/hvif/HVIFMain.cpp | 8 +++-- .../translators/hvif/HVIFTranslator.cpp | 11 +++++-- src/add-ons/translators/hvif/HVIFView.cpp | 17 +++++++---- src/add-ons/translators/hvif/Jamfile | 11 ++++++- src/add-ons/translators/pcx/ConfigView.cpp | 12 ++++++-- src/add-ons/translators/pcx/Jamfile | 11 +++++-- src/add-ons/translators/pcx/PCXTranslator.cpp | 7 +++-- src/add-ons/translators/pcx/main.cpp | 8 ++++- src/add-ons/translators/png/Jamfile | 11 +++++-- src/add-ons/translators/png/PNGMain.cpp | 7 ++++- src/add-ons/translators/png/PNGTranslator.cpp | 18 ++++++++--- src/add-ons/translators/png/PNGView.cpp | 27 +++++++++++------ 16 files changed, 156 insertions(+), 53 deletions(-) diff --git a/src/add-ons/translators/hpgs/ConfigView.cpp b/src/add-ons/translators/hpgs/ConfigView.cpp index dac7773b7e..549718ed57 100644 --- a/src/add-ons/translators/hpgs/ConfigView.cpp +++ b/src/add-ons/translators/hpgs/ConfigView.cpp @@ -8,15 +8,19 @@ #include "ConfigView.h" #include "HPGSTranslator.h" -#include +#include #include +#include #include #include +#undef B_TRANSLATE_CONTEXT +#define B_TRANSLATE_CONTEXT "ConfigView" + ConfigView::ConfigView(const BRect &frame, uint32 resize, uint32 flags) - : BView(frame, "HPGSTranslator Settings", resize, flags) + : BView(frame, B_TRANSLATE("HPGSTranslator Settings"), resize, flags) { SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); @@ -25,14 +29,15 @@ ConfigView::ConfigView(const BRect &frame, uint32 resize, uint32 flags) float height = fontHeight.descent + fontHeight.ascent + fontHeight.leading; BRect rect(10, 10, 200, 10 + height); - BStringView *stringView = new BStringView(rect, "title", "HPGS images"); + BStringView *stringView = new BStringView(rect, "title", + B_TRANSLATE("HPGS images")); stringView->SetFont(be_bold_font); stringView->ResizeToPreferred(); AddChild(stringView); rect.OffsetBy(0, height + 10); char version[256]; - sprintf(version, "Version %d.%d.%d, %s", + sprintf(version, B_TRANSLATE("Version %d.%d.%d, %s"), int(B_TRANSLATION_MAJOR_VERSION(HPGS_TRANSLATOR_VERSION)), int(B_TRANSLATION_MINOR_VERSION(HPGS_TRANSLATOR_VERSION)), int(B_TRANSLATION_REVISION_VERSION(HPGS_TRANSLATOR_VERSION)), @@ -45,17 +50,20 @@ ConfigView::ConfigView(const BRect &frame, uint32 resize, uint32 flags) height = fontHeight.descent + fontHeight.ascent + fontHeight.leading; rect.OffsetBy(0, height + 5); - stringView = new BStringView(rect, "copyright", B_UTF8_COPYRIGHT "2007 Haiku Inc."); + stringView = new BStringView(rect, "copyright", B_UTF8_COPYRIGHT + "2007 Haiku Inc."); stringView->ResizeToPreferred(); AddChild(stringView); rect.OffsetBy(0, height + 10); - stringView = new BStringView(rect, "copyright2", "Based on HPGS (http://hpgs.berlios.de)"); + stringView = new BStringView(rect, "copyright2", B_TRANSLATE("Based on " + "HPGS (http://hpgs.berlios.de)")); stringView->ResizeToPreferred(); AddChild(stringView); rect.OffsetBy(0, height + 5); - stringView = new BStringView(rect, "copyright3", B_UTF8_COPYRIGHT "2004-2006 ev-i Informationstechnologie GmbH"); + stringView = new BStringView(rect, "copyright3", B_UTF8_COPYRIGHT + "2004-2006 ev-i Informationstechnologie GmbH"); stringView->ResizeToPreferred(); AddChild(stringView); } diff --git a/src/add-ons/translators/hpgs/HPGSTranslator.cpp b/src/add-ons/translators/hpgs/HPGSTranslator.cpp index b052536c24..3b5cdae450 100644 --- a/src/add-ons/translators/hpgs/HPGSTranslator.cpp +++ b/src/add-ons/translators/hpgs/HPGSTranslator.cpp @@ -10,6 +10,7 @@ #include "hpgsimage.h" +#include #include #include @@ -17,6 +18,10 @@ #include #include +#undef B_TRANSLATE_CONTEXT +#define B_TRANSLATE_CONTEXT "HPGSTranslator" + + typedef struct my_hpgs_png_image_st { hpgs_png_image image; BPositionIO *target; @@ -80,7 +85,8 @@ const uint32 kNumDefaultSettings = sizeof(sDefaultSettings) / sizeof(TranSetting HPGSTranslator::HPGSTranslator() - : BaseTranslator("HPGS images", "HPGS image translator", + : BaseTranslator(B_TRANSLATE("HPGS images"), + B_TRANSLATE("HPGS image translator"), HPGS_TRANSLATOR_VERSION, sInputFormats, kNumInputFormats, sOutputFormats, kNumOutputFormats, @@ -115,14 +121,16 @@ HPGSTranslator::DerivedIdentify(BPositionIO *stream, hpgs_bool multipage = HPGS_FALSE; hpgs_bool ignore_ps = HPGS_FALSE; hpgs_bool do_linewidth = HPGS_TRUE; - hpgs_device *size_dev = (hpgs_device *)hpgs_new_plotsize_device(ignore_ps, do_linewidth); - hpgs_reader *reader = hpgs_new_reader(istream, size_dev, multipage, verbosity); + hpgs_device *size_dev = (hpgs_device *)hpgs_new_plotsize_device(ignore_ps, + do_linewidth); + hpgs_reader *reader = hpgs_new_reader(istream, size_dev, multipage, + verbosity); if (hpgs_read(reader, HPGS_FALSE) == B_OK) { info->type = HPGS_IMAGE_FORMAT; info->group = B_TRANSLATOR_BITMAP; info->quality = HPGS_IN_QUALITY; info->capability = HPGS_IN_CAPABILITY; - snprintf(info->name, sizeof(info->name), "HPGS image"); + snprintf(info->name, sizeof(info->name), B_TRANSLATE("HPGS image")); strcpy(info->MIME, "vector/x-hpgl2"); } else err = B_NO_TRANSLATOR; @@ -175,13 +183,13 @@ HPGSTranslator::DerivedTranslate(BPositionIO* source, size_dev = (hpgs_device *)hpgs_new_plotsize_device(ignore_ps, do_linewidth); hpgs_reader *reader = hpgs_new_reader(istream, size_dev, multipage, verbosity); if (hpgs_read(reader, HPGS_FALSE)) { - fprintf(stderr, "no hpgs\n"); + fprintf(stderr, B_TRANSLATE("no hpgs\n")); err = B_NO_TRANSLATOR; goto err1; } if (hpgs_getplotsize(size_dev,1,&bbox)<0) { - fprintf(stderr, "no hpgs\n"); + fprintf(stderr, B_TRANSLATE("no hpgs\n")); err = B_NO_TRANSLATOR; goto err1; } @@ -208,8 +216,8 @@ HPGSTranslator::DerivedTranslate(BPositionIO* source, plot_dev = (hpgs_device *)pdv; if (hpgs_reader_imbue(reader, plot_dev)) { - fprintf(stderr, hpgs_i18n("Error: Cannot imbue plot device to reader: %s\n"), - hpgs_get_error()); + fprintf(stderr, hpgs_i18n(B_TRANSLATE("Error: Cannot imbue plot " + "device to reader: %s\n")), hpgs_get_error()); err = B_NO_TRANSLATOR; goto err2; } @@ -227,7 +235,8 @@ HPGSTranslator::DerivedTranslate(BPositionIO* source, B_SWAP_HOST_TO_BENDIAN); bytesWritten = target->Write(&header, sizeof(TranslatorBitmap)); if (bytesWritten < B_OK) { - fprintf(stderr, "Write error %s\n", strerror(bytesWritten)); + fprintf(stderr, B_TRANSLATE("Write error %s\n"), + strerror(bytesWritten)); err = bytesWritten; goto err2; } @@ -238,7 +247,8 @@ HPGSTranslator::DerivedTranslate(BPositionIO* source, } if (err == B_OK && hpgs_read(reader, HPGS_FALSE)) { - fprintf(stderr, hpgs_i18n("Error: Cannot process plot data %s\n"), hpgs_get_error()); + fprintf(stderr, hpgs_i18n(B_TRANSLATE("Error: Cannot process plot " + "data %s\n")), hpgs_get_error()); err = B_NO_TRANSLATOR; } diff --git a/src/add-ons/translators/hpgs/Jamfile b/src/add-ons/translators/hpgs/Jamfile index ea474565a5..bfae81308e 100644 --- a/src/add-ons/translators/hpgs/Jamfile +++ b/src/add-ons/translators/hpgs/Jamfile @@ -49,4 +49,11 @@ Translator HPGSTranslator : : true ; +DoCatalogs HPGSTranslator : + x-vnd.Haiku-HPGSTranslator + : + ConfigView.cpp + HPGSTranslator.cpp +; + SEARCH on [ FGristFiles $(sources) ] = [ FDirName $(SUBDIR) lib ] ; diff --git a/src/add-ons/translators/hpgs/ReadHelper.h b/src/add-ons/translators/hpgs/ReadHelper.h index ce817bfa3a..9310e9e2dd 100644 --- a/src/add-ons/translators/hpgs/ReadHelper.h +++ b/src/add-ons/translators/hpgs/ReadHelper.h @@ -90,7 +90,7 @@ positionio_read(void *ptr, size_t size, size_t nmemb, my_hpgs_istream *stream) unsigned char *iptr = (unsigned char *)ptr; size_t i = 0; for (; i < nmemb; i++) { - if (size != stream->buffer->Read(iptr, size)) + if (size != (size_t)stream->buffer->Read(iptr, size)) break; iptr += size; } diff --git a/src/add-ons/translators/hvif/HVIFMain.cpp b/src/add-ons/translators/hvif/HVIFMain.cpp index e8573cc674..aeccf14315 100644 --- a/src/add-ons/translators/hvif/HVIFMain.cpp +++ b/src/add-ons/translators/hvif/HVIFMain.cpp @@ -7,15 +7,19 @@ */ #include +#include #include "HVIFTranslator.h" #include "TranslatorWindow.h" +#undef B_TRANSLATE_CONTEXT +#define B_TRANSLATE_CONTEXT "HVIFMain" + int main(int argc, char *argv[]) { BApplication application("application/x-vnd.Haiku.HVIFTranslator"); - if (LaunchTranslatorWindow(new HVIFTranslator, "HVIF Settings", - BRect(0, 0, 250, 150)) != B_OK) + if (LaunchTranslatorWindow(new HVIFTranslator, + B_TRANSLATE("HVIF Settings"), BRect(0, 0, 250, 150)) != B_OK) return 1; application.Run(); diff --git a/src/add-ons/translators/hvif/HVIFTranslator.cpp b/src/add-ons/translators/hvif/HVIFTranslator.cpp index 2e4e302657..54c26573dc 100644 --- a/src/add-ons/translators/hvif/HVIFTranslator.cpp +++ b/src/add-ons/translators/hvif/HVIFTranslator.cpp @@ -11,6 +11,7 @@ #include #include +#include #include #include @@ -21,6 +22,10 @@ #define HVIF_TRANSLATION_QUALITY 1.0 #define HVIF_TRANSLATION_CAPABILITY 1.0 +#undef B_TRANSLATE_CONTEXT +#define B_TRANSLATE_CONTEXT "HVIFTranslator" + + static const translation_format sInputFormats[] = { { HVIF_FORMAT_CODE, @@ -65,7 +70,8 @@ make_nth_translator(int32 n, image_id image, uint32 flags, ...) HVIFTranslator::HVIFTranslator() - : BaseTranslator("HVIF icons", "Native Haiku vector icon translator", + : BaseTranslator(B_TRANSLATE("HVIF icons"), + B_TRANSLATE("Native Haiku vector icon translator"), HVIF_TRANSLATOR_VERSION, sInputFormats, kNumInputFormats, sOutputFormats, kNumOutputFormats, @@ -174,5 +180,6 @@ HVIFTranslator::DerivedTranslate(BPositionIO *inSource, BView * HVIFTranslator::NewConfigView(TranslatorSettings *settings) { - return new HVIFView("HVIFTranslator Settings", B_WILL_DRAW, settings); + return new HVIFView(B_TRANSLATE("HVIFTranslator Settings"), + B_WILL_DRAW, settings); } diff --git a/src/add-ons/translators/hvif/HVIFView.cpp b/src/add-ons/translators/hvif/HVIFView.cpp index 889a9caa02..08c5558917 100644 --- a/src/add-ons/translators/hvif/HVIFView.cpp +++ b/src/add-ons/translators/hvif/HVIFView.cpp @@ -9,6 +9,7 @@ #include "HVIFView.h" #include "HVIFTranslator.h" +#include #include #include #include @@ -17,6 +18,9 @@ #define HVIF_SETTING_RENDER_SIZE_CHANGED 'rsch' +#undef B_TRANSLATE_CONTEXT +#define B_TRANSLATE_CONTEXT "HVIFView" + HVIFView::HVIFView(const char* name, uint32 flags, TranslatorSettings *settings) : @@ -26,12 +30,13 @@ HVIFView::HVIFView(const char* name, uint32 flags, TranslatorSettings *settings) BAlignment labelAlignment(B_ALIGN_LEFT, B_ALIGN_NO_VERTICAL); BStringView* title= new BStringView("title", - "Native Haiku icon format translator"); + B_TRANSLATE("Native Haiku icon format translator")); title->SetFont(be_bold_font); title->SetExplicitAlignment(labelAlignment); char versionString[256]; - snprintf(versionString, sizeof(versionString), "Version %d.%d.%d, %s", + snprintf(versionString, sizeof(versionString), + B_TRANSLATE("Version %d.%d.%d, %s"), int(B_TRANSLATION_MAJOR_VERSION(HVIF_TRANSLATOR_VERSION)), int(B_TRANSLATION_MINOR_VERSION(HVIF_TRANSLATOR_VERSION)), int(B_TRANSLATION_REVISION_VERSION(HVIF_TRANSLATOR_VERSION)), @@ -45,8 +50,8 @@ HVIFView::HVIFView(const char* name, uint32 flags, TranslatorSettings *settings) int32 renderSize = fSettings->SetGetInt32(HVIF_SETTING_RENDER_SIZE); - BString label = "Render size: "; - label << renderSize; + BString label = B_TRANSLATE("Render size:"); + label << " " << renderSize; fRenderSize = new BSlider("renderSize", label.String(), NULL, 1, 32, B_HORIZONTAL); @@ -101,8 +106,8 @@ HVIFView::MessageReceived(BMessage *message) fSettings->SetGetInt32(HVIF_SETTING_RENDER_SIZE, &value); fSettings->SaveSettings(); - BString newLabel = "Render size: "; - newLabel << value; + BString newLabel = B_TRANSLATE("Render size:"); + newLabel << " " << value; fRenderSize->SetLabel(newLabel.String()); return; } diff --git a/src/add-ons/translators/hvif/Jamfile b/src/add-ons/translators/hvif/Jamfile index 20c7b5fade..e1f0706f13 100644 --- a/src/add-ons/translators/hvif/Jamfile +++ b/src/add-ons/translators/hvif/Jamfile @@ -8,7 +8,16 @@ Translator HVIFTranslator : HVIFMain.cpp HVIFTranslator.cpp HVIFView.cpp - : be translation libtranslatorsutils.a $(TARGET_LIBSUPC++) + : be translation libtranslatorsutils.a $(TARGET_LIBSUPC++) +$(HAIKU_LOCALE_LIBS) $(HAIKU_LOCALE_LIBS) : true ; + +DoCatalogs HVIFTranslator : + x-vnd.Haiku-HVIFTranslator + : + HVIFMain.cpp + HVIFTranslator.cpp + HVIFView.cpp +; diff --git a/src/add-ons/translators/pcx/ConfigView.cpp b/src/add-ons/translators/pcx/ConfigView.cpp index 6e8c4053ed..813b48dab2 100644 --- a/src/add-ons/translators/pcx/ConfigView.cpp +++ b/src/add-ons/translators/pcx/ConfigView.cpp @@ -8,6 +8,7 @@ #include "ConfigView.h" #include "PCXTranslator.h" +#include #include #include @@ -15,8 +16,12 @@ #include +#undef B_TRANSLATE_CONTEXT +#define B_TRANSLATE_CONTEXT "ConfigView" + + ConfigView::ConfigView(const BRect &frame, uint32 resize, uint32 flags) - : BView(frame, "PCXTranslator Settings", resize, flags) + : BView(frame, B_TRANSLATE("PCXTranslator Settings"), resize, flags) { SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); @@ -25,14 +30,15 @@ ConfigView::ConfigView(const BRect &frame, uint32 resize, uint32 flags) float height = fontHeight.descent + fontHeight.ascent + fontHeight.leading; BRect rect(10, 10, 200, 10 + height); - BStringView *stringView = new BStringView(rect, "title", "PCX images"); + BStringView *stringView = new BStringView(rect, "title", + B_TRANSLATE("PCX images")); stringView->SetFont(be_bold_font); stringView->ResizeToPreferred(); AddChild(stringView); rect.OffsetBy(0, height + 10); char version[256]; - sprintf(version, "Version %d.%d.%d, %s", + sprintf(version, B_TRANSLATE("Version %d.%d.%d, %s"), int(B_TRANSLATION_MAJOR_VERSION(PCX_TRANSLATOR_VERSION)), int(B_TRANSLATION_MINOR_VERSION(PCX_TRANSLATOR_VERSION)), int(B_TRANSLATION_REVISION_VERSION(PCX_TRANSLATOR_VERSION)), diff --git a/src/add-ons/translators/pcx/Jamfile b/src/add-ons/translators/pcx/Jamfile index b98a68935a..12e37cd530 100644 --- a/src/add-ons/translators/pcx/Jamfile +++ b/src/add-ons/translators/pcx/Jamfile @@ -10,11 +10,18 @@ Translator PCXTranslator : PCXTranslator.cpp ConfigView.cpp PCX.cpp - : be translation libtranslatorsutils.a $(TARGET_LIBSUPC++) - $(HAIKU_LOCALE_LIBS) + : be translation libtranslatorsutils.a $(TARGET_LIBSUPC++) $(HAIKU_LOCALE_LIBS) : true ; +DoCatalogs PCXTranslator : + x-vnd.Haiku-PCXTranslator + : + main.cpp + ConfigView.cpp + PCXTranslator.cpp +; + Package haiku-translationkit-cvs : PCXTranslator : boot home config add-ons Translators diff --git a/src/add-ons/translators/pcx/PCXTranslator.cpp b/src/add-ons/translators/pcx/PCXTranslator.cpp index 21d7c932be..de3b23c606 100644 --- a/src/add-ons/translators/pcx/PCXTranslator.cpp +++ b/src/add-ons/translators/pcx/PCXTranslator.cpp @@ -9,10 +9,13 @@ #include "ConfigView.h" #include "PCX.h" +#include #include #include #include +#undef B_TRANSLATE_CONTEXT +#define B_TRANSLATE_CONTEXT "PCXTranslator" #define kPCXMimeType "image/x-pcx" @@ -69,7 +72,7 @@ const uint32 kNumDefaultSettings = sizeof(sDefaultSettings) / sizeof(TranSetting PCXTranslator::PCXTranslator() - : BaseTranslator("PCX images", "PCX translator", + : BaseTranslator(B_TRANSLATE("PCX images"), B_TRANSLATE("PCX translator"), PCX_TRANSLATOR_VERSION, sInputFormats, kNumInputFormats, sOutputFormats, kNumOutputFormats, @@ -104,7 +107,7 @@ PCXTranslator::DerivedIdentify(BPositionIO *stream, info->group = B_TRANSLATOR_BITMAP; info->quality = PCX_IN_QUALITY; info->capability = PCX_IN_CAPABILITY; - snprintf(info->name, sizeof(info->name), "PCX %lu bit image", + snprintf(info->name, sizeof(info->name), B_TRANSLATE("PCX %lu bit image"), bitsPerPixel); strcpy(info->MIME, kPCXMimeType); diff --git a/src/add-ons/translators/pcx/main.cpp b/src/add-ons/translators/pcx/main.cpp index 7e64bba3be..76ac3440ba 100644 --- a/src/add-ons/translators/pcx/main.cpp +++ b/src/add-ons/translators/pcx/main.cpp @@ -10,6 +10,11 @@ #include "TranslatorWindow.h" #include +#include + + +#undef B_TRANSLATE_CONTEXT +#define B_TRANSLATE_CONTEXT "main" int @@ -18,7 +23,8 @@ main(int /*argc*/, char **/*argv*/) BApplication app("application/x-vnd.Haiku-PCXTranslator"); status_t result; - result = LaunchTranslatorWindow(new PCXTranslator, "PCX Settings", BRect(0, 0, 225, 175)); + result = LaunchTranslatorWindow(new PCXTranslator, + B_TRANSLATE("PCX Settings"), BRect(0, 0, 225, 175)); if (result != B_OK) return 1; diff --git a/src/add-ons/translators/png/Jamfile b/src/add-ons/translators/png/Jamfile index df3d94f330..f0eb31c530 100644 --- a/src/add-ons/translators/png/Jamfile +++ b/src/add-ons/translators/png/Jamfile @@ -14,11 +14,18 @@ Translator PNGTranslator : PNGTranslator.cpp PNGView.cpp - : be translation libpng.a z libtranslatorsutils.a $(TARGET_LIBSUPC++) - $(HAIKU_LOCALE_LIBS) + : be translation libpng.so z libtranslatorsutils.a $(TARGET_LIBSUPC++) $(HAIKU_LOCALE_LIBS) : true ; +DoCatalogs PNGTranslator : + x-vnd.Haiku-PNGTranslator + : + PNGMain.cpp + PNGTranslator.cpp + PNGView.cpp +; + Package haiku-translationkit-cvs : PNGTranslator : boot home config add-ons Translators ; diff --git a/src/add-ons/translators/png/PNGMain.cpp b/src/add-ons/translators/png/PNGMain.cpp index e0e85952c0..6f5e675d0d 100644 --- a/src/add-ons/translators/png/PNGMain.cpp +++ b/src/add-ons/translators/png/PNGMain.cpp @@ -33,10 +33,14 @@ /*****************************************************************************/ #include +#include #include "PNGTranslator.h" #include "PNGView.h" #include "TranslatorWindow.h" +#undef B_TRANSLATE_CONTEXT +#define B_TRANSLATE_CONTEXT "PNGTranslator" + // --------------------------------------------------------------- // main // @@ -56,7 +60,8 @@ main() BApplication app("application/x-vnd.Haiku-PNGTranslator"); status_t result; result = LaunchTranslatorWindow(new PNGTranslator, - "PNG Settings", BRect(0, 0, PNG_VIEW_WIDTH, PNG_VIEW_HEIGHT)); + B_TRANSLATE("PNG Settings"), BRect(0, 0, PNG_VIEW_WIDTH, + PNG_VIEW_HEIGHT)); if (result == B_OK) { app.Run(); return 0; diff --git a/src/add-ons/translators/png/PNGTranslator.cpp b/src/add-ons/translators/png/PNGTranslator.cpp index 8bd83d983d..b49bd2729b 100644 --- a/src/add-ons/translators/png/PNGTranslator.cpp +++ b/src/add-ons/translators/png/PNGTranslator.cpp @@ -30,14 +30,22 @@ // DEALINGS IN THE SOFTWARE. /*****************************************************************************/ + +#include "PNGTranslator.h" + #include #include + +#include #include #define PNG_NO_PEDANTIC_WARNINGS #include -#include "PNGTranslator.h" + #include "PNGView.h" +#undef B_TRANSLATE_CONTEXT +#define B_TRANSLATE_CONTEXT "PNGTranslator" + // The input formats that this translator supports. static const translation_format sInputFormats[] = { { @@ -185,7 +193,8 @@ pngcb_flush_data(png_structp ppng) // Returns: // --------------------------------------------------------------- PNGTranslator::PNGTranslator() - : BaseTranslator("PNG images", "PNG image translator", + : BaseTranslator(B_TRANSLATE("PNG images"), + B_TRANSLATE("PNG image translator"), PNG_TRANSLATOR_VERSION, sInputFormats, kNumInputFormats, sOutputFormats, kNumOutputFormats, @@ -229,7 +238,7 @@ identify_png_header(BPositionIO *inSource, translator_info *outInfo) outInfo->quality = PNG_IN_QUALITY; outInfo->capability = PNG_IN_CAPABILITY; strcpy(outInfo->MIME, "image/png"); - strcpy(outInfo->name, "PNG image"); + strcpy(outInfo->name, B_TRANSLATE("PNG image")); } return B_OK; @@ -975,6 +984,7 @@ BView * PNGTranslator::NewConfigView(TranslatorSettings *settings) { return new PNGView(BRect(0, 0, PNG_VIEW_WIDTH, PNG_VIEW_HEIGHT), - "PNGTranslator Settings", B_FOLLOW_ALL, B_WILL_DRAW, settings); + B_TRANSLATE("PNGTranslator Settings"), B_FOLLOW_ALL, + B_WILL_DRAW, settings); } diff --git a/src/add-ons/translators/png/PNGView.cpp b/src/add-ons/translators/png/PNGView.cpp index 4b8dd07a33..97315b970e 100644 --- a/src/add-ons/translators/png/PNGView.cpp +++ b/src/add-ons/translators/png/PNGView.cpp @@ -12,6 +12,7 @@ #include "PNGTranslator.h" #include +#include #include #include #include @@ -22,6 +23,8 @@ #define PNG_NO_PEDANTIC_WARNINGS #include +#undef B_TRANSLATE_CONTEXT +#define B_TRANSLATE_CONTEXT "PNGTranslator" PNGView::PNGView(const BRect &frame, const char *name, uint32 resizeMode, uint32 flags, TranslatorSettings *settings) @@ -35,7 +38,8 @@ PNGView::PNGView(const BRect &frame, const char *name, uint32 resizeMode, float height = fontHeight.descent + fontHeight.ascent + fontHeight.leading; BRect rect(10, 10, 200, 10 + height); - BStringView *stringView = new BStringView(rect, "title", "PNG image translator"); + BStringView *stringView = new BStringView(rect, "title", + B_TRANSLATE("PNG image translator")); stringView->SetFont(be_bold_font); stringView->ResizeToPreferred(); AddChild(stringView); @@ -44,7 +48,7 @@ PNGView::PNGView(const BRect &frame, const char *name, uint32 resizeMode, rect.OffsetBy(0, height + 10); char version[256]; - snprintf(version, sizeof(version), "Version %d.%d.%d, %s", + snprintf(version, sizeof(version), B_TRANSLATE("Version %d.%d.%d, %s"), int(B_TRANSLATION_MAJOR_VERSION(PNG_TRANSLATOR_VERSION)), int(B_TRANSLATION_MINOR_VERSION(PNG_TRANSLATOR_VERSION)), int(B_TRANSLATION_REVISION_VERSION(PNG_TRANSLATOR_VERSION)), @@ -60,14 +64,16 @@ PNGView::PNGView(const BRect &frame, const char *name, uint32 resizeMode, height = fontHeight.descent + fontHeight.ascent + fontHeight.leading; rect.OffsetBy(0, height + 5); - stringView = new BStringView(rect, "Copyright", B_UTF8_COPYRIGHT "2003-2006 Haiku Inc."); + stringView = new BStringView(rect, + "Copyright", B_UTF8_COPYRIGHT "2003-2006 Haiku Inc."); stringView->ResizeToPreferred(); AddChild(stringView); // setup PNG interlace options - fInterlaceMenu = new BPopUpMenu("Interlace Option"); - BMenuItem* item = new BMenuItem("None", _InterlaceMessage(PNG_INTERLACE_NONE)); + fInterlaceMenu = new BPopUpMenu(B_TRANSLATE("Interlace Option")); + BMenuItem* item = new BMenuItem(B_TRANSLATE("None"), + _InterlaceMessage(PNG_INTERLACE_NONE)); if (fSettings->SetGetInt32(PNG_SETTING_INTERLACE) == PNG_INTERLACE_NONE) item->SetMarked(true); fInterlaceMenu->AddItem(item); @@ -78,8 +84,9 @@ PNGView::PNGView(const BRect &frame, const char *name, uint32 resizeMode, fInterlaceMenu->AddItem(item); rect.OffsetBy(0, stringView->Frame().Height() + 20.0f); - BMenuField* menuField = new BMenuField(rect, "PNG Interlace Menu", - "Interlacing type:", fInterlaceMenu); + BMenuField* menuField = new BMenuField(rect, + B_TRANSLATE("PNG Interlace Menu"), + B_TRANSLATE("Interlacing type:"), fInterlaceMenu); menuField->SetDivider(menuField->StringWidth(menuField->Label()) + 7.0f); menuField->ResizeToPreferred(); AddChild(menuField); @@ -87,7 +94,8 @@ PNGView::PNGView(const BRect &frame, const char *name, uint32 resizeMode, rect.OffsetBy(0, height + 15); rect.right = Bounds().right; rect.bottom = Bounds().bottom; - fCopyrightView = new BTextView(rect, "PNG copyright", rect.OffsetToCopy(B_ORIGIN), + fCopyrightView = new BTextView(rect, "PNG copyright", + rect.OffsetToCopy(B_ORIGIN), B_FOLLOW_ALL, B_WILL_DRAW | B_FRAME_EVENTS); fCopyrightView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); fCopyrightView->SetLowColor(fCopyrightView->ViewColor()); @@ -101,7 +109,8 @@ PNGView::PNGView(const BRect &frame, const char *name, uint32 resizeMode, if (maxWidth + 20 > Bounds().Width()) ResizeTo(maxWidth + 20, Bounds().Height()); - if (Bounds().Height() < rect.top + stringView->Bounds().Height() * 3.0f + 8.0f) + if (Bounds().Height() < rect.top + stringView->Bounds().Height() + * 3.0f + 8.0f) ResizeTo(Bounds().Width(), rect.top + height * 3.0f + 8.0f); fCopyrightView->SetTextRect(fCopyrightView->Bounds());