Common Desktop Environment: Internationalization Programmer's Guide

Example: uil_sample

Figure 4-4 shows a UIL sample program on English and Japanese environments.

Figure 4-4 Sample UIL program on English and Japanese environments

Graphic

In the following sample program, LLL indicates locale text, which can be Japanese, Korean, Traditional Chinese, Greek, French, or others.

uil_sample.uil  
!  
!		sample uil file - uil_sample.uil  
!  
!			C source file - uil_sample.c  
!  
!				Resource file - uil-sample.resource  
!  
module Test
  		version = 'v1.0'
  		names = case_sensitive
  		objects = {
  			XmPushButton = gadget;
  		}  
!************************************  
!		declare callback procedure  
!************************************  
procedure
  		exit_CB		; 
!***************************************************************  
!		declare BulletinBoard as parent of PushButton and Text  
!***************************************************************  
object
  		bb : XmBulletinBoard {
  			arguments{
  				XmNwidth = 500;
  				XmNheight = 200;
  			};
  			controls{
  				XmPushButton
				pb1;
  				XmText
			text1;
  			};
  		};  
!****************************  
!		declare PushButton  
!****************************  
object
  		pb1 : XmPushButton {
  			arguments{
  				XmNlabelString = #Normal "LLLexit buttonLLL";
  				XmNx = 50;
  				XmNy = 50;
  			}; 
 			callbacks{
  				XmNactivateCallback = procedure exit_CB;
  			};
  		};
!*********************  
!		declare Text  
!*********************
  		text1 : XmText {
  			arguments{
  				XmNx = 50;
  				XmNy = 150;
  			};
  		};

end module;  

/* 
 *			C source file - uil_sample.c 
 * 
 */  
#include <Mrm/MrmAppl.h>  
#include <locale.h>  
void exit_CB();  
static			MrmHierarchy				hierarchy;  
static			MrmType			*class;   

/******************************************/  
/*		specify the UID hierarchy list		  */  
/******************************************/  
static			char			*aray_file[]=
  					{"uil_sample.uid"
  					}; 
 static			int		num_file = (sizeof aray_file / sizeof 
 aray_file[0]);  
/******************************************************/  
/*		define the mapping between UIL procedure names	*/  
/*		and their addresses			         					*/  
/******************************************************/  
static			MRMRegisterArg				reglist[]={
  					{"exit_CB",(caddr_t) exit_CB}