Browse files

Fixes for I18n in view files.

  • Loading branch information...
1 parent 89439d1 commit c53ef5e0288c0a320bcebfc772e69d1d55fbe9ee @sleepycat committed Feb 25, 2011
View
12 README.markdown
@@ -1,6 +1,10 @@
# Rails 3 HAML Scaffold Generator
-Essentially just a copy of the Rails 3 ERB generator with HAML replacements for the templates.
+Essentially just a copy of the Rails 3 ERB generator with HAML replacements for the templates.
+
+#This fork
+This fork aims to clean up the Internationalization and other annoyances in that vein.
+
Original idea from [Paul Barry's article on custom genrators][OriginalIdea]
@@ -33,10 +37,14 @@ Original idea from [Paul Barry's article on custom genrators][OriginalIdea]
6. Either
+ git clone git://github.com/sleepycat/haml-rails.git lib/generators/haml
+ (or grab the original)
git clone git://github.com/psynix/rails3_haml_scaffold_generator.git lib/generators/haml
...or...
+ git submodule add git://github.com/sleepycat/haml-rails.git lib/generators/haml
+ (or grab the original)
git submodule add git://github.com/psynix/rails3_haml_scaffold_generator.git lib/generators/haml
7. Create stuff with:
@@ -55,4 +63,4 @@ Original idea from [Paul Barry's article on custom genrators][OriginalIdea]
* Gemify (?)
-[OriginalIdea]: http://paulbarry.com/articles/2010/01/13/customizing-generators-in-rails-3
+[OriginalIdea]: http://paulbarry.com/articles/2010/01/13/customizing-generators-in-rails-3
View
2 scaffold/templates/_form.html.haml
@@ -9,4 +9,4 @@
<% end -%>
.actions
- = f.submit
+ = f.submit t('submit')
View
4 scaffold/templates/edit.html.haml
@@ -1,5 +1,5 @@
-%h1 Editing <%= singular_name %>
+%h1 t('<%= singular_name %>.edit.title')
= render 'form'
-== #{ link_to 'Show', @<%= singular_name %> } | #{ link_to 'Back', <%= plural_name %>_path }
+== #{ link_to t('show'), @<%= singular_name %> } | #{ link_to t('back'), <%= plural_name %>_path }
View
15 scaffold/templates/index.html.haml
@@ -1,22 +1,23 @@
-%h1 Listing <%= plural_name %>
+%h1 t('<%= plural_name %>.index.title')
%table
%thead
%tr
<% for attribute in attributes -%>
- %th <%= attribute.human_name %>
+ %th
+ =t('activerecord.attributes.<%= singular_name %>.<%= attribute.name %>')
<% end -%>
%th{ :colspan => 3 }
%tbody
- for <%= singular_name %> in @<%= plural_name %>
%tr{ :class => cycle(:odd, :even) }
<% for attribute in attributes -%>
- %td= <%= singular_name %>.<%= attribute.name %>
+ %td= t('activerecord.attributes.<%= singular_name %>.<%= attribute.name %>')
<% end -%>
- %td= link_to 'Show', <%= singular_name %>
- %td= link_to 'Edit', edit_<%= singular_name %>_path(<%= singular_name %>)
- %td= link_to 'Destroy', <%= singular_name %>, :confirm => 'Are you sure?', :method => :delete
+ %td= link_to t('show'), <%= singular_name %>
+ %td= link_to t('edit'), edit_<%= singular_name %>_path(<%= singular_name %>)
+ %td= link_to t('destroy'), <%= singular_name %>, :confirm => I18n.t('confirm_delete'), :method => :delete
%br
-= link_to 'New <%= singular_name %>', new_<%= singular_name %>_path
+= link_to t('<%= singular_name %>.new'), new_<%= singular_name %>_path
View
4 scaffold/templates/new.html.haml
@@ -1,5 +1,5 @@
-%h1 New <%= singular_name %>
+%h1 t('<%= singular_name %>.new')
= render 'form'
-= link_to 'Back', <%= plural_name %>_path
+= link_to t('back'), <%= plural_name %>_path
View
4 scaffold/templates/show.html.haml
@@ -1,7 +1,7 @@
<% for attribute in attributes -%>
%p
- %strong <%= attribute.human_name %>:
+ %strong t('activerecord.attributes.<%= singular_name %>.<%= attribute.name %>')
= @<%= singular_name %>.<%= attribute.name %>
<% end -%>
-== #{ link_to 'Edit', edit_<%= singular_name %>_path(@<%= singular_name %>) } | #{ link_to 'Back', <%= plural_name %>_path }
+== #{ link_to t('edit'), edit_<%= singular_name %>_path(@<%= singular_name %>) } | #{ link_to t('back'), <%= plural_name %>_path }

0 comments on commit c53ef5e

Please sign in to comment.