/usr/share/doc/ruby-locale-rails/examples/app/views/samples/_part.html.erb is in ruby-locale-rails 2.0.5-7.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 | <%
app_lang_tags = ["ja_JP", "fr", "pt_BR", "zh_CN", "en_Latn_US_NYNORSK", "uz_UZ", "nl"]
%>
<h2>Get the current locale</h2>
<h3>Locale.candidates(with no option)</h3>
<p>Requested Locales order by the priority. This method is added by Ruby-Locale for Ruby on Rails.</p>
<div class="result">
<%=h Locale.candidates.inspect %>
</div>
<h3>I18n.locale (with inspect)</h3>
<p>I18n.locale is set the result(Locale::TagList) of Locale.candidates(:type => :rfc).<br/>
This method is extended by Ruby-Locale for Ruby on Rails and returns all candidates as the Locale::TagList.
</p>
<div class="result">
<%=h I18n.locale.inspect %>
</div>
<h3>I18n.locale (without inspect)</h3>
<p>Locale::TagList(the result of I18n.locale) can behave like a single tag string to follow I18n.locale specification.</p>
<div class="result">
<%=h I18n.locale %>
</div>
<h2>Auto-Detect the locale from the WWW browser</h2>
<p><a href="<%= samples_path %>">Reload this URL</a></p>
<h2>Set locale as the "lang" parameter</h2>
<ol>
<% (app_lang_tags - ["uz_UZ", "nl"]).each do |lang|
url = samples_path(:lang => lang) %>
<li><%= link_to h(url), url %> [<%= lang %>]</li>
<% end %>
</ol>
<h2>Set "lang" as the cookie value.</h2>
<p>Click one of the link below, and then click "Auto-Detect the locale from the WWW browser".</p>
<ol>
<% (app_lang_tags - ["uz_UZ", "nl"]).each do |lang|
url = url_for(:controller => :samples, :action => :set_cookie, :id => lang) %>
<li><%= link_to h(url), {:action => :set_cookie, :id => lang} %> [<%= lang %>]</li>
<% end %>
<li><%= link_to "Clear cookie", :action => :clear_cookie %> </li>
</ol>
<h2>Localized Routes</h2>
<p>See config/routes.rb</p>
<ol>
<% (app_lang_tags - ["uz_UZ", "nl"]).each do |lang|
url = url_for(:controller => :samples, :lang => lang, :action => :index) %>
<li><%= link_to h(url),:controller => :samples, :lang => lang, :action => :index %> [<%= lang %>]</li>
<% end %>
</ol>
<h2>Caching</h2>
<p>Fragment/Action caching is supported. Here is the sample for action caching. <br/>
Click the links then check %{RAILS_ROOT}/tmp/cache/ where Cached file is stored.
</p>
<ol>
<% (app_lang_tags - ["uz_UZ", "nl"]).each do |lang|
url = url_for(:controller => :samples, :action => :cached_action, :lang => lang) %>
<li><%= link_to h(url), {:controller => :samples, :action => :cached_action, :lang => lang} %> [<%= lang %>]</li>
<% end %>
</ol>
|