Ticket #7148: webptranslator-localization.patch

File webptranslator-localization.patch, 5.8 KB (added by Karvjorm, 11 years ago)

A WebPTranslator localization patch

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

     
    1010#include "ConfigView.h"
    1111#include "WebPTranslator.h"
    1212
     13#include <Catalog.h>
    1314#include <CheckBox.h>
    1415#include <GroupLayout.h>
    1516#include <GroupLayoutBuilder.h>
     
    1819#include <stdio.h>
    1920#include <string.h>
    2021
     22#undef B_TRANSLATE_CONTEXT
     23#define B_TRANSLATE_CONTEXT "ConfigView"
    2124
     25
    2226ConfigView::ConfigView(uint32 flags)
    23     : BView("WebPTranslator Settings", flags)
     27    : BView(B_TRANSLATE("WebPTranslator Settings"), flags)
    2428{
    2529    SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
    2630
    27     BStringView* title = new BStringView("title", "WebP Images");
     31    BStringView* title = new BStringView("title", B_TRANSLATE("WebP Images"));
    2832    title->SetFont(be_bold_font);
    2933
    3034    char versionString[256];
    31     sprintf(versionString, "Version %d.%d.%d, %s",
    32         int(B_TRANSLATION_MAJOR_VERSION(WEBP_TRANSLATOR_VERSION)),
    33         int(B_TRANSLATION_MINOR_VERSION(WEBP_TRANSLATOR_VERSION)),
    34         int(B_TRANSLATION_REVISION_VERSION(WEBP_TRANSLATOR_VERSION)),
    35         __DATE__);
     35    sprintf(versionString, B_TRANSLATE("Version %d.%d.%d, %s"),
     36        static_cast<int>(B_TRANSLATION_MAJOR_VERSION(WEBP_TRANSLATOR_VERSION)),
     37        static_cast<int>(B_TRANSLATION_MINOR_VERSION(WEBP_TRANSLATOR_VERSION)),
     38        static_cast<int>(B_TRANSLATION_REVISION_VERSION(
     39            WEBP_TRANSLATOR_VERSION)), __DATE__);
    3640    BStringView* version = new BStringView("version", versionString);
    3741
    3842    BStringView* copyright = new BStringView("copyright",
    3943        B_UTF8_COPYRIGHT "2010 Haiku Inc.");
    4044
    4145    BStringView* copyright2 = new BStringView("copyright2",
    42         "Based on libwebp v0.1");
     46        B_TRANSLATE("Based on libwebp v0.1"));
    4347
    4448    BStringView* copyright3 = new BStringView("copyright3",
    4549        B_UTF8_COPYRIGHT "2010 Google Inc.");
     
    6165
    6266    BFont font;
    6367    GetFont(&font);
    64     SetExplicitPreferredSize(BSize((font.Size() * 233)/12, (font.Size() * 200)/12));
     68    SetExplicitPreferredSize(BSize((font.Size() * 233)/12,
     69        (font.Size() * 200)/12));
    6570}
    6671
    6772
  • src/add-ons/translators/webp/WebPTranslator.cpp

     
    1212
    1313#include "decode.h"
    1414
     15#include <Catalog.h>
    1516#include <BufferIO.h>
    1617#include <Messenger.h>
    1718#include <TranslatorRoster.h>
     
    2021#include <stdlib.h>
    2122#include <string.h>
    2223
     24#undef B_TRANSLATE_CONTEXT
     25#define B_TRANSLATE_CONTEXT "WebPTranslator"
    2326
    2427class FreeAllocation {
    2528    public:
     
    7073    {B_TRANSLATOR_EXT_DATA_ONLY, TRAN_SETTING_BOOL, false}
    7174};
    7275
    73 const uint32 kNumInputFormats = sizeof(sInputFormats) / sizeof(translation_format);
    74 const uint32 kNumOutputFormats = sizeof(sOutputFormats) / sizeof(translation_format);
    75 const uint32 kNumDefaultSettings = sizeof(sDefaultSettings) / sizeof(TranSetting);
     76const uint32 kNumInputFormats = sizeof(sInputFormats) /
     77    sizeof(translation_format);
     78const uint32 kNumOutputFormats = sizeof(sOutputFormats) /
     79    sizeof(translation_format);
     80const uint32 kNumDefaultSettings = sizeof(sDefaultSettings) /
     81    sizeof(TranSetting);
    7682
    7783
    7884//  #pragma mark -
    7985
    8086
    8187WebPTranslator::WebPTranslator()
    82     : BaseTranslator("WebP images", "WebP image translator",
     88    : BaseTranslator(B_TRANSLATE("WebP images"),
     89        B_TRANSLATE("WebP image translator"),
    8390        WEBP_TRANSLATOR_VERSION,
    8491        sInputFormats, kNumInputFormats,
    8592        sOutputFormats, kNumOutputFormats,
     
    120127    info->group = B_TRANSLATOR_BITMAP;
    121128    info->quality = WEBP_IN_QUALITY;
    122129    info->capability = WEBP_IN_CAPABILITY;
    123     snprintf(info->name, sizeof(info->name), "WebP image");
     130    snprintf(info->name, sizeof(info->name), B_TRANSLATE("WebP image"));
    124131    strcpy(info->MIME, "image/webp");
    125132
    126133    return B_OK;
     
    139146
    140147    off_t streamLength = 0;
    141148    stream->GetSize(&streamLength);
    142     printf("stream GetSize(): %lld\n", streamLength);
     149    printf(B_TRANSLATE("stream GetSize(): %lld\n"), streamLength);
    143150
    144151    off_t streamSize = stream->Seek(0, SEEK_END);
    145152    stream->Seek(0, SEEK_SET);
     
    154161    }
    155162
    156163    int width, height;
    157     uint8* out = WebPDecodeRGB((const uint8*)streamData, streamSize, &width, &height);
     164    uint8* out = WebPDecodeRGB((const uint8*)streamData, streamSize, &width,
     165        &height);
    158166    free(streamData);
    159167
    160168    if (out == NULL)
     
    174182    // write out Be's Bitmap header
    175183    swap_data(B_UINT32_TYPE, &bitmapHeader, sizeof(TranslatorBitmap),
    176184        B_SWAP_HOST_TO_BENDIAN);
    177     ssize_t bytesWritten = target->Write(&bitmapHeader, sizeof(TranslatorBitmap));
     185    ssize_t bytesWritten = target->Write(&bitmapHeader,
     186        sizeof(TranslatorBitmap));
    178187    if (bytesWritten < B_OK)
    179188        return bytesWritten;
    180189
  • src/add-ons/translators/webp/main.cpp

     
    88
    99
    1010#include <Application.h>
     11#include <Catalog.h>
    1112
    1213#include "WebPTranslator.h"
    1314#include "TranslatorWindow.h"
    1415
     16#undef B_TRANSLATE_CONTEXT
     17#define B_TRANSLATE_CONTEXT "main"
     18
    1519int
    1620main()
    1721{
    1822    BApplication app("application/x-vnd.Haiku-WebPTranslator");
    1923    if (LaunchTranslatorWindow(new WebPTranslator,
    20         "WebP Settings") != B_OK)
     24        B_TRANSLATE("WebP Settings")) != B_OK)
    2125        return 1;
    2226
    2327    app.Run();
  • src/add-ons/translators/webp/Jamfile

     
    2727    : true
    2828;
    2929
     30DoCatalogs WebPTranslator :
     31    x-vnd.Haiku-WebPTranslator
     32    :
     33    main.cpp
     34    ConfigView.cpp
     35    WebPTranslator.cpp
     36;
     37