- 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.
- Need more information & interaction ? Browse here
_
1 Response to "Translation for your Ruby on Rails App"
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/.
Post a Comment