ebmDevMag.com home
ebm Developer's Magazine
links

developer's mag
main page

article
part 1
part 2
part 3
part 4
part 5
part 6
part 7


3 - Listening to the OS

You've made the commitment to translate - now what? Obviously, the Operating system is the first place your program needs to look. With the ebm OS available in five languages, tailoring your software to the OS language makes sense whenever possible. While there may be exceptions (such as possibly a language teaching tool), the first step is to see what the Operating System language is, with a call to look in the GUI resource:
  char *oslang = PKG_String( GUI_pkg, GUI_PACKAGE_NAME );
The pointer will be to a string indicating the OS language - currently valid strings are:
  • GUI_American
  • GUI_Nederlands(Dutch)
  • GUI_Español (Spanish)
  • GUI_Français (French)
  • GUI_Deutsch (German)
Performing a string comparison is all you need. We can thus easily create a function that returns a flag indicating the OS:
  LANG_MODE LANG_Get_OS_Version(void)
  {
    const char *oslang = PKG_String( GUI_pkg, GUI_PACKAGE_NAME );
    if ( 0==stricmp("GUI_American",oslang) )
      return LANG_ENGLISH;
    if ( 0==stricmp("GUI_Nederlands",oslang) )
      return LANG_DUTCH;
    if ( 0==stricmp("GUI_Español",oslang) )
      return LANG_SPANISH;
    if ( 0==stricmp("GUI_Français",oslang) )
      return LANG_FRENCH;
    if ( 0==stricmp("GUI_Deutsch",oslang) )
      return LANG_GERMAN;
    return LANG_NONE; // unknown!
  }
The LANG_MODE value is actually an enum series from the pen.h file, and is used to describe the pen recognition languages. However, it allows us to describe the language easily, and it's already there, so we'll just reuse it.

Previous Section
Next Section

Copyright © 2001-2006 ebmDevMag.com - Legal Notice