Ticket #7131: pngtranslator-localization.patch
File pngtranslator-localization.patch, 6.7 KB (added by , 13 years ago) |
---|
-
src/add-ons/translators/png/PNGTranslator.cpp
35 35 #include <OS.h> 36 36 #define PNG_NO_PEDANTIC_WARNINGS 37 37 #include <png.h> 38 #include <Catalog.h> 38 39 #include "PNGTranslator.h" 39 40 #include "PNGView.h" 40 41 42 #undef B_TRANSLATE_CONTEXT 43 #define B_TRANSLATE_CONTEXT "PNGTranslator" 44 41 45 // The input formats that this translator supports. 42 46 static const translation_format sInputFormats[] = { 43 47 { … … 185 189 // Returns: 186 190 // --------------------------------------------------------------- 187 191 PNGTranslator::PNGTranslator() 188 : BaseTranslator("PNG images", "PNG image translator", 192 : BaseTranslator(B_TRANSLATE("PNG images"), 193 B_TRANSLATE("PNG image translator"), 189 194 PNG_TRANSLATOR_VERSION, 190 195 sInputFormats, kNumInputFormats, 191 196 sOutputFormats, kNumOutputFormats, … … 229 234 outInfo->quality = PNG_IN_QUALITY; 230 235 outInfo->capability = PNG_IN_CAPABILITY; 231 236 strcpy(outInfo->MIME, "image/png"); 232 strcpy(outInfo->name, "PNG image");237 strcpy(outInfo->name, B_TRANSLATE("PNG image")); 233 238 } 234 239 235 240 return B_OK; … … 975 980 PNGTranslator::NewConfigView(TranslatorSettings *settings) 976 981 { 977 982 return new PNGView(BRect(0, 0, PNG_VIEW_WIDTH, PNG_VIEW_HEIGHT), 978 "PNGTranslator Settings", B_FOLLOW_ALL, B_WILL_DRAW, settings); 983 B_TRANSLATE("PNGTranslator Settings"), B_FOLLOW_ALL, 984 B_WILL_DRAW, settings); 979 985 } 980 986 -
src/add-ons/translators/png/PNGView.cpp
12 12 #include "PNGTranslator.h" 13 13 14 14 #include <Alert.h> 15 #include <Catalog.h> 15 16 #include <MenuField.h> 16 17 #include <MenuItem.h> 17 18 #include <PopUpMenu.h> … … 22 23 #define PNG_NO_PEDANTIC_WARNINGS 23 24 #include <png.h> 24 25 26 #undef B_TRANSLATE_CONTEXT 27 #define B_TRANSLATE_CONTEXT "PNGTranslator" 25 28 26 29 PNGView::PNGView(const BRect &frame, const char *name, uint32 resizeMode, 27 30 uint32 flags, TranslatorSettings *settings) … … 35 38 float height = fontHeight.descent + fontHeight.ascent + fontHeight.leading; 36 39 37 40 BRect rect(10, 10, 200, 10 + height); 38 BStringView *stringView = new BStringView(rect, "title", "PNG image translator"); 41 BStringView *stringView = new BStringView(rect, "title", 42 B_TRANSLATE("PNG image translator")); 39 43 stringView->SetFont(be_bold_font); 40 44 stringView->ResizeToPreferred(); 41 45 AddChild(stringView); … … 44 48 45 49 rect.OffsetBy(0, height + 10); 46 50 char version[256]; 47 snprintf(version, sizeof(version), "Version %d.%d.%d, %s",51 snprintf(version, sizeof(version), B_TRANSLATE("Version %d.%d.%d, %s"), 48 52 int(B_TRANSLATION_MAJOR_VERSION(PNG_TRANSLATOR_VERSION)), 49 53 int(B_TRANSLATION_MINOR_VERSION(PNG_TRANSLATOR_VERSION)), 50 54 int(B_TRANSLATION_REVISION_VERSION(PNG_TRANSLATOR_VERSION)), … … 60 64 height = fontHeight.descent + fontHeight.ascent + fontHeight.leading; 61 65 62 66 rect.OffsetBy(0, height + 5); 63 stringView = new BStringView(rect, "Copyright", B_UTF8_COPYRIGHT "2003-2006 Haiku Inc."); 67 stringView = new BStringView(rect, 68 "Copyright", B_UTF8_COPYRIGHT "2003-2006 Haiku Inc."); 64 69 stringView->ResizeToPreferred(); 65 70 AddChild(stringView); 66 71 67 72 // setup PNG interlace options 68 73 69 fInterlaceMenu = new BPopUpMenu("Interlace Option"); 70 BMenuItem* item = new BMenuItem("None", _InterlaceMessage(PNG_INTERLACE_NONE)); 74 fInterlaceMenu = new BPopUpMenu(B_TRANSLATE("Interlace Option")); 75 BMenuItem* item = new BMenuItem(B_TRANSLATE("None"), 76 _InterlaceMessage(PNG_INTERLACE_NONE)); 71 77 if (fSettings->SetGetInt32(PNG_SETTING_INTERLACE) == PNG_INTERLACE_NONE) 72 78 item->SetMarked(true); 73 79 fInterlaceMenu->AddItem(item); … … 78 84 fInterlaceMenu->AddItem(item); 79 85 80 86 rect.OffsetBy(0, stringView->Frame().Height() + 20.0f); 81 BMenuField* menuField = new BMenuField(rect, "PNG Interlace Menu", 82 "Interlacing type:", fInterlaceMenu); 87 BMenuField* menuField = new BMenuField(rect, 88 B_TRANSLATE("PNG Interlace Menu"), 89 B_TRANSLATE("Interlacing type:"), fInterlaceMenu); 83 90 menuField->SetDivider(menuField->StringWidth(menuField->Label()) + 7.0f); 84 91 menuField->ResizeToPreferred(); 85 92 AddChild(menuField); … … 87 94 rect.OffsetBy(0, height + 15); 88 95 rect.right = Bounds().right; 89 96 rect.bottom = Bounds().bottom; 90 fCopyrightView = new BTextView(rect, "PNG copyright", rect.OffsetToCopy(B_ORIGIN), 97 fCopyrightView = new BTextView(rect, "PNG copyright", 98 rect.OffsetToCopy(B_ORIGIN), 91 99 B_FOLLOW_ALL, B_WILL_DRAW | B_FRAME_EVENTS); 92 100 fCopyrightView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); 93 101 fCopyrightView->SetLowColor(fCopyrightView->ViewColor()); … … 101 109 102 110 if (maxWidth + 20 > Bounds().Width()) 103 111 ResizeTo(maxWidth + 20, Bounds().Height()); 104 if (Bounds().Height() < rect.top + stringView->Bounds().Height() * 3.0f + 8.0f) 112 if (Bounds().Height() < rect.top + stringView->Bounds().Height() 113 * 3.0f + 8.0f) 105 114 ResizeTo(Bounds().Width(), rect.top + height * 3.0f + 8.0f); 106 115 107 116 fCopyrightView->SetTextRect(fCopyrightView->Bounds()); -
src/add-ons/translators/png/Jamfile
14 14 PNGTranslator.cpp 15 15 PNGView.cpp 16 16 17 : be translation libpng.a z libtranslatorsutils.a $(TARGET_LIBSUPC++) 18 $(HAIKU_LOCALE_LIBS) 17 : be translation libpng.a z libtranslatorsutils.a $(TARGET_LIBSUPC++) $(HAIKU_LOCALE_LIBS) 19 18 : true 20 19 ; 21 20 21 DoCatalogs PNGTranslator : 22 x-vnd.Haiku-PNGTranslator 23 : 24 PNGMain.cpp 25 PNGTranslator.cpp 26 PNGView.cpp 27 ; 28 22 29 Package haiku-translationkit-cvs : 23 30 PNGTranslator : 24 31 boot home config add-ons Translators ; -
src/add-ons/translators/png/PNGMain.cpp
33 33 /*****************************************************************************/ 34 34 35 35 #include <Application.h> 36 #include <Catalog.h> 36 37 #include "PNGTranslator.h" 37 38 #include "PNGView.h" 38 39 #include "TranslatorWindow.h" 39 40 41 #undef B_TRANSLATE_CONTEXT 42 #define B_TRANSLATE_CONTEXT "PNGTranslator" 43 40 44 // --------------------------------------------------------------- 41 45 // main 42 46 // … … 56 60 BApplication app("application/x-vnd.Haiku-PNGTranslator"); 57 61 status_t result; 58 62 result = LaunchTranslatorWindow(new PNGTranslator, 59 "PNG Settings", BRect(0, 0, PNG_VIEW_WIDTH, PNG_VIEW_HEIGHT)); 63 B_TRANSLATE("PNG Settings"), BRect(0, 0, PNG_VIEW_WIDTH, 64 PNG_VIEW_HEIGHT)); 60 65 if (result == B_OK) { 61 66 app.Run(); 62 67 return 0;