소프트웨어는 화면에 표시하는 다국어 문자열을 message_file.xls 파일로 관리하며, xls2mc.exe를 이용하여 message_file.xls을 message_file.xml 파일과 message_file.mc 파일로 변환한다.

message_file.mc 파일은 mc.exe, rc.exe, 및 link.exe를 이용하여 message_file.h 파일과 message_file.dll 파일을 생성한다.

아래 그림은 위의 빌드 과정을 표시한다:.

Figure: Message file build process

xls2mc에서 link까지의 빌드과정은 다음과 같다:

if exist mc.exe mc.exe $(PROJECT_RES)nls\ message_file.xls
if exist message_file.mc mc -c -u message_file.mc
if exist message_file.rc rc message_file.rc
if exist message_file.res link /dll /noentry /MACHINE:X86 message_file.res  
if exist message_file.h move message_file.h $(PROJECT_INC)
if exist message_file.xml move message_file.xml $(PROJECT_ROR)
if exist message_file.dll move message_file.dll $(PRODUCT_BIN)

message_file.dll에 있는 문자열은, Windows의 FormatMessage() 함수를 통해 구한다:

Message_String Message_Utility::format_message( DWORD message_id, va_list* arguments )
{
Message_String message_string;
if ( !::FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_HMODULE,                       
my_dll,                       
message_id,                       
my_language_id,                       
( LPTSTR ) ( wchar_t** ) message_string,                       
0,                       
arguments ) )
{
::FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_HMODULE
| FORMAT_MESSAGE_FROM_SYSTEM,                    
my_dll,
                    message_id,
                    0,
                    ( LPTSTR ) ( wchar_t** ) message_string,
                    0,
                    arguments );
}
return message_string;
}

위에서,

message_id는 해당 문자열에 대응하는 숫자로 Windows의 message code 체계를 따른다.

//  Values are 32 bit values laid out as follows:
//
//   3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
//   1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
//  +—+-+-+———————–+——————————-+
//  |Sev|C|R|        Facility          |                    Code            |
//  +—+-+-+———————–+——————————-+
//
//  where
//      Sev – is the severity code
//          00 – Success
//          01 – Informational
//          10 – Warning
//          11 – Error
//
//      C – is the Customer code flag. Always 1 as software defines a message.
//      R – is a reserved bit
//      Facility – is the facility code. It depends on software modules.
//      Code – is the facility’s status code

화면의 GUI controls에 표시하는 문자열은, 예를 들면 Button의 OK, Informational severity code를 사용하여 표시한다.

MessageFile.xls 파일은 세 개의 쉬트로 구성된다. 첫번째 쉬트는 다국어 문자열을 관리하며, 두번째 쉬트는 Facility code를 관리한다. 세번째 쉬트는 Language code를 관리한다.

답글 남기기

이메일 주소는 공개되지 않습니다. 필수 필드는 *로 표시됩니다