Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to "localize" (translate) your program
#4
boriel Wrote:
LCD Wrote:I suppose, it is possible to define multiple macros, right?
-D LANG=de -D VERSION=hard -D RATING=adult
Yes, or that's the idea. Tongue

Note this is currently *beta* in 1.3.0.
The next version will have it more tested, since macros now allows also #if directives. e.g.
Code:
#if LANG==de && VERSION==hard || RATING=adult
PRINT "bla bla"
#else
PRINT "ble ble"
#endif
In a similar (but limited) way, as explained here: <!-- m --><a class="postlink" href="http://gcc.gnu.org/onlinedocs/cpp/If.html#If">http://gcc.gnu.org/onlinedocs/cpp/If.html#If</a><!-- m -->

Oh, that is great and I can imagine some uses for it, apart from Languages.
So this is C Plusplus syntax...

I think, I will try to use it without splitting into multiple sources:
Code:
#ifndef LANG
' if no LANG defined, fallback to English as default
#define LANG en
#endif

#if LANG==en
#define HELLO_WORLD "HELLO WORLD"
#define OTHER_TEXT "OTHER TEXT"
#endif

#if LANG==de
#define HELLO_WORLD "HALLO WELT"
#define OTHER_TEXT "ANDERER TEXT"
#endif


PRINT OTHER_TEXT
PrintString(@Message1)
END
Message1:
ASM
  DEFB 16,7
  DEFM HELLO_WORLD
END ASM
------------------------------------------------------------
http://lcd-one.da.ru redirector is dead
Visit my http://members.inode.at/838331/index.html home page!
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)