public
Description: Localization (L10n) and Internationalization (i18n) support for the Merb MVC Framework
Clone URL: git://github.com/myabc/merb_global.git
Click here to lend your support to: merb_global and make a donation at www.pledgie.com !
name age message
file .gitignore Tue Jun 24 07:05:27 -0700 2008 Fixed #18 [uzytkownik]
file CONTRIBUTORS Tue Jun 24 08:17:44 -0700 2008 Updated CONTRIBUTORS [myabc]
file HISTORY Tue Jul 29 03:01:02 -0700 2008 Updated HISTORY [uzytkownik]
file LICENSE Tue May 27 00:46:08 -0700 2008 Updating License Copyright [myabc]
file README Mon May 12 16:50:54 -0700 2008 Updated spec_helper.rb so that merb_global is l... [myabc]
file README.markdown Sun Aug 10 14:06:33 -0700 2008 Updated documentation [uzytkownik]
file Rakefile Thu Aug 21 10:24:58 -0700 2008 Version 0.0.5.1 [uzytkownik]
file TODO Mon May 12 16:50:54 -0700 2008 Updated spec_helper.rb so that merb_global is l... [myabc]
directory activerecord_generators/ Fri Jul 04 16:55:11 -0700 2008 Renamed MessageProviders and fix of comas [uzytkownik]
directory benchmarks/ Tue Jun 24 08:18:25 -0700 2008 Cleaning up whitepace using sake 'strip' [myabc]
directory examples/ Sun Aug 10 13:58:04 -0700 2008 Updated examples [uzytkownik]
directory lib/ Mon Aug 11 00:44:09 -0700 2008 Turn off cache in YAML in development mode (Abd... [uzytkownik]
directory sequel_generators/ Fri Jul 04 16:55:11 -0700 2008 Renamed MessageProviders and fix of comas [uzytkownik]
directory spec/ Sun Aug 10 13:57:51 -0700 2008 Missing numeric spec [uzytkownik]
README.markdown

MerbGlobal README

A plugin for the Merb framework providing Localization (L10n) and Internationalization (i18n) support.

merb_global will have the following feature set:

  • support for model (content) localization

    • by default, localization stored in the database
      • with DataMapper (targeted 0.1)
      • with ActiveRecord (targeted 0.2)
      • with Sequel ORM
    • and, with a choice of strategies in each case:

      • single-table (c.f. globalize RoR plugin)

        |title   |varchar(100)|
        |title_de|varchar(100)|
        |title_fr|varchar(100)|
        
      • joined-table for unlimited localizations (c.f. Symfony PHP)

    • or, alternatively localizations can be stored outside of the domain model, UI Strings.
  • support for view (UI String) localization

    • choice of providers (po, yaml, database)

      Merb::Plugins.config[:merb_global] = {
        #:message_provider => "po",   # default
        :message_provider => 'yaml'
        #:message_provider => active_record
        #:message_provider => data_mapper
        #:message_provider => sequel
      }
      
    • for JRuby, wrapper allowing use of .properties files.

  • Extract, update for PO/POT files

  • Currency, Date and Language Helpers - stored either in the database, or for JRuby, wrappers around built-in functionality provided by java.util.Currency, java.util.Locale

  • support for localization of Merb generated code

  • support for non-English Inflectors.

Developer ReadMe

REQUEST : Your development support is very much appreciated. Please contact us below if you're interested in lending a hand with the development of this project.

Getting the Source

Performing a git clone on either of the following repositories will get you the latest source:

git clone git://github.com/myabc/merb_global.git
git clone git://gitorious.org/merb_global/mainline.git (on gitorious)

The following additional mirrors are available:

git://repo.or.cz/merb_global.git
http://repo.or.cz/r/merb_global.git

Installation and Setup

Dependencies:
sudo gem install gettext

Installing MerbGlobal
rake gem
sudo gem install pkg/merb_global-0.0.1.gem

Configuration options

MerbGlobal is possible to configure with:

Merb::Plugins.config[:merb_global] = {
    :message_provider => 'gettext'
    ...
 }

in init.rb or using plugins.yml file:

:merb_global:
    :message_provider: gettext
    ...

Configuration options:

  • :message_provider

    What message provider we want to use.

    Values: gettext, yaml, sequel, active_record, data_mapper Default: gettext

  • :date_provider

    What date provider we want to use.

    Values: fork Default: fork

  • :numeric_providers

    What numeric provider we want to use.

    Values: fork Default: fork

  • :flat

    Are we running merb-flat or normal merb?

    Values: true/false Default: false

  • :localedir

    Define directory where translations are stored.

    If :flat is set to true than MerbGlobal will search in #{Merb.root}+'locale'. If :flat is false than in #{Merb.root}+:localedir. When :flat is false and :localedir configuration is not defined the default will be #{Merb.root}+'app/locale'.

  • :gettext => :domain

    Name of the text domain. Which is basically name of the GetText MO file without .mo extension.

    Default: merbapp

Configuration examples

Follwing configuraiton in plugins.yml:

:merb_global:
    :provider:  gettext
    :flat:      false
    :localedir: locale
:gettext:
    :domain:    messages

will make MerbGlobal to search translations in following places:

#{Merb.root}/locale/#{language}/LC_MESSAGES/messages.mo
#{Merb.root}/locale/#{language}/messages.mo

Where #{language} is string which defines language such as cs_CZ, en_GB or just cs, en.

No configuration will look at:

#{Merb.root}/app/locale/#{language}/LC_MESSAGES/merbapp.mo
#{Merb.root}/app/locale/#{language}/merbapp.mo

Licensing and Copyright

MerbGlobal is released under an MIT License. Copyright information, as well as a copy of the License may be found in the LICENSE file.

Support

WARNING REPEATED : MerbGlobal at an early stage of its development. You should not use this code unless you're reasonably secure with both Ruby and Merb. That said, please do get involved!

Your best sources for support are currently the wiki, IRC or our mailing list: