Ticket #7154: jpeg2000translator-localization.patch

File jpeg2000translator-localization.patch, 7.3 KB (added by Karvjorm, 10 years ago)

A JPEG2000Translator localization patch.

  • src/add-ons/translators/jpeg2000/JPEG2000Translator.cpp

     
    4040#include <TextView.h>
    4141
    4242
     43#undef B_TRANSLATE_CONTEXT
     44#define B_TRANSLATE_CONTEXT "JPEG2000Translator"
     45
    4346// Set these accordingly
    4447#define JP2_ACRONYM "JP2"
    4548#define JP2_FORMAT 'JP2 '
     
    615618        new BMessage(VIEW_MSG_SET_QUALITY), 0, 100);
    616619    fQualitySlider->SetHashMarks(B_HASH_MARKS_BOTTOM);
    617620    fQualitySlider->SetHashMarkCount(10);
    618     fQualitySlider->SetLimitLabels("Low", "High");
     621    fQualitySlider->SetLimitLabels(B_TRANSLATE("Low"), B_TRANSLATE("High"));
    619622    fQualitySlider->SetValue(fSettings->SetGetInt32(JP2_SET_QUALITY));
    620623
    621624    fGrayAsRGB24 = new BCheckBox("gray1asrgb24", VIEW_LABEL_GRAY1ASRGB24,
     
    703706{
    704707    BAlignment labelAlignment = BAlignment(B_ALIGN_LEFT, B_ALIGN_TOP);
    705708    BStringView* title = new BStringView("Title", sTranslatorName);
     709    title->SetText(B_TRANSLATE_MARK("JPEG2000 images"));
    706710    title->SetFont(be_bold_font);
    707711    title->SetExplicitAlignment(labelAlignment);
    708712
    709713    char versionString[16];
    710     sprintf(versionString, "v%d.%d.%d", (int)(sTranslatorVersion >> 8),
    711         (int)((sTranslatorVersion >> 4) & 0xf), (int)(sTranslatorVersion & 0xf));
     714    sprintf(versionString, "v%d.%d.%d",
     715        static_cast<int>(sTranslatorVersion >> 8),
     716        static_cast<int>((sTranslatorVersion >> 4) & 0xf),
     717        static_cast<int>(sTranslatorVersion & 0xf));
    712718
    713719    BStringView* version = new BStringView("Version", versionString);
    714720    version->SetExplicitAlignment(labelAlignment);
    715721
    716722    BTextView* infoView = new BTextView("info");
    717     infoView->SetText(sTranslatorInfo);
     723    BString translationInfo(sTranslatorInfo);
     724    translationInfo.ReplaceFirst("Based on JasPer library:",
     725        B_TRANSLATE("Based on JasPer library:"));
     726    translationInfo.ReplaceFirst("1999-2000, Image Power, Inc. and",
     727        B_TRANSLATE("1999-2000, Image Power, Inc. and"));
     728    translationInfo.ReplaceFirst("the University of British Columbia, Canada.",
     729        B_TRANSLATE("the University of British Columbia, Canada."));
     730    translationInfo.ReplaceFirst("ImageMagick's jp2 codec was used as "
     731        "\"tutorial\".", B_TRANSLATE("ImageMagick's jp2 codec was used as "
     732        "\"tutorial\"."));
     733    infoView->SetText(translationInfo.String());
    718734    infoView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
    719735    infoView->MakeEditable(false);
    720736
     
    738754    :
    739755    BTabView(name)
    740756{
    741     AddTab(new TranslatorWriteView("Write", settings->Acquire()));
    742     AddTab(new TranslatorReadView("Read", settings->Acquire()));
    743     AddTab(new TranslatorAboutView("About"));
     757    AddTab(new TranslatorWriteView(B_TRANSLATE("Write"),
     758        settings->Acquire()));
     759    AddTab(new TranslatorReadView(B_TRANSLATE("Read"),
     760        settings->Acquire()));
     761    AddTab(new TranslatorAboutView(B_TRANSLATE("About")));
    744762
    745763    settings->Release();
    746764
     
    9851003            break;
    9861004
    9871005        default:
    988             fprintf(stderr, "Unknown color space.\n");
     1006            fprintf(stderr, B_TRANSLATE("Unknown color space.\n"));
    9891007            return B_ERROR;
    9901008    }
    9911009
     
    11061124                out_color_space = B_RGBA32;
    11071125                converter = read_rgba32;
    11081126            } else {
    1109                 fprintf(stderr, "Other than RGB with 3 or 4 color components not implemented.\n");
     1127                fprintf(stderr, B_TRANSLATE("Other than RGB with 3 or 4 color "
     1128                    "components not implemented.\n"));
    11101129                return Error(ins, image, NULL, 0, NULL, B_ERROR);
    11111130            }
    11121131            break;
     
    11221141            }
    11231142            break;
    11241143        case JAS_IMAGE_CS_YCBCR:
    1125             fprintf(stderr, "Color space YCBCR not implemented yet.\n");
     1144            fprintf(stderr, B_TRANSLATE("Color space YCBCR not implemented "
     1145                "yet.\n"));
    11261146            return Error(ins, image, NULL, 0, NULL, B_ERROR);
    11271147            break;
    11281148        case JAS_IMAGE_CS_UNKNOWN:
    11291149        default:
    1130             fprintf(stderr, "Color space unkown. \n");
     1150            fprintf(stderr, B_TRANSLATE("Color space unknown. \n"));
    11311151            return Error(ins, image, NULL, 0, NULL, B_ERROR);
    11321152            break;
    11331153    }
     
    12331253            info->group = formats[i].group;
    12341254            info->quality = formats[i].quality;
    12351255            info->capability = formats[i].capability;
    1236             strcpy(info->name, formats[i].name);
    1237             strcpy(info->MIME,  formats[i].MIME);
     1256            if (strncmp(formats[i].name,
     1257                "Be Bitmap Format (JPEG2000Translator)",
     1258                sizeof("Be Bitmap Format (JPEG2000Translator)")) == 0)
     1259                strncpy(info->name,
     1260                    B_TRANSLATE("Be Bitmap Format (JPEG2000Translator)"),
     1261                    sizeof(info->name));
     1262            else
     1263                strncpy(info->name, formats[i].name, sizeof(info->name));           
     1264            strncpy(info->MIME,  formats[i].MIME, sizeof(info->MIME));
    12381265            return B_OK;
    12391266        }
    12401267    }
     
    12871314{
    12881315    BApplication app("application/x-vnd.Haiku-JPEG2000Translator");
    12891316    JP2Translator* translator = new JP2Translator();
    1290     if (LaunchTranslatorWindow(translator, sTranslatorName) == B_OK)
     1317    if (LaunchTranslatorWindow(translator, B_TRANSLATE("JPEG2000 images")
     1318        /*sTranslatorName*/) == B_OK)
    12911319        app.Run();
    12921320
    12931321    return 0;
  • src/add-ons/translators/jpeg2000/JPEG2000Translator.h

     
    3535
    3636#include <Alert.h>
    3737#include <Application.h>
     38#include <Catalog.h>
    3839#include <CheckBox.h>
    3940#include <FindDirectory.h>
    4041#include <Path.h>
     
    5253#include "libjasper/jasper.h"
    5354
    5455
     56#undef B_TRANSLATE_CONTEXT
     57#define B_TRANSLATE_CONTEXT "JPEG2000Translator"
     58
    5559// Settings
    5660#define JP2_SETTINGS_FILE   "JPEG2000Translator"
    5761
    58 #define JP2_SET_QUALITY "quality"
    59 #define JP2_SET_GRAY1_AS_B_RGB24 "24 from gray1"
    60 #define JP2_SET_GRAY8_AS_B_RGB32 "32 from gray8"
    61 #define JP2_SET_JPC "jpc"
     62#define JP2_SET_QUALITY B_TRANSLATE_MARK("quality")
     63#define JP2_SET_GRAY1_AS_B_RGB24 B_TRANSLATE_MARK("24 from gray1")
     64#define JP2_SET_GRAY8_AS_B_RGB32 B_TRANSLATE_MARK("32 from gray8")
     65#define JP2_SET_JPC B_TRANSLATE_MARK("jpc")
    6266
    6367// View messages
    6468#define VIEW_MSG_SET_QUALITY 'JSCQ'
     
    6771#define VIEW_MSG_SET_GRAYASRGB32 'JSAC'
    6872
    6973// View labels
    70 #define VIEW_LABEL_QUALITY "Output quality"
    71 #define VIEW_LABEL_JPC "Output only codestream (.jpc)"
    72 #define VIEW_LABEL_GRAY1ASRGB24 "Write black-and-white images as RGB24"
    73 #define VIEW_LABEL_GRAYASRGB32 "Read greyscale images as RGB32"
     74#define VIEW_LABEL_QUALITY B_TRANSLATE_MARK("Output quality")
     75#define VIEW_LABEL_JPC B_TRANSLATE_MARK("Output only codestream (.jpc)")
     76#define VIEW_LABEL_GRAY1ASRGB24 \
     77    B_TRANSLATE_MARK("Write black-and-white images as RGB24")
     78#define VIEW_LABEL_GRAYASRGB32 \
     79    B_TRANSLATE_MARK("Read greyscale images as RGB32")
    7480
    7581
    76 
    7782/*!
    7883    Slider used in TranslatorView
    7984    With status showing actual value
  • src/add-ons/translators/jpeg2000/Jamfile

     
    6969
    7070    $(jasper_files)
    7171
    72     : be translation libtranslatorsutils.a $(TARGET_LIBSUPC++)
    73     $(HAIKU_LOCALE_LIBS)
     72    : be translation libtranslatorsutils.a $(TARGET_LIBSUPC++) $(HAIKU_LOCALE_LIBS)
    7473    : true
    7574;
    7675
     76DoCatalogs JPEG2000Translator :
     77    x-vnd.Haiku-JPEG2000Translator
     78    :
     79    JPEG2000Translator.h
     80    JPEG2000Translator.cpp
     81;
     82
    7783Package haiku-translationkit-cvs :
    7884    JPEG2000Translator :
    7985    boot home config add-ons Translators ;