Linux2010. 12. 19. 17:46
예전 UFO:AI 번역시에 어순의 차이로 인해 번역에 곤혹을 치뤘던게 떠올라서
관련글에 문의를 했더니, 다음과 같은 답변이 달렸다.
gettext에서도 말씀하신 모든 것이 지원이 됩니다.
이러한 예가 broken sentence의 한 종류입니다. 비슷한 경우는 수많은 케이스가 있습니다. gettext를 제대로 쓰르면 "%1d of %2d"와 같이 처음부터 그렇게 코드를 작성해야 나중에 번역만 하면 됩니다.

[링크 : http://allofsoftware.net/202#comment2695704]


혹시나 해서 이래저래 검색하다가 영 안나와서 -_-
%d나 %s로 검색 고고싱!

15.3.1 C Format Strings

C format strings are described in POSIX (IEEE P1003.1 2001), section XSH 3 fprintf(), http://www.opengroup.org/onlinepubs/007904975/functions/fprintf.html. See also the fprintf() manual page, http://www.linuxvalley.it/encyclopedia/ldp/manpage/man3/printf.3.php, http://informatik.fh-wuerzburg.de/student/i510/man/printf.html.

Although format strings with positions that reorder arguments, such as

     "Only %2$d bytes free on '%1$s'."

which is semantically equivalent to

     "'%s' has only %d bytes free."

are a POSIX/XSI feature and not specified by ISO C 99, translators can rely on this reordering ability: On the few platforms where printf(), fprintf() etc. don't support this feature natively, libintl.a or libintl.so provides replacement functions, and GNU <libintl.h> activates these replacement functions automatically.

As a special feature for Farsi (Persian) and maybe Arabic, translators can insert an ‘I’ flag into numeric format directives. For example, the translation of "%d" can be "%Id". The effect of this flag, on systems with GNU libc, is that in the output, the ASCII digits are replaced with the ‘outdigits’ defined in the LC_CTYPE locale category. On other systems, the gettext function removes this flag, so that it has no effect.

Note that the programmer should not put this flag into the untranslated string. (Putting the ‘I’ format directive flag into an msgid string would lead to undefined behaviour on platforms without glibc when NLS is disabled.)


[링크 : http://www.gnu.org/software/gettext/manual/gettext.html#c_002dformat]

n$ 로 변수의 순서를 직접 정해서
다른 어순의 언어에서도 사용할수 있도록 수정이 가능한 것으로 보인다.

'Linux' 카테고리의 다른 글

메일서버 확인하기  (0) 2011.02.17
MacOSX 의 시스템 구조  (0) 2011.02.06
WOL on Linux - ether-wake  (0) 2010.10.05
POSIX - Portable Operating System Interface [for Unix]  (6) 2010.09.21
커널의 종류(kind of kernels)  (0) 2010.09.21
Posted by 구차니
gettext는 말그대로 text를 get하는 utility/function 이다.
어떤 용도로 사용하냐면은, 다국어지원등의 용도로 사용된다.

메시지들은 msgid를 통해 불러 오게되고,
gettext를 통해 받아온 메시지는, 현재 system의 언어설정에 따라 맞는 언어를 가져 온다.

#include <libintl.h>
#include <locale.h>
#include <stdio.h>

int main(void)
{
        /* 현재 호스트의 locale 을 사용한다. */
        setlocale(LC_ALL,"");
        /* Hello 의 message table 을 /usr/local/share/locale 아래에서 찾도록 한다. */
        bindtextdomain("Hello", "/usr/local/share/locale");

        textdomain("Hello");
   
        printf("original message : %s\n", "Greeting");
        printf("gettext trans  : %s\n", gettext("Greeting"));

        printf("original message : %s\n", "Hello");
        printf("gettext trans  : %s\n", gettext("Hello"));

        printf("original message : %s\n", "World!");
        printf("gettext trans  : %s\n", gettext("World!"));

       return 0;
}

아무튼, 리눅스나, 윈도우 상에서 이러한 po파일을 수정하고 만드는 건 꽤나 번거로운 작업이지만,
다국어 작업을 해야한다면 꽤 괜찮은 방법이라고 생각된다.



[링크 : http://wiki.kldp.org/wiki.php/DocbookSgml/Gettext-KLDP] Howto Document
[공식 : http://www.gnu.org/software/gettext/] GNU gettext official
[Poedit : http://www.poedit.net/] GUI Po Editor

'프로그램 사용 > poEdit' 카테고리의 다른 글

poEdit의 TM을 이용한 자동번역  (0) 2011.12.23
poedit - Translate memory 도움말 번역  (0) 2011.12.21
L10N / I18N  (0) 2009.04.08
Poedit - crossplatform gettext catalogs editor  (0) 2009.02.26
Posted by 구차니