共通デスクトップ環境 プログラマーズ・ガイド (国際化対応編)

UIL の default_charset 文字セット

default_charset 文字列リテラルについては、どんな文字でも有効な文字列リテラルとして設定できます。たとえば、LANG 環境変数が el_GR の場合は、default_charset の文字列リテラルにはギリシャ文字が入ります。LANG 環境変数が ja_JP の場合は、default_charset の文字列リテラルには日本語の EUC でエンコードされたすべての日本語の文字が入ります。

文字列リテラルに文字セットが設定されていない場合、文字列リテラルの文字セットは cur_charset に設定されます。また、システム環境では、cur_charset の値は常に default_charset に設定されています。

例: uil_sample

図 4-4 は、英語と日本語の環境での UIL のプログラム例を示します。

図 4-4 英語と日本語の環境での UIL のプログラム例

Graphic

次のプログラム例で LLL はロケール・テキストを示します。LLL には日本語、韓国語、中国語 (繁体字)、ギリシャ語、フランス語、その他の言語が入ります。

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
           }