Sha256: 3ec74b7efcc289b9df56731bb6d8c7c99f1098767c52dbfefc0be641d4055f82

Contents?: true

Size: 1.93 KB

Versions: 2

Compression:

Stored size: 1.93 KB

Contents

<h1>Ruby-Locale and Ruby on Rails <%= RAILS_GEM_VERSION %> sample</h1>
<p><a href ="http://locale.rubyforge.org/svn/trunk/locale_rails/sample">[source code]</a></p>

<h2>The values from Rails</h2>
<table border="1" cellspacing="0" cellpadding="2">
  <tr><th>Variables</th><th>Values</th></tr>
  <tr><td>HTTP_ACCEPT_LANGUAGE</td><td> <%= request.accept_language %></td></tr>
  <tr><td>HTTP_ACCEPT_CHARSET</td><td> <%= request.accept_charset %></td></tr>
  <tr><td>QUERY_STRING</td><td> <%= request.query_string %></td></tr>
  <tr><td>params[:lang]</td><td><%= params[:lang] %></td></tr>
  <tr><td>cookies[:lang]</td><td> <%= cookies[:lang] %></td></tr>
  <tr><td>I18n.t :hello (*1)</td><td> <%= I18n.t :hello %></td></tr>
</table>
<p>
(*1) Fallback to "en" if the localized message is not found in the locale.
Currently, <%= Dir.glob(File.join(RAILS_ROOT, "config/locales/*.yml")).collect {|v| File.basename(v, ".yml")}.inspect %> are supported.
</p>

<%= render :partial => 'part' %>

<h2>Separate Localized View template file in each languages</h2>
<p>View template can be separeted with language tags.</p> 
<ol>
  <li><%= link_to "uz_UZ has special index page(index_uz_UZ.html.erb)", :controller => :samples, :action => :index, :lang => "uz_UZ" %></li>
  <li><%= link_to "uz uses normal index page", :controller => :samples, :action => :index, :lang => "uz" %></li>
  <li><%= link_to "nl has special _part page(_part_nl.html.erb)", :controller => :samples, :action => :index, :lang => "nl" %></li>
  <li><%= link_to "nl_BE also uses the special _part page(_part_nl.html.erb)", :controller => :samples, :action => :index, :lang => "nl_BE" %></li>
</ol>
<p>View template by Rails-2.3.x is also supported. </p> 
<ol>
  <li><%= link_to "pt has special index page(index.pt.html.erb)", :controller => :samples, :action => :index, :lang => "pt" %></li>
  <li><%= link_to "pt_BR uses normal index page", :controller => :samples, :action => :index, :lang => "pt_BR" %></li>
</ol>

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
locale_rails-2.0.0 sample/app/views/samples/index.html.erb
locale_rails-2.0.1 sample/app/views/samples/index.html.erb