ruby-intl -- A simple wrapper of GNU gettext for ruby by HIRATA Naoto Install: Require * Ruby * GNU gettext $ ruby extconf.rb $ make $ make install Usage: You need to have ready for a message catalog beforehand. Catalogs are quit identical with catalogs for C. A default location of catalog files is found when a sample program `hello.rb' is run. First, you need to create an instance of an Intl class. An argument of constructor is gettext's domain name. intl = Intl.new( "hello" ); Second, you call the `_' method of the instance of an Intl class. A `_' method is an abbreviation of `gettext' method. print( intl._( "hello world" ), "\n" ); Reference: Class methods: new( domain ) Arguments domain: Type: String domain Description This method create a new Instance of Intl class. When a gettext method is called, an argument `domain' is used as a gettext's domain. Instance methods: bindtextdomain( domain, dirname ) Arguments domain: Type: String domain dirname: Type: String directory name where a message catalog exists Return value Type: Sring new directory Description This method bind `dirname' to `domain'. Afte this method is called, gettext will search for message catalogs under `dirname'. dcgettext( domain, msgid, category ) Arguments domain: Type: String domain msgid: Type: String gettext's msgid category: Type: Fixnum category for locale Return Value Type: String msgstr corresponding to msgid Description This method return msgstr corresponding to `msgid' from `domain' in `category'. category for locale is same with C. dgettext( domian, msgid) Arguments domain: Type: String domain msgid: Type: String gettext's msgid Return Value Type: String msgstr corresponding to msgid Description This method return msgstr corresponding to `msgid' from `domain'. gettext( msgid ) _( msgid ) Arguments msgid: Type: String gettext's msgid Return Value Type: String msgstr corresponding to msgid Description These methods return a msgstr corresponding to `msgid'. _ methods is abbreviation of gettext( msgid ). textdomian( domain ) Arguments domain: Type: String domain Return Value Type: Sting new domain Description This method set gettext's domain. It returns new domain name. Constants: LC_ALL LC_COLLATE LC_CTYPE LC_MESSAGES LC_MONETARY LC_NUMERIC LC_TIME Type:Fixnum Description These constants are equivalent to constants have same name defined in locale.h. Author HIRATA Naoto e-mail: hirata-naoto@sannet.ne.jp web: www.page.sannet.ne.jp/hirata-naoto/