Skip to content

Commit

Permalink
add localization
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkberg committed Mar 14, 2017
1 parent 2cc3733 commit e0c0faf
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 11 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ Calliope mini Demo.
This repository contains the demo code and the board test code. The board test is only shown after initially
flashing the device. Any subsequent reset or power cycle will not show it again.

## Compiling

- `yt build` (add `--config config_en.json` to compile with English localization, default is German)
- copy the `calliope-demo-combined.hex` on the board


## Test Code

After flashing this code, the test program will be executed once. Pressing `RESET` will directly go
Expand Down
11 changes: 11 additions & 0 deletions config_en.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"microbit-dal":{
"bluetooth": {
"enabled": 0
},
"debug": 0
},
"use": {
"english": 1
}
}
2 changes: 1 addition & 1 deletion source/CalliopeDemo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ const uint8_t arrow_right[25] = {0, 0, 1, 0, 0,
};
const uint8_t arrow_leftright[25] = {0, 0, 1, 0, 0,
0, 1, 0, 1, 0,
1, 0, 1, 0, 1,
1, 0, 0, 0, 1,
0, 1, 0, 1, 0,
0, 0, 1, 0, 0
};
Expand Down
21 changes: 11 additions & 10 deletions source/CalliopeDemo.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
#ifndef CALLOPE_DEMO_H
#define CALLOPE_DEMO_H

//#define COMPILE_FIRMWARE_MASTER 0
//#define USE_ENGLISH

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

#ifdef YOTTA_CFG_COMPILE_MASTER
#define COMPILE_FIRMWARE_MASTER 0
#endif

// 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
#ifdef YOTTA_CFG_USE_ENGLISH
#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?"
#else
#define DISPLAY_HELLO "Hallo!"
#define DISPLAY_SHAKE "SCHUETTELN"
#define DISPLAY_ORACLE "Orakel"
#define DISPLAY_SUPER "SUPER!"
#define DISPLAY_THEEND "ENDE"
#define DISPLAY_ERROR "Huch?"
#endif

#endif

0 comments on commit e0c0faf

Please sign in to comment.