Previous Next Table of Contents

8. Áú¹®°ú ´ä

ÀÌ ¼½¼ÇÀº Áö±ÝÀ¸·Î¼­´Â FAQ ¶ó°í ÇÒ ¼ö ¾ø°ÚÁö¸¸ ¾ÕÀ¸·Î FAQ ·Î ÀÚ¶ó³¯ °ÍÀÌ´Ù.

8.1 msgcat Áú¹®

³ª´Â ¸®´ª½º »ç¿ëÀÚÀÌ¸ç ´ÙÀ½°ú °°Àº ½ÃÇè ÇÁ·Î±×·¥À» ¸¸µé¾ú´Ù.


--------------------------------------------------------------------

#include <stdio.h>

#include <locale.h>

#include <features.h>

#include <nl_types.h>



main(int argc, char ** argv)

{

        nl_catd catd;



        setlocale(LC_MESSAGES, "");

        catd = catopen("msg", MCLoadBySet);

        fprintf(stderr,catgets(catd, 1, 1, "locale message fail\n"));

        catclose(catd);

}

--------------------------------------------------------------------

$ msg.m

$set 1



1 locale message pass\n

--------------------------------------------------------------------
³»°¡ ¸¸¾à catopen("/etc/locale/msg.cat",MCLoadBySet); ¿Í °°ÀÌ Àý´ë °æ·Î¸¦ »ç¿ëÇÏ¸é ¿ÇÀº °á°ú¸¦ ¾ò¾î³»Áö¸¸ À§Ã³·³ »ç¿ëÇÏ¸é °á°ú°ª -1 Áï ½ÇÆÐÇÏ°Ô µÈ´Ù.

8.2 msgcat ´äº¯

ÀÌ Áú¹®Àº Áö³­ ¼½¼Ç¿¡¼­ ´äº¯ÀÌ µÈ ¹®Á¦À̱ä ÇÏÁö¸¸ ¸î °¡Áö ºÎ°¡ÀûÀÎ Á¤º¸¸¦ ¸»ÇÒ ±âȸ¶ó°í »ý°¢ÇÑ´Ù.

¿©·¯ºÐÀÇ ¸Þ¼¼Áö ¸ñ·ÏÀ» ³ÖÀ» ¼ö ÀÖ´Â °÷Àº ¾ÆÁÖ ¸¹´Ù. ȯ°æº¯¼ö¿¡¼­ NLSPATH¸¦ ¸í½ÃÀûÀ¸·Î ¼³Á¤ÇÏÁö ¾Ê¾Ò´Ù ÇÏ´õ¶óµµ ´ÙÀ½°ú °°ÀÌ libc ¿¡ Á¤ÀǵǾî ÀÖ´Ù.


$ strings /lib/libc.so.5.4.17 | grep locale | grep %L

/etc/locale/%L/%N.cat:/usr/lib/locale/%L/%N.cat:/usr

/lib/locale/%N/%L:/usr/share/locale/%L/%N.cat:/usr/

local/share/locale/%L/%N.cat
µû¶ó¼­ ´ÙÀ½ Áß Çϳª¸¦ ¼¼ÆÃÇØÁÖ¸é :

$ export LC_MESSAGES=en_CA

$ export LC_ALL=en_CA

$ export LANG=en_CA

À§¿¡¼­ º¸¿©Áø NLSPATH¿Í ȯ°æº¯¼ö¿¡ ÀÇ°ÅÇÏ¿© catopen("msg", MCLoadBySet); ´Â ´ÙÀ½ µð·ºÅ丮 Áß Çϳª¿¡ ¸Þ¼¼Áö ¸ñ·ÏÀÌ ÀÖ´Â °æ¿ì ÀÛµ¿ÇÏ°Ô µÈ´Ù.


/etc/locale/en_CA/msg.cat

/usr/lib/locale/en_CA/msg.cat

/usr/lib/locale/msg/en_CA

/usr/share/locale/en_CA/msg.cat

/usr/local/share/locale/en_CA/msg.cat

ÇÏÁö¸¸ ¿©·¯ºÐÀÌ en_CA ·ÎÄÉÀÏÀ» ¼³Ä¡ÇÏÁö ¾Ê¾Ò´Ù¸é Á¦´ë·Î µ¿ÀÛÇÏÁö ¾Ê´Â´Ù. ¿Ö³ÄÇϸé setlocale °¡ ½ÇÆÐÇÏ¿© catopen ·çƾÀÇ "%L" À» en_CA °¡ ¾Æ´Ñ "C" ·Î ±³Ã¼ Çϱ⠶§¹®ÀÌ´Ù.


Previous Next Table of Contents