Add locale link in template

This commit is contained in:
Wen-Tien Chang 2010-03-01 14:57:21 +08:00
parent bd46cb1b12
commit e2a6d9fe0d
5 changed files with 11 additions and 1 deletions

View File

@ -15,7 +15,7 @@ namespace :dev do
:content_en => File.open("#{RAILS_ROOT}/lib/template/#{page_name}.page.en").read ) :content_en => File.open("#{RAILS_ROOT}/lib/template/#{page_name}.page.en").read )
end end
["nav", "footer"].each do |page_name| ["nav", "footer", "locale"].each do |page_name|
Snippet.create!( :name => page_name, :parent_name => "root", Snippet.create!( :name => page_name, :parent_name => "root",
:content_zh_tw => File.open("#{RAILS_ROOT}/lib/template/#{page_name}.snippet.zh_tw").read, :content_zh_tw => File.open("#{RAILS_ROOT}/lib/template/#{page_name}.snippet.zh_tw").read,
:content_en => File.open("#{RAILS_ROOT}/lib/template/#{page_name}.snippet.en").read ) :content_en => File.open("#{RAILS_ROOT}/lib/template/#{page_name}.snippet.en").read )

View File

@ -0,0 +1,4 @@
<ul>
<li><a href="?locale=en">English</a></li>
<li><a href="?locale=zh_tw">中文版</a></li>
</ul>

View File

@ -0,0 +1,4 @@
<ul>
<li><a href="?locale=en">English</a></li>
<li><a href="?locale=zh_tw">中文版</a></li>
</ul>

View File

@ -17,6 +17,7 @@
</div> </div>
<div id="footer"> <div id="footer">
{{ 'locale' | render_snippet }}
{{ 'footer' | render_snippet }} {{ 'footer' | render_snippet }}
</div> </div>

View File

@ -17,6 +17,7 @@
</div> </div>
<div id="footer"> <div id="footer">
{{ 'locale' | render_snippet }}
{{ 'footer' | render_snippet }} {{ 'footer' | render_snippet }}
</div> </div>