Browse files

fixed README.md, sinatra gemspec

  • Loading branch information...
1 parent 5b1a7c4 commit de876e9e5c95690b52f59b7d7d131d96e40581d3 Cyril David committed with cyx Mar 16, 2010
Showing with 35 additions and 2 deletions.
  1. +33 −0 README.md
  2. +2 −2 sinatra-i18n.gemspec
View
33 README.md
@@ -3,6 +3,39 @@ sinatra-i18n
Basic plugin to use internationalization on your sinatra application
+How to use
+----------
+
+On your sinatra application:
+
+ require 'sinatra/i18n'
+
+ # this is required if you want to assume the default path
+ set :root, File.dirname(__FILE__)
+
+ # an alternative would be to set the locales path
+ set :locales, File.join(File.dirname(__FILE__), 'config/en.yml')
+
+ # then just register the extension
+ register Sinatra::I18n
+
+
+This works for both the case of a Classic sinatra application and also for Sinatra::Base types.
+
+In your helpers / routes
+------------------------
+
+Once this is done you can go on and use `t` e.g.
+
+ post '/items' do
+ session[:message] = t('items_success')
+ redirect '/items'
+ end
+
+ # in your view
+ - if session[:message]
+ = session.delete(:message)
+
Note on Patches/Pull Requests
-----------------------------
View
4 sinatra-i18n.gemspec
@@ -10,7 +10,7 @@ Gem::Specification.new do |s|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Cyril David"]
s.date = %q{2010-03-16}
- s.description = %q{TODO: longer description of your gem}
+ s.description = %q{a barebones sinatra i18n extension}
s.email = %q{cyx.ucron@gmail.com}
s.extra_rdoc_files = [
"LICENSE",
@@ -32,7 +32,7 @@ Gem::Specification.new do |s|
s.rdoc_options = ["--charset=UTF-8"]
s.require_paths = ["lib"]
s.rubygems_version = %q{1.3.6}
- s.summary = %q{TODO: one-line summary of your gem}
+ s.summary = %q{a barebones sinatra i18n extension}
s.test_files = [
"test/helper.rb",
"test/test_sinatra-i18n.rb"

0 comments on commit de876e9

Please sign in to comment.