Skip to content

Commit

Permalink
add localized strings
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkberg committed Mar 14, 2017
1 parent 440c57c commit 2cc3733
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 8 deletions.
12 changes: 6 additions & 6 deletions source/CalliopeDemo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ const MicroBitImage Wave(7, 5, wave);

MicroBit uBit;

// DEMO 0 - 3
// DEMO 0 - 3
static const int MAX_DEMOS = 3;
static const int DEFAULT_PAUSE = 300;

Expand Down Expand Up @@ -257,7 +257,7 @@ void showIntro() {

invoke(startSound);

uBit.display.scroll("Hallo!");
uBit.display.scroll(DISPLAY_HELLO);
// press A
uBit.display.print("A");
uBit.sleep(DEFAULT_PAUSE);
Expand Down Expand Up @@ -295,7 +295,7 @@ void showIntro() {
uBit.display.clear();

// shake
uBit.display.scroll("SCHUETTELN");
uBit.display.scroll(DISPLAY_SHAKE);
uBit.messageBus.listen(MICROBIT_ID_GESTURE, MICROBIT_ACCELEROMETER_EVT_SHAKE, simpleEventHandler);
introAnimateImage(DoubleRow, 2, -1, 2);
if (introEventSkip) return;
Expand All @@ -304,7 +304,7 @@ void showIntro() {
uBit.display.print(Tick);
uBit.sleep(DEFAULT_PAUSE);
uBit.display.clear();
uBit.display.scroll("SUPER!");
uBit.display.scroll(DISPLAY_SUPER);

// show heart and change RGB led colors randomly

Expand Down Expand Up @@ -376,7 +376,7 @@ void leaveOracle(MicroBitEvent event) {
void oracle() {
uBit.messageBus.listen(MICROBIT_ID_BUTTON_AB, MICROBIT_BUTTON_EVT_CLICK, leaveOracle);

uBit.display.scroll("Orakel");
uBit.display.scroll(DISPLAY_ORACLE);
uBit.messageBus.listen(MICROBIT_ID_BUTTON_A, MICROBIT_BUTTON_EVT_CLICK, simpleEventHandler);
do {
eventOK = false;
Expand Down Expand Up @@ -733,7 +733,7 @@ void menuSelect(MicroBitEvent event) {
break;
default:
state = Menu;
uBit.display.scroll("Huch?");
uBit.display.scroll(DISPLAY_ERROR);
selectedDemo = 0;
uBit.messageBus.send(MicroBitEvent(MICROBIT_ID_BUTTON_AB, MICROBIT_BUTTON_EVT_CLICK));
break;
Expand Down
20 changes: 19 additions & 1 deletion source/CalliopeDemo.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#ifndef CALLOPE_DEMO_H
#define CALLOPE_DEMO_H

//#define COMPILE_FIRMWARE_MASTER 0
//#define USE_ENGLISH

// MENU HANDLING
typedef volatile enum State {
Expand All @@ -20,6 +22,22 @@ extern const MicroBitImage Tick;
void testBoard();
void snake();

//#define COMPILE_FIRMWARE_MASTER 0

// localization
#ifndef USE_ENGLISH
#define DISPLAY_HELLO "Hallo!"
#define DISPLAY_SHAKE "SCHUETTELN"
#define DISPLAY_ORACLE "Orakel"
#define DISPLAY_SUPER "SUPER!"
#define DISPLAY_THEEND "ENDE"
#define DISPLAY_ERROR "Huch?"
#else
#define DISPLAY_HELLO "Hello!"
#define DISPLAY_SHAKE "SHAKE"
#define DISPLAY_ORACLE "Oracle"
#define DISPLAY_SUPER "SUPER!"
#define DISPLAY_THEEND "THE END"
#define DISPLAY_ERROR "Oops?"
#endif

#endif
2 changes: 1 addition & 1 deletion source/Snake.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ void snake() {

int status = map.getPixelValue(newHead.x, newHead.y);
if (status == SNAKE_UP || status == SNAKE_DOWN || status == SNAKE_LEFT || status == SNAKE_RIGHT) {
uBit.display.scroll("ENDE");
uBit.display.scroll(DISPLAY_THEEND);
uBit.display.scroll(score);

return;
Expand Down

0 comments on commit 2cc3733

Please sign in to comment.