Ticket #7139: rtftranslator-localization.patch

File rtftranslator-localization.patch, 6.3 KB (added by Karvjorm, 13 years ago)

A RTFTranslator localization patch

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

     
    77#include "ConfigView.h"
    88#include "RTFTranslator.h"
    99
     10#include <Catalog.h>
    1011#include <StringView.h>
    1112
    1213#include <stdio.h>
    1314
     15#undef B_TRANSLATE_CONTEXT
     16#define B_TRANSLATE_CONTEXT "ConfigView"
    1417
     18
    1519ConfigView::ConfigView(const BRect &frame, uint32 resize, uint32 flags)
    16     : BView(frame, "RTF-Translator Settings", resize, flags)
     20    : BView(frame, B_TRANSLATE("RTF-Translator Settings"), resize, flags)
    1721{
    1822    SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
    1923
     
    2226    float height = fontHeight.descent + fontHeight.ascent + fontHeight.leading;
    2327
    2428    BRect rect(10, 10, 200, 10 + height);
    25     BStringView *stringView = new BStringView(rect, "title", "Rich Text Format (RTF) files");
     29    BStringView *stringView = new BStringView(rect, "title",
     30        B_TRANSLATE("Rich Text Format (RTF) files"));
    2631    stringView->SetFont(be_bold_font);
    2732    stringView->ResizeToPreferred();
    2833    AddChild(stringView);
     
    3136
    3237    rect.OffsetBy(0, height + 10);
    3338    char version[256];
    34     snprintf(version, sizeof(version), "Version %d.%d.%d, %s",
    35         int(B_TRANSLATION_MAJOR_VERSION(RTF_TRANSLATOR_VERSION)),
    36         int(B_TRANSLATION_MINOR_VERSION(RTF_TRANSLATOR_VERSION)),
    37         int(B_TRANSLATION_REVISION_VERSION(RTF_TRANSLATOR_VERSION)),
    38         __DATE__);
     39    snprintf(version, sizeof(version), B_TRANSLATE("Version %d.%d.%d, %s"),
     40        static_cast<int>(B_TRANSLATION_MAJOR_VERSION(RTF_TRANSLATOR_VERSION)),
     41        static_cast<int>(B_TRANSLATION_MINOR_VERSION(RTF_TRANSLATOR_VERSION)),
     42        static_cast<int>(B_TRANSLATION_REVISION_VERSION(
     43            RTF_TRANSLATOR_VERSION)), __DATE__);
    3944    stringView = new BStringView(rect, "version", version);
    4045    stringView->ResizeToPreferred();
    4146    AddChild(stringView);
     
    4752    height = fontHeight.descent + fontHeight.ascent + fontHeight.leading;
    4853
    4954    rect.OffsetBy(0, height + 5);
    50     stringView = new BStringView(rect, "Copyright", B_UTF8_COPYRIGHT "2004-2006 Haiku Inc.");
     55    stringView = new BStringView(rect,
     56        "Copyright", B_UTF8_COPYRIGHT "2004-2006 Haiku Inc.");
    5157    stringView->ResizeToPreferred();
    5258    AddChild(stringView);
    5359
  • src/add-ons/translators/rtf/main.cpp

     
    88#include <string.h>
    99
    1010#include <Application.h>
     11#include <Catalog.h>
    1112#include <FileIO.h>
    1213#include <TranslatorRoster.h>
    1314
     
    1718#include "RTF.h"
    1819#include "RTFTranslator.h"
    1920
     21#undef B_TRANSLATE_CONTEXT
     22#define B_TRANSLATE_CONTEXT "main"
    2023
     24
    2125int
    2226main(int argc, char** argv)
    2327{
     
    3034            BFile input;
    3135            status_t status = input.SetTo(argv[i], B_READ_ONLY);
    3236            if (status != B_OK) {
    33                 fprintf(stderr, "Could not open file \"%s\": %s\n", argv[i],
     37                fprintf(stderr,
     38                    B_TRANSLATE("Could not open file \"%s\": %s\n"), argv[i],
    3439                    strerror(status));
    3540                result = 1;
    3641                continue;
     
    4146
    4247            status = parser.Parse(header);
    4348            if (status != B_OK) {
    44                 fprintf(stderr, "Could not convert file \"%s\": %s\n", argv[i],
    45                     strerror(status));
     49                fprintf(stderr,
     50                    B_TRANSLATE("Could not convert file \"%s\": %s\n"),
     51                        argv[i], strerror(status));
    4652                result = 1;
    4753                continue;
    4854            }
     
    5662    BApplication app("application/x-vnd.Haiku-RTFTranslator");
    5763
    5864    status_t result;
    59     result = LaunchTranslatorWindow(new RTFTranslator, "RTF Settings",
    60         BRect(0, 0, 225, 175));
     65    result = LaunchTranslatorWindow(new RTFTranslator,
     66        B_TRANSLATE("RTF Settings"), BRect(0, 0, 225, 175));
    6167    if (result != B_OK)
    6268        return 1;
    6369
  • src/add-ons/translators/rtf/RTFTranslator.cpp

     
    99#include "RTF.h"
    1010#include "convert.h"
    1111
     12#include <Catalog.h>
    1213#include <stdlib.h>
    1314#include <stdio.h>
    1415#include <string.h>
    1516
     17#undef B_TRANSLATE_CONTEXT
     18#define B_TRANSLATE_CONTEXT "RTFTranslator"
    1619
    1720#define READ_BUFFER_SIZE 2048
    1821#define DATA_BUFFER_SIZE 64
     
    5457RTFTranslator::RTFTranslator()
    5558{
    5659    char info[256];
    57     sprintf(info, "Rich Text Format translator v%d.%d.%d %s",
    58         int(B_TRANSLATION_MAJOR_VERSION(RTF_TRANSLATOR_VERSION)),
    59         int(B_TRANSLATION_MINOR_VERSION(RTF_TRANSLATOR_VERSION)),
    60         int(B_TRANSLATION_REVISION_VERSION(RTF_TRANSLATOR_VERSION)),
     60    sprintf(info, B_TRANSLATE("Rich Text Format translator v%d.%d.%d %s"),
     61        static_cast<int>(B_TRANSLATION_MAJOR_VERSION(RTF_TRANSLATOR_VERSION)),
     62        static_cast<int>(B_TRANSLATION_MINOR_VERSION(RTF_TRANSLATOR_VERSION)),
     63        static_cast<int>(B_TRANSLATION_REVISION_VERSION(
     64            RTF_TRANSLATOR_VERSION)),
    6165        __DATE__);
    6266
    6367    fInfo = strdup(info);
     
    7377const char *
    7478RTFTranslator::TranslatorName() const
    7579{
    76     return "RTF text files";
     80    return B_TRANSLATE("RTF text files");
    7781}
    7882
    7983
    8084const char *
    8185RTFTranslator::TranslatorInfo() const
    8286{
    83     return "Rich Text Format Translator";
     87    return B_TRANSLATE("Rich Text Format Translator");
    8488}
    8589
    8690
     
    131135    info->group = B_TRANSLATOR_TEXT;
    132136    info->quality = RTF_IN_QUALITY;
    133137    info->capability = RTF_IN_CAPABILITY;
    134     strcpy(info->name, "RichTextFormat file");
     138    strcpy(info->name, B_TRANSLATE("RichTextFormat file"));
    135139    strcpy(info->MIME, "text/rtf");
    136140
    137141    return B_OK;
     
    168172
    169173
    170174status_t
    171 RTFTranslator::MakeConfigurationView(BMessage *ioExtension, BView **_view, BRect *_extent)
     175RTFTranslator::MakeConfigurationView(BMessage *ioExtension, BView **_view,
     176    BRect *_extent)
    172177{
    173178    if (_view == NULL || _extent == NULL)
    174179        return B_BAD_VALUE;
  • src/add-ons/translators/rtf/Jamfile

     
    1616    RTF.cpp
    1717    RTFTranslator.cpp
    1818
    19     : be translation libtranslatorsutils.a $(TARGET_LIBSUPC++)
     19    : be translation libtranslatorsutils.a $(TARGET_LIBSUPC++)
     20$(HAIKU_LOCALE_LIBS)
    2021    $(HAIKU_LOCALE_LIBS)
    2122    : true
    2223;
     24
     25DoCatalogs RTF-Translator :
     26    x-vnd.Haiku-RTFTranslator
     27    :
     28    main.cpp
     29    RTFTranslator.cpp
     30    ConfigView.cpp
     31;