Ruby-GetText-Package

ruby-gettext

What is Ruby-GetText-Package?

Ruby-GetText-Package is a Localization(L10n) Library and Tools which is modeled after GNU gettext package.

The library converts the messages to localized messages properly using client-side locale information.

And the tools for developers support to create, use, and modify localized message files(message catalogs) easily.

Features

  • A messages translation library and tools for maintainance.
  • Simple APIs(similar to GNU gettext)
    • Singular/plural forms.
    • Auto finding the correct locale.
  • rgettext command for creating po-files from the following formats:
    • ruby scripts (.rb)
    • glade-2 XML files (.glade)
    • ERB files (.rhtml)
    • ActiveRecord (.rb)
  • rmsgfmt command for creating a mo-file from a po-file.
  • The po-file is compatible with GNU gettext. You can maintain these files using GNU gettext tools.
  • The mo-file is compatible with GNU gettext(msgfmt).
  • Pure ruby library (Since 1.90.0)
  • JRuby support(Since 1.90.0)
  • Ruby on Rails support (gettext/rails)
  • CGI support (gettext/cgi)

Requirements

Ruby 1.8.4 or later<URL:http://www.ruby-lang.org/>

Optional
GNU gettext 0.10.35 or later

If you are developer of an application which uses Ruby-GetText-Package, it's better to prepare this to maintain your po/mo files because of some useful tools.

For MS Windows, I highly recommand to install Ruby-GNOME2 Win32 GUI Installer since it includes GNU gettext. Notice to install Development environment, not Runtime environment.

If you are a user of the application(not developer), you don't need this.

Racc-1.4.3 or later

If you need to compile src/rmsgfmt.ry by yourself. Usually you don't need this.

<URL:http://www.ruby-lang.org/raa/list.rhtml?name=racc>

Download

Go to <URL:http://rubyforge.org/frs/?group_id=855>.

ruby-gettext-package-x.x.x.tar.gz
Original source file package. Used for *nix system.
gettext-x.x.x.gem (Since 1.90.0)
Pure ruby gem package. Used for *nix system, Win32, JRuby.
gettext-x.x.x.gem (1.10.0 or older)
General Gem package. Used for *nix system (requires gcc(C compiler)).
gettext-x.x.x-mswin32.gem (1.10.0 or older)
Includes Win32 binary for the One-Click Ruby Installer.

Install

Download the source code package (ruby-gettext-package-x.x.x.tar.gz), de-compress the archive and enter its top directory.

Then type:

# ruby setup.rb

You can also install files in your favorite directory by supplying some options to setup.rb. Try "ruby setup.rb --help".

*nix gem package (or for all environment since 1.90.0)

Run gem install and choose the Ruby package as follows:

# gem install gettext
Attempting local installation of 'gettext'
Local gem file not found: gettext*.gem
Attempting remote installation of 'gettext'
Updating Gem source index for: http://gems.rubyforge.org
Select which gem to install for your platform (i386-mswin32)
 1. gettext x.x.x (ruby)
 2. gettext x.x.x (mswin32)
 3. Cancel installation
> 1

MS Windows (One-Click Ruby Installer For Windows) with rubygems. (1.10.0 or older)

Since 1.90.0, you don't need Run gem install and choose the mswin32 package like:

C:\>gem install gettext
Attempting local installation of 'gettext'
Local gem file not found: gettext*.gem
Attempting remote installation of 'gettext'
Updating Gem source index for: http://gems.rubyforge.org
Select which gem to install for your platform (i386-mswin32)
 1. gettext x.x.x (ruby)
 2. gettext x.x.x (mswin32)
 3. Cancel installation
> 2
Successfully installed gettext-1.0.0-mswin32

Environment Variables for users

LC_ALL, LC_MESSAGES, LANG

Set your locale. ja_JP.eucJP, ja_JP.UTF-8, etc. If it's not set, it's set C under a UNIX environment, and it's read from the system environment under MS Windows.

$export LC_ALL="ja_JP.eucJP"

OUTPUT_CHARSET

Set output-charset. UTF-8, euc-jp, etc. Usually, you don't need to set this variable.

$export OUTPUT_CHARSET="euc-jp"

RUBYOPT

Set RUBYOPT=rubygems if you install Ruby-GetText-Package with the gem command.

$export RUBYOPT=rubygems

License

This program is licenced under the same licence as Ruby. (See the file 'COPYING'.)

ChangeLog

  • 2008-01-29 Updated for 1.90.0 - Masao
  • 2006-02-08 Revised. - Masao
  • 2006-01-17 Revised "Requirement" - Masao
  • 2005-12-23 Updated for 1.1.0 - Masao
  • 2005-09-11 Revised. - Eli Gordon

Copyright (C) 2001-2008 Masao Mutoh <mutoh at highway.ne.jp>

Last modified:2008/04/26 15:45:52
Keyword(s):
References:[YotaLab Storage] [Ruby-GetText-Package HOWTO]