Skip to content

Commit

Permalink
Nebula: Internationalize strings
Browse files Browse the repository at this point in the history
  • Loading branch information
jscipione committed Jul 8, 2015
1 parent 5a17435 commit a11f9c2
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 21 deletions.
8 changes: 7 additions & 1 deletion src/add-ons/screen_savers/nebula/Jamfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
;
51 changes: 31 additions & 20 deletions src/add-ons/screen_savers/nebula/Nebula.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
*/

#include <AppKit.h>
#include <Catalog.h>
#include <ControlLook.h>
#include <InterfaceKit.h>
#include <LayoutBuilder.h>
Expand All @@ -20,6 +21,11 @@
#include <stdlib.h>
#include <string.h>


#undef B_TRANSLATION_CONTEXT
#define B_TRANSLATION_CONTEXT "Nebula Screen Saver"


typedef struct
{
int x, y, z, r;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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("");
Expand All @@ -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("");
Expand All @@ -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)
Expand Down

0 comments on commit a11f9c2

Please sign in to comment.