Ticket #7145: tgatranslator-localization.patch

File tgatranslator-localization.patch, 6.5 KB (added by Karvjorm, 11 years ago)

A TGATranslator localization patch

  • src/add-ons/translators/tga/TGAMain.cpp

     
    2828/*****************************************************************************/
    2929
    3030#include <Application.h>
     31#include <Catalog.h>
    3132#include "TGATranslator.h"
    3233#include "TranslatorWindow.h"
    3334
     35#undef B_TRANSLATE_CONTEXT
     36#define B_TRANSLATE_CONTEXT "TGAMain"
     37
    3438// ---------------------------------------------------------------
    3539// main
    3640//
     
    4953{
    5054    BApplication app("application/x-vnd.Haiku-TGATranslator");
    5155    status_t result;
    52     result = LaunchTranslatorWindow(new TGATranslator, "TGA Settings");
     56    result = LaunchTranslatorWindow(new TGATranslator,
     57        B_TRANSLATE("TGA Settings"));
    5358    if (result == B_OK) {
    5459        app.Run();
    5560        return 0;
  • src/add-ons/translators/tga/TGATranslator.cpp

     
    2828// DEALINGS IN THE SOFTWARE.
    2929/*****************************************************************************/
    3030
     31#include <Catalog.h>
    3132#include <string.h>
    3233#include <stdio.h>
    3334#include "TGATranslator.h"
    3435#include "TGAView.h"
    3536#include "StreamBuffer.h"
    3637
     38#undef B_TRANSLATE_CONTEXT
     39#define B_TRANSLATE_CONTEXT "TGATranslator"
     40
    3741// The input formats that this translator supports.
    3842static const translation_format sInputFormats[] = {
    3943    {
     
    136140// Returns:
    137141// ---------------------------------------------------------------
    138142TGATranslator::TGATranslator()
    139     : BaseTranslator("TGA images", "TGA image translator",
     143    : BaseTranslator(B_TRANSLATE("TGA images"),
     144        B_TRANSLATE("TGA image translator"),
    140145        TGA_TRANSLATOR_VERSION,
    141146        sInputFormats, kNumInputFormats,
    142147        sOutputFormats, kNumOutputFormats,
     
    385390        outInfo->group = B_TRANSLATOR_BITMAP;
    386391        outInfo->quality = TGA_IN_QUALITY;
    387392        outInfo->capability = TGA_IN_CAPABILITY;
    388         sprintf(outInfo->name, "Targa image (%d bits",
    389             imagespec.depth);
    390393        switch (fileheader.imagetype) {
    391394            case TGA_NOCOMP_COLORMAP:
    392                 strcat(outInfo->name, " colormap");
     395                snprintf(outInfo->name, sizeof(outInfo->name),
     396                    B_TRANSLATE("Targa image (%d bits colormap)"),
     397                    imagespec.depth);
    393398                break;
    394399            case TGA_NOCOMP_TRUECOLOR:
    395                 strcat(outInfo->name, " truecolor");
     400                snprintf(outInfo->name, sizeof(outInfo->name),
     401                    B_TRANSLATE("Targa image (%d bits truecolor)"),
     402                    imagespec.depth);
    396403                break;
    397             case TGA_NOCOMP_BW:
    398                 strcat(outInfo->name, " gray");
    399                 break;
    400404            case TGA_RLE_COLORMAP:
    401                 strcat(outInfo->name, " RLE colormap");
     405                snprintf(outInfo->name, sizeof(outInfo->name),
     406                    B_TRANSLATE("Targa image (%d bits RLE colormap)"),
     407                    imagespec.depth);
    402408                break;
    403409            case TGA_RLE_TRUECOLOR:
    404                 strcat(outInfo->name, " RLE truecolor");
     410                snprintf(outInfo->name, sizeof(outInfo->name),
     411                    B_TRANSLATE("Targa image (%d bits RLE truecolor)"),
     412                    imagespec.depth);
    405413                break;
    406414            case TGA_RLE_BW:
    407                 strcat(outInfo->name, " RLE gray");
     415                snprintf(outInfo->name, sizeof(outInfo->name),
     416                    B_TRANSLATE("Targa image (%d bits RLE gray)"),
     417                    imagespec.depth);
    408418                break;
     419            case TGA_NOCOMP_BW:
     420            default:
     421                snprintf(outInfo->name, sizeof(outInfo->name),
     422                    B_TRANSLATE("Targa image (%d bits gray)"),
     423                    imagespec.depth);
     424                break;
     425
    409426        }
    410         strcat(outInfo->name, ")");
    411427        strcpy(outInfo->MIME, "image/x-targa");
    412428    }
    413429
     
    21962212BView *
    21972213TGATranslator::NewConfigView(TranslatorSettings *settings)
    21982214{
    2199     return new TGAView("TGATranslator Settings", B_WILL_DRAW, settings);
     2215    return new TGAView(B_TRANSLATE("TGATranslator Settings"),
     2216        B_WILL_DRAW, settings);
    22002217}
    22012218
  • src/add-ons/translators/tga/Jamfile

     
    88    TGAMain.cpp
    99    TGATranslator.cpp
    1010    TGAView.cpp
    11     : be translation libtranslatorsutils.a $(TARGET_LIBSUPC++)
    12     $(HAIKU_LOCALE_LIBS)
     11    : be translation libtranslatorsutils.a $(TARGET_LIBSUPC++) $(HAIKU_LOCALE_LIBS)
    1312    : true
    1413;
    1514
     15DoCatalogs TGATranslator :
     16    x-vnd.Haiku-TGATranslator
     17    :
     18    TGAMain.cpp
     19    TGATranslator.cpp
     20    TGAView.cpp
     21;
     22
    1623Package haiku-translationkit-cvs :
    1724    TGATranslator :
    1825    boot home config add-ons Translators ;
  • src/add-ons/translators/tga/TGAView.cpp

     
    2929// DEALINGS IN THE SOFTWARE.
    3030/*****************************************************************************/
    3131
     32#include <Catalog.h>
    3233#include <GroupLayout.h>
    3334#include <GroupLayoutBuilder.h>
    3435#include <SpaceLayoutItem.h>
     
    3637#include <stdio.h>
    3738#include <string.h>
    3839
    39 
    4040#include "TGAView.h"
    4141#include "TGATranslator.h"
    4242
     43#undef B_TRANSLATE_CONTEXT
     44#define B_TRANSLATE_CONTEXT "TGAView"
    4345
     46
    4447TGAView::TGAView(const char *name, uint32 flags, TranslatorSettings *settings)
    4548    :
    4649    BView(name, flags),
     
    5356    fTitle->SetFont(be_bold_font);
    5457 
    5558    char detail[100];
    56     sprintf(detail, "Version %d.%d.%d %s",
     59    sprintf(detail, B_TRANSLATE("Version %d.%d.%d %s"),
    5760        static_cast<int>(B_TRANSLATION_MAJOR_VERSION(TGA_TRANSLATOR_VERSION)),
    5861        static_cast<int>(B_TRANSLATION_MINOR_VERSION(TGA_TRANSLATOR_VERSION)),
    59         static_cast<int>(B_TRANSLATION_REVISION_VERSION(TGA_TRANSLATOR_VERSION)),
    60         __DATE__);
     62        static_cast<int>(B_TRANSLATION_REVISION_VERSION(
     63            TGA_TRANSLATOR_VERSION)), __DATE__);
    6164    fDetail = new BStringView("detail", detail);
    6265    fWrittenBy = new BStringView("writtenby",
    63         "Written by the Haiku Translation Kit Team");
     66        B_TRANSLATE("Written by the Haiku Translation Kit Team"));
    6467 
    65     fpchkIgnoreAlpha = new BCheckBox("Ignore TGA alpha channel",
     68    fpchkIgnoreAlpha = new BCheckBox(B_TRANSLATE("Ignore TGA alpha channel"),
    6669        new BMessage(CHANGE_IGNORE_ALPHA));
    6770    int32 val = (fSettings->SetGetBool(TGA_SETTING_IGNORE_ALPHA)) ? 1 : 0;
    6871    fpchkIgnoreAlpha->SetValue(val);
    6972    fpchkIgnoreAlpha->SetViewColor(ViewColor());
    7073   
    71     fpchkRLE = new BCheckBox("Save with RLE Compression",
     74    fpchkRLE = new BCheckBox(B_TRANSLATE("Save with RLE Compression"),
    7275        new BMessage(CHANGE_RLE));
    7376    val = (fSettings->SetGetBool(TGA_SETTING_RLE)) ? 1 : 0;
    7477    fpchkRLE->SetValue(val);