github
Advanced Search
  • Home
  • Pricing and Signup
  • Explore GitHub
  • Blog
  • Login

amatsuda / i18n_generators

  • Admin
  • Watch Unwatch
  • Fork
  • Your Fork
  • Pull Request
  • Download Source
    • 67
    • 6
  • Source
  • Commits
  • Network (6)
  • Issues (1)
  • Downloads (0)
  • Wiki (1)
  • Graphs
  • Branch: master

click here to add a description

click here to add a homepage

  • Branches (1)
    • master ✓
  • Tags (0)
Sending Request…
Enable Donations

Pledgie Donations

Once activated, we'll place the following badge in your repository's detail box:
Pledgie_example
This service is courtesy of Pledgie.

A pack of Rails generators gem plugin that generates Rails 2.2 I18n locale files for almost every known locale. — Read more

  cancel

http://github.com/amatsuda/i18n_generators

  cancel
  • Private
  • Read-Only
  • HTTP Read-Only

This URL has Read+Write access

Add more error checks when loading models 
amatsuda (author)
Mon Feb 01 11:41:11 -0800 2010
commit  2bdc9ac4ffe2ca04603d2cd9c0bc026b2faf59e6
tree    b51b52536370f6b02f8b09574e6ef459971fe953
parent  80154f6c141a0960753793422e55fafc5dd87da4
i18n_generators /
name age
history
message
file History.txt Tue Mar 17 17:34:16 -0700 2009 Update History for 0.6.0 [amatsuda]
file MIT-LICENSE Wed Nov 12 02:59:51 -0800 2008 Initial commit [amatsuda]
file README.rdoc Thu Dec 18 04:06:17 -0800 2008 Update document [amatsuda]
file Rakefile Wed Dec 17 16:50:31 -0800 2008 Add spec task [amatsuda]
directory generators/ Loading commit data...
file i18n_generators.gemspec Mon Feb 01 10:17:26 -0800 2010 Fix gettext dependency version [amatsuda]
directory spec/ Tue Jan 20 22:21:26 -0800 2009 Add magick comment [amatsuda]
README.rdoc

I18n generators

This gem plugin generates a set of locale files for Rails 2.2 i18n feature.

  • github.com/amatsuda/i18n_generators/tree/master

FEATURES

This gem/plugin provides following four script/generate commands.

1. Generate I18n Scaffold

% ./script/generate i18n_scaffold ja (de-AT, pt-BR, etc.)

Generates I18n aware scaffold.

2. Generate Locale Files for ActiveRecord/ActiveSupport/ActionPack

% ./script/generate i18n_locale ja (de-AT, pt-BR, etc.)

or

% ./script/generate i18n —locale ja (de-AT, pt-BR, etc.)

  • A. If The Locale File Exists In Rails-I18n Repository

Firstly, the generator checks here. github.com/svenfuchs/rails-i18n/tree/master/rails/locale If the spacified .yml file exists in the repository, the generator downloads and puts the file into your config/locales directory. Then the generater sets the application default locale to the specified locale.

This will generate following locale file.

    config/locales/ja.yml
  • B. Else

The generator copies the en.yml file (bundled inside Rails framework) into config/locales directory, and one-to-one localizes/translates each attribute value into the specified locale/language. Then the generater sets the application default locale to the specified locale.

For example,

% ./script/generate i18n_locale zh

will generate following locale files.

    config/locales/active_support_zh.yml
    config/locales/active_record_zh.yml
    config/locales/action_view_zh.yml

3. Generate Translation YAML File For All Models/Attributes and views/**/*.erb

% ./script/generate i18n_translation ja (de-AT, pt-BR, etc.)

or

% ./script/generate i18n —translation ja (de-AT, pt-BR, etc.)

This will generate following YAML file.

    config/locales/translation_ja.yml

The generator scans your app/models directory, and generates a YAML file with all the AR model names and attributes so that you don’t have to write the YAML skeleton manually or by copy/paste. In addition, the generator scans all the *.erb files in your app/views/** directory, and picks all the keys for I18n.translate, then adds them to the YAML file. In addition, the generator tries to translate each of them into the specified language. The generator doesn’t overwrite the existing value so that you can rerun the generator again and again just like Annotate Model command.

4. Generate All

% ./script/generate i18n ja (de-AT, pt-BR, etc.)

Executes 2 and 3 at once.

REQUIREMENTS:

  • Ruby on Rails (>= 2.2)
  • Ruby-GetText-Package ( rubyforge.org/projects/gettext/ )
  • high speed Internet connection

INSTALL:

  • As a gem

% sudo gem source gems.github.com

% sudo gem install amatsuda-i18n_generators

  • As a Rails plugin

% ./script/plugin install git://github.com/amatsuda/i18n_generators.git

CAUTION

Current version of this plugin is very very very roughly implemented just for experiment. Every time you execute the generate command, the plugin connects to the Unicode CLDR website and scrapes the huge amount of its contents. Please be careful not to harm your network environment and CLDR website by running this plugin too many times.

Copyright © 2008 Akira Matsuda, released under the MIT license

Blog | Support | Training | Contact | API | Status | Twitter | Help | Security
© 2010 GitHub Inc. All rights reserved. | Terms of Service | Privacy Policy
Powered by the Dedicated Servers and
Cloud Computing of Rackspace Hosting®
Dedicated Server