SHOW:
|
|
- or go back to the newest paste.
| 1 | const char* get_message(enum Languages language, enum Messages message) {
| |
| 2 | ||
| 3 | /* The messages to print, with friendly error messages if the message or the language is not found */ | |
| 4 | #define EngHW "HelloWorld" | |
| 5 | #define EngOOM "OutOfMemory" | |
| 6 | #define EngFNF "FileNotFound" | |
| 7 | #define EngERRMSG "MESSAGENOTFOUND" | |
| 8 | #define SpaHW "HolaMundo" | |
| 9 | #define SpaOOM "MemoriaAgotada" | |
| 10 | #define SpaFNF "ArchivoNoEncontrado" | |
| 11 | #define SpaERRMSG "MENSAJENOENCONTRADO" | |
| 12 | #define LangERRMSG "LINGVONETROVITA" | |
| 13 | ||
| 14 | const char* result; | |
| 15 | ||
| 16 | if (language == English) {
| |
| 17 | if (message == HelloWorld) {
| |
| 18 | result = EngHW; | |
| 19 | } else if (message == OutOfMemory) {
| |
| 20 | result = EngOOM; | |
| 21 | } else if (message == FileNotFound) {
| |
| 22 | result = EngFNF; | |
| 23 | } else {
| |
| 24 | result = EngERRMSG; | |
| 25 | } | |
| 26 | } else if (language == Spanish) {
| |
| 27 | if (message == HelloWorld) {
| |
| 28 | result = SpaHW; | |
| 29 | } else if (message == OutOfMemory) {
| |
| 30 | result = SpaOOM; | |
| 31 | } else if (message == FileNotFound) {
| |
| 32 | result = SpaFNF; | |
| 33 | } else {
| |
| 34 | result = SpaERRMSG; | |
| 35 | } | |
| 36 | } else {
| |
| 37 | result = LangERRMSG; | |
| 38 | } | |
| 39 | ||
| 40 | return result; | |
| 41 | } |