768x90 Getting Online Shouldn't be Tough- $7.49 .com Domains at Go Daddy

Translation for your Ruby on Rails App



I am writing this article with accompanied by a cup of coffee while waiting MU Vs Chealsea for Champion Final. Back to the topic. You should know many familiar online translation like google and altavista. Now i will like to introduce you about gibberish in rails. Let start it :

  • Install the plugin to your app rails.
ruby script/plugin install http://svn.myutil.com/projects/plugins/gibberish_rails/
or
ruby script/plugin install svn://errtheblog.com/svn/plugins/gibberish
  • After that go to your Application_controller.rb then use arround_filter for implementation of gibberish :
class ApplicationController < ActionController::Base
around_filter :set_language

private
def set_language
Gibberish.use_language(session[:language]) { yield }
end
end
  • Another method is described in README file. Like :
class ApplicationController < ActionController::Base
around_filter :use_best_guess_locale

private
def use_best_guess_locale
session[:locale] = GibberishRails.best_guess_locale(params[:locale], request.env['HTTP_ACCEPT_LANGUAGE']) if ( ! session[:locale] || params[:locale] || RAILS_ENV == 'development' )

Gibberish.use_language(session[:locale]) {yield}
end
end
  • To create new dictionary, you can create it in YAML file such as es.yaml :
welcome_friend: ¡RecepciĆ³n, amigo!
welcome_user: ¡RecepciĆ³n, {user}!
love_rails: Amo los carriles.



_

1 Response to "Translation for your Ruby on Rails App"

Anonymous said...

Hello! A variant to translate your Ruby on Rails app is to try a software localization tool like poeditor.com that has a friendly work interface. It doesn't support .yaml formats for now, but you can convert these files to po formats with the help of a free converter tool like http://yml2po.com/.

 
powered by Blogger