2010-02-10 278 views
-3

我想寫一個簡單的國際程序i18n形式,使用C ... 有人可以幫我嗎? 感謝i18n世界您好世界

+3

發佈您到目前爲止的內容。 – duffymo 2010-02-10 13:06:12

回答

2

哼,讓我們嘗試做一些感覺出這個問題的:) 如果使用C,並提供Gettext中,你可以這樣做:

#include <libintl.h> 
#include <locale.h> 
#include <stdio.h> 
#include <stdlib.h> 
int main(void) 
{ 
    setlocale (LC_ALL, ""); 
    bindtextdomain ("hello", "/usr/share/locale"); 
    textdomain ("hello"); 
    printf (gettext ("Hello, world!\n")); 
    exit (0); 
} 
2

看一看的GNU Hello World程序。它展示了很多好的編程原則,包括國際化。從hello手冊頁:

GNU Gettext(請參見簡介)用於國際化支持。你好的問候已被翻譯成多種語言。