ロケールのサポート

Note: Written by Oleg Bartunov. See Oleg's web page for additional information on locale and Russian language support.

作者:Oleg Bartunov。 ロケールとロシア語サポートに関する詳細は、 Oleg の Web ページを参照のこと。

While doing a project for a company in Moscow, Russia, I encountered the problem that postgresql had no support of ★ national alphabets. After looking for possible workarounds I decided to develop support of locale myself. I'm not a C-programer but already had some experience with locale ★ programming when I work with perl (debugging) and glimpse. After several days of digging through the Postgres source tree I made very minor corections to src/backend/utils/adt/varlena.c and src/backend/main/main.c and got what I needed! I did support only for LC_CTYPE and LC_COLLATE, but later LC_MONETARY was added by others. I got many messages from people about this patch so I decided to send it to developers and (to my surprise) it was incorporated into the Postgres distribution. ロシアのモスクワにある、とある会社のプロジェクトをやっていた 時のこと。私は postgresql がこの国のアルファベットをサポート していないという問題にぶち当たってしまいました。どうにかなら ないかといろいろ探し回ったあげく、自分でロケールのサポートを 開発しようと思い立ちました。私は C プログラマではありません が、Perl(のデバッグ)と glimpse をやったおかげで、 すでにロケールのプログラミングの経験がありました。 Postgres のソースツリーを追いかけ始めて何日かた ったとき、src/backend/utils/adt/varlena.c と src/backend/main/main.c にちょっとばかりの修正をかけたのです が、そのときにやりかたが分かったのです!私は LC_CTYPE LC_COLLATE のみのサポートを行ったの ですが、その後別の人が LC_MONETARY をサポート しました。このパッチに関して非常にたくさんの方からメッセージ をいただいたので、これを開発チームに送ることを決心しました。 そしてこれは(私にとっては驚きですが)、Postgres の配布物に取り込まれることになりました。

People often complain that locale doesn't work for them. There are several common mistakes:

時々、自分たちの言語に関するロケールがうまく動かないと文句を 言う人がいますが、これは以下のミスに起因することが多いのです:

利点は何でしょう?

You can use ~* and order by operators for strings contain characters from national alphabets. Non-english users definitely need that. If you won't use locale stuff just undefine the USE_LOCALE variable.

自国語アルファベットを含む文字列に対して ~* や order by 演算子が使えます。非英語圏のユーザにとっては必須の機能でしょ う。ロケール機能を使いたくなければ、USE_LOCALE 環境変数を未 定義にするだけですみます。

欠点は何でしょう?

There is one evident drawback of using locale - its speed! So, use locale only if you really need it.

ロケールには明らかな欠点があります。その速度です!このため、 本当に使いたいときにのみロケールを使うようにしてください。