From a11f9c281c3062418f774966432a4de191310270 Mon Sep 17 00:00:00 2001 From: John Scipione Date: Wed, 8 Jul 2015 14:43:59 -0700 Subject: [PATCH] Nebula: Internationalize strings --- src/add-ons/screen_savers/nebula/Jamfile | 8 +++- src/add-ons/screen_savers/nebula/Nebula.cpp | 51 +++++++++++++-------- 2 files changed, 38 insertions(+), 21 deletions(-) diff --git a/src/add-ons/screen_savers/nebula/Jamfile b/src/add-ons/screen_savers/nebula/Jamfile index 8c81921731..9cd58cab0f 100644 --- a/src/add-ons/screen_savers/nebula/Jamfile +++ b/src/add-ons/screen_savers/nebula/Jamfile @@ -8,5 +8,11 @@ ScreenSaver Nebula : Draw.c DrawStars.c Nebula.cpp : - be libscreensaver.so [ TargetLibsupc++ ] + be libscreensaver.so localestub [ TargetLibsupc++ ] +; + +DoCatalogs Message : + x-vnd.Haiku-NebulaScreensaver + : + Nebula.cpp ; diff --git a/src/add-ons/screen_savers/nebula/Nebula.cpp b/src/add-ons/screen_savers/nebula/Nebula.cpp index 4f431c0989..3505de333d 100644 --- a/src/add-ons/screen_savers/nebula/Nebula.cpp +++ b/src/add-ons/screen_savers/nebula/Nebula.cpp @@ -7,6 +7,7 @@ */ #include +#include #include #include #include @@ -20,6 +21,11 @@ #include #include + +#undef B_TRANSLATION_CONTEXT +#define B_TRANSLATION_CONTEXT "Nebula Screen Saver" + + typedef struct { int x, y, z, r; @@ -459,11 +465,12 @@ SettingsView::SettingsView(BRect frame) : BView(frame, "", B_FOLLOW_ALL, B_WILL_DRAW) { - BStringView* titleString = new BStringView(B_EMPTY_STRING, "Nebula"); + BStringView* titleString = new BStringView(B_EMPTY_STRING, + B_TRANSLATE("Nebula")); titleString->SetFont(be_bold_font); BStringView* copyrightString = new BStringView(B_EMPTY_STRING, - "© 2001-2004 Axel Dörfler."); + B_TRANSLATE("© 2001-2004 Axel Dörfler.")); BPopUpMenu* popMenu; BMenuItem* item; @@ -495,22 +502,24 @@ SettingsView::SettingsView(BRect frame) BMessage* message = new BMessage(kMsgWidth); message->AddInt32("width", widths[i]); - popMenu->AddItem(item = new BMenuItem(label.String(), message)); + const char* l = label.String(); + popMenu->AddItem(item = new BMenuItem(B_TRANSLATE(l), message)); if (gSettingsWidth == widths[i]) item->SetMarked(true); } - fWidthMenu = new BMenuField("res", "Internal width:", popMenu); + fWidthMenu = new BMenuField("res", B_TRANSLATE("Internal width:"), + popMenu); const char* colorSchemes[] = { - "yellow", - "cyan", - "red", - "green", - "grey", - "cold", - "orange (original)" + B_TRANSLATE("yellow"), + B_TRANSLATE("cyan"), + B_TRANSLATE("red"), + B_TRANSLATE("green"), + B_TRANSLATE("grey"), + B_TRANSLATE("cold"), + B_TRANSLATE("orange (original)") }; popMenu = new BPopUpMenu(""); @@ -522,13 +531,13 @@ SettingsView::SettingsView(BRect frame) item->SetMarked(true); } - fColorMenu = new BMenuField("col", "Color: ", popMenu); + fColorMenu = new BMenuField("col", B_TRANSLATE("Color:"), popMenu); const char* blankBorderFormats[] = { - "fullscreen, no borders", - "16:9, wide-screen", - "2:3.5, cinemascope", - "only a slit" + B_TRANSLATE("fullscreen, no borders"), + B_TRANSLATE("16:9, wide-screen"), + B_TRANSLATE("2:3.5, cinemascope"), + B_TRANSLATE("only a slit") }; popMenu = new BPopUpMenu(""); @@ -540,15 +549,17 @@ SettingsView::SettingsView(BRect frame) item->SetMarked(true); } - fBorderMenu = new BMenuField("cinema", "Format: ", popMenu); + fBorderMenu = new BMenuField("cinema", B_TRANSLATE("Format:"), popMenu); - fMotionCheck = new BCheckBox(B_EMPTY_STRING, "Enable motion blur", new BMessage(kMsgMotionBlur)); + fMotionCheck = new BCheckBox(B_EMPTY_STRING, + B_TRANSLATE("Enable motion blur"), new BMessage(kMsgMotionBlur)); fMotionCheck->SetValue((int)gMotionBlur); - fSpeedSlider = new SimpleSlider("Speed", new BMessage(kMsgSpeed)); + fSpeedSlider = new SimpleSlider(B_TRANSLATE("Speed"), new BMessage(kMsgSpeed)); fSpeedSlider->SetValue((gSpeed - 0.002) / 0.05); - fFramesSlider = new SimpleSlider("Maximum Frames Per Second", new BMessage(kMsgFrames)); + fFramesSlider = new SimpleSlider(B_TRANSLATE("Maximum Frames Per Second"), + new BMessage(kMsgFrames)); fFramesSlider->SetValue(gMaxFramesPerSecond); BLayoutBuilder::Group<>(this, B_VERTICAL, B_USE_HALF_ITEM_SPACING)