テキストハードコードするとどんなことがヤバイかを簡単にまとめました。 新人さんなどに説明するのが面倒くさい時などにご活用ください。Read less
glib-gettextとintltoolでメッセージを日本語化してみる。面倒なので、コンソールアプリにする。しかも、Hello, World!アプリである。 はじめに、プロジェクト用のディレクトリを作る。 $ mkdir glib-hello $ cd glib-hello/ソース作成。 $ cat glib-hello.c #include <config.h> #include <stdio.h> #include <glib.h> #include <glib/gi18n.h> int main (int argc, char* argv[]) { setlocale (LC_ALL, ""); bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR); bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"
メッセージカタログファイルは一般にバイナリファイルであり、 OS・機種間の互換性はありません。 4.3 メッセージカタログの利用 メッセージカタログファイルをオープンするには、catopen(3)を使います。 #include <nl_types.h> nl_catd catopen (const char *name, int oflag); nameはメッセージカタログファイル名です。 oflagは0を指定します。 これは、$LANGによってlocaleを決定することを意味します。 これにより、所定のディレクトリ(または$NLSPATHで指定されたディレクトリ)でメッセージカタログファイルを検索し、オープンします。 拡張子.catが自動的に付加されるようです。 成功した場合、カタログ記述子(ファイル記述子のようなもの)を返します。 失敗した場合は、(nl_catd)-1を返します。 た
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く