#include <stdio.h>#include <stdlib.h>#include <string.h>#include <locale.h>#include <libintl.h>#define MAX_CHAR (32)intmain(intargc,char**argv){chardest[MAX_CHAR];chartransport[MAX_CHAR];/* Init gettext related APIs*/setlocale(LC_ALL,"");bindtextdomain(PACKAGE,LOCALEDIR);textdomain(PACKAGE);/*- Set up strings */strncpy(dest,gettext("Taipei"),MAX_CHAR);strncpy(transport,gettext("bus"),MAX_CHAR);/*- Let's print out some message */printf(gettext("I will go to %s by %s.\n"),dest,transport);return0;}
# SOME DESCRIPTIVE TITLE.# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER# This file is distributed under the same license as the PACKAGE package.# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.##, fuzzymsgid""msgstr"""Project-Id-Version: PACKAGE VERSION\n""Report-Msgid-Bugs-To: \n""POT-Creation-Date: 2014-05-30 23:11+0800\n""PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n""Last-Translator: FULL NAME <EMAIL@ADDRESS>\n""Language-Team: LANGUAGE <LL@li.org>\n""Language: \n""MIME-Version: 1.0\n""Content-Type: text/plain; charset=CHARSET\n""Content-Transfer-Encoding: 8bit\n"#. - Set up strings#: test_gettext.c:22msgid"Taipei"msgstr""#: test_gettext.c:23msgid"bus"msgstr""#. - Let's print out some message#: test_gettext.c:26#, c-formatmsgid"I will go to %s by %s\n"msgstr""
# Chinese translations for PACKAGE package.# Copyright (C) 2014 THE PACKAGE'S COPYRIGHT HOLDER# This file is distributed under the same license as the PACKAGE package.# Automatically generated, 2014.#msgid""msgstr"""Project-Id-Version: PACKAGE VERSION\n""Report-Msgid-Bugs-To: \n""POT-Creation-Date: 2014-05-30 23:03+0800\n""PO-Revision-Date: 2014-05-30 23:03+0800\n""Last-Translator: Automatically generated\n""Language-Team: none\n""Language: zh_TW\n""MIME-Version: 1.0\n""Content-Type: text/plain; charset=UTF-8\n""Content-Transfer-Encoding: 8bit\n"#. - Set up strings#: test_gettext.c:22msgid"Taipei"msgstr"台北"#: test_gettext.c:23msgid"bus"msgstr"公車"#. - Let's print out some message#: test_gettext.c:26#, c-formatmsgid"I will go to %s by %s.\n"msgstr"我搭乘%2$s到%1$s。\n"